Interface ZentrixPlayer


public interface ZentrixPlayer
Read-only view of a player in a Zentrix game.

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 Details

    • getUniqueId

      @NotNull @NotNull UUID getUniqueId()
      Gets the player's unique identifier (UUID).
      Returns:
      The player's UUID (never null)
    • getName

      @NotNull @NotNull String getName()
      Gets the player's name.
      Returns:
      The player's name (never null)
    • getBukkitPlayer

      @NotNull @NotNull Optional<org.bukkit.entity.Player> 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:
      true if 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

      @NotNull @NotNull Optional<ZentrixTeam> getTeam()
      Gets the player's team.
      Returns:
      Optional containing the team, or empty if not assigned
    • getTeamId

      @NotNull @NotNull Optional<String> 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:
      true if the player is on a team
    • getSelectedClass

      @NotNull @NotNull Optional<PlayerClass> 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:
      true if a class is selected
    • isAlive

      boolean isAlive()
      Checks if the player is alive (not eliminated/spectating).
      Returns:
      true if the player is alive in the game
    • isSpectating

      boolean isSpectating()
      Checks if the player is spectating.
      Returns:
      true if 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:
      true if 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

      @NotNull default @NotNull ParticipantState 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