Package net.minestom.server.utils.mojang
Class MojangUtils
java.lang.Object
net.minestom.server.utils.mojang.MojangUtils
Utils class using mojang API.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable com.google.gson.JsonObjectfromUsername(@NotNull String username) Gets aJsonObjectwith the response from the mojang APIstatic @Nullable com.google.gson.JsonObjectGets aJsonObjectwith the response from the mojang APIstatic @Nullable com.google.gson.JsonObjectGets aJsonObjectwith the response from the mojang APIstatic @NotNull StringgetUsername(UUID playerUUID) Gets a player's username from their UUIDstatic @NotNull 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
@Blocking @Nullable public static @Nullable com.google.gson.JsonObject fromUuid(@NotNull @NotNull UUID uuid) 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
@Blocking @Nullable public static @Nullable com.google.gson.JsonObject fromUuid(@NotNull @NotNull String uuid) 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
@Blocking @Nullable public static @Nullable com.google.gson.JsonObject fromUsername(@NotNull @NotNull String username) 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
-