Record Class ProfileApiConfig

java.lang.Object
java.lang.Record
me.pauleff.common.handlers.uuid.ProfileApiConfig

public record ProfileApiConfig(String customApiBaseUrl, String retrieveUuidUrl, String retrieveNameUrl) extends Record
Immutable endpoint configuration for online Minecraft profile lookups.

Endpoint-specific URLs override the shared custom base URL, which in turn overrides the Mojang / Minecraft Services defaults.

  • Constructor Details

    • ProfileApiConfig

      public ProfileApiConfig(String customApiBaseUrl, String retrieveUuidUrl, String retrieveNameUrl)
      Creates a config with normalized URL fields.
      Parameters:
      customApiBaseUrl - shared custom API base URL, or null/blank to unset
      retrieveUuidUrl - name-to-UUID endpoint prefix, or null/blank to unset
      retrieveNameUrl - UUID-to-name endpoint prefix, or null/blank to unset
  • Method Details

    • defaults

      public static ProfileApiConfig defaults()
      Returns a config that uses Mojang defaults for all lookups.
      Returns:
      the default profile API configuration
    • withCustomApiBaseUrl

      public ProfileApiConfig withCustomApiBaseUrl(String url)
      Returns a copy with a different shared custom API base URL.
      Parameters:
      url - the custom API base URL, or null/blank to clear it
      Returns:
      a new config with the updated base URL
    • withRetrieveUuidUrl

      public ProfileApiConfig withRetrieveUuidUrl(String url)
      Returns a copy with a different name-to-UUID endpoint prefix.

      When set, this overrides customApiBaseUrl() and the default Mojang endpoint. The player name is appended to the given URL.

      Parameters:
      url - the custom retrieve-UUID URL prefix, or null/blank to clear it
      Returns:
      a new config with the updated retrieve-UUID URL
    • withRetrieveNameUrl

      public ProfileApiConfig withRetrieveNameUrl(String url)
      Returns a copy with a different UUID-to-name endpoint prefix.

      When set, this overrides customApiBaseUrl() and the default Minecraft Services endpoint. The UUID string is appended to the given URL.

      Parameters:
      url - the custom retrieve-name URL prefix, or null/blank to clear it
      Returns:
      a new config with the updated retrieve-name URL
    • nameToUuidUrl

      public String nameToUuidUrl(String name)
      Builds the request URL used to resolve a player name to an online UUID.
      Parameters:
      name - the Minecraft player name
      Returns:
      the fully constructed request URL
    • uuidToNameUrl

      public String uuidToNameUrl(UUID uuid)
      Builds the request URL used to resolve an online UUID to a player name.
      Parameters:
      uuid - the Minecraft player UUID
      Returns:
      the fully constructed request URL
    • 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.
    • customApiBaseUrl

      public String customApiBaseUrl()
      Returns the value of the customApiBaseUrl record component.
      Returns:
      the value of the customApiBaseUrl record component
    • retrieveUuidUrl

      public String retrieveUuidUrl()
      Returns the value of the retrieveUuidUrl record component.
      Returns:
      the value of the retrieveUuidUrl record component
    • retrieveNameUrl

      public String retrieveNameUrl()
      Returns the value of the retrieveNameUrl record component.
      Returns:
      the value of the retrieveNameUrl record component