Pychnight / TshockRpgToolKit

Master Controller for distrubtion of quests, custom npcs, custom items and skills, housing, leveling, npcshops, etc.
GNU General Public License v2.0
11 stars 1 forks source link

[Custom Npcs 2] occasionly tries to load the same item.. #53

Closed Pychnight closed 2 years ago

Pychnight commented 5 years ago

The plugin will occasionally try during reload to load the same items, that have already exist within the directory.

Error log

[05/26/19 02:33:16] [Server API] Warning: Plugin "CustomNpcs" has had an unhandled exception thrown by one of its GamePostInitialize handlers: System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException (System.ExceptionResource resource) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Collections.Generic.Dictionary2[TKey,TValue].Insert (TKey key, TValue value, System.Boolean add) [0x0008e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Collections.Generic.Dictionary2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 at CustomNpcs.CustomTypeManager1[TCustomType].LoadDefinitions () [0x002c0] in :0 at CustomNpcs.Npcs.NpcManager.LoadDefinitions () [0x00010] in :0 at CustomNpcs.Npcs.NpcManager..ctor (CustomNpcs.CustomNpcsPlugin plugin) [0x0005f] in :0 at CustomNpcs.CustomNpcsPlugin.OnLoad () [0x0002d] in :0 at CustomNpcs.CustomNpcsPlugin.OnGamePostInitialize (System.EventArgs args) [0x00000] in :0 at TerrariaApi.Server.HandlerCollection1[ArgsType].Invoke (ArgsType args) [0x0004d] in <dbe9cd2e9eff467eb81ce247e7a9b53d>:0

Pychnight commented 4 years ago

This is annoying bug that occasionally prevents Custom Npcs 2 from reloading files properly using the /reload command.

This should be fixed after #65 is completed.

BlackStar26724 commented 2 years ago

TDefinition contains "Name" field. Npcs contain "CustomID" field.

TDefinition .Name = Npc["CustomID"].ToString();