mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-02-03 12:01:22 +01:00
Yeah, include server economy account
This commit is contained in:
parent
df0de0ab44
commit
cd13f1ce8f
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user