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 TypeMethodDescriptiondoubleCalculates the average kills per game.doubleCalculates the average survival time per game, in seconds.intGets the current consecutive win streak.doubleGets the total damage dealt across all games.default doubleGets the damage ratio (dealt / taken).doubleGets the total damage taken across all games.intGets the total number of deaths across all games.intGets the highest number of kills achieved in a single game.intGets the highest kill streak achieved in a single game.intGets the highest consecutive win streak ever achieved.doubleCalculates the kill/death ratio.intgetKills()Gets the total number of kills across all games.doubleGets the longest survival time in a single game, in seconds.default intGets the number of losses (matches played minus wins).intGets the total number of matches played.doubleGets the total survival time across all games, in seconds.doubleCalculates the win rate as a percentage.intgetWins()Gets the total number of games won.default booleanChecks 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:
trueif 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
-