Package one.tranic.t.base.parse.mojang
Class MojangAPIParser
java.lang.Object
one.tranic.t.base.parse.mojang.MojangAPIParser
MojangAPIParser is a utility class for interacting with the Mojang API to perform profile lookups.
It provides methods to retrieve Minecraft profile information by username, UUID, or a batch of usernames.
Connections are established using the RequestWithProxyParser class to support proxy configurations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ProfileLookuplookupProfile(boolean useProxy, String name) Looks up profile information for a given username from a remote server.static ProfileLookuplookupProfile(boolean useProxy, UUID uuid) Looks up a profile from the Mojang API using the specified UUID.static ProfileLookuplookupProfile(String name) Retrieves the profile information for a user based on their username.static ProfileLookuplookupProfile(UUID uuid) Retrieves the profile information associated with the specified UUID.static List<ProfileLookup>lookupProfiles(boolean useProxy, String... names) Looks up profiles for the given list of names by sending an HTTP request to the Mojang API.static List<ProfileLookup>lookupProfiles(String... names) Retrieves a list of profile lookups for the given player names.
-
Constructor Details
-
MojangAPIParser
public MojangAPIParser()
-
-
Method Details
-
lookupProfile
Retrieves the profile information for a user based on their username.- Parameters:
name- the username for which profile information is to be looked up- Returns:
- a
ProfileLookupobject containing the profile information - Throws:
IOException- if an I/O error occurs during the profile lookup
-
lookupProfile
Looks up profile information for a given username from a remote server.- Parameters:
useProxy- whether to use a proxy connection for the requestname- the username to look up- Returns:
- the
ProfileLookupcontaining the profile ID and name - Throws:
IOException- if an I/O error occurs while performing the request or reading the response
-
lookupProfile
Retrieves the profile information associated with the specified UUID.- Parameters:
uuid- theUUIDof the profile to lookup; must not be null- Returns:
- a
ProfileLookupcontaining the profile information corresponding to the given UUID - Throws:
IOException- if an I/O error occurs while making the request or processing the response
-
lookupProfile
Looks up a profile from the Mojang API using the specified UUID.- Parameters:
useProxy- a boolean indicating whether a proxy should be used for the connectionuuid- the UUID of the profile to lookup, must not be null- Returns:
- a
ProfileLookupobject containing the profile information - Throws:
IOException- if an error occurs during the network request or while reading the response
-
lookupProfiles
Retrieves a list of profile lookups for the given player names.- Parameters:
names- the array of player names to look up profiles for; each name must be a valid string- Returns:
- a list of
ProfileLookuprecords containing the ID and name of each requested profile - Throws:
IOException- if an I/O error occurs during the HTTP request or response parsing
-
lookupProfiles
public static List<ProfileLookup> lookupProfiles(boolean useProxy, String... names) throws IOException Looks up profiles for the given list of names by sending an HTTP request to the Mojang API.- Parameters:
useProxy- a boolean indicating whether to use a proxy for the HTTP connectionnames- a variable-length list of usernames to look up profiles for- Returns:
- a list of
ProfileLookuprepresenting the fetched profile information for each provided name - Throws:
IOException- if an I/O error occurs while making the request or processing the response
-