Add player statistics tracking and integration.
Introduced a comprehensive system for tracking player stats, including kills, flags captured, damage dealt, and more. Integrated stat recording into related game events and ensured proper handling for both individual and team actions. This enhances gameplay analysis and future feature potential.
This commit is contained in:
@@ -7,6 +7,8 @@ import com.alttd.ctf.game.GamePhase;
|
||||
import com.alttd.ctf.game_class.GameClass;
|
||||
import com.alttd.ctf.game_class.GameClassRetrieval;
|
||||
import com.alttd.ctf.gui.ClassSelectionGUI;
|
||||
import com.alttd.ctf.stats.PlayerStat;
|
||||
import com.alttd.ctf.stats.Stat;
|
||||
import com.github.yannicklamprecht.worldborder.api.WorldBorderApi;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -21,15 +23,17 @@ import java.util.*;
|
||||
@Getter
|
||||
public class TeamPlayer {
|
||||
|
||||
private final PlayerStat playerStat;
|
||||
private final UUID uuid;
|
||||
private final Team team;
|
||||
@Setter
|
||||
private GameClass gameClass;
|
||||
private boolean isDead = false;
|
||||
|
||||
protected TeamPlayer(UUID uuid, Team team) {
|
||||
this.uuid = uuid;
|
||||
protected TeamPlayer(Player player, Team team) {
|
||||
this.uuid = player.getUniqueId();
|
||||
this.team = team;
|
||||
this.playerStat = new PlayerStat(uuid, player.getName());
|
||||
}
|
||||
|
||||
public void respawn(@NotNull Player player, @NotNull WorldBorderApi worldBorderApi, @NotNull GamePhase gamePhase) {
|
||||
@@ -87,4 +91,12 @@ public class TeamPlayer {
|
||||
public int hashCode() {
|
||||
return Objects.hash(uuid);
|
||||
}
|
||||
|
||||
public void increaseStat(Stat stat) {
|
||||
playerStat.increaseStat(stat);
|
||||
}
|
||||
|
||||
public void increaseStat(Stat stat, double amount) {
|
||||
playerStat.increaseStat(stat, amount);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user