From 55b873ddeadd2940691dffdf155bd3434fea820d Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Wed, 6 Jul 2011 19:24:50 -0600 Subject: [PATCH] Update more allpay libraries --- lib/allpay | 2 +- .../MultiverseCore/MVPluginListener.java | 36 ++++++------------- .../MultiverseCore/MultiverseCore.java | 6 ++++ 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/lib/allpay b/lib/allpay index 8380320e..a1624c1e 160000 --- a/lib/allpay +++ b/lib/allpay @@ -1 +1 @@ -Subproject commit 8380320e0f8653d0361cd344101ca8d3fd620042 +Subproject commit a1624c1ed3977fc3170df5e5b847355e1e054e11 diff --git a/src/com/onarandombox/MultiverseCore/MVPluginListener.java b/src/com/onarandombox/MultiverseCore/MVPluginListener.java index f020f39f..c10ca495 100644 --- a/src/com/onarandombox/MultiverseCore/MVPluginListener.java +++ b/src/com/onarandombox/MultiverseCore/MVPluginListener.java @@ -1,22 +1,23 @@ package com.onarandombox.MultiverseCore; +import java.util.Arrays; import java.util.logging.Level; import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.ServerListener; -import org.bukkit.plugin.Plugin; +import com.fernferret.allpay.AllPay; import com.nijikokun.bukkit.Permissions.Permissions; public class MVPluginListener extends ServerListener { - + MultiverseCore plugin; - + public MVPluginListener(MultiverseCore plugin) { this.plugin = plugin; } - + /** * Keep an eye out for Plugins which we can utilize. */ @@ -29,21 +30,12 @@ public class MVPluginListener extends ServerListener { this.plugin.ph.setPermissions(((Permissions) this.plugin.getServer().getPluginManager().getPlugin("Permissions")).getHandler()); this.plugin.log(Level.INFO, "- Attached to Permissions"); } - // TODO: Use AllPay - /** - * Use the METHOD supplied by iConomy to register it etc... - */ - if(event.getPlugin().getDescription().getName().equals("iConomy")) { - //Plugin iConomy = this.plugin.getServer().getPluginManager().getPlugin("iConomy"); - -// if (iConomy != null) { -// if (iConomy.isEnabled()) { -// MultiverseCore.iConomy = (iConomy) iConomy; -// } -// } + // Let AllPay handle all econ plugin loadings, only go for econ plugins we support + if (Arrays.asList(AllPay.validEconPlugins).contains(event.getPlugin().getDescription().getName())) { + this.plugin.bank = this.plugin.banker.loadEconPlugin(); } } - + /** * We'll check if any of the plugins we rely on decide to Disable themselves. */ @@ -56,13 +48,7 @@ public class MVPluginListener extends ServerListener { this.plugin.log(Level.INFO, "Permissions disabled"); this.plugin.ph.setPermissions(null); } - - /** - * Check to see if iConomy just disabled. - */ -// if (MultiverseCore.getiConomy() != null) { -// MultiverseCore.iConomy = null; -// } + // TODO: Disable econ when it disables. } - + } diff --git a/src/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/com/onarandombox/MultiverseCore/MultiverseCore.java index 41da1f4c..b50eb0d7 100644 --- a/src/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -21,6 +21,8 @@ import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.config.Configuration; +import com.fernferret.allpay.AllPay; +import com.fernferret.allpay.GenericBank; import com.onarandombox.MultiverseCore.command.CommandManager; import com.onarandombox.MultiverseCore.command.commands.*; import com.onarandombox.MultiverseCore.configuration.DefaultConfiguration; @@ -64,6 +66,8 @@ public class MultiverseCore extends JavaPlugin { // HashMap to contain information relating to the Players. public HashMap playerSessions = new HashMap(); private PurgeWorlds worldPurger; + public GenericBank bank = null; + public AllPay banker = new AllPay(this, "[Multiverse-Core] ");; @Override public void onLoad() { @@ -84,6 +88,8 @@ public class MultiverseCore extends JavaPlugin { this.registerEvents(); // Setup Permissions, we'll do an initial check for the Permissions plugin then fall back on isOP(). this.ph = new MVPermissions(this); + + this.bank = this.banker.loadEconPlugin(); // Setup the command manager this.commandManager = new CommandManager(this); // Setup the world purger