Player Profile

Get Player Data from Mojang’s API

  1. Data
  2. Get Player ID
  3. Get Player Profile

This class uses Mojang’s API to fetch general data about players.

Data

  • name — The current Player Name
  • id — The UUID of the Player
  • skin — The URL where the skin image is saved
  • isSlim — Whether the skin is slim or normal
  • cape — The URL where the cape image is saved
  • getSkinId() — Caches the skin image and auto-assigns an ResourceLocation to it
  • getCapeId() — Caches the cape image and auto-assigns an ResourceLocation 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 nulls 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 nulls 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