70 lines
2.4 KiB
Java
70 lines
2.4 KiB
Java
package me.demon.bank;
|
|
|
|
import org.bukkit.configuration.file.FileConfiguration;
|
|
import org.bukkit.entity.Player;
|
|
|
|
public abstract class BankAPI {
|
|
|
|
public static void addVault(Player p,int money){
|
|
if(Main.dataMap.get(p) == null){
|
|
Main.dataMap.put(p,new BankData(p));
|
|
}
|
|
long currentTime = System.currentTimeMillis();
|
|
Main.lastCommandTime.put(p,currentTime);
|
|
BankData bankData = Main.dataMap.get(p);
|
|
bankData.addMoney(money);
|
|
}
|
|
|
|
public static int getMoney(String playName){
|
|
FileConfiguration yml = Main.plugin.getConfig();
|
|
return yml.getInt("BankStats."+playName+".Money");
|
|
}
|
|
public static void addMoney(String playName,int amount){
|
|
int money = getMoney(playName);
|
|
setMoney(playName,(money+amount));
|
|
}
|
|
public static void takeMoney(String playName,int amount){
|
|
int money = getMoney(playName);
|
|
setMoney(playName,(money-amount));
|
|
}
|
|
public static void setMoney(String playName,int amount){
|
|
FileConfiguration yml = Main.plugin.getConfig();
|
|
yml.set("BankStats."+playName+".Money",amount);
|
|
}
|
|
|
|
public static int getMoneyUUID(String uuid){
|
|
FileConfiguration yml = Main.plugin.getConfig();
|
|
return yml.getInt("BankStats."+uuid+".Money");
|
|
}
|
|
public static void addMoneyUUID(String uuid,int amount){
|
|
int money = getMoneyUUID(uuid);
|
|
setMoneyUUID(uuid,(money+amount));
|
|
}
|
|
public static void takeMoneyUUID(String uuid,int amount){
|
|
int money = getMoneyUUID(uuid);
|
|
setMoneyUUID(uuid,(money-amount));
|
|
}
|
|
public static void setMoneyUUID(String uuid,int amount){
|
|
FileConfiguration yml = Main.plugin.getConfig();
|
|
yml.set("BankStats."+uuid+".Money",amount);
|
|
}
|
|
|
|
public static int getPoints(String playName){
|
|
FileConfiguration yml = Main.plugin.getConfig();
|
|
return yml.getInt("BankStats."+playName+".Points");
|
|
}
|
|
public static void addPoints(String playName,int amount){
|
|
int money = getPoints(playName);
|
|
setPoints(playName,(money+amount));
|
|
}
|
|
public static void takePoints(String playName,int amount){
|
|
int money = getPoints(playName);
|
|
setPoints(playName,(money-amount));
|
|
}
|
|
public static void setPoints(String playName,int amount){
|
|
FileConfiguration yml = Main.plugin.getConfig();
|
|
yml.set("BankStats."+playName+".Points",amount);
|
|
}
|
|
|
|
}
|