152 lines
4.6 KiB
Java
152 lines
4.6 KiB
Java
package net.crankedpvp.leaderboards.struct;
|
|
|
|
import lombok.Getter;
|
|
import net.crankedpvp.crankedutils.utils.CC;
|
|
import net.crankedpvp.storageutils.struct.NewKeyToSave;
|
|
import org.bukkit.Bukkit;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
import java.util.stream.Collectors;
|
|
|
|
@Getter
|
|
public class PlayerStats implements NewKeyToSave<UUID> {
|
|
|
|
private UUID uuid;
|
|
private int kills;
|
|
private int deaths;
|
|
private int petsUsed;
|
|
private int starItemsApplied;
|
|
private int envoysOpened;
|
|
private int bossKills;
|
|
private long mobKills;
|
|
private long expGained;
|
|
private int coresBroken;
|
|
private double shardsSpent;
|
|
private int underworldMobsKilled;
|
|
private int underworldEssenceGained;
|
|
private int underworldSkipsUsed;
|
|
private int crateKeysOpened;
|
|
|
|
public PlayerStats(UUID uuid) {
|
|
this.uuid = uuid;
|
|
this.kills = 0;
|
|
this.deaths = 0;
|
|
this.petsUsed = 0;
|
|
this.starItemsApplied = 0;
|
|
this.envoysOpened = 0;
|
|
this.bossKills = 0;
|
|
this.mobKills = 0;
|
|
this.expGained = 0;
|
|
this.coresBroken = 0;
|
|
this.shardsSpent = 0;
|
|
this.underworldMobsKilled = 0;
|
|
this.underworldEssenceGained = 0;
|
|
this.underworldSkipsUsed = 0;
|
|
this.crateKeysOpened = 0;
|
|
}
|
|
|
|
public List<String> getAllStats() {
|
|
List<String> allStats = new ArrayList<>();
|
|
allStats.add("&6Player Stats: " + Bukkit.getOfflinePlayer(this.uuid).getName());
|
|
allStats.add("&2Kills: &7[&a" + this.kills + "&7]");
|
|
allStats.add("&4Deaths: &7[&c" + this.deaths + "&7]");
|
|
allStats.add("&3KDR: &7[&b" + this.getKDR() + "&7]");
|
|
allStats.add("&3Pets Used: &7[&b" + this.petsUsed + "&7]");
|
|
allStats.add("&5Star Items Applied: &7[&d" + this.starItemsApplied + "&7]");
|
|
allStats.add("&6Envoys Opened: &7[&e" + this.envoysOpened + "&7]");
|
|
allStats.add("&4Boss Kills: &7[&c" + this.bossKills + "&7]");
|
|
allStats.add("&1Mob Kills: &3[&a" + this.mobKills + "&7]");
|
|
allStats.add("&6EXP Gained: &7[&e" + this.expGained + "&7]");
|
|
allStats.add("&eAverage EXP Per Mob: &7[&6" + this.getAverageXPPerMobKilled() + "&7]");
|
|
allStats.add("&eCores Broken: &7[&6" + this.coresBroken + "&7]");
|
|
allStats.add("&6Shards Spent: &7[&e" + this.shardsSpent + "&7]");
|
|
allStats.add("&cUnderworld Mobs Killed: &7[&4" + this.underworldMobsKilled + "&7]");
|
|
allStats.add("&3Underworld Essence Gained: &7[&b" + this.underworldEssenceGained + "&7]");
|
|
allStats.add("&bUnderworld Skips Used: &7[&3" + this.underworldSkipsUsed + "&7]");
|
|
allStats.add("&aCrate Keys Opened: &7[&2" + this.crateKeysOpened + "&7]");
|
|
allStats.add("");
|
|
return allStats.stream().map(CC::translate).collect(Collectors.toList());
|
|
}
|
|
|
|
public double getKDR() {
|
|
if(this.deaths <= 1) return this.kills;
|
|
if(this.kills == 0) return 0.0D;
|
|
return (double) this.kills / this.deaths;
|
|
}
|
|
|
|
public double getAverageXPPerMobKilled() {
|
|
if(this.mobKills == 0 || this.expGained == 1) return 0.0D;
|
|
return (double) this.expGained / this.mobKills;
|
|
}
|
|
|
|
public void incrementKills() {
|
|
this.kills++;
|
|
}
|
|
|
|
public void incrementDeaths() {
|
|
this.deaths++;
|
|
}
|
|
|
|
public void incrementPetsUsed() {
|
|
this.petsUsed++;
|
|
}
|
|
|
|
public void incrementStarItemsApplied() {
|
|
this.starItemsApplied++;
|
|
}
|
|
|
|
public void incrementEnvoysOpened() {
|
|
this.envoysOpened++;
|
|
}
|
|
|
|
public void incrementBossKills() {
|
|
this.bossKills++;
|
|
}
|
|
|
|
public void incrementCoresBroken() {
|
|
this.coresBroken++;
|
|
}
|
|
|
|
public void incrementUnderworldSkipsUsed() {
|
|
this.underworldSkipsUsed++;
|
|
}
|
|
|
|
public void incrementUnderworldMobsKilled() {
|
|
this.underworldMobsKilled++;
|
|
}
|
|
|
|
public void addMobsKilled(int mobsKilled) {
|
|
this.mobKills = this.mobKills + mobsKilled;
|
|
}
|
|
|
|
public void addShardsSpent(double shardsSpent) {
|
|
this.shardsSpent = this.shardsSpent + shardsSpent;
|
|
}
|
|
|
|
public void addEXPGained(int expGained) {
|
|
this.expGained = this.expGained + expGained;
|
|
}
|
|
|
|
public void addUnderworldEssenceGained(int essenceGained) {
|
|
this.underworldEssenceGained = this.underworldEssenceGained + essenceGained;
|
|
}
|
|
|
|
public void addCrateKeysOpened(int crateKeysOpened) {
|
|
this.crateKeysOpened = this.crateKeysOpened + crateKeysOpened;
|
|
}
|
|
|
|
|
|
@Override
|
|
public UUID getKey() {
|
|
return uuid;
|
|
}
|
|
|
|
@Override
|
|
public void setKey(UUID uuid) {
|
|
this.uuid = uuid;
|
|
}
|
|
|
|
}
|