I'm working on a plugin and i want to add Player heads as the hats. I searched for it but i cannot find it... Can anyone give me the code for adding a Player head (StrayDog99) into a GUI so u can where it as a hat. I know how to set hat and stuff but i don't know how to add the skull item. into the gui so it would be StrayDog99's skull. [EDIT] Its the same thing as Hypixel with the Hats gui!
Code (Text): ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); SkullMeta meta = (SkullMeta) skull.getItemMeta(); meta.setOwner("Spigot"); skull.setItemMeta(meta); Inventory inv = Bukkit.createInventory(null, 9, "Spigot"); inv.setItem(0, skull);
Call getItemMeta on a skull itemstack, set the owner name and set the meta back to the itemstack again. EDIT: Oh, @Frealy1995 was quicker
No offense, but your Hats class looks like shit. I am a 100% sure there is a better way of doing that. Also, what exactly don't you understand?