Record Class FinishedSession

java.lang.Object
java.lang.Record
com.djrapitops.plan.gathering.domain.FinishedSession
All Implemented Interfaces:
DateHolder

public record FinishedSession(UUID playerUUID, ServerUUID serverUUID, long start, long end, long afkTime, DataMap extraData) extends Record implements DateHolder
  • Constructor Details

    • FinishedSession

      public FinishedSession(UUID playerUUID, ServerUUID serverUUID, long start, long end, long afkTime, DataMap extraData)
      Creates an instance of a FinishedSession record class.
      Parameters:
      playerUUID - the value for the playerUUID record component
      serverUUID - the value for the serverUUID record component
      start - the value for the start record component
      end - the value for the end record component
      afkTime - the value for the afkTime record component
      extraData - the value for the extraData record component
  • Method Details

    • deserializeCSV

      public static Optional<FinishedSession> deserializeCSV(String serialized)
      Deserialize csv format of the session.
      Parameters:
      serialized - Serialized version of the session
      Returns:
      Proper session if the csv had 9 columns or more
      Throws:
      com.google.gson.JsonSyntaxException - if serialized format has a json syntax error
    • getLength

      public long getLength()
    • getActiveTime

      public long getActiveTime()
    • getMobKillCount

      public int getMobKillCount()
    • getDeathCount

      public int getDeathCount()
    • getPlayerKillCount

      public int getPlayerKillCount()
    • setAsFirstSessionIfMatches

      public void setAsFirstSessionIfMatches(Long registerDate)
    • isFirstSession

      public boolean isFirstSession()
    • getExtraData

      public <T> Optional<T> getExtraData(Class<T> ofType)
    • date

      public long date()
      Description copied from interface: DateHolder
      Get the date the object holds.
      Specified by:
      date in interface DateHolder
      Returns:
      Epoch ms - milliseconds passed since January 1st 1970.
    • toString

      public @NonNull 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
    • equals

      public 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • serializeCSV

      public String serializeCSV()
      Serialize into csv format.
      Returns:
      Serialized format
    • 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
    • playerUUID

      public UUID playerUUID()
      Returns the value of the playerUUID record component.
      Returns:
      the value of the playerUUID record component
    • serverUUID

      public ServerUUID serverUUID()
      Returns the value of the serverUUID record component.
      Returns:
      the value of the serverUUID record component
    • start

      public long start()
      Returns the value of the start record component.
      Returns:
      the value of the start record component
    • end

      public long end()
      Returns the value of the end record component.
      Returns:
      the value of the end record component
    • afkTime

      public long afkTime()
      Returns the value of the afkTime record component.
      Returns:
      the value of the afkTime record component
    • extraData

      public DataMap extraData()
      Returns the value of the extraData record component.
      Returns:
      the value of the extraData record component