Solved Player heads in a GUI

Discussion in 'Spigot Plugin Development' started by goats123123456, May 21, 2016.

  1. 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!
  2. Code (Text):

                    ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
                    SkullMeta meta = (SkullMeta) skull.getItemMeta();
                    Inventory inv = Bukkit.createInventory(null, 9,  "Spigot");
                    inv.setItem(0, skull);
  3. Call getItemMeta on a skull itemstack, set the owner name and set the meta back to the itemstack again.

    EDIT: Oh, @Frealy1995 was quicker :p
  4. 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?
  5. Well...
  6. Why did you delete your previous post? :O
    • Like Like x 1