Record Class PlayerData

java.lang.Object
java.lang.Record
com.btcvelocity.api.storage.PlayerData
Record Components:
uuid - the player's unique identifier
username - the player's username
ipAddress - the player's IP address, or null if unavailable
proxyId - the identifier of the proxy the player is connected to
serverName - the name of the backend server the player is on, or null if the player has not yet joined a server
lastSeen - the epoch millisecond timestamp of the player's last activity
firstJoin - the epoch millisecond timestamp of the player's first join
playtimeSeconds - the total accumulated playtime in seconds

public record PlayerData(@NotNull UUID uuid, @NotNull String username, @Nullable String ipAddress, @NotNull String proxyId, @Nullable String serverName, long lastSeen, long firstJoin, long playtimeSeconds) extends Record
Immutable record representing persisted player data stored in the PostgreSQL backend.

This record is produced by StorageService query operations and consumed by StorageService.upsertPlayer(PlayerData) for persistence. All timestamps are epoch milliseconds.

  • Constructor Details

    • PlayerData

      public PlayerData(@NotNull @NotNull UUID uuid, @NotNull @NotNull String username, @Nullable @Nullable String ipAddress, @NotNull @NotNull String proxyId, @Nullable @Nullable String serverName, long lastSeen, long firstJoin, long playtimeSeconds)
      Creates an instance of a PlayerData record class.
      Parameters:
      uuid - the value for the uuid record component
      username - the value for the username record component
      ipAddress - the value for the ipAddress record component
      proxyId - the value for the proxyId record component
      serverName - the value for the serverName record component
      lastSeen - the value for the lastSeen record component
      firstJoin - the value for the firstJoin record component
      playtimeSeconds - the value for the playtimeSeconds record component
  • Method Details

    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • uuid

      @NotNull public @NotNull UUID uuid()
      Returns the value of the uuid record component.
      Returns:
      the value of the uuid record component
    • username

      @NotNull public @NotNull String username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • ipAddress

      @Nullable public @Nullable String ipAddress()
      Returns the value of the ipAddress record component.
      Returns:
      the value of the ipAddress record component
    • proxyId

      @NotNull public @NotNull String proxyId()
      Returns the value of the proxyId record component.
      Returns:
      the value of the proxyId record component
    • serverName

      @Nullable public @Nullable String serverName()
      Returns the value of the serverName record component.
      Returns:
      the value of the serverName record component
    • lastSeen

      public long lastSeen()
      Returns the value of the lastSeen record component.
      Returns:
      the value of the lastSeen record component
    • firstJoin

      public long firstJoin()
      Returns the value of the firstJoin record component.
      Returns:
      the value of the firstJoin record component
    • playtimeSeconds

      public long playtimeSeconds()
      Returns the value of the playtimeSeconds record component.
      Returns:
      the value of the playtimeSeconds record component