Yeah, include server economy account

This commit is contained in:
Acrobot 2012-11-03 20:40:30 +01:00
parent df0de0ab44
commit cd13f1ce8f

View File

@ -33,6 +33,10 @@ public class Economy {
} }
public static void add(String name, double amount) { public static void add(String name, double amount) {
if (isServerAccount(name) && !getServerAccountName().isEmpty()) {
name = getServerAccountName();
}
Property taxAmount = isServerAccount(name) ? Property.SERVER_TAX_AMOUNT : Property.TAX_AMOUNT; Property taxAmount = isServerAccount(name) ? Property.SERVER_TAX_AMOUNT : Property.TAX_AMOUNT;
double tax = getTax(taxAmount, amount); double tax = getTax(taxAmount, amount);
@ -51,6 +55,10 @@ public class Economy {
} }
public static void subtract(String name, double amount) { public static void subtract(String name, double amount) {
if (isServerAccount(name) && !getServerAccountName().isEmpty()) {
name = getServerAccountName();
}
economy.subtract(uName.getName(name), roundUp(amount)); economy.subtract(uName.getName(name), roundUp(amount));
} }
@ -58,11 +66,18 @@ public class Economy {
if (amount <= 0) { if (amount <= 0) {
return true; return true;
} }
if (isServerAccount(name) && !getServerAccountName().isEmpty()) {
name = getServerAccountName();
}
return economy.hasEnough(uName.getName(name), roundUp(amount)); return economy.hasEnough(uName.getName(name), roundUp(amount));
} }
public static double getBalance(String name) { public static double getBalance(String name) {
if (isServerAccount(name) && !getServerAccountName().isEmpty()) {
name = getServerAccountName();
}
return economy.balance(uName.getName(name)); return economy.balance(uName.getName(name));
} }