From 7a976aaf983dd1a8cdabbf13e0053e500225933e Mon Sep 17 00:00:00 2001 From: Evenprime Date: Thu, 24 Feb 2011 19:24:19 +0100 Subject: [PATCH] Compatible with MC server 1.3 and Permissions 2.0 + 2.1 --- plugin.yml | 2 +- .../bukkit/nocheat/NoCheatPlugin.java | 23 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/plugin.yml b/plugin.yml index 7176b90c..7eb1c15d 100644 --- a/plugin.yml +++ b/plugin.yml @@ -3,5 +3,5 @@ name: NoCheatPlugin author: Evenprime main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin -version: 0.5.4 +version: 0.5.5 diff --git a/src/cc/co/evenprime/bukkit/nocheat/NoCheatPlugin.java b/src/cc/co/evenprime/bukkit/nocheat/NoCheatPlugin.java index f9703dae..d80ec01f 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/NoCheatPlugin.java +++ b/src/cc/co/evenprime/bukkit/nocheat/NoCheatPlugin.java @@ -56,8 +56,7 @@ public class NoCheatPlugin extends JavaPlugin { * @param f2 * @param cLoader */ - public NoCheatPlugin(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File f1, File f2, ClassLoader cLoader) { - super(pluginLoader, instance, desc, f1, f2, cLoader); + public NoCheatPlugin() { // Create our listeners and feed them with neccessary information playerListener = new NoCheatPluginPlayerListener(); @@ -95,6 +94,9 @@ public class NoCheatPlugin extends JavaPlugin { } public void onDisable() { + PluginDescriptionFile pdfFile = this.getDescription(); + Logger.getLogger("Minecraft").info( "[NoCheatPlugin] version [" + pdfFile.getVersion() + "] is disabled."); + } public void onEnable() { @@ -108,9 +110,9 @@ public class NoCheatPlugin extends JavaPlugin { PluginDescriptionFile pdfFile = this.getDescription(); - // Get, if available, the Permissions 2.0 plugin + // Get, if available, the Permissions plugin setupPermissions(); - + // parse the nocheat.yml config file setupConfig(); @@ -118,20 +120,27 @@ public class NoCheatPlugin extends JavaPlugin { (NoCheatConfiguration.speedhackCheckActive ? "speedhack " : "") + (NoCheatConfiguration.airbuildCheckActive ? "airbuild " : ""); - Logger.getLogger("Minecraft").info( "NoCheatPlugin version " + pdfFile.getVersion() + " is enabled with the following checks: "+checks); + Logger.getLogger("Minecraft").info( "[NoCheatPlugin] version [" + pdfFile.getVersion() + "] is enabled with the following checks: "+checks); } /** * Get, if available, a reference to the Permissions-plugin */ public void setupPermissions() { + Permissions = null; + Plugin test = this.getServer().getPluginManager().getPlugin("Permissions"); if(test != null) { + Permissions = ((Permissions)test).getHandler(); + if(Permissions == null) { + this.getServer().getPluginManager().enablePlugin(test); + } Permissions = ((Permissions)test).getHandler(); - } else { + } + + if(Permissions == null) { log.info("Nocheat couldn't find Permissions plugin. Fallback to 'isOp()' equals 'all allowed'."); - this.getServer().getPluginManager().disablePlugin(this); } }