Update to new AllPay version

This commit is contained in:
Eric Stokes 2011-09-13 19:54:06 -06:00
parent 89ea09fba2
commit 9c1a9769b2
2 changed files with 35 additions and 7 deletions

@ -1 +1 @@
Subproject commit 5f40678ac750210a3121921af0c4e58e6516bfdb Subproject commit 18c55a9070a5e64b2cb0737940290643f324fa7d

View File

@ -90,7 +90,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
private Configuration configMV = null; private Configuration configMV = null;
private WorldManager worldManager = new WorldManager(this); private WorldManager worldManager = new WorldManager(this);
// Setup the block/player/entity listener. // Setup the block/player/entity listener.
private MVPlayerListener playerListener = new MVPlayerListener(this); private MVPlayerListener playerListener = new MVPlayerListener(this);
@ -105,12 +105,12 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
// HashMap to contain information relating to the Players. // HashMap to contain information relating to the Players.
private HashMap<String, MVPlayerSession> playerSessions; private HashMap<String, MVPlayerSession> playerSessions;
private GenericBank bank = null; private GenericBank bank = null;
private AllPay banker = new AllPay(this, tag + " "); private AllPay banker;
protected MVConfigMigrator migrator = new MVCoreConfigMigrator(this); protected MVConfigMigrator migrator = new MVCoreConfigMigrator(this);
protected int pluginCount; protected int pluginCount;
private DestinationFactory destFactory; private DestinationFactory destFactory;
private SpoutInterface spoutInterface = null; private SpoutInterface spoutInterface = null;
private int allpayversion = 3;
@Override @Override
public void onLoad() { public void onLoad() {
@ -130,6 +130,12 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
} }
public void onEnable() { public void onEnable() {
// Perform initial checks for AllPay
if (!this.validateAllpay()) {
this.getServer().getPluginManager().disablePlugin(this);
return;
}
this.banker = new AllPay(this, tag + " ");
// Output a little snippet to show it's enabled. // Output a little snippet to show it's enabled.
this.log(Level.INFO, "- Version " + this.getDescription().getVersion() + " Enabled - By " + getAuthors()); this.log(Level.INFO, "- Version " + this.getDescription().getVersion() + " Enabled - By " + getAuthors());
this.checkServerProps(); this.checkServerProps();
@ -147,7 +153,6 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
this.registerCommands(); this.registerCommands();
this.playerSessions = new HashMap<String, MVPlayerSession>(); this.playerSessions = new HashMap<String, MVPlayerSession>();
// Start the Update Checker // Start the Update Checker
// updateCheck = new UpdateChecker(this.getDescription().getName(), this.getDescription().getVersion()); // updateCheck = new UpdateChecker(this.getDescription().getName(), this.getDescription().getVersion());
@ -164,6 +169,29 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
} }
} }
private boolean validateAllpay() {
try {
this.banker = new AllPay(this, "Verify");
if (this.banker.getVersion() >= allpayversion) {
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 AllPay!");
log.info(tag + " The Following Plugins MAY out of date!");
log.info(tag + " This plugin needs AllPay v" + allpayversion + " or higher and another plugin has loaded v" + this.banker.getVersion() + "!");
log.info(tag + AllPay.pluginsThatUseUs.toString());
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 AllPay!");
log.info(tag + " Check the logs for [AllPay] - Version ... for PLUGIN NAME to find the culprit! Then Yell at that dev!");
log.info(tag + " Or update that plugin :P");
log.info(tag + " This plugin needs AllPay v" + allpayversion + " or higher!");
return false;
}
private void initializeDestinationFactory() { private void initializeDestinationFactory() {
this.destFactory = new DestinationFactory(this); this.destFactory = new DestinationFactory(this);
this.destFactory.registerDestinationType(WorldDestination.class, ""); this.destFactory.registerDestinationType(WorldDestination.class, "");
@ -206,7 +234,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
new DefaultConfig(getDataFolder(), "worlds.yml", this.migrator); new DefaultConfig(getDataFolder(), "worlds.yml", this.migrator);
// Now grab the Configuration Files. // Now grab the Configuration Files.
this.configMV = new Configuration(new File(getDataFolder(), "config.yml")); this.configMV = new Configuration(new File(getDataFolder(), "config.yml"));
this.worldManager.loadWorldConfig(new File(getDataFolder(), "worlds.yml")); this.worldManager.loadWorldConfig(new File(getDataFolder(), "worlds.yml"));
// Now attempt to Load the configurations. // Now attempt to Load the configurations.
@ -292,7 +320,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
*/ */
@Deprecated @Deprecated
public boolean removeWorldFromConfig(String name) { public boolean removeWorldFromConfig(String name) {
return this.worldManager.removeWorldFromConfig(name); return this.worldManager.removeWorldFromConfig(name);
} }
/** /**