Only print debug info, if the flag is set. + Spaces.

This commit is contained in:
asofold 2014-08-07 18:56:05 +02:00
parent d0aea7feaa
commit 7743dd9d8a

View File

@ -117,8 +117,8 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
/** Configuration problems (likely put to ConfigManager later). */
protected String configProblems = null;
// /** Is a new update available? */
// private boolean updateAvailable = false;
// /** Is a new update available? */
// private boolean updateAvailable = false;
/** Player data future stuff. */
protected final DataManager dataMan = new DataManager();
@ -529,8 +529,12 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
// Remove listener references.
if (verbose){
if (listenerManager.hasListenerMethods()) LogUtil.logInfo("[NoCheatPlus] Cleanup ListenerManager...");
else LogUtil.logInfo("[NoCheatPlus] (ListenerManager not in use, prevent registering...)");
if (listenerManager.hasListenerMethods()) {
LogUtil.logInfo("[NoCheatPlus] Cleanup ListenerManager...");
}
else {
LogUtil.logInfo("[NoCheatPlus] (ListenerManager not in use, prevent registering...)");
}
}
listenerManager.setRegisterDirectly(false);
listenerManager.clear();
@ -544,7 +548,9 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
}
// Stop the tickTask.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Stop TickTask...");
if (verbose) {
LogUtil.logInfo("[NoCheatPlus] Stop TickTask...");
}
TickTask.setLocked(true);
TickTask.purge();
TickTask.cancel();
@ -558,15 +564,21 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
}
// Just to be sure nothing gets left out.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Stop all remaining tasks...");
if (verbose) {
LogUtil.logInfo("[NoCheatPlus] Stop all remaining tasks...");
}
sched.cancelTasks(this);
// Exemptions cleanup.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Reset ExemptionManager...");
if (verbose) {
LogUtil.logInfo("[NoCheatPlus] Reset ExemptionManager...");
}
NCPExemptionManager.clear();
// Data cleanup.
if (verbose) LogUtil.logInfo("[NoCheatPlus] onDisable calls (include DataManager cleanup)...");
if (verbose) {
LogUtil.logInfo("[NoCheatPlus] onDisable calls (include DataManager cleanup)...");
}
for (final DisableListener dl : disableListeners) {
try {
dl.onDisable();
@ -579,7 +591,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
// Write some debug/statistics.
final Counters counters = getGenericInstance(Counters.class);
if (counters != null) {
if (verbose && counters != null) {
LogUtil.logInfo(counters.getMergedCountsString(true));
}
@ -588,17 +600,23 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
// (No native hooks present, yet.)
// Unregister all added components explicitly.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Unregister all registered components...");
if (verbose) {
LogUtil.logInfo("[NoCheatPlus] Unregister all registered components...");
}
final ArrayList<Object> allComponents = new ArrayList<Object>(this.allComponents);
for (int i = allComponents.size() - 1; i >= 0; i--){
removeComponent(allComponents.get(i));
}
// Cleanup BlockProperties.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Cleanup BlockProperties...");
if (verbose) {
LogUtil.logInfo("[NoCheatPlus] Cleanup BlockProperties...");
}
BlockProperties.cleanup();
if (verbose) LogUtil.logInfo("[NoCheatPlus] Cleanup some mappings...");
if (verbose) {
LogUtil.logInfo("[NoCheatPlus] Cleanup some mappings...");
}
// Remove listeners.
listeners.clear();
// Remove config listeners.
@ -617,20 +635,26 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
changedCommands.clear();
changedCommands = null;
}
// // Restore changed commands.
// if (verbose) LogUtil.logInfo("[NoCheatPlus] Undo command changes...");
// undoCommandChanges();
// // Restore changed commands.
// if (verbose) LogUtil.logInfo("[NoCheatPlus] Undo command changes...");
// undoCommandChanges();
// Cleanup the configuration manager.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Cleanup ConfigManager...");
if (verbose) {
LogUtil.logInfo("[NoCheatPlus] Cleanup ConfigManager...");
}
ConfigManager.cleanup();
// Cleanup file logger.
if (verbose) LogUtil.logInfo("[NoCheatPlus] Cleanup file logger...");
if (verbose) {
LogUtil.logInfo("[NoCheatPlus] Cleanup file logger...");
}
StaticLogFile.cleanup();
// Tell the server administrator the we finished unloading NoCheatPlus.
if (verbose) LogUtil.logInfo("[NoCheatPlus] All cleanup done.");
if (verbose) {
LogUtil.logInfo("[NoCheatPlus] All cleanup done.");
}
final PluginDescriptionFile pdfFile = getDescription();
LogUtil.logInfo("[NoCheatPlus] Version " + pdfFile.getVersion() + " is disabled.");
}
@ -809,16 +833,16 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
// Set up consistency checking.
scheduleConsistencyCheckers();
// if (config.getBoolean(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES)){
// // Is a new update available?
// final int timeout = config.getInt(ConfPaths.MISCELLANEOUS_UPDATETIMEOUT, 4) * 1000;
// getServer().getScheduler().scheduleAsyncDelayedTask(this, new Runnable() {
// @Override
// public void run() {
// updateAvailable = Updates.checkForUpdates(getDescription().getVersion(), timeout);
// }
// });
// }
// if (config.getBoolean(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES)){
// // Is a new update available?
// final int timeout = config.getInt(ConfPaths.MISCELLANEOUS_UPDATETIMEOUT, 4) * 1000;
// getServer().getScheduler().scheduleAsyncDelayedTask(this, new Runnable() {
// @Override
// public void run() {
// updateAvailable = Updates.checkForUpdates(getDescription().getVersion(), timeout);
// }
// });
// }
// Is the version the configuration was created with consistent with the current one?
configProblems = Updates.isConfigUpToDate(config);
@ -1049,8 +1073,8 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
if (nameSetPerms.hasPermission(playerName, Permissions.NOTIFY)){
// Login notifications...
final PlayerData data = DataManager.getPlayerData(playerName, true);
// // Update available.
// if (updateAvailable) player.sendMessage(ChatColor.RED + "NCP: " + ChatColor.WHITE + "A new update of NoCheatPlus is available.\n" + "Download it at http://nocheatplus.org/update");
// // Update available.
// if (updateAvailable) player.sendMessage(ChatColor.RED + "NCP: " + ChatColor.WHITE + "A new update of NoCheatPlus is available.\n" + "Download it at http://nocheatplus.org/update");
// Inconsistent config version.
if (configProblems != null && ConfigManager.getConfigFile().getBoolean(ConfPaths.CONFIGVERSION_NOTIFY)) {