Skip to content

Instantly share code, notes, and snippets.

@Ebycow
Created May 5, 2017 13:02
Show Gist options
  • Save Ebycow/7fad2966c2f8ea6fdd3afba76a0eb374 to your computer and use it in GitHub Desktop.
Save Ebycow/7fad2966c2f8ea6fdd3afba76a0eb374 to your computer and use it in GitHub Desktop.
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("head")) {
Player player = (Player) sender;
ItemStack headItem = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
SkullMeta itemMeta = (SkullMeta) headItem.getItemMeta();
itemMeta.setOwner(sender.getName());
headItem.setItemMeta(itemMeta);
player.getInventory().addItem(headItem);
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment