Fix unregistering of components from allComponents.

This commit is contained in:
asofold 2013-01-26 07:41:51 +01:00
parent 1e29c03251
commit 034a7d58b0

View File

@ -325,6 +325,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
notifyReload.remove(obj); notifyReload.remove(obj);
} }
dataMan.removeComponent(obj); dataMan.removeComponent(obj);
allComponents.remove(obj);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -345,7 +346,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
// Remove listener references. // Remove listener references.
if (verbose){ if (verbose){
if (listenerManager.hasListenerMethods()) LogUtil.logInfo("[NoCheatPlus] Cleanup ListenerManager..."); if (listenerManager.hasListenerMethods()) LogUtil.logInfo("[NoCheatPlus] Cleanup ListenerManager...");
else LogUtil.logInfo("[NoCheatPlus] (ListenerManager empty...)"); else LogUtil.logInfo("[NoCheatPlus] (ListenerManager not in use, prevent registering...)");
} }
listenerManager.setRegisterDirectly(false); listenerManager.setRegisterDirectly(false);
listenerManager.clear(); listenerManager.clear();
@ -369,6 +370,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
getServer().getScheduler().cancelTasks(this); getServer().getScheduler().cancelTasks(this);
// Exemptions cleanup. // Exemptions cleanup.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Reset ExemptionManager...");
NCPExemptionManager.clear(); NCPExemptionManager.clear();
// Data cleanup. // Data cleanup.
@ -380,7 +382,8 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
// (No native hooks present, yet.) // (No native hooks present, yet.)
// Unregister all added components explicitly. // Unregister all added components explicitly.
for (Object obj : allComponents){ if (verbose) LogUtil.logInfo("[NoCheatPlus] Unregister all registered components...");
for (Object obj : new ArrayList<Object>(allComponents)){
removeComponent(obj); removeComponent(obj);
} }