Add verbose log entries on disable (logging.debug).

This commit is contained in:
asofold 2012-12-03 17:46:38 +01:00
parent a564d676a0
commit 5ebaf7a8ea

View File

@ -302,45 +302,59 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
* |____/|_|___/\__,_|_.__/|_|\___| * |____/|_|___/\__,_|_.__/|_|\___|
*/ */
final boolean verbose = ConfigManager.getConfigFile().getBoolean(ConfPaths.LOGGING_DEBUG);
// Remove listener references. // Remove listener references.
if (verbose){
if (listenerManager.hasListenerMethods()) LogUtil.logInfo("[NoCheatPlus] Cleanup ListenerManager...");
else LogUtil.logInfo("[NoCheatPlus] (ListenerManager empty...)");
}
listenerManager.setRegisterDirectly(false); listenerManager.setRegisterDirectly(false);
listenerManager.clear(); listenerManager.clear();
// Stop the tickTask. // Stop the tickTask.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Stop TickTask...");
TickTask.setLocked(true); TickTask.setLocked(true);
TickTask.purge(); TickTask.purge();
TickTask.cancel(); TickTask.cancel();
// Stop metrics task. // Stop metrics task.
if (metrics != null){ if (metrics != null){
if (verbose) LogUtil.logInfo("[NoCheatPlus] Stop Metrics...");
metrics.cancel(); metrics.cancel();
metrics = null; metrics = null;
} }
// Stop the lag measuring task. // Stop the lag measuring task.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Stop LagMeasureTask...");
LagMeasureTask.cancel(); LagMeasureTask.cancel();
// Just to be sure nothing gets left out. // Just to be sure nothing gets left out.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Stop all remaining tasks...");
getServer().getScheduler().cancelTasks(this); getServer().getScheduler().cancelTasks(this);
if (verbose) LogUtil.logInfo("[NoCheatPlus] Cleanup some mappings...");
// Remove listeners. // Remove listeners.
listeners.clear(); listeners.clear();
// Remove config listeners. // Remove config listeners.
notifyReload.clear(); notifyReload.clear();
// World specific permissions.
permStateReceivers.clear(); permStateReceivers.clear();
// More cleanup. // More cleanup.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Cleanup DataManager...");
dataMan.onDisable(); dataMan.onDisable();
// Restore changed commands. // Restore changed commands.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Undo command changes...");
undoCommandChanges(); undoCommandChanges();
// Cleanup the configuration manager. // Cleanup the configuration manager.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Cleanup ConfigManager...");
ConfigManager.cleanup(); ConfigManager.cleanup();
// Tell the server administrator the we finished unloading NoCheatPlus. // Tell the server administrator the we finished unloading NoCheatPlus.
if (verbose) LogUtil.logInfo("[NoCheatPlus] All cleanup done.");
final PluginDescriptionFile pdfFile = getDescription(); final PluginDescriptionFile pdfFile = getDescription();
LogUtil.logInfo("[NoCheatPlus] Version " + pdfFile.getVersion() + " is disabled."); LogUtil.logInfo("[NoCheatPlus] Version " + pdfFile.getVersion() + " is disabled.");
} }