/** * Return a skull of a player. * * @param name player's name * @return itemstack */ public static ItemStack getPlayerSkull(String name) { ItemStack itemStack = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal()); SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); meta.setOwner(name); itemStack.setItemMeta(meta); return itemStack; }
public static ItemStack Skull(String skullOwner, String displayName, int quantity) { ItemStack skull = new ItemStack(Material.SKULL_ITEM, quantity, (short) SkullType.PLAYER.ordinal()); SkullMeta skullMeta = (SkullMeta) skull.getItemMeta(); skullMeta.setOwner(skullOwner); if (displayName != null) { skullMeta.setDisplayName(ChatColor.RESET + displayName); } skull.setItemMeta(skullMeta); return skull; }