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 unstatedprofanityFilter- whether the profanity filter is on, ornullwhen the service did not sayfriendsPreferences- the friends preferences as the service sent them, keyed by wire name; empty when absentchatPreferences- the chat preferences as the service sent them, keyed by wire name; empty when absentbannedScopes- 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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne ban, as listed under a scope.static final recordThe privileges block. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe ban scope covering multiplayer servers — the one a host asks about before joining a server. -
Constructor Summary
ConstructorsConstructorDescriptionPlayerAttributes(PlayerAttributes.Privileges privileges, Boolean profanityFilter, Map<String, String> friendsPreferences, Map<String, String> chatPreferences, Map<String, PlayerAttributes.Ban> bannedScopes) Normalises the absent blocks to empties, so a caller never has to null-check them. -
Method Summary
Modifier and TypeMethodDescriptionReturns the ban on one scope.booleanbanned()Returns whether the service lists any ban on the account, in any scope.booleanReturns whether any listed ban is still in force at the given instant, discounting one whose expiry has passed.Returns the value of thebannedScopesrecord component.booleancanChat()Returns whether the account may use online chat.booleanReturns whether the account may join multiplayer servers: the privilege is enabled and noSCOPE_MULTIPLAYERban is listed.booleanReturns whether the account may join Realms.Returns the value of thechatPreferencesrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefriendsPreferencesrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theprivilegesrecord component.Returns the value of theprofanityFilterrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
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
-
PlayerAttributes
public PlayerAttributes(PlayerAttributes.Privileges privileges, Boolean profanityFilter, Map<String, String> friendsPreferences, Map<String, String> chatPreferences, Map<String, PlayerAttributes.Ban> bannedScopes) Normalises the absent blocks to empties, so a caller never has to null-check them.- Since:
- 0.12.0
-
-
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 noSCOPE_MULTIPLAYERban 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
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
Returns the ban on one scope.- Parameters:
scope- the scope name, for exampleSCOPE_MULTIPLAYER- Returns:
- the ban, or
nullwhen that scope is not banned - Since:
- 0.12.0
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
privileges
Returns the value of theprivilegesrecord component.- Returns:
- the value of the
privilegesrecord component
-
profanityFilter
Returns the value of theprofanityFilterrecord component.- Returns:
- the value of the
profanityFilterrecord component
-
friendsPreferences
Returns the value of thefriendsPreferencesrecord component.- Returns:
- the value of the
friendsPreferencesrecord component
-
chatPreferences
Returns the value of thechatPreferencesrecord component.- Returns:
- the value of the
chatPreferencesrecord component
-
bannedScopes
Returns the value of thebannedScopesrecord component.- Returns:
- the value of the
bannedScopesrecord component
-