From 318564ccf2cb186bc5f8fec293c31c53e8f868b6 Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Tue, 13 Sep 2011 20:13:27 -0600 Subject: [PATCH] Add new CH and CH checks --- lib/commandhandler | 2 +- .../MultiverseCore/MultiverseCore.java | 26 +++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/commandhandler b/lib/commandhandler index 9bdd7dd5..ad5c57e5 160000 --- a/lib/commandhandler +++ b/lib/commandhandler @@ -1 +1 @@ -Subproject commit 9bdd7dd59a4946acb5fd47e8813f903e5ba95e3b +Subproject commit ad5c57e56cb44061b1b0f6429ada625da26d434d diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index e894830b..1e85f9cc 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -110,7 +110,8 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin { protected int pluginCount; private DestinationFactory destFactory; private SpoutInterface spoutInterface = null; - private int allpayversion = 3; + private double allpayversion = 3; + private double chversion = 1; @Override public void onLoad() { @@ -131,7 +132,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin { public void onEnable() { // Perform initial checks for AllPay - if (!this.validateAllpay()) { + if (!this.validateAllpay() || !this.validateCH()) { this.getServer().getPluginManager().disablePlugin(this); return; } @@ -191,6 +192,27 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin { log.info(tag + " This plugin needs AllPay v" + allpayversion + " or higher!"); return false; } + + private boolean validateCH() { + try { + this.commandHandler = new CommandHandler(this, null); + if (this.commandHandler.getVersion() >= chversion) { + return true; + } else { + log.info(tag + " - Version " + this.getDescription().getVersion() + " was NOT ENABLED!!!"); + log.info(tag + " A plugin that has loaded before " + this.getDescription().getName() + " has an incompatable version of CommandHandler (an internal library)!"); + log.info(tag + " Please contact this plugin author!!!!!!!"); + log.info(tag + " This plugin needs CommandHandler v" + chversion + " or higher and another plugin has loaded v" + this.commandHandler.getVersion() + "!"); + return false; + } + } catch (Throwable t) { + } + log.info(tag + " - Version " + this.getDescription().getVersion() + " was NOT ENABLED!!!"); + log.info(tag + " A plugin that has loaded before " + this.getDescription().getName() + " has an incompatable version of CommandHandler (an internal library)!"); + log.info(tag + " Please contact this plugin author!!!!!!!"); + log.info(tag + " This plugin needs CommandHandler v" + chversion + " or higher!"); + return false; + } private void initializeDestinationFactory() { this.destFactory = new DestinationFactory(this);