Skip to main content

Player Head/Profile

With the SkullTexture class you can get textured heads from base64, url, texture ID, player name or UUID, and also get player profiles.

Get the following texture as ItemStack head using all the different methods.

String texture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmVkZmEyZTBmZGVhMGMwNDIzODA0Y2RiNWI2MmFkMDVhNmU5MTRjMDQ2YzRhM2I3ZTM1NWJmODEyNjkxMjVmZCJ9fQ==";
ItemStack head = SkullTexture.mojang().item(texture);

</TabItem>
<TabItem value="url" label="URL">

```java
String texture = "http://textures.minecraft.net/texture/fedfa2e0fdea0c0423804cdb5b62ad05a6e914c046c4a3b7e355bf81269125fd";
ItemStack head = SkullTexture.mojang().item(texture);
Server performance

If you want to get some textured head using player name or UUID is suggested to use asynchronous methods since it will probably require internet connection.

And also provide a separated Executor if you want to get an exaggerated amount of textured heads using names and UUIDs, DO NOT use Bukkit scheduler due you will slow down others plugins performance.

Profile

Get a SkullTexture.Profile (an encapsulation of GameProfile from Mojang code) using different types of profile providers.

// --- Compatible with multiple types of player declaration
// Player object
Player player = Bukkit.getPlayer("Rubenicos");
// Player name
String player = "Rubenicos";
// Player id
UUID player = UUID.fromString("7ca003dc-175f-4f1f-b490-5651045311ad");
String player = "7ca003dc-175f-4f1f-b490-5651045311ad";
String player = "7ca003dc175f4f1fb4905651045311ad";

// Using Mojang API
SkullTexture.Profile profile = SkullTexture.mojang().profileFrom(player);
// Using PlayerDB API
SkullTexture.Profile profile = SkullTexture.playerDB().profileFrom(player);
// Using CraftHead API
SkullTexture.Profile profile = SkullTexture.craftHead().profileFrom(player);
Profile fetching

Getting profiles in most cases require internet connection with long waiting times, DO NOT fetch different profiles continuously on the main thread or using Bukkit scheduler (Make your own one in this case).

Cache rules

By default, profiles are cached with 3 hours expiration after last access to reduce network usage.

If you don't want to cache anything make your own implementation of SkullTexture or create a new SkullTexture.Mojang, SkullTexture.PlayerDB or SkullTexture.CraftHead with null cache.