From 3d84e901de2d0be441ffeb946c78d6a764a1b6fb Mon Sep 17 00:00:00 2001 From: Sleaker Date: Sat, 28 Jan 2012 11:15:41 -0800 Subject: [PATCH] Added deleteBank method. fixed eWallet not implemented messages. --- src/net/milkbowl/vault/economy/Economy.java | 29 +- .../vault/economy/plugins/Economy_3co.java | 69 +-- .../vault/economy/plugins/Economy_BOSE6.java | 400 +++++++++--------- .../vault/economy/plugins/Economy_BOSE7.java | 158 +++---- .../economy/plugins/Economy_Craftconomy.java | 11 +- .../economy/plugins/Economy_CurrencyCore.java | 13 +- .../vault/economy/plugins/Economy_EconXP.java | 279 ++++++------ .../economy/plugins/Economy_Essentials.java | 73 ++-- .../economy/plugins/Economy_MineConomy.java | 237 ++++++----- .../plugins/Economy_MultiCurrency.java | 73 ++-- .../economy/plugins/Economy_eWallet.java | 243 +++++------ .../economy/plugins/Economy_iConomy4.java | 73 ++-- .../economy/plugins/Economy_iConomy5.java | 73 ++-- .../economy/plugins/Economy_iConomy6.java | 103 +++-- 14 files changed, 963 insertions(+), 871 deletions(-) diff --git a/src/net/milkbowl/vault/economy/Economy.java b/src/net/milkbowl/vault/economy/Economy.java index dace53b..e174d69 100644 --- a/src/net/milkbowl/vault/economy/Economy.java +++ b/src/net/milkbowl/vault/economy/Economy.java @@ -44,7 +44,7 @@ public interface Economy { * @return true if the implementation supports banks */ public abstract boolean hasBankSupport(); - + /** * Format amount into a human readable String This provides translation into * economy specific formatting to improve consistency between plugins. @@ -62,8 +62,8 @@ public interface Economy { * @return if the player has an account */ public boolean hasAccount(String playerName); - - + + /** * Gets balance of a player * @param playerName @@ -93,7 +93,7 @@ public interface Economy { * @return Detailed response of transaction */ public EconomyResponse depositPlayer(String playerName, double amount); - + /** * Creates a bank account with the specified name and the player as the owner * @param name @@ -101,14 +101,21 @@ public interface Economy { * @return */ public EconomyResponse createBank(String name, String player); - + + /** + * Deletes a bank account with the specified name. + * @param name + * @return if the operation completed successfully + */ + public EconomyResponse deleteBank(String name); + /** * Returns the amount the bank has * @param name * @return */ public EconomyResponse bankBalance(String name); - + /** * Returns true or false whether the bank has the amount specified * @param name @@ -116,7 +123,7 @@ public interface Economy { * @return */ public EconomyResponse bankHas(String name, double amount); - + /** * Withdraw an amount from a bank account * @param name @@ -124,7 +131,7 @@ public interface Economy { * @return */ public EconomyResponse bankWithdraw(String name, double amount); - + /** * Deposit an amount into a bank account * @param name @@ -132,7 +139,7 @@ public interface Economy { * @return */ public EconomyResponse bankDeposit(String name, double amount); - + /** * Check if a player is the owner of a bank account * @param name @@ -140,7 +147,7 @@ public interface Economy { * @return */ public EconomyResponse isBankOwner(String name, String playerName); - + /** * Check if the player is a member of the bank account * @param name @@ -154,7 +161,7 @@ public interface Economy { * @return the List of Banks */ public List getBanks(); - + /** * Attempts to create a player account for the given player * @return if the account creation was successful diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_3co.java b/src/net/milkbowl/vault/economy/plugins/Economy_3co.java index 668ccc3..39b42ec 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_3co.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_3co.java @@ -187,45 +187,50 @@ public class Economy_3co implements Economy { } } - @Override - public EconomyResponse createBank(String name, String player) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } + @Override + public EconomyResponse createBank(String name, String player) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); + } - @Override - public EconomyResponse bankHas(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } + @Override + public EconomyResponse deleteBank(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); + } - @Override - public EconomyResponse bankWithdraw(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } + @Override + public EconomyResponse bankHas(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); + } - @Override - public EconomyResponse bankDeposit(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } + @Override + public EconomyResponse bankWithdraw(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); + } - @Override - public boolean has(String playerName, double amount) { - return getBalance(playerName) >= amount; - } + @Override + public EconomyResponse bankDeposit(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); + } - @Override - public EconomyResponse isBankOwner(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } + @Override + public boolean has(String playerName, double amount) { + return getBalance(playerName) >= amount; + } - @Override - public EconomyResponse isBankMember(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } + @Override + public EconomyResponse isBankOwner(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); + } - @Override - public EconomyResponse bankBalance(String name) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } + @Override + public EconomyResponse isBankMember(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); + } + + @Override + public EconomyResponse bankBalance(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); + } @Override public List getBanks() { diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java index b371d56..1a73215 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java @@ -38,238 +38,246 @@ import cosine.boseconomy.BOSEconomy; @SuppressWarnings("deprecation") public class Economy_BOSE6 implements Economy { - private static final Logger log = Logger.getLogger("Minecraft"); + private static final Logger log = Logger.getLogger("Minecraft"); - private String name = "BOSEconomy"; - private Plugin plugin = null; - private BOSEconomy economy = null; + private String name = "BOSEconomy"; + private Plugin plugin = null; + private BOSEconomy economy = null; - public Economy_BOSE6(Plugin plugin) { - this.plugin = plugin; - Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); + public Economy_BOSE6(Plugin plugin) { + this.plugin = plugin; + Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); - // Load Plugin in case it was loaded before - if (economy == null) { - Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy"); - if (bose != null && bose.isEnabled() && bose.getDescription().getVersion().startsWith("0.6")) { - economy = (BOSEconomy) bose; - log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name)); - } - } - } - - @Override - public String getName() { - return name; - } - - @Override - public boolean isEnabled() { - if (economy == null) { - return false; - } else { - return economy.isEnabled(); - } - } + // Load Plugin in case it was loaded before + if (economy == null) { + Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy"); + if (bose != null && bose.isEnabled() && bose.getDescription().getVersion().startsWith("0.6")) { + economy = (BOSEconomy) bose; + log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name)); + } + } + } @Override - public double getBalance(String playerName) { - return (double) economy.getPlayerMoney(playerName); - } + public String getName() { + return name; + } - @Override - public boolean has(String playerName, double amount) { - return getBalance(playerName) >= amount; - } + @Override + public boolean isEnabled() { + if (economy == null) { + return false; + } else { + return economy.isEnabled(); + } + } - @Override - public EconomyResponse withdrawPlayer(String playerName, double amount) { - double balance; - EconomyResponse.ResponseType type; - String errorMessage = null; + @Override + public double getBalance(String playerName) { + return (double) economy.getPlayerMoney(playerName); + } - if (amount < 0) { - errorMessage = "Cannot withdraw negative funds"; - type = EconomyResponse.ResponseType.FAILURE; - amount = 0; - balance = (double) economy.getPlayerMoney(playerName); + @Override + public boolean has(String playerName, double amount) { + return getBalance(playerName) >= amount; + } - return new EconomyResponse(balance, balance, type, errorMessage); - } + @Override + public EconomyResponse withdrawPlayer(String playerName, double amount) { + double balance; + EconomyResponse.ResponseType type; + String errorMessage = null; - amount = Math.ceil(amount); - balance = (double) economy.getPlayerMoney(playerName); - if (balance - amount < 0) { - errorMessage = "Insufficient funds"; - type = EconomyResponse.ResponseType.FAILURE; - amount = 0; + if (amount < 0) { + errorMessage = "Cannot withdraw negative funds"; + type = EconomyResponse.ResponseType.FAILURE; + amount = 0; + balance = (double) economy.getPlayerMoney(playerName); - return new EconomyResponse(balance, balance, type, errorMessage); - } - if (economy.setPlayerMoney(playerName, (int) (balance - amount), false)) { - type = EconomyResponse.ResponseType.SUCCESS; - balance = (double) economy.getPlayerMoney(playerName); + return new EconomyResponse(balance, balance, type, errorMessage); + } - return new EconomyResponse(amount, balance, type, errorMessage); - } else { - errorMessage = "Error withdrawing funds"; - type = EconomyResponse.ResponseType.FAILURE; - amount = 0; - balance = (double) economy.getPlayerMoney(playerName); + amount = Math.ceil(amount); + balance = (double) economy.getPlayerMoney(playerName); + if (balance - amount < 0) { + errorMessage = "Insufficient funds"; + type = EconomyResponse.ResponseType.FAILURE; + amount = 0; - return new EconomyResponse(amount, balance, type, errorMessage); - } - } + return new EconomyResponse(balance, balance, type, errorMessage); + } + if (economy.setPlayerMoney(playerName, (int) (balance - amount), false)) { + type = EconomyResponse.ResponseType.SUCCESS; + balance = (double) economy.getPlayerMoney(playerName); - @Override - public EconomyResponse depositPlayer(String playerName, double amount) { - double balance; - EconomyResponse.ResponseType type; - String errorMessage = null; + return new EconomyResponse(amount, balance, type, errorMessage); + } else { + errorMessage = "Error withdrawing funds"; + type = EconomyResponse.ResponseType.FAILURE; + amount = 0; + balance = (double) economy.getPlayerMoney(playerName); - if (amount < 0) { - errorMessage = "Cannot deposit negative funds"; - type = EconomyResponse.ResponseType.FAILURE; - amount = 0; - balance = (double) economy.getPlayerMoney(playerName); + return new EconomyResponse(amount, balance, type, errorMessage); + } + } - return new EconomyResponse(balance, balance, type, errorMessage); - } - amount = Math.ceil(amount); - balance = (double) economy.getPlayerMoney(playerName); - if (economy.setPlayerMoney(playerName, (int) (balance + amount), false)) { - type = EconomyResponse.ResponseType.SUCCESS; - balance = (double) economy.getPlayerMoney(playerName); + @Override + public EconomyResponse depositPlayer(String playerName, double amount) { + double balance; + EconomyResponse.ResponseType type; + String errorMessage = null; - return new EconomyResponse(amount, balance, type, errorMessage); - } else { - errorMessage = "Error withdrawing funds"; - type = EconomyResponse.ResponseType.FAILURE; - amount = 0; - balance = (double) economy.getPlayerMoney(playerName); + if (amount < 0) { + errorMessage = "Cannot deposit negative funds"; + type = EconomyResponse.ResponseType.FAILURE; + amount = 0; + balance = (double) economy.getPlayerMoney(playerName); - return new EconomyResponse(balance, balance, type, errorMessage); - } - } + return new EconomyResponse(balance, balance, type, errorMessage); + } + amount = Math.ceil(amount); + balance = (double) economy.getPlayerMoney(playerName); + if (economy.setPlayerMoney(playerName, (int) (balance + amount), false)) { + type = EconomyResponse.ResponseType.SUCCESS; + balance = (double) economy.getPlayerMoney(playerName); - public String getMoneyNamePlural() { - return economy.getMoneyNamePlural(); - } + return new EconomyResponse(amount, balance, type, errorMessage); + } else { + errorMessage = "Error withdrawing funds"; + type = EconomyResponse.ResponseType.FAILURE; + amount = 0; + balance = (double) economy.getPlayerMoney(playerName); - public String getMoneyNameSingular() { - return economy.getMoneyName(); - } + return new EconomyResponse(balance, balance, type, errorMessage); + } + } - public class EconomyServerListener implements Listener { - Economy_BOSE6 economy = null; + public String getMoneyNamePlural() { + return economy.getMoneyNamePlural(); + } - public EconomyServerListener(Economy_BOSE6 economy) { - this.economy = economy; - } + public String getMoneyNameSingular() { + return economy.getMoneyName(); + } - @EventHandler(priority = EventPriority.MONITOR) - public void onPluginEnable(PluginEnableEvent event) { - if (economy.economy == null) { - Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy"); + public class EconomyServerListener implements Listener { + Economy_BOSE6 economy = null; - if (bose != null && bose.isEnabled() && bose.getDescription().getVersion().startsWith("0.6")) { - economy.economy = (BOSEconomy) bose; - log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); - } - } - } - - @EventHandler(priority = EventPriority.MONITOR) - public void onPluginDisable(PluginDisableEvent event) { - if (economy.economy != null) { - if (event.getPlugin().getDescription().getName().equals("BOSEconomy") && event.getPlugin().getDescription().getVersion().startsWith("0.6")) { - economy.economy = null; - log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name)); - } - } - } - } + public EconomyServerListener(Economy_BOSE6 economy) { + this.economy = economy; + } - @Override - public String format(double amount) { - if (amount == 1) { - return String.format("%.0f %s", amount, getMoneyNameSingular()); - } else { - return String.format("%.2f %s", amount, getMoneyNamePlural()); - } - } + @EventHandler(priority = EventPriority.MONITOR) + public void onPluginEnable(PluginEnableEvent event) { + if (economy.economy == null) { + Plugin bose = plugin.getServer().getPluginManager().getPlugin("BOSEconomy"); - @Override - public EconomyResponse createBank(String name, String player) { - boolean success = economy.addBankOwner(name, player, false); - if (success) - return new EconomyResponse(0, economy.getBankMoney(name), ResponseType.SUCCESS, ""); + if (bose != null && bose.isEnabled() && bose.getDescription().getVersion().startsWith("0.6")) { + economy.economy = (BOSEconomy) bose; + log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); + } + } + } - return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to create that bank account."); - } + @EventHandler(priority = EventPriority.MONITOR) + public void onPluginDisable(PluginDisableEvent event) { + if (economy.economy != null) { + if (event.getPlugin().getDescription().getName().equals("BOSEconomy") && event.getPlugin().getDescription().getVersion().startsWith("0.6")) { + economy.economy = null; + log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name)); + } + } + } + } - @Override - public EconomyResponse bankHas(String name, double amount) { - if (!economy.bankExists(name)) - return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); + @Override + public String format(double amount) { + if (amount == 1) { + return String.format("%.0f %s", amount, getMoneyNameSingular()); + } else { + return String.format("%.2f %s", amount, getMoneyNamePlural()); + } + } - double bankMoney = economy.getBankMoney(name); - if (bankMoney < amount) - return new EconomyResponse(0, bankMoney, ResponseType.FAILURE, "The bank does not have enough money!"); - else - return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, ""); + @Override + public EconomyResponse createBank(String name, String player) { + boolean success = economy.addBankOwner(name, player, false); + if (success) + return new EconomyResponse(0, economy.getBankMoney(name), ResponseType.SUCCESS, ""); - } + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to create that bank account."); + } + @Override + public EconomyResponse deleteBank(String name) { + boolean success = economy.removeBank(name); + if (success) { + return new EconomyResponse(0, 0, ResponseType.SUCCESS, ""); + } + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to remove that bank account."); + } - @Override - public EconomyResponse bankWithdraw(String name, double amount) { - EconomyResponse er = bankHas(name, amount); - if (!er.transactionSuccess()) - return er; - else { - economy.addBankMoney(name, (int) -amount, true); - return new EconomyResponse((int) amount, economy.getBankMoney(name), ResponseType.SUCCESS, ""); - } - } + @Override + public EconomyResponse bankHas(String name, double amount) { + if (!economy.bankExists(name)) + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); - @Override - public EconomyResponse bankDeposit(String name, double amount) { - if (!economy.bankExists(name)) - return new EconomyResponse(amount, 0, ResponseType.FAILURE, "That bank does not exist!"); - else { - economy.addBankMoney(name, (int) amount, true); - return new EconomyResponse((int) amount, economy.getBankMoney(name), ResponseType.SUCCESS, ""); - } - } + double bankMoney = economy.getBankMoney(name); + if (bankMoney < amount) + return new EconomyResponse(0, bankMoney, ResponseType.FAILURE, "The bank does not have enough money!"); + else + return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, ""); - @Override - public EconomyResponse isBankOwner(String name, String playerName) { - if (!economy.bankExists(name)) - return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); - else if (economy.isBankOwner(name, playerName)) { - return new EconomyResponse(0, economy.getBankMoney(name), ResponseType.SUCCESS, ""); - } else - return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank owner!"); - } + } - @Override - public EconomyResponse isBankMember(String name, String playerName) { - if (!economy.bankExists(name)) - return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); - else if (economy.isBankMember(name, playerName)) { - return new EconomyResponse(0, economy.getBankMoney(name), ResponseType.SUCCESS, ""); - } else - return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank member!"); - } + @Override + public EconomyResponse bankWithdraw(String name, double amount) { + EconomyResponse er = bankHas(name, amount); + if (!er.transactionSuccess()) + return er; + else { + economy.addBankMoney(name, (int) -amount, true); + return new EconomyResponse((int) amount, economy.getBankMoney(name), ResponseType.SUCCESS, ""); + } + } - @Override - public EconomyResponse bankBalance(String name) { - if (!economy.bankExists(name)) - return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); + @Override + public EconomyResponse bankDeposit(String name, double amount) { + if (!economy.bankExists(name)) + return new EconomyResponse(amount, 0, ResponseType.FAILURE, "That bank does not exist!"); + else { + economy.addBankMoney(name, (int) amount, true); + return new EconomyResponse((int) amount, economy.getBankMoney(name), ResponseType.SUCCESS, ""); + } + } - double bankMoney = economy.getBankMoney(name); - return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, null); - } + @Override + public EconomyResponse isBankOwner(String name, String playerName) { + if (!economy.bankExists(name)) + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); + else if (economy.isBankOwner(name, playerName)) { + return new EconomyResponse(0, economy.getBankMoney(name), ResponseType.SUCCESS, ""); + } else + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank owner!"); + } + + @Override + public EconomyResponse isBankMember(String name, String playerName) { + if (!economy.bankExists(name)) + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); + else if (economy.isBankMember(name, playerName)) { + return new EconomyResponse(0, economy.getBankMoney(name), ResponseType.SUCCESS, ""); + } else + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank member!"); + } + + @Override + public EconomyResponse bankBalance(String name) { + if (!economy.bankExists(name)) + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); + + double bankMoney = economy.getBankMoney(name); + return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, null); + } @Override public List getBanks() { diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java index 097c607..7b413e5 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java @@ -194,88 +194,98 @@ public class Economy_BOSE7 implements Economy { return String.format("%.2f %s", amount, getMoneyNamePlural()); } } - - @Override - public EconomyResponse createBank(String name, String player) { - boolean success = economy.addBankOwner(name, player, false); - if (success) - return new EconomyResponse(0, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); - return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to create that bank account."); - } + @Override + public EconomyResponse createBank(String name, String player) { + boolean success = economy.addBankOwner(name, player, false); + if (success) { + return new EconomyResponse(0, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); + } + + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to create that bank account."); + } - @Override - public EconomyResponse bankHas(String name, double amount) { - if (!economy.bankExists(name)) - return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); + @Override + public EconomyResponse deleteBank(String name) { + boolean success = economy.removeBank(name); + if (success) { + return new EconomyResponse(0, 0, ResponseType.SUCCESS, ""); + } + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to remove that bank account."); + } - double bankMoney = economy.getBankMoneyDouble(name); - if (bankMoney < amount) - return new EconomyResponse(0, bankMoney, ResponseType.FAILURE, "The bank does not have enough money!"); - else - return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, ""); + @Override + public EconomyResponse bankHas(String name, double amount) { + if (!economy.bankExists(name)) + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); - } + double bankMoney = economy.getBankMoneyDouble(name); + if (bankMoney < amount) + return new EconomyResponse(0, bankMoney, ResponseType.FAILURE, "The bank does not have enough money!"); + else + return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, ""); - @Override - public EconomyResponse bankWithdraw(String name, double amount) { - EconomyResponse er = bankHas(name, amount); - if (!er.transactionSuccess()) - return er; - else { - economy.addBankMoney(name, -amount, true); - return new EconomyResponse(amount, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); - } - } + } - @Override - public EconomyResponse bankDeposit(String name, double amount) { - if (!economy.bankExists(name)) - return new EconomyResponse(amount, 0, ResponseType.FAILURE, "That bank does not exist!"); - else { - economy.addBankMoney(name, amount, true); - return new EconomyResponse(amount, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); - } - } + @Override + public EconomyResponse bankWithdraw(String name, double amount) { + EconomyResponse er = bankHas(name, amount); + if (!er.transactionSuccess()) + return er; + else { + economy.addBankMoney(name, -amount, true); + return new EconomyResponse(amount, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); + } + } - @Override - public EconomyResponse isBankOwner(String name, String playerName) { - if (!economy.bankExists(name)) - return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); - else if (economy.isBankOwner(name, playerName)) { - return new EconomyResponse(0, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); - } else - return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank owner!"); - } + @Override + public EconomyResponse bankDeposit(String name, double amount) { + if (!economy.bankExists(name)) + return new EconomyResponse(amount, 0, ResponseType.FAILURE, "That bank does not exist!"); + else { + economy.addBankMoney(name, amount, true); + return new EconomyResponse(amount, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); + } + } - @Override - public EconomyResponse isBankMember(String name, String playerName) { - if (!economy.bankExists(name)) - return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); - else if (economy.isBankMember(name, playerName)) { - return new EconomyResponse(0, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); - } else - return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank member!"); - } - - @Override - public EconomyResponse bankBalance(String name) { - if (!economy.bankExists(name)) - return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); + @Override + public EconomyResponse isBankOwner(String name, String playerName) { + if (!economy.bankExists(name)) + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); + else if (economy.isBankOwner(name, playerName)) { + return new EconomyResponse(0, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); + } else + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank owner!"); + } - double bankMoney = economy.getBankMoneyDouble(name); - return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, null); - } - - @Override - public List getBanks() { - return economy.getBankList(); - } - - @Override - public boolean has(String playerName, double amount) { - return getBalance(playerName) >= amount; - } + @Override + public EconomyResponse isBankMember(String name, String playerName) { + if (!economy.bankExists(name)) + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); + else if (economy.isBankMember(name, playerName)) { + return new EconomyResponse(0, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); + } else + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank member!"); + } + + @Override + public EconomyResponse bankBalance(String name) { + if (!economy.bankExists(name)) + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); + + double bankMoney = economy.getBankMoneyDouble(name); + return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, null); + } + + @Override + public List getBanks() { + return economy.getBankList(); + } + + @Override + public boolean has(String playerName, double amount) { + return getBalance(playerName) >= amount; + } @Override public boolean hasBankSupport() { @@ -286,7 +296,7 @@ public class Economy_BOSE7 implements Economy { public boolean hasAccount(String playerName) { return economy.playerRegistered(playerName, false); } - + @Override public boolean createPlayerAccount(String playerName) { if (economy.playerRegistered(playerName, false)) { diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_Craftconomy.java b/src/net/milkbowl/vault/economy/plugins/Economy_Craftconomy.java index 57f7673..3a69868 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_Craftconomy.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_Craftconomy.java @@ -132,12 +132,21 @@ public class Economy_Craftconomy implements Economy { } + @Override + public EconomyResponse deleteBank(String name) { + if (AccountHandler.exists(name)) { + AccountHandler.delete(AccountHandler.getAccount(name)); + return new EconomyResponse(0, 0, ResponseType.SUCCESS, ""); + } + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Thank bank account does not exist!"); + } + @Override public EconomyResponse bankHas(String name, double amount) { if (!AccountHandler.exists(name)) { return new EconomyResponse(0, 0, ResponseType.FAILURE, "Account does not exists!"); } - + double balance = AccountHandler.getAccount(name).getBank().getBalance(); if ( balance >= amount) { return new EconomyResponse(0, balance, ResponseType.SUCCESS, ""); diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_CurrencyCore.java b/src/net/milkbowl/vault/economy/plugins/Economy_CurrencyCore.java index 4b1a1fd..953175f 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_CurrencyCore.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_CurrencyCore.java @@ -29,7 +29,7 @@ public class Economy_CurrencyCore implements Economy { public Economy_CurrencyCore(Plugin plugin) { this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); - + // Load Plugin in case it was loaded before if(currency == null) { Plugin currencyPlugin = plugin.getServer().getPluginManager().getPlugin("CurrencyCore"); @@ -135,6 +135,15 @@ public class Economy_CurrencyCore implements Economy { return new EconomyResponse(0, 0, ResponseType.SUCCESS, ""); } + @Override + public EconomyResponse deleteBank(String name) { + if (this.currency.getAccountManager().hasAccount(name)) { + this.currency.getAccountManager().removeAccount(name); + return new EconomyResponse(0, 0, ResponseType.SUCCESS, ""); + } + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That account does not exist!"); + } + @Override public EconomyResponse bankBalance(String name) { AccountContext account = this.currency.getAccountManager().getAccount(name); @@ -195,7 +204,7 @@ public class Economy_CurrencyCore implements Economy { public List getBanks() { return Arrays.asList(this.currency.getAccountManager().getAccounts()); } - + @Override public boolean hasBankSupport() { return true; diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java b/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java index 269599e..f0a6010 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java @@ -20,178 +20,183 @@ import org.bukkit.plugin.Plugin; import ca.agnate.EconXP.EconXP; public class Economy_EconXP implements Economy { - private static final Logger log = Logger.getLogger("Minecraft"); + private static final Logger log = Logger.getLogger("Minecraft"); - private String name = "EconXP"; - private Plugin plugin = null; - private EconXP econ = null; + private String name = "EconXP"; + private Plugin plugin = null; + private EconXP econ = null; - public Economy_EconXP(Plugin plugin) { - this.plugin = plugin; - Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); + public Economy_EconXP(Plugin plugin) { + this.plugin = plugin; + Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); - // Load Plugin in case it was loaded before - if (econ == null) { - Plugin econ = plugin.getServer().getPluginManager().getPlugin("EconXP"); - if (econ != null && econ.isEnabled()) { - this.econ = (EconXP) econ; - log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name)); - } - } - } + // Load Plugin in case it was loaded before + if (econ == null) { + Plugin econ = plugin.getServer().getPluginManager().getPlugin("EconXP"); + if (econ != null && econ.isEnabled()) { + this.econ = (EconXP) econ; + log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name)); + } + } + } - public class EconomyServerListener implements Listener { - Economy_EconXP economy = null; + public class EconomyServerListener implements Listener { + Economy_EconXP economy = null; - public EconomyServerListener(Economy_EconXP economy) { - this.economy = economy; - } + public EconomyServerListener(Economy_EconXP economy) { + this.economy = economy; + } - @EventHandler(priority = EventPriority.MONITOR) - public void onPluginEnable(PluginEnableEvent event) { - if (economy.econ == null) { - Plugin eco = plugin.getServer().getPluginManager().getPlugin("EconXP"); + @EventHandler(priority = EventPriority.MONITOR) + public void onPluginEnable(PluginEnableEvent event) { + if (economy.econ == null) { + Plugin eco = plugin.getServer().getPluginManager().getPlugin("EconXP"); - if (eco != null && eco.isEnabled()) { - economy.econ = (EconXP) eco; - log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); - } - } - } + if (eco != null && eco.isEnabled()) { + economy.econ = (EconXP) eco; + log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); + } + } + } - @EventHandler(priority = EventPriority.MONITOR) - public void onPluginDisable(PluginDisableEvent event) { - if (economy.econ != null) { - if (event.getPlugin().getDescription().getName().equals("EconXP")) { - economy.econ = null; - log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name)); - } - } - } - } + @EventHandler(priority = EventPriority.MONITOR) + public void onPluginDisable(PluginDisableEvent event) { + if (economy.econ != null) { + if (event.getPlugin().getDescription().getName().equals("EconXP")) { + economy.econ = null; + log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name)); + } + } + } + } - @Override - public boolean isEnabled() { - return this.econ != null; - } + @Override + public boolean isEnabled() { + return this.econ != null; + } - @Override - public String getName() { - return name; - } + @Override + public String getName() { + return name; + } - @Override - public String format(double amount) { - amount = Math.ceil(amount); - - return String.format("%d %s", (int)amount, "experience"); - } + @Override + public String format(double amount) { + amount = Math.ceil(amount); - @Override - public double getBalance(String playerName) { - OfflinePlayer player = econ.getPlayer(playerName); - - if ( player == null ) { return 0; } - - return econ.getExp(player); - } + return String.format("%d %s", (int)amount, "experience"); + } + + @Override + public double getBalance(String playerName) { + OfflinePlayer player = econ.getPlayer(playerName); + + if ( player == null ) { return 0; } + + return econ.getExp(player); + } + + @Override + public boolean has(String playerName, double amount) { + OfflinePlayer player = econ.getPlayer(playerName); - @Override - public boolean has(String playerName, double amount) { - OfflinePlayer player = econ.getPlayer(playerName); - if ( player == null ) { return false; } - - return econ.hasExp(player, (int) Math.ceil(amount) ); - } - @Override - public EconomyResponse withdrawPlayer(String playerName, double amount) { - OfflinePlayer player = econ.getPlayer(playerName); - + return econ.hasExp(player, (int) Math.ceil(amount) ); + } + + @Override + public EconomyResponse withdrawPlayer(String playerName, double amount) { + OfflinePlayer player = econ.getPlayer(playerName); + if ( player == null ) { return new EconomyResponse(0, 0, ResponseType.FAILURE, "Player does not exist"); } - - double balance = econ.getExp(player); - amount = Math.ceil(amount); - - if (amount < 0) { - return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot withdraw negative funds"); - } - - if ( econ.hasExp(player, (int) amount) == false ) { - return new EconomyResponse(0, balance, ResponseType.FAILURE, "Insufficient funds"); - } - - econ.removeExp(player, (int) amount); - - double finalBalance = econ.getExp(player); - - return new EconomyResponse(amount, finalBalance, ResponseType.SUCCESS, null); - } - @Override - public EconomyResponse depositPlayer(String playerName, double amount) { - OfflinePlayer player = econ.getPlayer(playerName); - - if ( player == null ) { - return new EconomyResponse(0, 0, ResponseType.FAILURE, "Player does not exist"); - } - double balance = econ.getExp(player); amount = Math.ceil(amount); - + if (amount < 0) { return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot withdraw negative funds"); } - + + if ( econ.hasExp(player, (int) amount) == false ) { + return new EconomyResponse(0, balance, ResponseType.FAILURE, "Insufficient funds"); + } + + econ.removeExp(player, (int) amount); + + double finalBalance = econ.getExp(player); + + return new EconomyResponse(amount, finalBalance, ResponseType.SUCCESS, null); + } + + @Override + public EconomyResponse depositPlayer(String playerName, double amount) { + OfflinePlayer player = econ.getPlayer(playerName); + + if ( player == null ) { + return new EconomyResponse(0, 0, ResponseType.FAILURE, "Player does not exist"); + } + + double balance = econ.getExp(player); + amount = Math.ceil(amount); + + if (amount < 0) { + return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot withdraw negative funds"); + } + econ.addExp(player, (int) amount ); - balance = econ.getExp(player); - - return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null); - } + balance = econ.getExp(player); - @Override - public EconomyResponse createBank(String name, String player) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); - } + return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null); + } - @Override - public EconomyResponse bankHas(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); - } + @Override + public EconomyResponse createBank(String name, String player) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); + } - @Override - public EconomyResponse bankWithdraw(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); - } + @Override + public EconomyResponse deleteBank(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); + } - @Override - public EconomyResponse bankDeposit(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); - } - - @Override - public EconomyResponse isBankOwner(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); - } + @Override + public EconomyResponse bankHas(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); + } - @Override - public EconomyResponse isBankMember(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); - } + @Override + public EconomyResponse bankWithdraw(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); + } + + @Override + public EconomyResponse bankDeposit(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); + } + + @Override + public EconomyResponse isBankOwner(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); + } + + @Override + public EconomyResponse isBankMember(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); + } + + @Override + public EconomyResponse bankBalance(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); + } - @Override - public EconomyResponse bankBalance(String name) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "EconXP does not support bank accounts!"); - } - @Override public List getBanks() { return new ArrayList(); } - + @Override public boolean hasBankSupport() { return false; diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java b/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java index db48603..5a671ad 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java @@ -203,51 +203,56 @@ public class Economy_Essentials implements Economy { return com.earth2me.essentials.api.Economy.format(amount); } - @Override - public boolean has(String playerName, double amount) { - return getBalance(playerName) >= amount; - } + @Override + public boolean has(String playerName, double amount) { + return getBalance(playerName) >= amount; + } - @Override - public EconomyResponse createBank(String name, String player) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); - } + @Override + public EconomyResponse createBank(String name, String player) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); + } - @Override - public EconomyResponse bankHas(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); - } + @Override + public EconomyResponse deleteBank(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); + } - @Override - public EconomyResponse bankWithdraw(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); - } + @Override + public EconomyResponse bankHas(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); + } - @Override - public EconomyResponse bankDeposit(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); - } + @Override + public EconomyResponse bankWithdraw(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); + } - @Override - public EconomyResponse isBankOwner(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); - } + @Override + public EconomyResponse bankDeposit(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); + } - @Override - public EconomyResponse isBankMember(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); - } + @Override + public EconomyResponse isBankOwner(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); + } + + @Override + public EconomyResponse isBankMember(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); + } + + @Override + public EconomyResponse bankBalance(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); + } - @Override - public EconomyResponse bankBalance(String name) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "Essentials Eco does not support bank accounts!"); - } - @Override public List getBanks() { return new ArrayList(); } - + @Override public boolean hasBankSupport() { return false; diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java b/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java index 50b89ff..0dbcf92 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java @@ -19,147 +19,152 @@ import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.plugin.Plugin; public class Economy_MineConomy implements Economy { - private static final Logger log = Logger.getLogger("Minecraft"); + private static final Logger log = Logger.getLogger("Minecraft"); - private String name = "MineConomy"; - private Plugin plugin = null; - private MineConomy econ = null; + private String name = "MineConomy"; + private Plugin plugin = null; + private MineConomy econ = null; - public Economy_MineConomy(Plugin plugin) { - this.plugin = plugin; - Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); + public Economy_MineConomy(Plugin plugin) { + this.plugin = plugin; + Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); - // Load Plugin in case it was loaded before - if (econ == null) { - Plugin econ = plugin.getServer().getPluginManager().getPlugin("MineConomy"); - if (econ != null && econ.isEnabled()) { - this.econ = (MineConomy) econ; - log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name)); - } - } - } + // Load Plugin in case it was loaded before + if (econ == null) { + Plugin econ = plugin.getServer().getPluginManager().getPlugin("MineConomy"); + if (econ != null && econ.isEnabled()) { + this.econ = (MineConomy) econ; + log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name)); + } + } + } - public class EconomyServerListener implements Listener { - Economy_MineConomy economy = null; + public class EconomyServerListener implements Listener { + Economy_MineConomy economy = null; - public EconomyServerListener(Economy_MineConomy economy) { - this.economy = economy; - } + public EconomyServerListener(Economy_MineConomy economy) { + this.economy = economy; + } - @EventHandler(priority = EventPriority.MONITOR) - public void onPluginEnable(PluginEnableEvent event) { - if (economy.econ == null) { - Plugin eco = plugin.getServer().getPluginManager().getPlugin("MineConomy"); + @EventHandler(priority = EventPriority.MONITOR) + public void onPluginEnable(PluginEnableEvent event) { + if (economy.econ == null) { + Plugin eco = plugin.getServer().getPluginManager().getPlugin("MineConomy"); - if (eco != null && eco.isEnabled()) { - economy.econ = (MineConomy) eco; - log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); - } - } - } + if (eco != null && eco.isEnabled()) { + economy.econ = (MineConomy) eco; + log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); + } + } + } - @EventHandler(priority = EventPriority.MONITOR) - public void onPluginDisable(PluginDisableEvent event) { - if (economy.econ != null) { - if (event.getPlugin().getDescription().getName().equals("MineConomy")) { - economy.econ = null; - log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name)); - } - } - } - } + @EventHandler(priority = EventPriority.MONITOR) + public void onPluginDisable(PluginDisableEvent event) { + if (economy.econ != null) { + if (event.getPlugin().getDescription().getName().equals("MineConomy")) { + economy.econ = null; + log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name)); + } + } + } + } - @Override - public boolean isEnabled() { - return this.econ != null; - } + @Override + public boolean isEnabled() { + return this.econ != null; + } - @Override - public String getName() { - return name; - } + @Override + public String getName() { + return name; + } - @Override - public String format(double amount) { - return String.valueOf(amount); - } + @Override + public String format(double amount) { + return String.valueOf(amount); + } - @Override - public double getBalance(String playerName) { - return Accounting.getBalance(playerName, MineConomy.accounts); - } + @Override + public double getBalance(String playerName) { + return Accounting.getBalance(playerName, MineConomy.accounts); + } - @Override - public boolean has(String playerName, double amount) { - return getBalance(playerName) >= amount; - } + @Override + public boolean has(String playerName, double amount) { + return getBalance(playerName) >= amount; + } - @Override - public EconomyResponse withdrawPlayer(String playerName, double amount) { - double balance = getBalance(playerName); - if (amount < 0) { - return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot withdraw negative funds"); - } else if (balance >= amount) { - double finalBalance = balance - amount; - Accounting.setBalance(playerName, finalBalance, MineConomy.accounts); - return new EconomyResponse(amount, finalBalance, ResponseType.SUCCESS, null); - } else { - return new EconomyResponse(0, balance, ResponseType.FAILURE, "Insufficient funds"); - } - } + @Override + public EconomyResponse withdrawPlayer(String playerName, double amount) { + double balance = getBalance(playerName); + if (amount < 0) { + return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot withdraw negative funds"); + } else if (balance >= amount) { + double finalBalance = balance - amount; + Accounting.setBalance(playerName, finalBalance, MineConomy.accounts); + return new EconomyResponse(amount, finalBalance, ResponseType.SUCCESS, null); + } else { + return new EconomyResponse(0, balance, ResponseType.FAILURE, "Insufficient funds"); + } + } - @Override - public EconomyResponse depositPlayer(String playerName, double amount) { - double balance = getBalance(playerName); - if (amount < 0) { - return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot deposit negative funds"); - } else { - balance += amount; - Accounting.setBalance(playerName, balance, MineConomy.accounts); - return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null); - } - } + @Override + public EconomyResponse depositPlayer(String playerName, double amount) { + double balance = getBalance(playerName); + if (amount < 0) { + return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot deposit negative funds"); + } else { + balance += amount; + Accounting.setBalance(playerName, balance, MineConomy.accounts); + return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null); + } + } - @Override - public EconomyResponse createBank(String name, String player) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); - } + @Override + public EconomyResponse createBank(String name, String player) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); + } - @Override - public EconomyResponse bankHas(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); - } + @Override + public EconomyResponse deleteBank(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); + } - @Override - public EconomyResponse bankWithdraw(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); - } + @Override + public EconomyResponse bankHas(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); + } - @Override - public EconomyResponse bankDeposit(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); - } - - @Override - public EconomyResponse isBankOwner(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); - } + @Override + public EconomyResponse bankWithdraw(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); + } - @Override - public EconomyResponse isBankMember(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); - } + @Override + public EconomyResponse bankDeposit(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); + } + + @Override + public EconomyResponse isBankOwner(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); + } + + @Override + public EconomyResponse isBankMember(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); + } + + @Override + public EconomyResponse bankBalance(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); + } - @Override - public EconomyResponse bankBalance(String name) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MineConomy does not support bank accounts!"); - } - @Override public List getBanks() { return new ArrayList(); } - + @Override public boolean hasBankSupport() { return false; diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java b/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java index fef271a..6fedb10 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java @@ -186,51 +186,56 @@ public class Economy_MultiCurrency implements Economy { return String.format("%.2f %s", amount, "Currency"); } - @Override - public boolean has(String playerName, double amount) { - return getBalance(playerName) >= amount; - } + @Override + public boolean has(String playerName, double amount) { + return getBalance(playerName) >= amount; + } - @Override - public EconomyResponse createBank(String name, String player) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); - } + @Override + public EconomyResponse createBank(String name, String player) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); + } - @Override - public EconomyResponse bankHas(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); - } + @Override + public EconomyResponse deleteBank(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts!"); + } - @Override - public EconomyResponse bankWithdraw(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); - } + @Override + public EconomyResponse bankHas(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); + } - @Override - public EconomyResponse bankDeposit(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); - } + @Override + public EconomyResponse bankWithdraw(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); + } - @Override - public EconomyResponse isBankOwner(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); - } + @Override + public EconomyResponse bankDeposit(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); + } - @Override - public EconomyResponse isBankMember(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); - } + @Override + public EconomyResponse isBankOwner(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); + } + + @Override + public EconomyResponse isBankMember(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); + } + + @Override + public EconomyResponse bankBalance(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); + } - @Override - public EconomyResponse bankBalance(String name) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "MultiCurrency does not support bank accounts"); - } - @Override public List getBanks() { return new ArrayList(); } - + @Override public boolean hasBankSupport() { return false; diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java b/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java index 9c46793..661e9e7 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java @@ -18,155 +18,160 @@ import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.plugin.Plugin; public class Economy_eWallet implements Economy { - private static final Logger log = Logger.getLogger("Minecraft"); + private static final Logger log = Logger.getLogger("Minecraft"); - private String name = "eWallet"; - private Plugin plugin = null; - private ECO econ = null; + private String name = "eWallet"; + private Plugin plugin = null; + private ECO econ = null; - public Economy_eWallet(Plugin plugin) { - this.plugin = plugin; - Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); + public Economy_eWallet(Plugin plugin) { + this.plugin = plugin; + Bukkit.getServer().getPluginManager().registerEvents(new EconomyServerListener(this), plugin); - // Load Plugin in case it was loaded before - if (econ == null) { - Plugin econ = plugin.getServer().getPluginManager().getPlugin("eWallet"); - if (econ != null && econ.isEnabled()) { - this.econ = (ECO) econ; - log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name)); - } - } - } + // Load Plugin in case it was loaded before + if (econ == null) { + Plugin econ = plugin.getServer().getPluginManager().getPlugin("eWallet"); + if (econ != null && econ.isEnabled()) { + this.econ = (ECO) econ; + log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name)); + } + } + } - public class EconomyServerListener implements Listener { - Economy_eWallet economy = null; + public class EconomyServerListener implements Listener { + Economy_eWallet economy = null; - public EconomyServerListener(Economy_eWallet economy) { - this.economy = economy; - } + public EconomyServerListener(Economy_eWallet economy) { + this.economy = economy; + } - @EventHandler(priority = EventPriority.MONITOR) - public void onPluginEnable(PluginEnableEvent event) { - if (economy.econ == null) { - Plugin eco = plugin.getServer().getPluginManager().getPlugin("eWallet"); + @EventHandler(priority = EventPriority.MONITOR) + public void onPluginEnable(PluginEnableEvent event) { + if (economy.econ == null) { + Plugin eco = plugin.getServer().getPluginManager().getPlugin("eWallet"); - if (eco != null && eco.isEnabled()) { - economy.econ = (ECO) eco; - log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); - } - } - } + if (eco != null && eco.isEnabled()) { + economy.econ = (ECO) eco; + log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name)); + } + } + } - @EventHandler(priority = EventPriority.MONITOR) - public void onPluginDisable(PluginDisableEvent event) { - if (economy.econ != null) { - if (event.getPlugin().getDescription().getName().equals("eWallet")) { - economy.econ = null; - log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name)); - } - } - } - } + @EventHandler(priority = EventPriority.MONITOR) + public void onPluginDisable(PluginDisableEvent event) { + if (economy.econ != null) { + if (event.getPlugin().getDescription().getName().equals("eWallet")) { + economy.econ = null; + log.info(String.format("[%s][Economy] %s unhooked.", plugin.getDescription().getName(), economy.name)); + } + } + } + } - @Override - public boolean isEnabled() { - return this.econ != null; - } + @Override + public boolean isEnabled() { + return this.econ != null; + } - @Override - public String getName() { - return name; - } + @Override + public String getName() { + return name; + } - @Override - public String format(double amount) { - amount = Math.ceil(amount); + @Override + public String format(double amount) { + amount = Math.ceil(amount); if (amount == 1) { return String.format("%d %s", (int)amount, econ.singularCurrency); } else { return String.format("%d %s", (int)amount, econ.pluralCurrency); } - } + } - @Override - public double getBalance(String playerName) { - Integer i = econ.getMoney(playerName); - return i == null ? 0 : i; - } + @Override + public double getBalance(String playerName) { + Integer i = econ.getMoney(playerName); + return i == null ? 0 : i; + } - @Override - public boolean has(String playerName, double amount) { - return getBalance(playerName) >= Math.ceil(amount); - } + @Override + public boolean has(String playerName, double amount) { + return getBalance(playerName) >= Math.ceil(amount); + } - @Override - public EconomyResponse withdrawPlayer(String playerName, double amount) { - double balance = getBalance(playerName); - amount = Math.ceil(amount); - if (amount < 0) { - return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot withdraw negative funds"); - } else if (balance >= amount) { - double finalBalance = balance - amount; - econ.takeMoney(playerName, (int) amount); - return new EconomyResponse(amount, finalBalance, ResponseType.SUCCESS, null); - } else { - return new EconomyResponse(0, balance, ResponseType.FAILURE, "Insufficient funds"); - } - } + @Override + public EconomyResponse withdrawPlayer(String playerName, double amount) { + double balance = getBalance(playerName); + amount = Math.ceil(amount); + if (amount < 0) { + return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot withdraw negative funds"); + } else if (balance >= amount) { + double finalBalance = balance - amount; + econ.takeMoney(playerName, (int) amount); + return new EconomyResponse(amount, finalBalance, ResponseType.SUCCESS, null); + } else { + return new EconomyResponse(0, balance, ResponseType.FAILURE, "Insufficient funds"); + } + } - @Override - public EconomyResponse depositPlayer(String playerName, double amount) { - double balance = getBalance(playerName); - amount = Math.ceil(amount); - if (amount < 0) { - return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot deposit negative funds"); - } else { - balance += amount; - econ.giveMoney(playerName, (int) amount); - return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null); - } - } + @Override + public EconomyResponse depositPlayer(String playerName, double amount) { + double balance = getBalance(playerName); + amount = Math.ceil(amount); + if (amount < 0) { + return new EconomyResponse(0, balance, ResponseType.FAILURE, "Cannot deposit negative funds"); + } else { + balance += amount; + econ.giveMoney(playerName, (int) amount); + return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null); + } + } - @Override - public EconomyResponse createBank(String name, String player) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } + @Override + public EconomyResponse createBank(String name, String player) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "eWallet does not support bank accounts!"); + } - @Override - public EconomyResponse bankHas(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } + @Override + public EconomyResponse deleteBank(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "eWallet does not support bank accounts!"); + } - @Override - public EconomyResponse bankWithdraw(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } + @Override + public EconomyResponse bankHas(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "eWallet does not support bank accounts!"); + } - @Override - public EconomyResponse bankDeposit(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } - - @Override - public EconomyResponse isBankOwner(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } + @Override + public EconomyResponse bankWithdraw(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "eWallet does not support bank accounts!"); + } - @Override - public EconomyResponse isBankMember(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } + @Override + public EconomyResponse bankDeposit(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "eWallet does not support bank accounts!"); + } + + @Override + public EconomyResponse isBankOwner(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "eWallet does not support bank accounts!"); + } + + @Override + public EconomyResponse isBankMember(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "eWallet does not support bank accounts!"); + } + + @Override + public EconomyResponse bankBalance(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "eWallet does not support bank accounts!"); + } - @Override - public EconomyResponse bankBalance(String name) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "3co does not support bank accounts!"); - } - @Override public List getBanks() { return new ArrayList(); } - + @Override public boolean hasBankSupport() { return false; diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java index bc12f3a..119fa6a 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java @@ -193,51 +193,56 @@ public class Economy_iConomy4 implements Economy { } } - @Override - public boolean has(String playerName, double amount) { - return getBalance(playerName) >= amount; - } + @Override + public boolean has(String playerName, double amount) { + return getBalance(playerName) >= amount; + } - @Override - public EconomyResponse createBank(String name, String player) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); - } + @Override + public EconomyResponse createBank(String name, String player) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); + } - @Override - public EconomyResponse bankHas(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); - } + @Override + public EconomyResponse deleteBank(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); + } - @Override - public EconomyResponse bankWithdraw(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); - } + @Override + public EconomyResponse bankHas(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); + } - @Override - public EconomyResponse bankDeposit(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); - } + @Override + public EconomyResponse bankWithdraw(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); + } - @Override - public EconomyResponse isBankOwner(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); - } + @Override + public EconomyResponse bankDeposit(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); + } - @Override - public EconomyResponse isBankMember(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); - } + @Override + public EconomyResponse isBankOwner(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); + } + + @Override + public EconomyResponse isBankMember(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); + } + + @Override + public EconomyResponse bankBalance(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); + } - @Override - public EconomyResponse bankBalance(String name) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy4 does not support bank accounts!"); - } - @Override public List getBanks() { return new ArrayList(); } - + @Override public boolean hasBankSupport() { return false; diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java index a6ba268..35f6190 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java @@ -156,51 +156,56 @@ public class Economy_iConomy5 implements Economy { return iConomy.format(amount); } - @Override - public boolean has(String playerName, double amount) { - return getBalance(playerName) >= amount; - } + @Override + public boolean has(String playerName, double amount) { + return getBalance(playerName) >= amount; + } - @Override - public EconomyResponse createBank(String name, String player) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single account banks!"); - } + @Override + public EconomyResponse createBank(String name, String player) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single account banks!"); + } - @Override - public EconomyResponse bankHas(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single bank accounts!"); - } + @Override + public EconomyResponse deleteBank(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support bank accounts!"); + } - @Override - public EconomyResponse bankWithdraw(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single bank accounts!"); - } + @Override + public EconomyResponse bankHas(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single bank accounts!"); + } - @Override - public EconomyResponse bankDeposit(String name, double amount) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single bank accounts!"); - } + @Override + public EconomyResponse bankWithdraw(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single bank accounts!"); + } - @Override - public EconomyResponse isBankOwner(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single bank accounts!"); - } + @Override + public EconomyResponse bankDeposit(String name, double amount) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single bank accounts!"); + } - @Override - public EconomyResponse isBankMember(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single bank accounts!"); - } + @Override + public EconomyResponse isBankOwner(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single bank accounts!"); + } + + @Override + public EconomyResponse isBankMember(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single bank accounts!"); + } + + @Override + public EconomyResponse bankBalance(String name) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single bank accounts!"); + } - @Override - public EconomyResponse bankBalance(String name) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy5 does not support single bank accounts!"); - } - @Override public List getBanks() { return new ArrayList(); } - + @Override public boolean hasBankSupport() { return false; diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java index 131d959..1709e84 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java @@ -135,65 +135,74 @@ public class Economy_iConomy6 implements Economy { return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null); } - @Override - public boolean has(String playerName, double amount) { - return getBalance(playerName) >= amount; - } + @Override + public boolean has(String playerName, double amount) { + return getBalance(playerName) >= amount; + } - @Override - public EconomyResponse createBank(String name, String player) { - if (accounts.exists(name)) - return new EconomyResponse(0, accounts.get(name).getHoldings().getBalance(), ResponseType.FAILURE, "That account already exists."); + @Override + public EconomyResponse createBank(String name, String player) { + if (accounts.exists(name)) + return new EconomyResponse(0, accounts.get(name).getHoldings().getBalance(), ResponseType.FAILURE, "That account already exists."); - boolean created = accounts.create(name); - if (created) - return new EconomyResponse(0, 0, ResponseType.SUCCESS, ""); - else - return new EconomyResponse(0, 0, ResponseType.FAILURE, "There was an error creating the account"); - - } + boolean created = accounts.create(name); + if (created) + return new EconomyResponse(0, 0, ResponseType.SUCCESS, ""); + else + return new EconomyResponse(0, 0, ResponseType.FAILURE, "There was an error creating the account"); - @Override - public EconomyResponse bankHas(String name, double amount) { - if (has(name, amount)) - return new EconomyResponse(0, amount, ResponseType.SUCCESS, ""); - else - return new EconomyResponse(0, accounts.get(name).getHoldings().getBalance(), ResponseType.FAILURE, "The account does not have enough!"); - } + } - @Override - public EconomyResponse bankWithdraw(String name, double amount) { - return withdrawPlayer(name, amount); - } + @Override + public EconomyResponse deleteBank(String name) { + if (accounts.exists(name)) { + accounts.remove(name); + return new EconomyResponse(0, 0, ResponseType.SUCCESS, ""); + } + return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank account does not exist."); + } - @Override - public EconomyResponse bankDeposit(String name, double amount) { - return depositPlayer(name, amount); - } + @Override + public EconomyResponse bankHas(String name, double amount) { + if (has(name, amount)) + return new EconomyResponse(0, amount, ResponseType.SUCCESS, ""); + else + return new EconomyResponse(0, accounts.get(name).getHoldings().getBalance(), ResponseType.FAILURE, "The account does not have enough!"); + } - @Override - public EconomyResponse isBankOwner(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy 6 does not support Bank owners."); - } + @Override + public EconomyResponse bankWithdraw(String name, double amount) { + return withdrawPlayer(name, amount); + } - @Override - public EconomyResponse isBankMember(String name, String playerName) { - return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy 6 does not support Bank members."); - } + @Override + public EconomyResponse bankDeposit(String name, double amount) { + return depositPlayer(name, amount); + } + + @Override + public EconomyResponse isBankOwner(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy 6 does not support Bank owners."); + } + + @Override + public EconomyResponse isBankMember(String name, String playerName) { + return new EconomyResponse(0, 0, ResponseType.NOT_IMPLEMENTED, "iConomy 6 does not support Bank members."); + } + + @Override + public EconomyResponse bankBalance(String name) { + if (!accounts.exists(name)) + return new EconomyResponse(0, 0, ResponseType.FAILURE, "There is no bank account with that name"); + else + return new EconomyResponse(0, accounts.get(name).getHoldings().getBalance(), ResponseType.SUCCESS, null); + } - @Override - public EconomyResponse bankBalance(String name) { - if (!accounts.exists(name)) - return new EconomyResponse(0, 0, ResponseType.FAILURE, "There is no bank account with that name"); - else - return new EconomyResponse(0, accounts.get(name).getHoldings().getBalance(), ResponseType.SUCCESS, null); - } - @Override public List getBanks() { throw new UnsupportedOperationException("iConomy does not support listing of bank accounts"); } - + @Override public boolean hasBankSupport() { return true;