Player Profile
Get Player Data from Mojang’s API
This class uses Mojang’s API to fetch general data about players.
Data
name
— The current Player Nameid
— The UUID of the Playerskin
— The URL where the skin image is savedisSlim
— Whether the skin is slim or normalcape
— The URL where the cape image is savedgetSkinId()
— Caches theskin
image and auto-assigns anResourceLocation
to itgetCapeId()
— Caches thecape
image and auto-assigns anResourceLocation
to it
Get Player ID
To get the UUID of a player by it’s name, you can use:
PlayerProfile.getUUID(playerName);
This method can be very slow since tries to fetch the data from Mojang’s API, if it wasn’t already cached and can therefore take quite some time. Consider running it asynchronous by using CompletableFuture.runAsync(() -> PlayerProfile.getUUID(playerName););
You might as well only ask for the cached values, but it might return null
s if the value wasn’t already cached.
PlayerProfile.getCachedId(playerName);
Get Player Profile
To get the whole Player Profile of a player, you can use:
PlayerProfile.ofName(playerName); // by Player name as String, auto-runs getUUID(playerName) and ofId(playerId)!
PlayerProfile.ofId(playerID); // by Player ID as UUID
This methods can be very slow since tries to fetch the data from Mojang’s API, if it wasn’t already cached and can therefore take quite some time. Consider running it asynchronous by using CompletableFuture.runAsync(() -> PlayerProfile.ofId(playerName););
You might as well only ask for the cached values, but it might return null
s if the value wasn’t already cached.
PlayerProfile.getCachedProfile(playerName); // by Player name as String
PlayerProfile.getCachedProfile(playerID); // by Player ID as UUID
Continue with Synchronized Reload Listener