Fix economy listeners to actually check the plugin in the event rather

than checking for the plugin on the server.
This commit is contained in:
Nick Minkler 2013-09-03 15:39:25 -07:00
parent db5249ba18
commit 15ff2d310b
23 changed files with 52 additions and 52 deletions

View File

@ -156,9 +156,9 @@ public class Economy_3co implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("3co"); Plugin eco = event.getPlugin();
if (eco != null) { if (eco.getDescription().getName().equals("3co")) {
economy.economy = (ECO) eco; economy.economy = (ECO) eco;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -124,9 +124,9 @@ public class Economy_AEco implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("AEco"); Plugin eco = event.getPlugin();
if (eco != null) { if (eco.getDescription().getName().equals("AEco")) {
economy.economy = AEco.ECONOMY; economy.economy = AEco.ECONOMY;
try { try {
createWallet = economy.getClass().getMethod("createWallet", String.class); createWallet = economy.getClass().getMethod("createWallet", String.class);

View File

@ -169,9 +169,9 @@ public class Economy_BOSE6 implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy"); Plugin bose = event.getPlugin();
if (bose != null && bose.getDescription().getVersion().startsWith("0.6")) { if (bose.getDescription().getName().equals("BOSEconomy") && bose.getDescription().getVersion().startsWith("0.6")) {
economy.economy = (BOSEconomy) bose; economy.economy = (BOSEconomy) bose;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -130,9 +130,9 @@ public class Economy_BOSE7 implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy"); Plugin bose = event.getPlugin();
if (bose != null && bose.getDescription().getVersion().startsWith("0.7")) { if (bose.getDescription().getName().equals("BOSEconomy") && bose.getDescription().getVersion().startsWith("0.7")) {
economy.economy = (BOSEconomy) bose; economy.economy = (BOSEconomy) bose;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -49,9 +49,9 @@ public class Economy_CommandsEX implements net.milkbowl.vault.economy.Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin cex = plugin.getServer().getPluginManager().getPlugin("CommandsEX"); Plugin cex = event.getPlugin();
if (cex != null) { if (cex.getDescription().getName().equals("CommandsEX")) {
economy.economy = (CommandsEX) cex; economy.economy = (CommandsEX) cex;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -69,10 +69,9 @@ public class Economy_Craftconomy implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("Craftconomy"); Plugin p = event.getPlugin();
if (p.getDescription().getName().equals("Craftconomy") && p.getClass().getName().equals("me.greatman.Craftconomy.Craftconomy")) {
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("me.greatman.Craftconomy.Craftconomy")) { economy.economy = (Craftconomy) p;
economy.economy = (Craftconomy) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }
} }
@ -291,10 +290,10 @@ public class Economy_Craftconomy implements Economy {
return true; return true;
} }
@Override @Override
public int fractionalDigits() { public int fractionalDigits() {
return -1; return -1;
} }
@Override @Override
public boolean hasAccount(String playerName, String worldName) { public boolean hasAccount(String playerName, String worldName) {

View File

@ -69,9 +69,9 @@ public class Economy_Craftconomy3 implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("Craftconomy3"); Plugin ec = event.getPlugin();
if (ec != null && ec.getClass().getName().equals("com.greatmancode.craftconomy3.tools.interfaces.BukkitLoader")) { if (ec.getDescription().getName().equals("Craftconomy3") && ec.getClass().getName().equals("com.greatmancode.craftconomy3.tools.interfaces.BukkitLoader")) {
economy.economy = (BukkitLoader) ec; economy.economy = (BukkitLoader) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -65,8 +65,9 @@ public class Economy_CurrencyCore implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if(this.economy.currency == null) { if(this.economy.currency == null) {
Plugin currencyPlugin = plugin.getServer().getPluginManager().getPlugin("CurrencyCore"); Plugin currencyPlugin = event.getPlugin();
if(currencyPlugin != null && currencyPlugin.getClass().getName().equals("is.currency.Currency")) {
if(currencyPlugin.getDescription().getName().equals("CurrencyCore") && currencyPlugin.getClass().getName().equals("is.currency.Currency")) {
this.economy.currency = (Currency) currencyPlugin; this.economy.currency = (Currency) currencyPlugin;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), this.economy.getName())); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), this.economy.getName()));
} }

View File

@ -66,9 +66,9 @@ public class Economy_EconXP implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.econ == null) { if (economy.econ == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("EconXP"); Plugin eco = event.getPlugin();
if (eco != null) { if (eco.getDescription().getName().equals("EconXP")) {
economy.econ = (EconXP) eco; economy.econ = (EconXP) eco;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -182,9 +182,9 @@ public class Economy_Essentials implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.ess == null) { if (economy.ess == null) {
Plugin essentials = plugin.getServer().getPluginManager().getPlugin("Essentials"); Plugin essentials = event.getPlugin();
if (essentials != null) { if (essentials.getDescription().getName().equals("Essentials")) {
economy.ess = (Essentials) essentials; economy.ess = (Essentials) essentials;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -110,9 +110,9 @@ public class Economy_GoldIsMoney implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("GoldIsMoney"); Plugin ec = event.getPlugin();
if (ec != null && ec.getClass().getName().equals("com.flobi.GoldIsMoney.GoldIsMoney")) { if (ec.getDescription().getName().equals("GoldIsMoney") && ec.getClass().getName().equals("com.flobi.GoldIsMoney.GoldIsMoney")) {
economy.economy = (GoldIsMoney) ec; economy.economy = (GoldIsMoney) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -264,9 +264,9 @@ public class Economy_GoldIsMoney2 implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("GoldIsMoney"); Plugin ec = event.getPlugin();
if (ec != null && ec.getClass().getName().equals("com.flobi.GoldIsMoney2.GoldIsMoney")) { if (ec.getClass().getName().equals("com.flobi.GoldIsMoney2.GoldIsMoney")) {
economy.economy = (GoldIsMoney) ec; economy.economy = (GoldIsMoney) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -65,9 +65,9 @@ public class Economy_Gringotts implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.gringotts == null) { if (economy.gringotts == null) {
Plugin grngts = plugin.getServer().getPluginManager().getPlugin("Gringotts"); Plugin grngts = event.getPlugin();
if (grngts != null) { if (grngts.getDescription().getName().equals("Gringotts")) {
economy.gringotts = (Gringotts) grngts; economy.gringotts = (Gringotts) grngts;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -111,9 +111,9 @@ public class Economy_McMoney implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("McMoney"); Plugin eco = event.getPlugin();
if (eco != null) { if (eco.getDescription().getName().equals("McMoney")) {
economy.economy = McMoneyAPI.getInstance(); economy.economy = McMoneyAPI.getInstance();
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -339,9 +339,9 @@ public class Economy_MiConomy implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin miConomyPlugin = plugin.getServer().getPluginManager().getPlugin("MiConomy"); Plugin miConomyPlugin = event.getPlugin();
if (miConomyPlugin != null) { if (miConomyPlugin.getDescription().getName().equals("MiConomy")) {
economy.miConomy = (Main) miConomyPlugin; economy.miConomy = (Main) miConomyPlugin;
economy.economy = miConomy.getInstance(); economy.economy = miConomy.getInstance();

View File

@ -67,9 +67,9 @@ public class Economy_MineConomy implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.econ == null) { if (economy.econ == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("MineConomy"); Plugin eco = event.getPlugin();
if (eco != null) { if (eco.getDescription().getName().equals("MineConomy")) {
economy.econ = (MineConomy) eco; economy.econ = (MineConomy) eco;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -54,9 +54,9 @@ public class Economy_Minefaconomy implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy_minefaconomy.economy == null) { if (economy_minefaconomy.economy == null) {
Plugin mfc = plugin.getServer().getPluginManager().getPlugin("Minefaconomy"); Plugin mfc = event.getPlugin();
if (mfc != null) { if (mfc.getDescription().getName().equals("Minefaconomy")) {
economy_minefaconomy.economy = (Minefaconomy) economy; economy_minefaconomy.economy = (Minefaconomy) economy;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy_minefaconomy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy_minefaconomy.name));
} }

View File

@ -157,9 +157,9 @@ public class Economy_MultiCurrency implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin mcur = plugin.getServer().getPluginManager().getPlugin("MultiCurrency"); Plugin mcur = event.getPlugin();
if (mcur != null) { if (mcur.getDescription().getName().equals("MultiCurrency")) {
economy.economy = (Currency) mcur; economy.economy = (Currency) mcur;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -71,9 +71,9 @@ public class Economy_XPBank implements Economy {
@EventHandler (priority = EventPriority.MONITOR) @EventHandler (priority = EventPriority.MONITOR)
public void onPluginEnable (PluginEnableEvent event) { public void onPluginEnable (PluginEnableEvent event) {
if (economy.XPB == null) { if (economy.XPB == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("XPBank"); Plugin eco = event.getPlugin();
if (eco != null) { if (eco.getDescription().getName().equals("XPBank")) {
economy.XPB = (XPBank) eco; economy.XPB = (XPBank) eco;
api = XPB.getAPI(); api = XPB.getAPI();
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));

View File

@ -63,9 +63,9 @@ public class Economy_eWallet implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.econ == null) { if (economy.econ == null) {
Plugin eco = plugin.getServer().getPluginManager().getPlugin("eWallet"); Plugin eco = event.getPlugin();
if (eco != null) { if (eco.getDescription().getName().equals("eWallet")) {
economy.econ = (ECO) eco; economy.econ = (ECO) eco;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -172,9 +172,9 @@ public class Economy_iConomy4 implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin iConomy = plugin.getServer().getPluginManager().getPlugin("iConomy"); Plugin iConomy = event.getPlugin();
if (iConomy != null && iConomy.getClass().getName().equals("com.nijiko.coelho.iConomy.iConomy")) { if (iConomy.getClass().getName().equals("com.nijiko.coelho.iConomy.iConomy")) {
economy.economy = (iConomy) iConomy; economy.economy = (iConomy) iConomy;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -114,9 +114,9 @@ public class Economy_iConomy5 implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy"); Plugin ec = event.getPlugin();
if (ec != null && ec.getClass().getName().equals("com.iConomy.iConomy")) { if (ec.getClass().getName().equals("com.iConomy.iConomy")) {
economy.economy = (iConomy) ec; economy.economy = (iConomy) ec;
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
} }

View File

@ -72,8 +72,8 @@ public class Economy_iConomy6 implements Economy {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) { public void onPluginEnable(PluginEnableEvent event) {
if (economy.economy == null) { if (economy.economy == null) {
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy"); Plugin ec = event.getPlugin();
if (ec != null && ec.getClass().getName().equals("com.iCo6.iConomy")) { if (ec.getClass().getName().equals("com.iCo6.iConomy")) {
String version = ec.getDescription().getVersion().split("\\.")[0]; String version = ec.getDescription().getVersion().split("\\.")[0];
name += version; name += version;
economy.economy = (iConomy) ec; economy.economy = (iConomy) ec;