From e4a152561e9ae54ca0eddf487a3304fc9ad417b2 Mon Sep 17 00:00:00 2001 From: Acrobot Date: Fri, 15 Feb 2013 19:05:07 +0100 Subject: [PATCH] Fix economy plugins which check for active accounts. --- com/Acrobot/ChestShop/Economy/Economy.java | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/com/Acrobot/ChestShop/Economy/Economy.java b/com/Acrobot/ChestShop/Economy/Economy.java index 5e4e759..8ca3970 100644 --- a/com/Acrobot/ChestShop/Economy/Economy.java +++ b/com/Acrobot/ChestShop/Economy/Economy.java @@ -36,8 +36,12 @@ public class Economy { } public static boolean add(String name, double amount) { - if (isServerAccount(name) && !getServerAccountName().isEmpty()) { - name = getServerAccountName(); + if (isServerAccount(name)) { + if (!getServerAccountName().isEmpty()) { + name = getServerAccountName(); + } else { + return true; + } } float taxAmount = isServerAccount(name) ? Properties.SERVER_TAX_AMOUNT : Properties.TAX_AMOUNT; @@ -58,8 +62,12 @@ public class Economy { } public static boolean subtract(String name, double amount) { - if (isServerAccount(name) && !getServerAccountName().isEmpty()) { - name = getServerAccountName(); + if (isServerAccount(name)) { + if (!getServerAccountName().isEmpty()) { + name = getServerAccountName(); + } else { + return true; + } } return manager.subtract(uName.getName(name), roundUp(amount)); @@ -70,16 +78,24 @@ public class Economy { return true; } - if (isServerAccount(name) && !getServerAccountName().isEmpty()) { - name = getServerAccountName(); + if (isServerAccount(name)) { + if (!getServerAccountName().isEmpty()) { + name = getServerAccountName(); + } else { + return true; + } } return manager.hasEnough(uName.getName(name), roundUp(amount)); } public static double getBalance(String name) { - if (isServerAccount(name) && !getServerAccountName().isEmpty()) { - name = getServerAccountName(); + if (isServerAccount(name)) { + if (!getServerAccountName().isEmpty()) { + name = getServerAccountName(); + } else { + return Double.MAX_VALUE; + } } return manager.balance(uName.getName(name));