diff --git a/lib/BOSEconomy6.jar b/lib/BOSEconomy6.jar deleted file mode 100644 index bba5231..0000000 Binary files a/lib/BOSEconomy6.jar and /dev/null differ diff --git a/src/net/milkbowl/vault/economy/Economy.java b/src/net/milkbowl/vault/economy/Economy.java index 5de12b2..3bcf77e 100644 --- a/src/net/milkbowl/vault/economy/Economy.java +++ b/src/net/milkbowl/vault/economy/Economy.java @@ -19,6 +19,8 @@ package net.milkbowl.vault.economy; +import java.util.List; + /** * The main economy API * @@ -130,4 +132,10 @@ public interface Economy { * @return */ public EconomyResponse isBankMember(String name, String playerName); + + /** + * Gets the list of banks + * @return the List of Banks + */ + public List getBanks(); } \ No newline at end of file diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_3co.java b/src/net/milkbowl/vault/economy/plugins/Economy_3co.java index cf21d35..11e6006 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_3co.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_3co.java @@ -19,6 +19,8 @@ package net.milkbowl.vault.economy.plugins; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Logger; import me.ic3d.eco.ECO; @@ -226,4 +228,9 @@ public class Economy_3co implements Economy { 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(); + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java index ab6dcca..3b06b5a 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java @@ -19,6 +19,7 @@ package net.milkbowl.vault.economy.plugins; +import java.util.List; import java.util.logging.Logger; import net.milkbowl.vault.economy.Economy; @@ -35,6 +36,7 @@ import org.bukkit.plugin.PluginManager; import cosine.boseconomy.BOSEconomy; +@SuppressWarnings("deprecation") public class Economy_BOSE6 implements Economy { private static final Logger log = Logger.getLogger("Minecraft"); @@ -77,14 +79,9 @@ public class Economy_BOSE6 implements Economy { } } - @Override + @Override public double getBalance(String playerName) { - final double balance; - - balance = (double) economy.getPlayerMoney(playerName); - - final double fBalance = balance; - return fBalance; + return (double) economy.getPlayerMoney(playerName); } @Override @@ -113,7 +110,6 @@ public class Economy_BOSE6 implements Economy { errorMessage = "Insufficient funds"; type = EconomyResponse.ResponseType.FAILURE; amount = 0; - balance = (double) economy.getPlayerMoney(playerName); return new EconomyResponse(balance, balance, type, errorMessage); } @@ -279,4 +275,9 @@ public class Economy_BOSE6 implements Economy { double bankMoney = economy.getBankMoney(name); return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, null); } + + @Override + public List getBanks() { + return economy.getBankList(); + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java index af1f7fd..1db069d 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java @@ -19,6 +19,7 @@ package net.milkbowl.vault.economy.plugins; +import java.util.List; import java.util.logging.Logger; import net.milkbowl.vault.economy.Economy; @@ -81,7 +82,7 @@ public class Economy_BOSE7 implements Economy { public double getBalance(String playerName) { final double balance; - balance = (double) economy.getPlayerMoney(playerName); + balance = economy.getPlayerMoneyDouble(playerName); final double fBalance = balance; return fBalance; @@ -97,31 +98,30 @@ public class Economy_BOSE7 implements Economy { errorMessage = "Cannot withdraw negative funds"; type = EconomyResponse.ResponseType.FAILURE; amount = 0; - balance = (double) economy.getPlayerMoney(playerName); + balance = economy.getPlayerMoneyDouble(playerName); return new EconomyResponse(amount, balance, type, errorMessage); } amount = Math.ceil(amount); - balance = (double) economy.getPlayerMoney(playerName); + balance = economy.getPlayerMoneyDouble(playerName); if (balance - amount < 0) { errorMessage = "Insufficient funds"; type = EconomyResponse.ResponseType.FAILURE; amount = 0; - balance = (double) economy.getPlayerMoney(playerName); return new EconomyResponse(amount, balance, type, errorMessage); } - if (economy.setPlayerMoney(playerName, (int) (balance - amount), false)) { + if (economy.setPlayerMoney(playerName, balance - amount, false)) { type = EconomyResponse.ResponseType.SUCCESS; - balance = (double) economy.getPlayerMoney(playerName); + balance = economy.getPlayerMoneyDouble(playerName); return new EconomyResponse(amount, balance, type, errorMessage); } else { errorMessage = "Error withdrawing funds"; type = EconomyResponse.ResponseType.FAILURE; amount = 0; - balance = (double) economy.getPlayerMoney(playerName); + balance = economy.getPlayerMoneyDouble(playerName); return new EconomyResponse(amount, balance, type, errorMessage); } @@ -137,22 +137,21 @@ public class Economy_BOSE7 implements Economy { 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(amount, economy.getPlayerMoneyDouble(playerName), type, errorMessage); } amount = Math.ceil(amount); - balance = (double) economy.getPlayerMoney(playerName); - if (economy.setPlayerMoney(playerName, (int) (balance + amount), false)) { + balance = economy.getPlayerMoneyDouble(playerName); + if (economy.setPlayerMoney(playerName, balance + amount, false)) { type = EconomyResponse.ResponseType.SUCCESS; - balance = (double) economy.getPlayerMoney(playerName); + balance = economy.getPlayerMoneyDouble(playerName); return new EconomyResponse(amount, balance, type, errorMessage); } else { errorMessage = "Error withdrawing funds"; type = EconomyResponse.ResponseType.FAILURE; amount = 0; - balance = (double) economy.getPlayerMoney(playerName); + balance = economy.getPlayerMoneyDouble(playerName); return new EconomyResponse(amount, balance, type, errorMessage); } @@ -202,11 +201,12 @@ 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.getBankMoney(name), ResponseType.SUCCESS, ""); + return new EconomyResponse(0, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to create that bank account."); } @@ -216,7 +216,7 @@ public class Economy_BOSE7 implements Economy { if (!economy.bankExists(name)) return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); - double bankMoney = economy.getBankMoney(name); + double bankMoney = economy.getBankMoneyDouble(name); if (bankMoney < amount) return new EconomyResponse(0, bankMoney, ResponseType.FAILURE, "The bank does not have enough money!"); else @@ -230,8 +230,8 @@ public class Economy_BOSE7 implements Economy { if (!er.transactionSuccess()) return er; else { - economy.addBankMoney(name, (int) -amount, true); - return new EconomyResponse((int) amount, economy.getBankMoney(name), ResponseType.SUCCESS, ""); + economy.addBankMoney(name, -amount, true); + return new EconomyResponse(amount, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); } } @@ -240,8 +240,8 @@ public class Economy_BOSE7 implements Economy { 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, ""); + economy.addBankMoney(name, amount, true); + return new EconomyResponse(amount, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); } } @@ -250,7 +250,7 @@ public class Economy_BOSE7 implements Economy { 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, ""); + return new EconomyResponse(0, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); } else return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank owner!"); } @@ -260,7 +260,7 @@ public class Economy_BOSE7 implements Economy { 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, ""); + return new EconomyResponse(0, economy.getBankMoneyDouble(name), ResponseType.SUCCESS, ""); } else return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank member!"); } @@ -270,10 +270,15 @@ public class Economy_BOSE7 implements Economy { if (!economy.bankExists(name)) return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!"); - double bankMoney = economy.getBankMoney(name); + 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; diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java b/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java index de8d97b..179c098 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java @@ -1,5 +1,7 @@ package net.milkbowl.vault.economy.plugins; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Logger; import org.bukkit.OfflinePlayer; @@ -189,4 +191,9 @@ public class Economy_EconXP implements Economy { 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(); + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java b/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java index b7ec03c..5ae73c1 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java @@ -19,6 +19,8 @@ package net.milkbowl.vault.economy.plugins; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Logger; import net.milkbowl.vault.economy.Economy; @@ -90,8 +92,7 @@ public class Economy_Essentials implements Economy { balance = 0; } - final double fBalance = balance; - return fBalance; + return balance; } private boolean createPlayerAccount(String playerName) { @@ -249,4 +250,9 @@ public class Economy_Essentials implements Economy { 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(); + } } \ No newline at end of file diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java b/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java index 2d88334..fab0d1d 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java @@ -1,5 +1,7 @@ package net.milkbowl.vault.economy.plugins; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Logger; import me.mjolnir.mineconomy.Accounting; @@ -158,4 +160,9 @@ public class Economy_MineConomy implements Economy { 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(); + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java b/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java index af2078a..eec4635 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java @@ -19,6 +19,8 @@ package net.milkbowl.vault.economy.plugins; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Logger; import net.milkbowl.vault.economy.Economy; @@ -229,4 +231,9 @@ public class Economy_MultiCurrency implements Economy { 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(); + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java b/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java index eb7cbfc..dcc4cf8 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java @@ -1,5 +1,7 @@ package net.milkbowl.vault.economy.plugins; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Logger; import me.ethan.eWallet.ECO; @@ -165,4 +167,9 @@ public class Economy_eWallet implements Economy { 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(); + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java index fa238c2..824a3fb 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java @@ -19,6 +19,8 @@ package net.milkbowl.vault.economy.plugins; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Logger; import net.milkbowl.vault.economy.Economy; @@ -93,12 +95,7 @@ public class Economy_iConomy4 implements Economy { @Override public double getBalance(String playerName) { - final double balance; - - balance = getAccountBalance(playerName); - - final double fBalance = balance; - return fBalance; + return getAccountBalance(playerName); } private double getAccountBalance(String playerName) { @@ -240,4 +237,9 @@ public class Economy_iConomy4 implements Economy { 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(); + } } \ No newline at end of file diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java index d8e101a..2ccbf16 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java @@ -19,6 +19,8 @@ package net.milkbowl.vault.economy.plugins; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Logger; import net.milkbowl.vault.economy.Economy; @@ -86,12 +88,7 @@ public class Economy_iConomy5 implements Economy { @Override public double getBalance(String playerName) { - final double balance; - - balance = getAccountBalance(playerName); - - final double fBalance = balance; - return fBalance; + return getAccountBalance(playerName); } @Override @@ -203,4 +200,9 @@ public class Economy_iConomy5 implements Economy { 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(); + } } \ No newline at end of file diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java index a64bfed..c8131ac 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java @@ -1,5 +1,6 @@ package net.milkbowl.vault.economy.plugins; +import java.util.List; import java.util.logging.Logger; import org.bukkit.event.Event.Priority; @@ -196,5 +197,9 @@ public class Economy_iConomy6 implements Economy { 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"); + } } diff --git a/src/net/milkbowl/vault/regions/Regions.java b/src/net/milkbowl/vault/regions/Regions.java new file mode 100644 index 0000000..4b50bcd --- /dev/null +++ b/src/net/milkbowl/vault/regions/Regions.java @@ -0,0 +1,29 @@ +package net.milkbowl.vault.regions; + +import java.util.Set; + +import org.bukkit.entity.Player; + +public abstract class Regions { + + /** + * Gets name of regions method + * @return Name of Regions Method + */ + abstract public String getName(); + + /** + * Checks if this regions method is enabled. + * @return Success or Failure + */ + abstract public boolean isEnabled(); + + abstract public boolean playerInRegion(Player player, String name); + + abstract public Set getRegions(Player player); + + abstract public boolean canBuild(Player player); + + abstract public boolean canUse(Player player); + +}