Record Class SessionData

java.lang.Object
java.lang.Record
lol.trq.alts.model.SessionData
Record Components:
username - the player's username
uuid - the player's UUID, dashed
accessToken - the session access token (empty for offline accounts)
type - the protocol the account was authenticated with

public record SessionData(String username, String uuid, String accessToken, AccountType type) extends Record
A transport-neutral description of a resolved account, handed to the host's SessionInjector so it can install the session in whatever form its platform uses. Deliberately free of any Minecraft or renderer type so the library stays consumer-agnostic.
Since:
0.1.0
  • Constructor Details

    • SessionData

      public SessionData(String username, String uuid, String accessToken, AccountType type)
      Creates an instance of a SessionData record class.
      Parameters:
      username - the value for the username record component
      uuid - the value for the uuid record component
      accessToken - the value for the accessToken record component
      type - the value for the type record component
  • Method Details

    • toString

      public String toString()
      Returns a description of this session with the access token redacted, so a host that logs what it was handed does not write a live credential to disk.
      Specified by:
      toString in class Record
      Returns:
      a loggable description carrying no credential
      Since:
      0.6.0
    • 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 Objects::equals(Object,Object).
      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.
    • username

      public String username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • uuid

      public String uuid()
      Returns the value of the uuid record component.
      Returns:
      the value of the uuid record component
    • accessToken

      public String accessToken()
      Returns the value of the accessToken record component.
      Returns:
      the value of the accessToken record component
    • type

      public AccountType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component