Compatible with MC server 1.3 and Permissions 2.0 + 2.1

This commit is contained in:
Evenprime 2011-02-24 19:24:19 +01:00
parent abeb50c62c
commit 7a976aaf98
2 changed files with 17 additions and 8 deletions

View File

@ -3,5 +3,5 @@ name: NoCheatPlugin
author: Evenprime author: Evenprime
main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin
version: 0.5.4 version: 0.5.5

View File

@ -56,8 +56,7 @@ public class NoCheatPlugin extends JavaPlugin {
* @param f2 * @param f2
* @param cLoader * @param cLoader
*/ */
public NoCheatPlugin(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File f1, File f2, ClassLoader cLoader) { public NoCheatPlugin() {
super(pluginLoader, instance, desc, f1, f2, cLoader);
// Create our listeners and feed them with neccessary information // Create our listeners and feed them with neccessary information
playerListener = new NoCheatPluginPlayerListener(); playerListener = new NoCheatPluginPlayerListener();
@ -95,6 +94,9 @@ public class NoCheatPlugin extends JavaPlugin {
} }
public void onDisable() { public void onDisable() {
PluginDescriptionFile pdfFile = this.getDescription();
Logger.getLogger("Minecraft").info( "[NoCheatPlugin] version [" + pdfFile.getVersion() + "] is disabled.");
} }
public void onEnable() { public void onEnable() {
@ -108,9 +110,9 @@ public class NoCheatPlugin extends JavaPlugin {
PluginDescriptionFile pdfFile = this.getDescription(); PluginDescriptionFile pdfFile = this.getDescription();
// Get, if available, the Permissions 2.0 plugin // Get, if available, the Permissions plugin
setupPermissions(); setupPermissions();
// parse the nocheat.yml config file // parse the nocheat.yml config file
setupConfig(); setupConfig();
@ -118,20 +120,27 @@ public class NoCheatPlugin extends JavaPlugin {
(NoCheatConfiguration.speedhackCheckActive ? "speedhack " : "") + (NoCheatConfiguration.speedhackCheckActive ? "speedhack " : "") +
(NoCheatConfiguration.airbuildCheckActive ? "airbuild " : ""); (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 * Get, if available, a reference to the Permissions-plugin
*/ */
public void setupPermissions() { public void setupPermissions() {
Permissions = null;
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions"); Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
if(test != null) { if(test != null) {
Permissions = ((Permissions)test).getHandler();
if(Permissions == null) {
this.getServer().getPluginManager().enablePlugin(test);
}
Permissions = ((Permissions)test).getHandler(); Permissions = ((Permissions)test).getHandler();
} else { }
if(Permissions == null) {
log.info("Nocheat couldn't find Permissions plugin. Fallback to 'isOp()' equals 'all allowed'."); log.info("Nocheat couldn't find Permissions plugin. Fallback to 'isOp()' equals 'all allowed'.");
this.getServer().getPluginManager().disablePlugin(this);
} }
} }