Class MojangAPIParser

java.lang.Object
one.tranic.t.base.parse.mojang.MojangAPIParser

public class MojangAPIParser extends Object
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 Details

    • MojangAPIParser

      public MojangAPIParser()
  • Method Details

    • lookupProfile

      public static ProfileLookup lookupProfile(String name) throws IOException
      Looks up a Minecraft profile by its username using the Mojang API.
      Parameters:
      name - the username of the Minecraft profile to be looked up
      Returns:
      a ProfileLookup object containing the profile's ID and username
      Throws:
      IOException - if an I/O error occurs while connecting to the Mojang API or parsing the response
    • lookupProfile

      public static ProfileLookup lookupProfile(UUID uuid) throws IOException
      Retrieves the Minecraft profile associated with the given UUID by performing a lookup request to the Mojang API.
      Parameters:
      uuid - the unique identifier of the Minecraft account to look up, must not be null
      Returns:
      a ProfileLookup record containing the profile information, including the UUID and username
      Throws:
      IOException - if an I/O error occurs while making the request or parsing the response
    • lookupProfile

      public static List<ProfileLookup> lookupProfile(String... names) throws IOException
      Retrieves a list of Minecraft profiles by performing a bulk lookup using an array of usernames.
      Parameters:
      names - an array of usernames to be looked up; each name represents a Minecraft user's profile
      Returns:
      a list of ProfileLookup records containing the id and name of the queried profiles
      Throws:
      IOException - if an I/O error occurs during the HTTP request or response handling