mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-11-27 04:55:33 +01:00
don't check if economy is enabled in PluginEnableEvent assume it is
being enabled and add the hook.
This commit is contained in:
parent
30a9603647
commit
a514f066c8
@ -158,7 +158,7 @@ public class Economy_3co implements Economy {
|
||||
if (economy.economy == null) {
|
||||
Plugin eco = plugin.getServer().getPluginManager().getPlugin("3co");
|
||||
|
||||
if (eco != null && eco.isEnabled()) {
|
||||
if (eco != null) {
|
||||
economy.economy = (ECO) eco;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class Economy_AEco implements Economy {
|
||||
if (economy.economy == null) {
|
||||
Plugin eco = plugin.getServer().getPluginManager().getPlugin("AEco");
|
||||
|
||||
if (eco != null && eco.isEnabled()) {
|
||||
if (eco != null) {
|
||||
economy.economy = AEco.ECONOMY;
|
||||
try {
|
||||
createWallet = economy.getClass().getMethod("createWallet", String.class);
|
||||
|
@ -171,7 +171,7 @@ public class Economy_BOSE6 implements Economy {
|
||||
if (economy.economy == null) {
|
||||
Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy");
|
||||
|
||||
if (bose != null && bose.isEnabled() && bose.getDescription().getVersion().startsWith("0.6")) {
|
||||
if (bose != null && bose.getDescription().getVersion().startsWith("0.6")) {
|
||||
economy.economy = (BOSEconomy) bose;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class Economy_BOSE7 implements Economy {
|
||||
if (economy.economy == null) {
|
||||
Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy");
|
||||
|
||||
if (bose != null && bose.isEnabled() && bose.getDescription().getVersion().startsWith("0.7")) {
|
||||
if (bose != null && bose.getDescription().getVersion().startsWith("0.7")) {
|
||||
economy.economy = (BOSEconomy) bose;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class Economy_CommandsEX implements net.milkbowl.vault.economy.Economy {
|
||||
if (economy.economy == null) {
|
||||
Plugin cex = plugin.getServer().getPluginManager().getPlugin("CommandsEX");
|
||||
|
||||
if (cex != null && cex.isEnabled()) {
|
||||
if (cex != null) {
|
||||
economy.economy = (CommandsEX) cex;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class Economy_Craftconomy implements Economy {
|
||||
// Load Plugin in case it was loaded before
|
||||
if (economy == null) {
|
||||
Plugin ec = plugin.getServer().getPluginManager().getPlugin("Craftconomy");
|
||||
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("me.greatman.Craftconomy.Craftconomy")) {
|
||||
if (ec != null && ec.getClass().getName().equals("me.greatman.Craftconomy.Craftconomy")) {
|
||||
economy = (Craftconomy) ec;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class Economy_Craftconomy3 implements Economy {
|
||||
if (economy.economy == null) {
|
||||
Plugin ec = plugin.getServer().getPluginManager().getPlugin("Craftconomy3");
|
||||
|
||||
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.greatmancode.craftconomy3.BukkitLoader")) {
|
||||
if (ec != null && ec.getClass().getName().equals("com.greatmancode.craftconomy3.BukkitLoader")) {
|
||||
economy.economy = (BukkitLoader) ec;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -27,144 +27,140 @@ import net.milkbowl.vault.economy.EconomyResponse;
|
||||
|
||||
|
||||
public class Economy_Dosh implements Economy {
|
||||
|
||||
|
||||
Plugin plugin;
|
||||
Dosh doshPlugin;
|
||||
boolean isEnabled = false;
|
||||
DoshAPIHandler apiHandle;
|
||||
|
||||
public Economy_Dosh(Plugin _plugin) {
|
||||
|
||||
plugin = _plugin;
|
||||
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("Dosh")) {
|
||||
doshPlugin = (Dosh) plugin.getServer().getPluginManager().getPlugin("Dosh");
|
||||
apiHandle = new DoshAPIHandler();
|
||||
isEnabled = true;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return isEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Dosh";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBankSupport() {
|
||||
return false;
|
||||
}
|
||||
Plugin plugin;
|
||||
Dosh doshPlugin;
|
||||
DoshAPIHandler apiHandle;
|
||||
|
||||
@Override
|
||||
public int fractionalDigits() {
|
||||
return 0;
|
||||
}
|
||||
public Economy_Dosh(Plugin _plugin) {
|
||||
plugin = _plugin;
|
||||
|
||||
@Override
|
||||
public String format(double amount) {
|
||||
return null;
|
||||
}
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("Dosh")) {
|
||||
doshPlugin = (Dosh) plugin.getServer().getPluginManager().getPlugin("Dosh");
|
||||
apiHandle = new DoshAPIHandler();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currencyNamePlural() {
|
||||
return Dosh.getSettings().moneyName + "s";
|
||||
}
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return apiHandle != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currencyNameSingular() {
|
||||
return Dosh.getSettings().moneyName;
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Dosh";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAccount(String playerName) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasBankSupport() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(String playerName) {
|
||||
return DoshAPIHandler.getUserBal(playerName);
|
||||
}
|
||||
@Override
|
||||
public int fractionalDigits() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String playerName, double amount) {
|
||||
return (getBalance(playerName) - amount) > 0;
|
||||
}
|
||||
@Override
|
||||
public String format(double amount) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse withdrawPlayer(String playerName, double amount) {
|
||||
|
||||
if (DoshAPIHandler.subtractMoney(playerName, amount)) {
|
||||
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.SUCCESS, "Worked!");
|
||||
}
|
||||
|
||||
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.FAILURE, "Didnt work!");
|
||||
|
||||
}
|
||||
@Override
|
||||
public String currencyNamePlural() {
|
||||
return Dosh.getSettings().moneyName + "s";
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse depositPlayer(String playerName, double amount) {
|
||||
DoshAPIHandler.addUserBal(playerName, amount);
|
||||
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.SUCCESS, "It worked!");
|
||||
}
|
||||
@Override
|
||||
public String currencyNameSingular() {
|
||||
return Dosh.getSettings().moneyName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse createBank(String name, String player) {
|
||||
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
|
||||
}
|
||||
@Override
|
||||
public boolean hasAccount(String playerName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse deleteBank(String name) {
|
||||
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
|
||||
}
|
||||
@Override
|
||||
public double getBalance(String playerName) {
|
||||
return DoshAPIHandler.getUserBal(playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankBalance(String name) {
|
||||
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
|
||||
}
|
||||
@Override
|
||||
public boolean has(String playerName, double amount) {
|
||||
return (getBalance(playerName) - amount) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankHas(String name, double amount) {
|
||||
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
|
||||
}
|
||||
@Override
|
||||
public EconomyResponse withdrawPlayer(String playerName, double amount) {
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankWithdraw(String name, double amount) {
|
||||
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
|
||||
}
|
||||
if (DoshAPIHandler.subtractMoney(playerName, amount)) {
|
||||
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.SUCCESS, "Worked!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankDeposit(String name, double amount) {
|
||||
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
|
||||
}
|
||||
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.FAILURE, "Didnt work!");
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankOwner(String name, String playerName) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankMember(String name, String playerName) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public EconomyResponse depositPlayer(String playerName, double amount) {
|
||||
DoshAPIHandler.addUserBal(playerName, amount);
|
||||
return new EconomyResponse(amount, getBalance(playerName), EconomyResponse.ResponseType.SUCCESS, "It worked!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getBanks() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public EconomyResponse createBank(String name, String player) {
|
||||
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse deleteBank(String name) {
|
||||
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankBalance(String name) {
|
||||
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankHas(String name, double amount) {
|
||||
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankWithdraw(String name, double amount) {
|
||||
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankDeposit(String name, double amount) {
|
||||
return new EconomyResponse(0D, 0D, EconomyResponse.ResponseType.NOT_IMPLEMENTED, "We do not use banks!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankOwner(String name, String playerName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankMember(String name, String playerName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getBanks() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createPlayerAccount(String playerName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public class DoshAPIHandler extends MoneyUtils {}
|
||||
|
||||
@Override
|
||||
public boolean createPlayerAccount(String playerName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public class DoshAPIHandler extends MoneyUtils {}
|
||||
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class Economy_EconXP implements Economy {
|
||||
if (economy.econ == null) {
|
||||
Plugin eco = plugin.getServer().getPluginManager().getPlugin("EconXP");
|
||||
|
||||
if (eco != null && eco.isEnabled()) {
|
||||
if (eco != null) {
|
||||
economy.econ = (EconXP) eco;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class Economy_Essentials implements Economy {
|
||||
if (economy.ess == null) {
|
||||
Plugin essentials = plugin.getServer().getPluginManager().getPlugin("Essentials");
|
||||
|
||||
if (essentials != null && essentials.isEnabled()) {
|
||||
if (essentials != null) {
|
||||
economy.ess = (Essentials) essentials;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class Economy_GoldIsMoney implements Economy {
|
||||
if (economy.economy == null) {
|
||||
Plugin ec = plugin.getServer().getPluginManager().getPlugin("GoldIsMoney");
|
||||
|
||||
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.flobi.GoldIsMoney.GoldIsMoney")) {
|
||||
if (ec != null && ec.getClass().getName().equals("com.flobi.GoldIsMoney.GoldIsMoney")) {
|
||||
economy.economy = (GoldIsMoney) ec;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ public class Economy_GoldIsMoney2 implements Economy {
|
||||
if (economy.economy == null) {
|
||||
Plugin ec = plugin.getServer().getPluginManager().getPlugin("GoldIsMoney");
|
||||
|
||||
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.flobi.GoldIsMoney2.GoldIsMoney")) {
|
||||
if (ec != null && ec.getClass().getName().equals("com.flobi.GoldIsMoney2.GoldIsMoney")) {
|
||||
economy.economy = (GoldIsMoney) ec;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class Economy_Gringotts implements Economy {
|
||||
if (economy.gringotts == null) {
|
||||
Plugin grngts = plugin.getServer().getPluginManager().getPlugin("Gringotts");
|
||||
|
||||
if (grngts != null && grngts.isEnabled()) {
|
||||
if (grngts != null) {
|
||||
economy.gringotts = (Gringotts) grngts;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class Economy_McMoney implements Economy {
|
||||
if (economy.economy == null) {
|
||||
Plugin eco = plugin.getServer().getPluginManager().getPlugin("McMoney");
|
||||
|
||||
if (eco != null && eco.isEnabled()) {
|
||||
if (eco != null) {
|
||||
economy.economy = McMoneyAPI.getInstance();
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class Economy_MineConomy implements Economy {
|
||||
if (economy.econ == null) {
|
||||
Plugin eco = plugin.getServer().getPluginManager().getPlugin("MineConomy");
|
||||
|
||||
if (eco != null && eco.isEnabled()) {
|
||||
if (eco != null) {
|
||||
economy.econ = (MineConomy) eco;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ public class Economy_MultiCurrency implements Economy {
|
||||
if (economy.economy == null) {
|
||||
Plugin mcur = plugin.getServer().getPluginManager().getPlugin("MultiCurrency");
|
||||
|
||||
if (mcur != null && mcur.isEnabled()) {
|
||||
if (mcur != null) {
|
||||
economy.economy = (Currency) mcur;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class Economy_XPBank implements Economy {
|
||||
if (economy.XPB == null) {
|
||||
Plugin eco = plugin.getServer().getPluginManager().getPlugin("XPBank");
|
||||
|
||||
if (eco != null && eco.isEnabled()) {
|
||||
if (eco != null) {
|
||||
economy.XPB = (XPBank) eco;
|
||||
api = XPB.getAPI();
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
|
@ -65,7 +65,7 @@ public class Economy_eWallet implements Economy {
|
||||
if (economy.econ == null) {
|
||||
Plugin eco = plugin.getServer().getPluginManager().getPlugin("eWallet");
|
||||
|
||||
if (eco != null && eco.isEnabled()) {
|
||||
if (eco != null) {
|
||||
economy.econ = (ECO) eco;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public class Economy_iConomy4 implements Economy {
|
||||
if (economy.economy == null) {
|
||||
Plugin iConomy = plugin.getServer().getPluginManager().getPlugin("iConomy");
|
||||
|
||||
if (iConomy != null && iConomy.isEnabled() && iConomy.getClass().getName().equals("com.nijiko.coelho.iConomy.iConomy")) {
|
||||
if (iConomy != null && iConomy.getClass().getName().equals("com.nijiko.coelho.iConomy.iConomy")) {
|
||||
economy.economy = (iConomy) iConomy;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class Economy_iConomy5 implements Economy {
|
||||
if (economy.economy == null) {
|
||||
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy");
|
||||
|
||||
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.iConomy.iConomy")) {
|
||||
if (ec != null && ec.getClass().getName().equals("com.iConomy.iConomy")) {
|
||||
economy.economy = (iConomy) ec;
|
||||
log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class Economy_iConomy6 implements Economy {
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (economy.economy == null) {
|
||||
Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy");
|
||||
if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.iCo6.iConomy")) {
|
||||
if (ec != null && ec.getClass().getName().equals("com.iCo6.iConomy")) {
|
||||
String version = ec.getDescription().getVersion().split("\\.")[0];
|
||||
name += version;
|
||||
economy.economy = (iConomy) ec;
|
||||
|
Loading…
Reference in New Issue
Block a user