Interface ZentrixPlayer
It exposes the player's identity, game statistics, team membership, and selected class.
Example
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 TypeMethodDescriptiondefault intGets the assists credited to the player in this game.@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.default doubleGets this game's longest ranged kill, in blocks from where the shot was fired.@NotNull StringgetName()Gets the player's name.default @NotNull ParticipantStateWhere the player stands in their match.default intGets the kills in this game whose killing blow was a projectile.default intGets the teammates this player revived in this game.@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.This is the class the player plays with: their explicit choice, or the configured default when they made none, resolved exactly as gameplay resolves it. For an eliminated participant it is the class they played with. Use
ClassService.getExplicitClass(java.util.UUID)to tell an explicit choice apart from the default.- 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
-
getAssists
default int getAssists()Gets the assists credited to the player in this game.- Returns:
- Assists this game, or 0 when stats are not available
- Since:
- 1.8.0
-
getRevives
default int getRevives()Gets the teammates this player revived in this game.- Returns:
- Revives this game, or 0 when stats are not available
- Since:
- 1.8.0
-
getRangedKills
default int getRangedKills()Gets the kills in this game whose killing blow was a projectile.- Returns:
- Ranged kills this game, or 0 when stats are not available
- Since:
- 1.8.0
-
getLongestRangedKill
default double getLongestRangedKill()Gets this game's longest ranged kill, in blocks from where the shot was fired.- Returns:
- The distance, or 0 without a ranged kill
- Since:
- 1.8.0
-
getParticipantState
Where the player stands in their match.Tells an eliminated participant, whose statistics, team and class are kept from when they were playing, apart from a spectator who never played.
- Returns:
- The player's state in the match
- Since:
- 1.8.0
-