Interface ZentrixPlayer
public interface ZentrixPlayer
Represents a read-only view of a player participating in a Zentrix game.
This interface provides access to player information including their identity, game statistics, team membership, and selected class.
Example Usage
ZentrixPlayer zentrixPlayer = ZentrixProvider.get()
.getPlayerService()
.getPlayer(player)
.orElse(null);
if (zentrixPlayer != null) {
int kills = zentrixPlayer.getGameKills();
String teamId = zentrixPlayer.getTeamId().orElse("none");
boolean alive = zentrixPlayer.isAlive();
}
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescription@NotNull Optional<org.bukkit.entity.Player> Gets the underlying Bukkit player instance if online.doubleGets the total damage dealt by this player in the current game.doubleGets the total damage taken by this player in the current game.intGets the player's current kill count in this game.intGets the highest kill streak achieved in this game.intGets the player's current kill streak.@NotNull StringgetName()Gets the player's name.@NotNull Optional<PlayerClass> Gets the player's selected class.longGets the player's survival time in seconds.@NotNull Optional<ZentrixTeam> getTeam()Gets the player's team.Gets the player's team ID.@NotNull UUIDGets the player's unique identifier (UUID).booleanChecks if per-game statistics are available.booleanChecks if the player has selected a class.booleanhasTeam()Checks if the player has been assigned to a team.booleanisAlive()Checks if the player is alive (not eliminated/spectating).booleanisOnline()Checks if the player is currently online.booleanChecks if the player is spectating.
-
Method Details
-
getUniqueId
Gets the player's unique identifier (UUID).- Returns:
- The player's UUID (never null)
-
getName
Gets the player's name.- Returns:
- The player's name (never null)
-
getBukkitPlayer
Gets the underlying Bukkit player instance if online.The player may be offline if they disconnected during the game.
- Returns:
- Optional containing the Bukkit player, or empty if offline
-
isOnline
boolean isOnline()Checks if the player is currently online.- Returns:
trueif the player is online
-
getGameKills
int getGameKills()Gets the player's current kill count in this game.- Returns:
- The number of kills this game
-
getTeam
Gets the player's team.- Returns:
- Optional containing the team, or empty if not assigned
-
getTeamId
Gets the player's team ID.Format: "team-{number}" (e.g., "team-1", "team-2")
- Returns:
- Optional containing the team ID, or empty if not assigned
-
hasTeam
boolean hasTeam()Checks if the player has been assigned to a team.- Returns:
trueif the player is on a team
-
getSelectedClass
Gets the player's selected class.- Returns:
- Optional containing the class, or empty if none selected
-
hasSelectedClass
boolean hasSelectedClass()Checks if the player has selected a class.- Returns:
trueif a class is selected
-
isAlive
boolean isAlive()Checks if the player is alive (not eliminated/spectating).- Returns:
trueif the player is alive in the game
-
isSpectating
boolean isSpectating()Checks if the player is spectating.- Returns:
trueif the player is spectating
-
getDamageDealt
double getDamageDealt()Gets the total damage dealt by this player in the current game.- Returns:
- Damage dealt, or 0 if stats not tracked
-
getDamageTaken
double getDamageTaken()Gets the total damage taken by this player in the current game.- Returns:
- Damage taken, or 0 if stats not tracked
-
getKillStreak
int getKillStreak()Gets the player's current kill streak.Kill streak resets on death.
- Returns:
- Current kill streak, or 0 if none
-
getHighestKillStreak
int getHighestKillStreak()Gets the highest kill streak achieved in this game.- Returns:
- Highest kill streak, or 0 if none
-
getSurvivalTimeSeconds
long getSurvivalTimeSeconds()Gets the player's survival time in seconds.Measured from game start (not waiting lobby join).
- Returns:
- Survival time in seconds
-
hasGameStats
boolean hasGameStats()Checks if per-game statistics are available.Stats may not be available if the player just joined or the game hasn't started yet.
- Returns:
trueif stats are available
-