-
-
Notifications
You must be signed in to change notification settings - Fork 1
Player Profile
This class uses Mojang's API to fetch general data about players.
-
name{:.heading.flip-title} --- The current Player Name -
id{:.heading.flip-title} --- The UUID of the Player -
skin{:.heading.flip-title} --- The URL where the skin image is saved -
isSlim{:.heading.flip-title} --- Whether the skin is slim or normal -
cape{:.heading.flip-title} --- The URL where the cape image is saved -
getSkinId(){:.heading.flip-title} --- Caches theskinimage and auto-assigns anResourceLocation{:.language-java.highlight} to it -
getCapeId(){:.heading.flip-title} --- Caches thecapeimage and auto-assigns anResourceLocation{:.language-java.highlight} to it
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););{:.language-java .highlight}
{:.note}
You might as well only ask for the cached values, but it might return null{:.language-java .highlight}s if the value wasn't already cached.
PlayerProfile.getCachedId(playerName);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 UUIDThis 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););{:.language-java .highlight}
{:.note}
You might as well only ask for the cached values, but it might return null{:.language-java .highlight}s if the value wasn't already cached.
PlayerProfile.getCachedProfile(playerName); // by Player name as String
PlayerProfile.getCachedProfile(playerID); // by Player ID as UUIDContinue with Synchronized Reload Listener{:.heading.flip-title} {:.read-more}