Record Class PlayerAttributes

java.lang.Object
java.lang.Record
lol.trq.alts.account.PlayerAttributes
Record Components:
privileges - what the account may do online; never null, its members null where unstated
profanityFilter - whether the profanity filter is on, or null when the service did not say
friendsPreferences - the friends preferences as the service sent them, keyed by wire name; empty when absent
chatPreferences - the chat preferences as the service sent them, keyed by wire name; empty when absent
bannedScopes - the bans the account is serving, keyed by scope; empty for an account in good standing

public record PlayerAttributes(PlayerAttributes.Privileges privileges, Boolean profanityFilter, Map<String,String> friendsPreferences, Map<String,String> chatPreferences, Map<String, PlayerAttributes.Ban> bannedScopes) extends Record
What an account is allowed to do online, from GET /player/attributes: its privileges, its safety preferences, and any ban it is serving.

Read leniently, because the endpoint grows: every block is optional, a field this release does not know is ignored, and a ban scope it has not heard of is kept under its own name rather than dropped. A privilege the service did not state is null — "not said" — which the convenience accessors treat as not granted, the same reading the game itself makes.

Since:
0.12.0
  • Field Details

    • SCOPE_MULTIPLAYER

      public static final String SCOPE_MULTIPLAYER
      The ban scope covering multiplayer servers — the one a host asks about before joining a server.
      Since:
      0.12.0
      See Also:
  • Constructor Details

  • Method Details

    • canChat

      public boolean canChat()
      Returns whether the account may use online chat.
      Returns:
      true only if the service stated the chat privilege as enabled
      Since:
      0.12.0
    • canPlayMultiplayer

      public boolean canPlayMultiplayer()
      Returns whether the account may join multiplayer servers: the privilege is enabled and no SCOPE_MULTIPLAYER ban is listed.
      Returns:
      true if multiplayer is permitted and the account is not banned from it
      Since:
      0.12.0
    • canPlayRealms

      public boolean canPlayRealms()
      Returns whether the account may join Realms.
      Returns:
      true only if the service stated the Realms privilege as enabled
      Since:
      0.12.0
    • banned

      public boolean banned()
      Returns whether the service lists any ban on the account, in any scope.
      Returns:
      true if at least one scope is banned
      Since:
      0.12.0
    • bannedAt

      public boolean bannedAt(Instant now)
      Returns whether any listed ban is still in force at the given instant, discounting one whose expiry has passed.
      Parameters:
      now - the instant to measure against
      Returns:
      true if a permanent or unexpired ban is listed
      Since:
      0.12.0
    • ban

      public PlayerAttributes.Ban ban(String scope)
      Returns the ban on one scope.
      Parameters:
      scope - the scope name, for example SCOPE_MULTIPLAYER
      Returns:
      the ban, or null when that scope is not banned
      Since:
      0.12.0
    • 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 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.
    • privileges

      @SerializedName("privileges") public PlayerAttributes.Privileges privileges()
      Returns the value of the privileges record component.
      Returns:
      the value of the privileges record component
    • profanityFilter

      @SerializedName("profanityFilterPreferences") public Boolean profanityFilter()
      Returns the value of the profanityFilter record component.
      Returns:
      the value of the profanityFilter record component
    • friendsPreferences

      @SerializedName("friendsPreferences") public Map<String,String> friendsPreferences()
      Returns the value of the friendsPreferences record component.
      Returns:
      the value of the friendsPreferences record component
    • chatPreferences

      @SerializedName("chatPreferences") public Map<String,String> chatPreferences()
      Returns the value of the chatPreferences record component.
      Returns:
      the value of the chatPreferences record component
    • bannedScopes

      @SerializedName("banStatus") public Map<String, PlayerAttributes.Ban> bannedScopes()
      Returns the value of the bannedScopes record component.
      Returns:
      the value of the bannedScopes record component