Record Class NameEligibility
java.lang.Object
java.lang.Record
lol.trq.alts.account.NameEligibility
- Record Components:
nameChangeAllowed- whether a name change is permitted nowcreatedAt- when the account was created, ornullwhen the endpoint did not saychangedAt- when the name was last changed, ornullwhen it never was or the endpoint did not say; added in 0.12.0
public record NameEligibility(boolean nameChangeAllowed, Instant createdAt, Instant changedAt)
extends Record
Whether an account may change its name right now, from
GET /minecraft/profile/namechange.
Mojang enforces a cooldown between name changes; nameChangeAllowed is whether the account is
past it. createdAt is when the account was made, which a host turns into account age, and
changedAt is when the name last changed — the anchor for the cooldown a caller may want to
display.
- Since:
- 0.11.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurationThe documented wait between two name changes. -
Constructor Summary
ConstructorsConstructorDescriptionNameEligibility(boolean nameChangeAllowed, Instant createdAt) Creates an eligibility with no known last-change time — the shape this record had beforechangedAtwas added.NameEligibility(boolean nameChangeAllowed, Instant createdAt, Instant changedAt) Creates an instance of aNameEligibilityrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns how long ago the account was created, ornullwhen the creation time is unknown.Returns the value of thechangedAtrecord component.Returns the value of thecreatedAtrecord component.final booleanIndicates whether some other object is "equal to" this one.Estimates the earliest instant the name can next be changed: the last change plus the documentedNAME_CHANGE_COOLDOWN.estimatedWaitAt(Instant now) Estimates how long remains until the name can next be changed, by the same arithmetic and with the same caveats asestimatedNextChange().final inthashCode()Returns a hash code value for this object.booleanReturns the value of thenameChangeAllowedrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
NAME_CHANGE_COOLDOWN
The documented wait between two name changes.- Since:
- 0.12.0
-
-
Constructor Details
-
NameEligibility
Creates an eligibility with no known last-change time — the shape this record had beforechangedAtwas added.- Parameters:
nameChangeAllowed- whether a name change is permitted nowcreatedAt- when the account was created, ornull- Since:
- 0.11.0
-
NameEligibility
Creates an instance of aNameEligibilityrecord class.- Parameters:
nameChangeAllowed- the value for thenameChangeAllowedrecord componentcreatedAt- the value for thecreatedAtrecord componentchangedAt- the value for thechangedAtrecord component
-
-
Method Details
-
ageAt
-
estimatedNextChange
Estimates the earliest instant the name can next be changed: the last change plus the documentedNAME_CHANGE_COOLDOWN.An estimate, not the service's answer. The endpoint returns no such date; this is arithmetic over the one it does return and a cooldown length taken from documentation, which the service is free to change or to apply differently to a given account. Use it to show a user roughly when to come back.
nameChangeAllowed()is the authority on whether a change is permitted now, and where the two disagree the flag is right.- Returns:
- the estimated instant, or
nullwhen the last-change time is unknown — including for a name that has never been changed - Since:
- 0.12.0
-
estimatedWaitAt
Estimates how long remains until the name can next be changed, by the same arithmetic and with the same caveats asestimatedNextChange().- Parameters:
now- the current instant to measure against- Returns:
- the estimated wait; zero when a change is already allowed or the estimate has passed, and
nullwhen a change is not allowed and there is nothing to estimate from - 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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
nameChangeAllowed
@SerializedName("nameChangeAllowed") public boolean nameChangeAllowed()Returns the value of thenameChangeAllowedrecord component.- Returns:
- the value of the
nameChangeAllowedrecord component
-
createdAt
-
changedAt
-