Record Class MinecraftAccount

java.lang.Object
java.lang.Record
com.soulfiremc.server.account.MinecraftAccount
Record Components:
authType - The type of authentication
profileId - Identifier that uniquely identifies the account
lastKnownName - The last known name of the account
accountData - The data of the account (values depend on the authType)
settings - Per-bot settings
persistentMetadata - Persistent metadata stored with the account
All Implemented Interfaces:
SettingsSource.Stem<SettingsSource.Bot>

public record MinecraftAccount(AuthType authType, UUID profileId, String lastKnownName, AccountData accountData, @Nullable Map<String, Map<String, com.google.gson.JsonElement>> settings, @Nullable Map<String, Map<String, com.google.gson.JsonElement>> persistentMetadata) extends Record implements SettingsSource.Stem<SettingsSource.Bot>
Represents an authenticated MC account. This can be a premium, offline or bedrock account. Beware that the profileId is not a valid online UUID for offline and bedrock accounts.
  • Constructor Details

    • MinecraftAccount

      public MinecraftAccount(AuthType authType, UUID profileId, String lastKnownName, AccountData accountData, @Nullable Map<String, Map<String, com.google.gson.JsonElement>> settings, @Nullable Map<String, Map<String, com.google.gson.JsonElement>> persistentMetadata)
      Creates an instance of a MinecraftAccount record class.
      Parameters:
      authType - the value for the authType record component
      profileId - the value for the profileId record component
      lastKnownName - the value for the lastKnownName record component
      accountData - the value for the accountData record component
      settings - the value for the settings record component
      persistentMetadata - the value for the persistentMetadata record component
  • Method Details

    • fromProto

      public static MinecraftAccount fromProto(MinecraftAccountProto account)
    • toString

      public 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
    • toProto

      public MinecraftAccountProto toProto()
    • withAuthType

      @NotNull public @NotNull MinecraftAccount withAuthType(AuthType authType)
      Returns:
      this.
    • withProfileId

      @NotNull public @NotNull MinecraftAccount withProfileId(UUID profileId)
      Returns:
      this.
    • withLastKnownName

      @NotNull public @NotNull MinecraftAccount withLastKnownName(String lastKnownName)
      Returns:
      this.
    • withAccountData

      @NotNull public @NotNull MinecraftAccount withAccountData(AccountData accountData)
      Returns:
      this.
    • withSettings

      @NotNull public @NotNull MinecraftAccount withSettings(@Nullable Map<String, Map<String, com.google.gson.JsonElement>> settings)
      Returns:
      this.
    • withPersistentMetadata

      @NotNull public @NotNull MinecraftAccount withPersistentMetadata(@Nullable Map<String, Map<String, com.google.gson.JsonElement>> persistentMetadata)
      Returns:
      this.
    • 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.
    • authType

      public AuthType authType()
      Returns the value of the authType record component.
      Returns:
      the value of the authType record component
    • profileId

      public UUID profileId()
      Returns the value of the profileId record component.
      Returns:
      the value of the profileId record component
    • lastKnownName

      public String lastKnownName()
      Returns the value of the lastKnownName record component.
      Returns:
      the value of the lastKnownName record component
    • accountData

      public AccountData accountData()
      Returns the value of the accountData record component.
      Returns:
      the value of the accountData record component
    • settings

      public @Nullable Map<String, Map<String, com.google.gson.JsonElement>> settings()
      Returns the value of the settings record component.
      Specified by:
      settings in interface SettingsSource.Stem<SettingsSource.Bot>
      Returns:
      the value of the settings record component
    • persistentMetadata

      public @Nullable Map<String, Map<String, com.google.gson.JsonElement>> persistentMetadata()
      Returns the value of the persistentMetadata record component.
      Returns:
      the value of the persistentMetadata record component