From 404f7296e0b5d623d065a845433232b091338aa4 Mon Sep 17 00:00:00 2001 From: Andrzej Pomirski Date: Sat, 14 Jun 2014 20:40:31 +0200 Subject: [PATCH] Remove Register - NO DEFAULT ECONOMY SUPPORT --- pom.xml | 2 +- .../com/Acrobot/ChestShop/Dependencies.java | 6 - .../Economy/Plugins/RegisterListener.java | 109 -------- .../register/payment/forChestShop/Method.java | 177 ------------- .../payment/forChestShop/Methods.java | 72 ------ .../payment/forChestShop/methods/BOSE7.java | 222 ----------------- .../payment/forChestShop/methods/iCo5.java | 235 ------------------ .../payment/forChestShop/methods/iCo6.java | 149 ----------- src/main/resources/plugin.yml | 2 +- 9 files changed, 2 insertions(+), 972 deletions(-) delete mode 100644 src/main/java/com/Acrobot/ChestShop/Listeners/Economy/Plugins/RegisterListener.java delete mode 100644 src/main/java/com/nijikokun/register/payment/forChestShop/Method.java delete mode 100644 src/main/java/com/nijikokun/register/payment/forChestShop/Methods.java delete mode 100644 src/main/java/com/nijikokun/register/payment/forChestShop/methods/BOSE7.java delete mode 100644 src/main/java/com/nijikokun/register/payment/forChestShop/methods/iCo5.java delete mode 100644 src/main/java/com/nijikokun/register/payment/forChestShop/methods/iCo6.java diff --git a/pom.xml b/pom.xml index 8d658bf..bc48a70 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,7 @@ net.milkbowl.vault Vault - 1.2.27 + 1.4.1 com.iCo6 diff --git a/src/main/java/com/Acrobot/ChestShop/Dependencies.java b/src/main/java/com/Acrobot/ChestShop/Dependencies.java index 821daa8..e70fb2b 100644 --- a/src/main/java/com/Acrobot/ChestShop/Dependencies.java +++ b/src/main/java/com/Acrobot/ChestShop/Dependencies.java @@ -2,7 +2,6 @@ package com.Acrobot.ChestShop; import com.Acrobot.Breeze.Utils.MaterialUtil; import com.Acrobot.ChestShop.Configuration.Properties; -import com.Acrobot.ChestShop.Listeners.Economy.Plugins.RegisterListener; import com.Acrobot.ChestShop.Listeners.Economy.Plugins.VaultListener; import com.Acrobot.ChestShop.Plugins.*; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; @@ -34,11 +33,6 @@ public class Dependencies { String plugin = "Vault"; Listener economy = VaultListener.initializeVault(); - if (economy == null) { - plugin = "Register"; - economy = RegisterListener.initializeRegister(); - } - if (economy == null) { return; } diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/Economy/Plugins/RegisterListener.java b/src/main/java/com/Acrobot/ChestShop/Listeners/Economy/Plugins/RegisterListener.java deleted file mode 100644 index df5ad59..0000000 --- a/src/main/java/com/Acrobot/ChestShop/Listeners/Economy/Plugins/RegisterListener.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.Acrobot.ChestShop.Listeners.Economy.Plugins; - -import com.Acrobot.ChestShop.ChestShop; -import com.Acrobot.ChestShop.Events.Economy.*; -import com.nijikokun.register.payment.forChestShop.Method; -import com.nijikokun.register.payment.forChestShop.Methods; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -import javax.annotation.Nullable; -import java.math.BigDecimal; - -/** - * Represents a Register connector - * - * @author Acrobot - */ -public class RegisterListener implements Listener { - private Method paymentMethod; - - private RegisterListener(Method paymentMethod) { - this.paymentMethod = paymentMethod; - } - - public static @Nullable RegisterListener initializeRegister() { - Method method = Methods.load(); - - if (method == null) { - return null; - } - - return new RegisterListener(method); - } - - @EventHandler - public void onAmountCheck(CurrencyAmountEvent event) { - if (!event.getAmount().equals(BigDecimal.ZERO)) { - return; - } - - event.setAmount(paymentMethod.getAccount(event.getAccount()).balance()); - } - - @EventHandler - public void onCurrencyCheck(CurrencyCheckEvent event) { - if (event.hasEnough()) { - return; - } - - boolean check = paymentMethod.getAccount(event.getAccount()).hasEnough(event.getDoubleAmount()); - event.hasEnough(check); - } - - @EventHandler - public void onAccountCheck(AccountCheckEvent event) { - if (event.hasAccount()) { - return; - } - - boolean check = paymentMethod.hasAccount(event.getAccount()); - event.hasAccount(check); - } - - @EventHandler - public void onCurrencyFormat(CurrencyFormatEvent event) { - if (!event.getFormattedAmount().isEmpty()) { - return; - } - - String formatted = paymentMethod.format(event.getDoubleAmount()); - event.setFormattedAmount(formatted); - } - - @EventHandler - public void onCurrencyAdd(CurrencyAddEvent event) { - if (event.isAdded()) { - return; - } - - paymentMethod.getAccount(event.getTarget()).add(event.getDoubleAmount()); - event.setAdded(true); - } - - @EventHandler - public void onCurrencySubtract(CurrencySubtractEvent event) { - if (event.isSubtracted()) { - return; - } - - paymentMethod.getAccount(event.getTarget()).subtract(event.getDoubleAmount()); - } - - @EventHandler - public static void onCurrencyTransfer(CurrencyTransferEvent event) { - if (event.hasBeenTransferred()) { - return; - } - - CurrencySubtractEvent currencySubtractEvent = new CurrencySubtractEvent(event.getAmount(), event.getSender(), event.getWorld()); - ChestShop.callEvent(currencySubtractEvent); - - if (!currencySubtractEvent.isSubtracted()) { - return; - } - - CurrencyAddEvent currencyAddEvent = new CurrencyAddEvent(currencySubtractEvent.getAmount(), event.getReceiver(), event.getWorld()); - ChestShop.callEvent(currencyAddEvent); - } -} diff --git a/src/main/java/com/nijikokun/register/payment/forChestShop/Method.java b/src/main/java/com/nijikokun/register/payment/forChestShop/Method.java deleted file mode 100644 index daa377d..0000000 --- a/src/main/java/com/nijikokun/register/payment/forChestShop/Method.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.nijikokun.register.payment.forChestShop; - -import org.bukkit.plugin.Plugin; - -/** - * Interface to be implemented by a payment method. - * - * @author Nijikokun (@nijikokun) - * @copyright Copyright (C) 2011 - * @license AOL license - */ -public interface Method { - /** - * Encodes the Plugin into an Object disguised as the Plugin. - * If you want the original Plugin Class you must cast it to the correct - * Plugin, to do so you have to verify the name and or version then cast. - *

- *

-     *  if(method.getName().equalsIgnoreCase("iConomy"))
-     *   iConomy plugin = ((iConomy)method.getPlugin());
- * - * @return Object - * @see #getName() - * @see #getVersion() - */ - Object getPlugin(); - - /** - * Returns the actual name of this method. - * - * @return String Plugin name. - */ - String getName(); - - /** - * Returns the actual version of this method. - * - * @return String Plugin version. - */ - String getVersion(); - - /** - * Returns the amount of decimal places that get stored - * NOTE: it will return -1 if there is no rounding - * - * @return int for each decimal place - */ - int fractionalDigits(); - - /** - * Formats amounts into this payment methods style of currency display. - * - * @param amount Double - * @return String - Formatted Currency Display. - */ - String format(double amount); - - /** - * Allows the verification of bank API existence in this payment method. - * - * @return boolean - */ - boolean hasBanks(); - - /** - * Determines the existence of a bank via name. - * - * @param bank Bank name - * @return boolean - * @see #hasBanks - */ - boolean hasBank(String bank); - - /** - * Determines the existence of an account via name. - * - * @param name Account name - * @return boolean - */ - boolean hasAccount(String name); - - /** - * Check to see if an account name is tied to a bank. - * - * @param bank Bank name - * @param name Account name - * @return boolean - */ - boolean hasBankAccount(String bank, String name); - - /** - * Forces an account creation - * - * @param name Account name - * @return boolean - */ - boolean createAccount(String name); - - /** - * Forces an account creation - * - * @param name Account name - * @param balance Initial account balance - * @return boolean - */ - boolean createAccount(String name, double balance); - - /** - * Returns a MethodAccount class for an account name. - * - * @param name Account name - * @return MethodAccount or Null - */ - MethodAccount getAccount(String name); - - - /** - * Returns a MethodBankAccount class for an account name. - * - * @param bank Bank name - * @param name Account name - * @return MethodBankAccount or Null - */ - MethodBankAccount getBankAccount(String bank, String name); - - /** - * Checks to verify the compatibility between this Method and a plugin. - * Internal usage only, for the most part. - * - * @param plugin Plugin - * @return boolean - */ - boolean isCompatible(Plugin plugin); - - /** - * Set Plugin data. - * - * @param plugin Plugin - */ - void setPlugin(Plugin plugin); - - /** - * Contains Calculator and Balance functions for Accounts. - */ - interface MethodAccount { - double balance(); - - boolean set(double amount); - - boolean add(double amount); - - boolean subtract(double amount); - - boolean multiply(double amount); - - boolean divide(double amount); - - boolean hasEnough(double amount); - - boolean hasOver(double amount); - - boolean hasUnder(double amount); - - boolean isNegative(); - - boolean remove(); - } - - /** - * Contains Calculator and Balance functions for Bank Accounts. - */ - interface MethodBankAccount extends MethodAccount { - String getBankName(); - - int getBankId(); - } -} diff --git a/src/main/java/com/nijikokun/register/payment/forChestShop/Methods.java b/src/main/java/com/nijikokun/register/payment/forChestShop/Methods.java deleted file mode 100644 index 6ed76f1..0000000 --- a/src/main/java/com/nijikokun/register/payment/forChestShop/Methods.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.nijikokun.register.payment.forChestShop; - -import com.nijikokun.register.payment.forChestShop.methods.BOSE7; -import com.nijikokun.register.payment.forChestShop.methods.iCo5; -import com.nijikokun.register.payment.forChestShop.methods.iCo6; -import org.bukkit.Bukkit; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginManager; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Acrobot - */ -public class Methods { - private static final Map PLUGINS_TO_LOAD = new HashMap() {{ - put(new iCo5(), "iConomy"); - put(new iCo6(), "iConomy"); - put(new BOSE7(), "BOSEconomy"); - }}; - private static String preferredPlugin; - - public static void setPreferred(String plugin) { - preferredPlugin = plugin; - } - - public static Method load() { - PluginManager pluginManager = Bukkit.getPluginManager(); - - Method preferred = getPreferredMethod(); - if (preferred != null) { - return preferred; - } - - for (String pluginName : PLUGINS_TO_LOAD.values()) { - Plugin plugin = pluginManager.getPlugin(pluginName); - if (plugin != null) { - Method method = createMethod(plugin); - if (method != null) { - return method; - } - } - } - - return null; - } - - private static Method createMethod(Plugin plugin) { - for (Method method : PLUGINS_TO_LOAD.keySet()) { - if (method.isCompatible(plugin)) { - method.setPlugin(plugin); - return method; - } - } - return null; - } - - private static Method getPreferredMethod() { - if (preferredPlugin == null || preferredPlugin.isEmpty()) { - return null; - } - - Plugin plugin = Bukkit.getPluginManager().getPlugin(preferredPlugin); - - if (plugin == null) { - return null; - } - - return createMethod(plugin); - } -} diff --git a/src/main/java/com/nijikokun/register/payment/forChestShop/methods/BOSE7.java b/src/main/java/com/nijikokun/register/payment/forChestShop/methods/BOSE7.java deleted file mode 100644 index c59a3df..0000000 --- a/src/main/java/com/nijikokun/register/payment/forChestShop/methods/BOSE7.java +++ /dev/null @@ -1,222 +0,0 @@ -package com.nijikokun.register.payment.forChestShop.methods; - -import com.nijikokun.register.payment.forChestShop.Method; -import cosine.boseconomy.BOSEconomy; -import org.bukkit.plugin.Plugin; - -/** - * BOSEconomy 7 Implementation of Method - * - * @author Acrobot - * @author Nijikokun (@nijikokun) - * @copyright (c) 2011 - * @license AOL license - */ -public class BOSE7 implements Method { - private BOSEconomy BOSEconomy; - - public BOSEconomy getPlugin() { - return this.BOSEconomy; - } - - public String getName() { - return "BOSEconomy"; - } - - public String getVersion() { - return "0.7.0"; - } - - public int fractionalDigits() { - return this.BOSEconomy.getFractionalDigits(); - } - - public String format(double amount) { - String currency = this.BOSEconomy.getMoneyNamePlural(); - - if (amount == 1) - currency = this.BOSEconomy.getMoneyName(); - - return amount + " " + currency; - } - - public boolean hasBanks() { - return true; - } - - public boolean hasBank(String bank) { - return this.BOSEconomy.bankExists(bank); - } - - public boolean hasAccount(String name) { - return this.BOSEconomy.playerRegistered(name, false); - } - - public boolean hasBankAccount(String bank, String name) { - return this.BOSEconomy.isBankOwner(bank, name) || this.BOSEconomy.isBankMember(bank, name); - } - - public boolean createAccount(String name) { - if (hasAccount(name)) - return false; - - this.BOSEconomy.registerPlayer(name); - return true; - } - - public boolean createAccount(String name, double balance) { - if (hasAccount(name)) - return false; - - this.BOSEconomy.registerPlayer(name); - this.BOSEconomy.setPlayerMoney(name, balance, false); - return true; - } - - public MethodAccount getAccount(String name) { - if (!hasAccount(name)) - createAccount(name); - - return new BOSEAccount(name, this.BOSEconomy); - } - - public MethodBankAccount getBankAccount(String bank, String name) { - if (!hasBankAccount(bank, name)) - return null; - - return new BOSEBankAccount(bank, BOSEconomy); - } - - public boolean isCompatible(Plugin plugin) { - return plugin.getDescription().getName().equalsIgnoreCase("boseconomy") - && plugin instanceof BOSEconomy - && !plugin.getDescription().getVersion().equals("0.6.2"); - } - - public void setPlugin(Plugin plugin) { - BOSEconomy = (BOSEconomy) plugin; - } - - public static class BOSEAccount implements MethodAccount { - private String name; - private BOSEconomy BOSEconomy; - - public BOSEAccount(String name, BOSEconomy bOSEconomy) { - this.name = name; - this.BOSEconomy = bOSEconomy; - } - - public double balance() { - return this.BOSEconomy.getPlayerMoneyDouble(this.name); - } - - public boolean set(double amount) { - return this.BOSEconomy.setPlayerMoney(this.name, amount, false); - } - - public boolean add(double amount) { - return this.BOSEconomy.addPlayerMoney(this.name, amount, false); - } - - public boolean subtract(double amount) { - double balance = this.balance(); - return this.BOSEconomy.setPlayerMoney(this.name, (balance - amount), false); - } - - public boolean multiply(double amount) { - double balance = this.balance(); - return this.BOSEconomy.setPlayerMoney(this.name, (balance * amount), false); - } - - public boolean divide(double amount) { - double balance = this.balance(); - return this.BOSEconomy.setPlayerMoney(this.name, (balance / amount), false); - } - - public boolean hasEnough(double amount) { - return (this.balance() >= amount); - } - - public boolean hasOver(double amount) { - return (this.balance() > amount); - } - - public boolean hasUnder(double amount) { - return (this.balance() < amount); - } - - public boolean isNegative() { - return (this.balance() < 0); - } - - public boolean remove() { - return false; - } - } - - public static class BOSEBankAccount implements MethodBankAccount, MethodAccount { - private String bank; - private BOSEconomy BOSEconomy; - - public BOSEBankAccount(String bank, BOSEconomy bOSEconomy) { - this.bank = bank; - this.BOSEconomy = bOSEconomy; - } - - public String getBankName() { - return this.bank; - } - - public int getBankId() { - return -1; - } - - public double balance() { - return this.BOSEconomy.getBankMoneyDouble(bank); - } - - public boolean set(double amount) { - return this.BOSEconomy.setBankMoney(bank, amount, true); - } - - public boolean add(double amount) { - double balance = this.balance(); - return this.BOSEconomy.setBankMoney(bank, (balance + amount), false); - } - - public boolean subtract(double amount) { - double balance = this.balance(); - return this.BOSEconomy.setBankMoney(bank, (balance - amount), false); - } - - public boolean multiply(double amount) { - double balance = this.balance(); - return this.BOSEconomy.setBankMoney(bank, (balance * amount), false); - } - - public boolean divide(double amount) { - double balance = this.balance(); - return this.BOSEconomy.setBankMoney(bank, (balance / amount), false); - } - - public boolean hasEnough(double amount) { - return (this.balance() >= amount); - } - - public boolean hasOver(double amount) { - return (this.balance() > amount); - } - - public boolean hasUnder(double amount) { - return (this.balance() < amount); - } - - public boolean isNegative() { - return (this.balance() < 0); - } - - public boolean remove() { - return this.BOSEconomy.removeBank(bank); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/nijikokun/register/payment/forChestShop/methods/iCo5.java b/src/main/java/com/nijikokun/register/payment/forChestShop/methods/iCo5.java deleted file mode 100644 index 8dd7a69..0000000 --- a/src/main/java/com/nijikokun/register/payment/forChestShop/methods/iCo5.java +++ /dev/null @@ -1,235 +0,0 @@ -package com.nijikokun.register.payment.forChestShop.methods; - -import com.iConomy.iConomy; -import com.iConomy.system.Account; -import com.iConomy.system.BankAccount; -import com.iConomy.system.Holdings; -import com.iConomy.util.Constants; -import com.nijikokun.register.payment.forChestShop.Method; -import org.bukkit.plugin.Plugin; - -/** - * iConomy 5 Implementation of Method - * - * @author Nijikokun (@nijikokun) - * @copyright (c) 2011 - * @license AOL license - */ -public class iCo5 implements Method { - private iConomy iconomy; - - public iConomy getPlugin() { - return this.iconomy; - } - - public String getName() { - return "iConomy"; - } - - public String getVersion() { - return "5"; - } - - public int fractionalDigits() { - return 2; - } - - public String format(double amount) { - return com.iConomy.iConomy.format(amount); - } - - public boolean hasBanks() { - return Constants.Banking; - } - - public boolean hasBank(String bank) { - return (hasBanks()) && com.iConomy.iConomy.Banks.exists(bank); - } - - public boolean hasAccount(String name) { - return com.iConomy.iConomy.hasAccount(name); - } - - public boolean hasBankAccount(String bank, String name) { - return (hasBank(bank)) && com.iConomy.iConomy.getBank(bank).hasAccount(name); - } - - public boolean createAccount(String name) { - return !hasAccount(name) && iConomy.Accounts.create(name); - - } - - public boolean createAccount(String name, double balance) { - if (hasAccount(name)) - return false; - - if (!com.iConomy.iConomy.Accounts.create(name)) - return false; - - getAccount(name).set(balance); - - return true; - } - - public MethodAccount getAccount(String name) { - return new iCoAccount(com.iConomy.iConomy.getAccount(name)); - } - - public MethodBankAccount getBankAccount(String bank, String name) { - return new iCoBankAccount(com.iConomy.iConomy.getBank(bank).getAccount(name)); - } - - public boolean isCompatible(Plugin plugin) { - return plugin.getDescription().getName().equalsIgnoreCase("iconomy") - && plugin.getClass().getName().equals("com.iConomy.iConomy") - && plugin instanceof iConomy; - } - - public void setPlugin(Plugin plugin) { - iconomy = (iConomy) plugin; - } - - public static class iCoAccount implements MethodAccount { - private Account account; - private Holdings holdings; - - public iCoAccount(Account account) { - this.account = account; - this.holdings = account.getHoldings(); - } - - public double balance() { - return this.holdings.balance(); - } - - public boolean set(double amount) { - if (this.holdings == null) return false; - this.holdings.set(amount); - return true; - } - - public boolean add(double amount) { - if (this.holdings == null) return false; - this.holdings.add(amount); - return true; - } - - public boolean subtract(double amount) { - if (this.holdings == null) return false; - this.holdings.subtract(amount); - return true; - } - - public boolean multiply(double amount) { - if (this.holdings == null) return false; - this.holdings.multiply(amount); - return true; - } - - public boolean divide(double amount) { - if (this.holdings == null) return false; - this.holdings.divide(amount); - return true; - } - - public boolean hasEnough(double amount) { - return this.holdings.hasEnough(amount); - } - - public boolean hasOver(double amount) { - return this.holdings.hasOver(amount); - } - - public boolean hasUnder(double amount) { - return this.holdings.hasUnder(amount); - } - - public boolean isNegative() { - return this.holdings.isNegative(); - } - - public boolean remove() { - if (this.account == null) return false; - this.account.remove(); - return true; - } - } - - public static class iCoBankAccount implements MethodBankAccount { - private BankAccount account; - private Holdings holdings; - - public iCoBankAccount(BankAccount account) { - this.account = account; - this.holdings = account.getHoldings(); - } - - public BankAccount getiCoBankAccount() { - return account; - } - - public String getBankName() { - return this.account.getBankName(); - } - - public int getBankId() { - return this.account.getBankId(); - } - - public double balance() { - return this.holdings.balance(); - } - - public boolean set(double amount) { - if (this.holdings == null) return false; - this.holdings.set(amount); - return true; - } - - public boolean add(double amount) { - if (this.holdings == null) return false; - this.holdings.add(amount); - return true; - } - - public boolean subtract(double amount) { - if (this.holdings == null) return false; - this.holdings.subtract(amount); - return true; - } - - public boolean multiply(double amount) { - if (this.holdings == null) return false; - this.holdings.multiply(amount); - return true; - } - - public boolean divide(double amount) { - if (this.holdings == null) return false; - this.holdings.divide(amount); - return true; - } - - public boolean hasEnough(double amount) { - return this.holdings.hasEnough(amount); - } - - public boolean hasOver(double amount) { - return this.holdings.hasOver(amount); - } - - public boolean hasUnder(double amount) { - return this.holdings.hasUnder(amount); - } - - public boolean isNegative() { - return this.holdings.isNegative(); - } - - public boolean remove() { - if (this.account == null) return false; - this.account.remove(); - return true; - } - } -} \ No newline at end of file diff --git a/src/main/java/com/nijikokun/register/payment/forChestShop/methods/iCo6.java b/src/main/java/com/nijikokun/register/payment/forChestShop/methods/iCo6.java deleted file mode 100644 index 524e5f2..0000000 --- a/src/main/java/com/nijikokun/register/payment/forChestShop/methods/iCo6.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.nijikokun.register.payment.forChestShop.methods; - -import com.iCo6.iConomy; -import com.iCo6.system.Account; -import com.iCo6.system.Accounts; -import com.iCo6.system.Holdings; -import com.nijikokun.register.payment.forChestShop.Method; -import org.bukkit.plugin.Plugin; - -/** - * iConomy 6 Implementation of Method - * - * @author Nijikokun (@nijikokun) - * @copyright (c) 2011 - * @license AOL license - */ -public class iCo6 implements Method { - private iConomy iConomy; - - public iConomy getPlugin() { - return this.iConomy; - } - - public String getName() { - return "iConomy"; - } - - public String getVersion() { - return "6"; - } - - public int fractionalDigits() { - return 2; - } - - public String format(double amount) { - return com.iCo6.iConomy.format(amount); - } - - public boolean hasBanks() { - return false; - } - - public boolean hasBank(String bank) { - return false; - } - - public boolean hasAccount(String name) { - return (new Accounts()).exists(name); - } - - public boolean hasBankAccount(String bank, String name) { - return false; - } - - public boolean createAccount(String name) { - return !hasAccount(name) && (new Accounts()).create(name); - - } - - public boolean createAccount(String name, double balance) { - return !hasAccount(name) && (new Accounts()).create(name, balance); - - } - - public MethodAccount getAccount(String name) { - return new iCoAccount((new Accounts()).get(name)); - } - - public MethodBankAccount getBankAccount(String bank, String name) { - return null; - } - - public boolean isCompatible(Plugin plugin) { - return plugin.getDescription().getName().equalsIgnoreCase("iconomy") - && plugin.getClass().getName().equals("com.iCo6.iConomy") - && plugin instanceof iConomy; - } - - public void setPlugin(Plugin plugin) { - iConomy = (iConomy) plugin; - } - - public static class iCoAccount implements MethodAccount { - private Account account; - private Holdings holdings; - - public iCoAccount(Account account) { - this.account = account; - this.holdings = account.getHoldings(); - } - - public double balance() { - return this.holdings.getBalance(); - } - - public boolean set(double amount) { - if (this.holdings == null) return false; - this.holdings.setBalance(amount); - return true; - } - - public boolean add(double amount) { - if (this.holdings == null) return false; - this.holdings.add(amount); - return true; - } - - public boolean subtract(double amount) { - if (this.holdings == null) return false; - this.holdings.subtract(amount); - return true; - } - - public boolean multiply(double amount) { - if (this.holdings == null) return false; - this.holdings.multiply(amount); - return true; - } - - public boolean divide(double amount) { - if (this.holdings == null) return false; - this.holdings.divide(amount); - return true; - } - - public boolean hasEnough(double amount) { - return this.holdings.hasEnough(amount); - } - - public boolean hasOver(double amount) { - return this.holdings.hasOver(amount); - } - - public boolean hasUnder(double amount) { - return this.holdings.hasUnder(amount); - } - - public boolean isNegative() { - return this.holdings.isNegative(); - } - - public boolean remove() { - if (this.account == null) return false; - this.account.remove(); - return true; - } - } -} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index cedb131..cd63a6f 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -14,7 +14,7 @@ description: > softdepend: [LWC, Lockette, Deadbolt, OddItem, WorldGuard, Vault, Heroes, - iConomy, BOSEconomy, SimpleChestLock, Residence] + SimpleChestLock, Residence] commands: iteminfo: aliases: [iinfo]