MojangAPI utility provides methods for interacting with the Mojang API to fetch player information, profiles, and manage skins.
Accessing MojangAPI
Get an instance using dependency injection:Player lookups
getUUID
Get a player’s UUID from their username.getName
Get a player’s current username from their UUID.Profile data
getProfile
Get a complete player profile including skin and cape information.Skin management
changeSkin
Change a player’s skin using their session token.After successfully changing a skin, the player must disconnect from their current server and reconnect to see the changes.
Data types
Profile
Player profile data from the Mojang API.Player UUID as a string without dashes.
Player’s current username.
Profile properties containing encoded texture data.
Decoded skin and cape information (computed property).
ProfileTextures
Decoded texture information for a player.Timestamp of when the profile was fetched.
Player’s UUID.
Player’s username.
Skin and cape texture URLs.
Textures
Skin and cape texture URLs.Player’s skin texture.
Player’s cape texture (if they have one).
Model
Skin model type enumeration.Classic/default skin model with 4-pixel wide arms.
Slim skin model with 3-pixel wide arms.
Model methods
SkinResponse
Response from a skin change request.Response identifier.
Player’s username.
List of player’s skins.
List of player’s capes.
API reference
Methods
Get a player’s UUID from their username. Returns null if the request fails.See wiki.vg documentation.
Get a player’s username from their UUID. Returns null if the request fails.See wiki.vg documentation.
Get the complete player profile including skin and cape data. Returns null if the request fails.See wiki.vg documentation.
Send a skin change request. Requires a valid session token for authentication. Returns null if the request fails.See wiki.vg documentation.