Class OnlineProfileLookup
java.lang.Object
me.pauleff.common.handlers.uuid.OnlineProfileLookup
Resolves online Minecraft player profiles via HTTP API lookups.
Prefer the static one-shot methods for single operations against the process-wide
configuration. Use of(ProfileApiConfig) when supplying a custom config,
or configure(ProfileApiConfig) once at startup (for example from CLI flags).
-
Method Summary
Modifier and TypeMethodDescriptionconfig()Returns the API configuration used by this lookup.static voidconfigure(ProfileApiConfig config) Replaces the process-wide lookup used by the static one-shot methods.static OnlineProfileLookupcurrent()Returns the process-wide lookup installed viaconfigure(ProfileApiConfig), or the Mojang-default lookup when nothing custom was configured.lookupName(UUID uuid) Resolves an online UUID to a Minecraft player name via HTTP API lookup.lookupOnlineUuid(String name) Resolves a player name to an online (Mojang) UUID via HTTP API lookup.static UUIDnameToOnlineUuid(String name) Resolves a player name to an online UUID using the process-wide lookup.static OnlineProfileLookupof(ProfileApiConfig config) Returns a lookup that uses the given API configuration and the default HTTP client.static OnlineProfileLookupof(ProfileApiConfig config, HttpGet http) Returns a lookup that uses the given API configuration and HTTP client.static StringonlineUuidToName(UUID uuid) Resolves an online UUID to a player name using the process-wide lookup.
-
Method Details
-
of
Returns a lookup that uses the given API configuration and the default HTTP client.- Parameters:
config- the profile API endpoint configuration- Returns:
- an online profile lookup
- Throws:
NullPointerException- ifconfigisnull
-
of
Returns a lookup that uses the given API configuration and HTTP client.- Parameters:
config- the profile API endpoint configurationhttp- the HTTP GET client- Returns:
- an online profile lookup
- Throws:
NullPointerException- ifconfigorhttpisnull
-
configure
Replaces the process-wide lookup used by the static one-shot methods.Called once at startup when custom API URLs are provided on the command line.
- Parameters:
config- the profile API endpoint configuration- Throws:
NullPointerException- ifconfigisnull
-
current
Returns the process-wide lookup installed viaconfigure(ProfileApiConfig), or the Mojang-default lookup when nothing custom was configured.- Returns:
- the current online profile lookup
-
nameToOnlineUuid
Resolves a player name to an online UUID using the process-wide lookup.- Parameters:
name- the Minecraft player name- Returns:
- the online UUID, or
nullif no profile or valid UUID was found - Throws:
IOException- if the HTTP request fails
-
onlineUuidToName
Resolves an online UUID to a player name using the process-wide lookup.- Parameters:
uuid- the online Minecraft player UUID- Returns:
- the player name, or
nullif no profile or name was found - Throws:
IOException- if the HTTP request fails
-
config
Returns the API configuration used by this lookup.- Returns:
- the profile API configuration
-
lookupOnlineUuid
Resolves a player name to an online (Mojang) UUID via HTTP API lookup.- Parameters:
name- the Minecraft player name- Returns:
- the online UUID, or
nullif no profile or valid UUID was found - Throws:
IOException- if the HTTP request fails
-
lookupName
Resolves an online UUID to a Minecraft player name via HTTP API lookup.- Parameters:
uuid- the online Minecraft player UUID- Returns:
- the player name, or
nullif no profile or name was found - Throws:
IOException- if the HTTP request fails
-