Player skin
Last updated
Was this helpful?
Last updated
Was this helpful?
There are three ways of defining a player skin:
Setting your player UUID (see ) to their Mojang UUID, clients by default retrieve the skin based on this value. This is done automatically by MojangAuth.init()
Changing it in the PlayerSkinInitEvent
event
Using the method Player#setSkin(PlayerSkin)
PlayerSkin
offers some utils methods to retrieve a skin using simple information such as a Mojang UUID or a Minecraft username
Those methods make direct requests to the Mojang API, it is recommended to cache the values.
Most of what I will say is described here:
You firstly need to get your Mojang UUID, which can be done by a request based on your username:
Then, after getting your UUID:
You'll get here both the texture value and the signature. Those values are used to create a PlayerSkin
.
The event is called at the player connection and is used to define the skin to send to the player the first time. It is as simple as