Solved Getting player heads

Discussion in 'Plugin Development' started by 1SmallVille1, May 26, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    1SmallVille1

    Hey I was wondering how I could make a skull with a player's skin. The code I have is:
    Code:Java
    1. Player player = (Player) sender;
    2.  
    3. ItemStack is = new ItemStack(Material.SKULL);
    4.  
    5. SkullMeta sm = (SkullMeta) is.getItemMeta();
    6.  
    7. sm.setOwner("1SmallVille1");
    8.  
    9. is.setItemMeta(sm);
    10.  
    11. player.getInventory().addItem(is);

    I thought that this was how you did it but I get an error saying I can't cast from the itemstack's Meta to SkullMeta
     
  2. Offline

    Skyshayde

    I am fairly confident the Skull skin is an nbt tag.
     
  3. Offline

    Compressions

    1SmallVille1
    Code:java
    1. Player player = (Player) sender;
    2.  
    3. ItemStack is = new ItemStack(Material.SKULL_ITEM);
    4.  
    5. is.setDurability((short) 3);
    6.  
    7. SkullMeta sm = (SkullMeta) is.getItemMeta();
    8.  
    9. sm.setOwner("1SmallVille1");
    10.  
    11. is.setItemMeta(sm);
    12.  
    13. player.getInventory().addItem(is);
     
  4. Offline

    AstramG

    Try this: ItemStack is = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
     
  5. Offline

    Compressions

    AstramG Same thing as what I posted xD
     
  6. Offline

    AstramG

    No. I used Skull_Item there is a difference and Skull itself won't work from my experiences with my plugin that deals mainly with heads.
     
  7. Offline

    Compressions

    AstramG I meant for the durability part, but true, you must use SKULL_ITEM.
     
  8. Offline

    1SmallVille1

Thread Status:
Not open for further replies.

Share This Page