From 9f9c99c20fbbe8c8f92d2a4834edc1778e3c2e6c Mon Sep 17 00:00:00 2001 From: MjolnirCommando Date: Sat, 14 Jul 2012 23:59:08 -0300 Subject: [PATCH] External Multiple Currency Fix --- .../economy/plugins/Economy_MineConomy.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java b/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java index 8d69c92..47f2dcf 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java @@ -23,6 +23,7 @@ import me.mjolnir.mineconomy.MineConomy; import me.mjolnir.mineconomy.exceptions.AccountNameConflictException; import me.mjolnir.mineconomy.exceptions.NoAccountException; import me.mjolnir.mineconomy.internal.MCCom; +import me.mjolnir.mineconomy.internal.util.MCFormat; import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.EconomyResponse; import net.milkbowl.vault.economy.EconomyResponse.ResponseType; @@ -95,7 +96,7 @@ public class Economy_MineConomy implements Economy { } public String format(double amount) { - return String.valueOf(amount); + return MCFormat.format(amount); } public String currencyNameSingular() { @@ -109,22 +110,22 @@ public class Economy_MineConomy implements Economy { public double getBalance(String playerName) { try { - return MCCom.getBalance(playerName); + return MCCom.getExternalBalance(playerName); } catch (NoAccountException e) { MCCom.create(playerName); - return MCCom.getBalance(playerName); + return MCCom.getExternalBalance(playerName); } } @Override public boolean has(String playerName, double amount) { try { - return MCCom.canAfford(playerName, amount); + return MCCom.canExternalAfford(playerName, amount); } catch(NoAccountException e) { MCCom.create(playerName); - return MCCom.canAfford(playerName, amount); + return MCCom.canExternalAfford(playerName, amount); } } @@ -132,10 +133,10 @@ public class Economy_MineConomy implements Economy { public EconomyResponse withdrawPlayer(String playerName, double amount) { double balance; try { - balance = MCCom.getBalance(playerName); + balance = MCCom.getExternalBalance(playerName); } catch (NoAccountException e) { MCCom.create(playerName); - balance = MCCom.getBalance(playerName); + balance = MCCom.getExternalBalance(playerName); } if(amount < 0.0D) { @@ -144,7 +145,7 @@ public class Economy_MineConomy implements Economy { if(balance >= amount) { double finalBalance = balance - amount; - MCCom.setBalance(playerName, finalBalance); + MCCom.setExternalBalance(playerName, finalBalance); return new EconomyResponse(amount, finalBalance, ResponseType.SUCCESS, null); } else { return new EconomyResponse(0.0D, balance, ResponseType.FAILURE, "Insufficient funds"); @@ -155,17 +156,17 @@ public class Economy_MineConomy implements Economy { public EconomyResponse depositPlayer(String playerName, double amount) { double balance; try { - balance = MCCom.getBalance(playerName); + balance = MCCom.getExternalBalance(playerName); } catch (NoAccountException e) { MCCom.create(playerName); - balance = MCCom.getBalance(playerName); + balance = MCCom.getExternalBalance(playerName); } if(amount < 0.0D) { return new EconomyResponse(0.0D, 0.0, ResponseType.FAILURE, "Cannot deposit negative funds"); } balance += amount; - MCCom.setBalance(playerName, balance); + MCCom.setExternalBalance(playerName, balance); return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null); } @@ -234,8 +235,8 @@ public class Economy_MineConomy implements Economy { } } - @Override - public int fractionalDigits() { - return 2; - } + @Override + public int fractionalDigits() { + return 2; + } } \ No newline at end of file