PlayerHead isnt under Material?

Discussion in 'Spigot Plugin Development' started by KingDotCom, Jun 2, 2016.

  1. Hi, I was wondering how I can make a player drop a head when they die, I know how to make it drop a skeleton head but with the plugins I am working with I NEED playerheads to drop not Material.SKULL_ITEM thanks
  2. Add a data value of 3 to it.
  3. How can I do that?
  4. In the ItemStack constructor
  5. I do .getData() then what?
  6. Create an ItemStack like this:
    Code (Text):
    ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
    Then get the ItemMeta and cast it to SkullMeta. You can then use the function .setOwner(playerName);
  7. The method setOwner(String) in the type SkullMeta is not applicable for the arguments (Player)
    Code (Text):
        public void headdrop(PlayerDeathEvent e) {
            Player a = e.getEntity().getKiller();
            Player p = e.getEntity().getPlayer();
            ItemStack h = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
            SkullMeta hmeta = (SkullMeta) h.getItemMeta();
  8. You have to use the name of the player instead of the player object itself.
  9. I need it to be the player that died.