MojangAPI interface provides utilities for interacting with the Mojang API, allowing you to fetch player information, profiles, and manage skins.
Accessing MojangAPI
Player Lookups
getUUID
Retrieve a player’s UUID from their username.- Kotlin
- Java
name: String- The player’s username
CompletableFuture<UUID>? - A future that resolves to the player’s UUID, or null if the request fails
Reference: Mojang API - Username to UUID
getName
Retrieve a player’s username from their UUID.uuid: UUID- The player’s UUID
CompletableFuture<String>? - A future that resolves to the player’s username, or null if the request fails
Reference: Mojang API - Usernames to UUIDs
Player Profiles
getProfile
Retrieve the complete player profile including skin and cape information.uuid: UUID- The player’s UUID
Profile? - The player’s profile object, or null if the request fails
Reference: Mojang API - UUID to Profile and Skin/Cape
Skin Management
changeSkin
Send a skin change request to Mojang. The player must rejoin the server to see the new skin.accessToken: String- Session token for authentication with Mojanguuid: UUID- Player UUID (must match the session token)model: Model- Skin model type (STEVE or ALEX)url: String- Image URL of the new skin
SkinResponse? - Response from Mojang, or null if the request fails
Reference: Mojang API - Change Skin
Data Types
Profile
ProfileTextures
Model
Skin model enumeration:SkinResponse
Name (Deprecated)
Method Reference
Common Use Cases
Looking Up Player Information
Displaying Player Skins
Async Player Lookup
Checking Skin Model
Notes
- All network operations return futures or nullable types - always handle failure cases
- The Mojang API has rate limits - cache responses when possible
- Name history endpoint has been deprecated by Mojang and is no longer functional
- Skin changes require valid authentication tokens
- Players must rejoin servers to see skin changes take effect