Hey guys i have tried in many ways to remove the item in hand and this is my code now: Code: if (event.getPlayer().getItemInHand().getAmount() <= 1) { event.getPlayer().getInventory().setItemInHand(null); event.getPlayer().sendMessage("1"); } else { event.getPlayer().getItemInHand().setAmount(event.getPlayer().getItemInHand().getAmount() - 1); event.getPlayer().sendMessage("2"); } i have tried removeItem(iteminhand) and many more things and it just won't work (i only get the number 1 in the chat so that's not the problem.) I hope you guys can help me ?
i now have this but it still won't work. (It removes it till there's 1 item left and my item has a lore i don't know if that's a problem?) Code: if (event.getPlayer().getItemInHand().getAmount() <= 1) { event.getPlayer().getInventory().removeItem(event.getPlayer().getItemInHand()); event.getPlayer().updateInventory(); } else { event.getPlayer().getItemInHand().setAmount(event.getPlayer().getItemInHand().getAmount() - 1); } Oh and when i clear the inventory everything (except armor) is removed but not the item in my hand. fixed it! added a bukkitrunnable with a delay of 1 tick and then removed the item EDIT by Moderator: merged posts, please use the edit button instead of double posting.