Hi, im looking for the code, for when a certain command is typed, it will give them their OWN head! As well, as a specified player's head (arg0) Code:java package me.iamcion.MyHead; import org.bukkit.ChatColor;import org.bukkit.Material;import org.bukkit.command.Command;import org.bukkit.command.CommandExecutor;import org.bukkit.command.CommandSender;import org.bukkit.event.Listener;import org.bukkit.inventory.ItemStack;import org.bukkit.inventory.meta.SkullMeta;import org.bukkit.plugin.java.JavaPlugin;import org.bukkit.Server; public class Main{ ItemStack myhead = new ItemStack(Material.SKULL_ITEM, 1, (short)3); public void onEnable() { SkullMeta playerskull = (SkullMeta)this.myhead.getItemMeta(); playerskull.setOwner("TEST"); this.myhead.setItemMeta(playerskull); } { SkullMeta MySkull = (SkullMeta)this.myhead.getItemMeta(); MySkull.setOwner("iamcion"); this.myhead.setItemMeta(MySkull); } public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if ((cmd.getName().equalsIgnoreCase("phead")) && (sender.hasPermission("phead.give"))) { if (args.length == 1) { getServer.getPlayer(args[0]).getInventory().addItem(new ItemStack[] { this.myhead }); } else { sender.sendMessage(ChatColor.RED + "§b[PlayerHead] Player Not Online!"); } } else { sender.sendMessage(ChatColor.AQUA + "§b[PlayerHead] §cPlease specify who's head you want"); sender.sendMessage(ChatColor.GOLD + "EG: /phead <username>"); } return true; { return false; }}}
iamcion Code:java public ItemStack getHeadFromString(String string) { ItemStack itemStack = new ItemStack(Material.SKULL_ITEM); SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); meta.setOwner(string); itemStack.setItemMeta(meta); return itemStack;}