Minestom wiki
Search…
Presentation
Setup
Dependencies
Your first server
Thread Architecture
Thread safety in the JVM
Acquirable API
World
Instances
Chunk management
Blocks
Coordinates
Generation
Batch
Feature
Adventure
Player capabilities
Events
Items
Entities
Tags
Schedulers
Commands
Inventories
Player UUID
Player skin
Permissions
Advancements
Map rendering
Query system
Open to LAN
Expansion
Extensions
Scripting
Storage
Data
Persistent data
Powered By
GitBook
Player skin
There are three ways of defining a player skin:
Setting your player UUID (see
here
) to their Mojang UUID, clients by default retrieve skin based on this value
Changing it in the
PlayerSkinInitEvent
event
Using the method
Player#setSkin(PlayerSkin)
How to retrieve skin data from Mojang
Using PlayerSkin methods
PlayerSkin
offers some utils methods to retrieve a skin using simple information such as a Mojang UUID or a Minecraft username
1
PlayerSkin
skinFromUUID
=
PlayerSkin
.
fromUuid
(
MOJANG_UUID_AS_STRING
);
2
​
3
PlayerSkin
skinFromUsername
=
PlayerSkin
.
fromUsername
(
"Notch"
);
Copied!
Those methods make direct requests to the Mojang API, it is recommended to cache the values.
Retrieve texture value & signature manually
Most of what I will say is described here:
https://wiki.vg/Mojang_API#Username_-.3E_UUID_at_time
​
You firstly need to get your Mojang UUID, which can be done by a request based on your username:
1
GET https://api.mojang.com/users/profiles/minecraft/<username>
Copied!
Then, after getting your UUID:
1
GET https://sessionserver.mojang.com/session/minecraft/profile/<uuid>?unsigned=false
Copied!
You'll get here both the texture value and the signature. Those values are used to create a
PlayerSkin
.
PlayerSkinInitEvent
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
1
player
.
addEventCallback
(
PlayerSkinInitEvent
.
class
,
event
->
{
2
PlayerSkin
skin
=
new
PlayerSkin
(
textureValue
,
signature
);
3
event
.
setSkin
(
skin
);
4
});
Copied!
Player#setSkin
1
PlayerSkin
skin
=
new
PlayerSkin
(
textureValue
,
signature
);
2
player
.
setSkin
(
skin
);
Copied!
Feature - Previous
Player UUID
Next - Feature
Permissions
Last modified
6mo ago
Copy link
Edit on GitHub
Contents
How to retrieve skin data from Mojang
Using PlayerSkin methods
Retrieve texture value & signature manually
PlayerSkinInitEvent
Player#setSkin