Question

So basically, my problem is that when I use getItemInHand() and setHelmet(), it returns an error "Change type of item to 'ItemStack'" for both lines. Here is the code where the errors appear:

toggle.add(player.getName());
//Do stuff here when enabled.   
player.sendMessage(ChatColor.GREEN + "Enabled!");
ItemStack item = player.getItemInHand();
player.getInventory().setHelmet(item);

Please help me, I'd be very grateful.

~ Jack

Was it helpful?

Solution

My best guess is that you are importing CraftBukkit and that the ItemStack you import is the net.minecraft.server.ItemStack, not org.bukkit.inventory.ItemStack. If this is the case, change your import and you should be fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top