Record Class ModeStats

java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.profile.ModeStats
Record Components:
matchesPlayed - matches played in this mode
wins - matches won in this mode
kills - kills in this mode
deaths - deaths in this mode

public record ModeStats(int matchesPlayed, int wins, int kills, int deaths) extends Record
One mode's share of a profile: solo or team matches.

Modes are counted from the first match Zentrix recorded with modes, so the lifetime totals in PlayerStats can include earlier matches neither mode holds.

Since:
1.8.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ModeStats
    No matches in this mode.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ModeStats(int matchesPlayed, int wins, int kills, int deaths)
    Creates an instance of a ModeStats record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the deaths record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double
    Kills per death with two decimals; the kill count when there are no deaths.
    int
    Returns the value of the kills record component.
    int
    Matches played but not won.
    int
    Returns the value of the matchesPlayed record component.
    final String
    Returns a string representation of this record class.
    double
    Win rate as a percentage with two decimals, or 0 without matches.
    int
    Returns the value of the wins record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • EMPTY

      public static final ModeStats EMPTY
      No matches in this mode.
  • Constructor Details

    • ModeStats

      public ModeStats(int matchesPlayed, int wins, int kills, int deaths)
      Creates an instance of a ModeStats record class.
      Parameters:
      matchesPlayed - the value for the matchesPlayed record component
      wins - the value for the wins record component
      kills - the value for the kills record component
      deaths - the value for the deaths record component
  • Method Details

    • losses

      public int losses()
      Matches played but not won.
    • winRate

      public double winRate()
      Win rate as a percentage with two decimals, or 0 without matches.
    • kdRatio

      public double kdRatio()
      Kills per death with two decimals; the kill count when there are no deaths.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • matchesPlayed

      public int matchesPlayed()
      Returns the value of the matchesPlayed record component.
      Returns:
      the value of the matchesPlayed record component
    • wins

      public int wins()
      Returns the value of the wins record component.
      Returns:
      the value of the wins record component
    • kills

      public int kills()
      Returns the value of the kills record component.
      Returns:
      the value of the kills record component
    • deaths

      public int deaths()
      Returns the value of the deaths record component.
      Returns:
      the value of the deaths record component