Interface PlayerStats


public interface PlayerStats
Represents a player's lifetime statistics in Zentrix.

This interface provides access to persistent statistics that are accumulated across all games a player has participated in.

Example Usage


 PlayerStats stats = ZentrixProvider.get()
     .getProfileService()
     .getCachedStats(player.getUniqueId());

 int wins = stats.getWins();
 int kills = stats.getKills();
 double kd = stats.getKDRatio();
 double winRate = stats.getWinRate();

 player.sendMessage("Stats - Wins: " + wins + ", K/D: " + kd);
 
Since:
1.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Calculates the average kills per game.
    double
    Calculates the average survival time per game, in seconds.
    int
    Gets the current consecutive win streak.
    double
    Gets the total damage dealt across all games.
    default double
    Gets the damage ratio (dealt / taken).
    double
    Gets the total damage taken across all games.
    int
    Gets the total number of deaths across all games.
    int
    Gets the highest number of kills achieved in a single game.
    int
    Gets the highest kill streak achieved in a single game.
    int
    Gets the highest consecutive win streak ever achieved.
    double
    Calculates the kill/death ratio.
    int
    Gets the total number of kills across all games.
    double
    Gets the longest survival time in a single game, in seconds.
    default int
    Gets the number of losses (matches played minus wins).
    int
    Gets the total number of matches played.
    double
    Gets the total survival time across all games, in seconds.
    double
    Calculates the win rate as a percentage.
    int
    Gets the total number of games won.
    default boolean
    Checks if the player has any recorded statistics.
  • Method Details

    • getWins

      int getWins()
      Gets the total number of games won.
      Returns:
      Total wins
    • getMatchesPlayed

      int getMatchesPlayed()
      Gets the total number of matches played.
      Returns:
      Total matches played
    • getKills

      int getKills()
      Gets the total number of kills across all games.
      Returns:
      Total kills
    • getDeaths

      int getDeaths()
      Gets the total number of deaths across all games.
      Returns:
      Total deaths
    • getDamageDealt

      double getDamageDealt()
      Gets the total damage dealt across all games.
      Returns:
      Total damage dealt
    • getDamageTaken

      double getDamageTaken()
      Gets the total damage taken across all games.
      Returns:
      Total damage taken
    • getHighestKillGame

      int getHighestKillGame()
      Gets the highest number of kills achieved in a single game.
      Returns:
      Highest kills in one game
    • getHighestKillStreak

      int getHighestKillStreak()
      Gets the highest kill streak achieved in a single game.
      Returns:
      Highest kill streak
    • getTotalSurvivalTime

      double getTotalSurvivalTime()
      Gets the total survival time across all games, in seconds.
      Returns:
      Total survival time in seconds
    • getLongestSurvivalTime

      double getLongestSurvivalTime()
      Gets the longest survival time in a single game, in seconds.
      Returns:
      Longest survival time in seconds
    • getCurrentWinStreak

      int getCurrentWinStreak()
      Gets the current consecutive win streak.

      This resets to 0 when the player loses a game.

      Returns:
      Current win streak
    • getHighestWinStreak

      int getHighestWinStreak()
      Gets the highest consecutive win streak ever achieved.
      Returns:
      Highest win streak
    • getKDRatio

      double getKDRatio()
      Calculates the kill/death ratio.

      If deaths is 0, returns the kill count as the ratio.

      Returns:
      K/D ratio rounded to 2 decimal places
    • getWinRate

      double getWinRate()
      Calculates the win rate as a percentage.

      Returns 0 if no matches have been played.

      Returns:
      Win rate percentage (0-100)
    • getAverageKills

      double getAverageKills()
      Calculates the average kills per game.

      Returns 0 if no matches have been played.

      Returns:
      Average kills per game
    • getAverageSurvivalTime

      double getAverageSurvivalTime()
      Calculates the average survival time per game, in seconds.

      Returns 0 if no matches have been played.

      Returns:
      Average survival time in seconds
    • getLosses

      default int getLosses()
      Gets the number of losses (matches played minus wins).
      Returns:
      Total losses
    • hasPlayed

      default boolean hasPlayed()
      Checks if the player has any recorded statistics.

      Returns true if the player has played at least one match.

      Returns:
      true if the player has played any games
    • getDamageRatio

      default double getDamageRatio()
      Gets the damage ratio (dealt / taken).

      Returns damage dealt if no damage has been taken.

      Returns:
      Damage ratio