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 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.
      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