You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
5.4 KiB

package cx.sfy.TheBridge.database;
import java.util.HashMap;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import cx.sfy.TheBridge.Main;
import cx.sfy.TheBridge.archievements.ArchiType;
public class PlayerStat {
public static HashMap<Player, PlayerStat> players = new HashMap<Player, PlayerStat>();
private Player p;
private UUID uuid;
private String name;
private ItemStack[] hotbar;
private String cage;
private int normalWins;
private int fourWins;
private int normalKills;
private int fourKills;
private int normalDeaths;
private int fourDeaths;
private int normalGoals;
private int fourGoals;
private int coins;
private int xp;
private int broken;
private int placed;
public PlayerStat(Player p) {
this.p = p;
this.uuid = p.getUniqueId();
this.name = p.getName();
Main.get().getDB().loadData(this);
Main.get().getCB().loadData(this);
players.put(p, this);
}
public static PlayerStat getPlayerStat(Player p) {
return players.get(p);
}
public String getCage() {
return cage;
}
public void setCage(String cage) {
this.cage = cage;
}
public void addBroken() {
broken = broken + 1;
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, broken, ArchiType.BLOCKS_BROKEN);
}
}
public void addPlaced() {
placed = placed + 1;
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, placed, ArchiType.BLOCKS_PLACED);
}
}
public int getBroken() {
return broken;
}
public void setBroken(int broken) {
this.broken = broken;
}
public int getPlaced() {
return placed;
}
public void setPlaced(int placed) {
this.placed = placed;
}
public Player getPlayer() {
return p;
}
public String getUUID() {
return uuid.toString();
}
public String getName() {
return name;
}
public ItemStack[] getHotbar() {
return hotbar;
}
public void setHotbar(ItemStack[] hotbar) {
this.hotbar = hotbar;
}
public void addNormalKills() {
normalKills = normalKills + 1;
xp += Main.get().getConfig().getInt("xp.normal.kill");
coins += Main.get().getConfig().getInt("coins.normal.kill");
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, normalKills + fourKills, ArchiType.KILLS);
}
}
public void addNormalWins() {
normalWins = normalWins + 1;
xp += Main.get().getConfig().getInt("xp.normal.win");
coins += Main.get().getConfig().getInt("coins.normal.win");
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, normalWins + fourWins, ArchiType.WINS);
}
}
public void addNormalGoals() {
normalGoals = normalGoals + 1;
xp += Main.get().getConfig().getInt("xp.normal.goals");
coins += Main.get().getConfig().getInt("coins.normal.goals");
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, normalGoals + fourGoals, ArchiType.GOALS);
}
}
public void addFourKills() {
fourKills = fourKills + 1;
xp += Main.get().getConfig().getInt("xp.four.kill");
coins += Main.get().getConfig().getInt("coins.four.kill");
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, normalKills + fourKills, ArchiType.KILLS);
}
}
public void addFourWins() {
fourWins = fourWins + 1;
xp += Main.get().getConfig().getInt("coins.four.win");
coins += Main.get().getConfig().getInt("coins.four.win");
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, normalWins + fourWins, ArchiType.WINS);
}
}
public void addFourGoals() {
fourGoals = fourGoals + 1;
xp += coins + Main.get().getConfig().getInt("xp.four.goals");
coins += Main.get().getConfig().getInt("coins.four.goals");
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, normalGoals + fourGoals, ArchiType.GOALS);
}
}
public void addCoins(int coins) {
this.coins = this.coins + coins;
}
public void removeCoins(int coins) {
this.coins = this.coins - coins;
}
public void addXP(int xp) {
this.xp = this.xp + xp;
}
public void removeXP(int xp) {
this.xp = this.xp - xp;
}
public int getNormalWins() {
return normalWins;
}
public int getFourWins() {
return fourWins;
}
public int getNormalKills() {
return normalKills;
}
public int getFourKills() {
return fourKills;
}
public int getNormalDeaths() {
return normalDeaths;
}
public int getFourDeaths() {
return fourDeaths;
}
public int getNormalGoals() {
return normalGoals;
}
public int getFourGoals() {
return fourGoals;
}
public int getCoins() {
return coins;
}
public int getXP() {
return xp;
}
public void setNormalWins(int normalWins) {
this.normalWins = normalWins;
}
public void setFourWins(int fourWins) {
this.fourWins = fourWins;
}
public void setNormalKills(int normalKills) {
this.normalKills = normalKills;
}
public void setFourKills(int fourKills) {
this.fourKills = fourKills;
}
public void setNormalDeaths(int normalDeaths) {
this.normalDeaths = normalDeaths;
}
public void setFourDeaths(int fourDeaths) {
this.fourDeaths = fourDeaths;
}
public void setNormalGoals(int normalGoals) {
this.normalGoals = normalGoals;
}
public void setFourGoals(int fourGoals) {
this.fourGoals = fourGoals;
}
public void setCoins(int coins) {
this.coins = coins;
}
public void setXP(int xp) {
this.xp = xp;
}
}