Package net.minestom.server.utils.mojang
Class MojangUtils
java.lang.Object
net.minestom.server.utils.mojang.MojangUtils
Utils class using mojang API.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull com.google.gson.JsonObject
authenticateSession
(String loginUsername, String serverId, @Nullable SocketAddress userSocket) static @Nullable com.google.gson.JsonObject
fromUsername
(@NotNull String username) Gets aJsonObject
with the response from the mojang APIstatic @Nullable com.google.gson.JsonObject
Gets aJsonObject
with the response from the mojang APIstatic @Nullable com.google.gson.JsonObject
Gets aJsonObject
with the response from the mojang APIstatic @NotNull String
getUsername
(UUID playerUUID) Gets a player's username from their UUIDstatic @NotNull UUID
Gets 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
- TheUUID
of the player- Returns:
- The player's username
- Throws:
IOException
- with text detailing the exception
-
fromUuid
@Blocking @Nullable public static @Nullable com.google.gson.JsonObject fromUuid(@NotNull @NotNull UUID uuid) Gets aJsonObject
with the response from the mojang API- Parameters:
uuid
- The UUID as aUUID
- Returns:
- The
JsonObject
ornull
if the mojang API is down or the UUID is invalid
-
fromUuid
@Blocking @Nullable public static @Nullable com.google.gson.JsonObject fromUuid(@NotNull @NotNull String uuid) Gets aJsonObject
with the response from the mojang API- Parameters:
uuid
- The UUID as aString
- Returns:
- The
JsonObject
ornull
if the mojang API is down or the UUID is invalid
-
fromUsername
@Blocking @Nullable public static @Nullable com.google.gson.JsonObject fromUsername(@NotNull @NotNull String username) Gets aJsonObject
with the response from the mojang API- Parameters:
username
- The username as aString
- Returns:
- The
JsonObject
ornull
if the mojang API is down or the username is invalid
-
authenticateSession
@Blocking @Internal @NotNull public static @NotNull com.google.gson.JsonObject authenticateSession(String loginUsername, String serverId, @Nullable @Nullable SocketAddress userSocket) throws IOException - Throws:
IOException
-