diff options
author | md_5 <md_5@bigpond.com> | 2012-03-12 10:39:36 +1100 |
---|---|---|
committer | md_5 <md_5@bigpond.com> | 2012-03-12 10:39:36 +1100 |
commit | 78f4820876f42f7b50bf88f64afd45bee939e4e4 (patch) | |
tree | 317cd3bcc63fc9e86a6efbcb5e13a50ed9efbaaf /EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/debug/ActiveCheckPrinter.java | |
parent | 26409058467e9f34aa65a08df3c68a58129d22ba (diff) | |
download | Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.tar Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.tar.gz Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.tar.lz Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.tar.xz Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.zip |
Initial formatted and slightly tweaked version of @evenprime 's NoCheat. Will be intergrated into the main Essentials as soon as possible
Diffstat (limited to 'EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/debug/ActiveCheckPrinter.java')
-rw-r--r-- | EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/debug/ActiveCheckPrinter.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/debug/ActiveCheckPrinter.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/debug/ActiveCheckPrinter.java new file mode 100644 index 000000000..295acb9ef --- /dev/null +++ b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/debug/ActiveCheckPrinter.java @@ -0,0 +1,66 @@ +package com.earth2me.essentials.anticheat.debug; + +import com.earth2me.essentials.anticheat.EventManager; +import com.earth2me.essentials.anticheat.NoCheat; +import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; +import java.util.List; +import org.bukkit.World; + + +/** + * Prints the list of active checks per world on startup, if requested + * + */ +public class ActiveCheckPrinter +{ + public static void printActiveChecks(NoCheat plugin, List<EventManager> eventManagers) + { + + boolean introPrinted = false; + + // Print active checks for NoCheat, if needed. + for (World world : plugin.getServer().getWorlds()) + { + + StringBuilder line = new StringBuilder(" ").append(world.getName()).append(": "); + + int length = line.length(); + + ConfigurationCacheStore cc = plugin.getConfig(world); + + if (!cc.logging.showactivechecks) + { + continue; + } + + for (EventManager em : eventManagers) + { + if (em.getActiveChecks(cc).isEmpty()) + { + continue; + } + + for (String active : em.getActiveChecks(cc)) + { + line.append(active).append(' '); + } + + if (!introPrinted) + { + plugin.getLogger().info("Active Checks: "); + introPrinted = true; + } + + plugin.getServer().getLogger().info(line.toString()); + + line = new StringBuilder(length); + + for (int i = 0; i < length; i++) + { + line.append(' '); + } + } + + } + } +} |