ChestShop-3/com/Acrobot/ChestShop/Economy.java
Acrobot 637e08e985 Wow, that is ugly now :/
- Added WorldGuard support
- Fixed protection
- Added shop refund price
- Updated Register
2011-10-11 13:15:53 +02:00

44 lines
1.4 KiB
Java

package com.Acrobot.ChestShop;
import com.Acrobot.ChestShop.Config.Config;
import com.Acrobot.ChestShop.Config.Property;
import com.Acrobot.ChestShop.Utils.uLongName;
import com.nijikokun.register.payment.forChestShop.Method;
/**
* @author Acrobot
* Economy management
*/
public class Economy {
public static Method economy;
public static boolean hasAccount(String p) {
return economy.hasAccount(uLongName.getName(p));
}
public static void add(String name, float amount) {
if (Config.getFloat(Property.TAX_AMOUNT) != 0F && !Config.getString(Property.SERVER_ECONOMY_ACCOUNT).isEmpty()) {
float tax = (Config.getFloat(Property.TAX_AMOUNT) / 100F) * amount;
economy.getAccount(Config.getString(Property.SERVER_ECONOMY_ACCOUNT)).add(tax);
amount = amount - tax;
}
economy.getAccount(uLongName.getName(name)).add(amount);
}
public static void substract(String name, float amount) {
economy.getAccount(uLongName.getName(name)).subtract(amount);
}
public static boolean hasEnough(String name, float amount) {
return economy.getAccount(uLongName.getName(name)).hasEnough(amount);
}
public static double balance(String name) {
return economy.getAccount(uLongName.getName(name)).balance();
}
public static String formatBalance(double amount) {
return economy.format(amount);
}
}