I would like to use the custom heads provided by minecraft-heads in the GUI
minecraft-heads.com
Custom Heads (107208)

SkullMeta
to change the skin of the skull. You can get the SkullMeta
by calling ItemStack#getItemMeta()
and casting the result to SkullMeta
. From there you can use SkullMeta#setPlayerProfile(PlayerProfile)
to change the skin displayed on the skull.PlayerProfile
, you first need to create a PlayerProfile
via Bukkit#createProfile
or Bukkit#createProfileExact
. Then you can change the textures of this PlayerProfile
with PlayerProfile#setTextures(PlayerTextures)
. These PlayerTextures
can be retrieved via PlayerProfile#getTextures()
. You can then change the skin with PlayerTextures#setSkin(String)
where the string is the URL that points to the skin image you want to apply. You can find this URL on the website you mentioned by clicking on the skull you want, scrolling to the bottom, and then copying the link next to "Minecraft-URL".public static ItemStack createHead(URL url){
UUID uuid = UUID.randomUUID();
PlayerProfile profile = Bukkit.createProfile(uuid);
profile.setTextures();
ItemStack head = new ItemStack(Material.PLAYER_HEAD);
SkullMeta skullMeta = (SkullMeta) head.getItemMeta();
skullMeta.setPlayerProfile(profile);
return head;
}