Write a plugin that correctly supports onEnable and onDisable (i.e. PlugMan compatible)
Use the NPCRegistry in onEnable, and call destroy in onDisable
Sometimes (when the registry contains NPCs), you will get the stacktrace below:
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(Unknown Source) ~[?:1.8.0_60]
at java.util.HashMap$KeyIterator.next(Unknown Source) ~[?:1.8.0_60]
at org.inventivetalent.npclib.registry.NPCRegistry.destroy(NPCRegistry.java:51) ~[?:?]
at org.inventivetalent.npclib.registry.NPCRegistry.destroy(NPCRegistry.java:59) ~[?:?]
at com.github.rlf.pokeamon.PokeAMon.onDisable(PokeAMon.java:40) ~[?:?]
What were you expecting to happen? What happened instead?
The destroy method should either iterate over a copy of the data-model, or use the iterator to remove the items.
What version of the plugin are you using? Type /version <Plugin Name>
What steps will reproduce the problem?
onEnable
andonDisable
(i.e. PlugMan compatible)NPCRegistry
in onEnable, and call destroy in onDisableWhat were you expecting to happen? What happened instead?
The destroy method should either iterate over a copy of the data-model, or use the iterator to remove the items.
What version of the plugin are you using? Type /version <Plugin Name>
2.2.5