Class MojangUtils
java.lang.Object
net.minestom.server.utils.mojang.MojangUtils
Utils class using mojang API.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonObjectauthenticateSession(String loginUsername, String serverId, @Nullable SocketAddress userSocket) static @Nullable JsonObjectfromUsername(String username) Gets aJsonObjectwith the response from the mojang APIstatic @Nullable JsonObjectGets aJsonObjectwith the response from the mojang APIstatic @Nullable JsonObjectGets aJsonObjectwith the response from the mojang APIstatic StringgetUsername(UUID playerUUID) Gets a player's username from their UUIDstatic UUIDGets a player's UUID from their username
-
Constructor Details
-
MojangUtils
public MojangUtils()
-
-
Method Details
-
getUUID
Gets a player's UUID from their username- Parameters:
username- The players username- Returns:
- The
UUID - Throws:
IOException- with text detailing the exception
-
getUsername
Gets a player's username from their UUID- Parameters:
playerUUID- TheUUIDof the player- Returns:
- The player's username
- Throws:
IOException- with text detailing the exception
-
fromUuid
Gets aJsonObjectwith the response from the mojang API- Parameters:
uuid- The UUID as aUUID- Returns:
- The
JsonObjectornullif the mojang API is down or the UUID is invalid
-
fromUuid
Gets aJsonObjectwith the response from the mojang API- Parameters:
uuid- The UUID as aString- Returns:
- The
JsonObjectornullif the mojang API is down or the UUID is invalid
-
fromUsername
Gets aJsonObjectwith the response from the mojang API- Parameters:
username- The username as aString- Returns:
- The
JsonObjectornullif the mojang API is down or the username is invalid
-
authenticateSession
@Blocking @Internal public static JsonObject authenticateSession(String loginUsername, String serverId, @Nullable @Nullable SocketAddress userSocket) throws IOException - Throws:
IOException
-