mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-16 11:37:30 +02:00
Fix removing of item in /hat
This commit is contained in:
@@ -34,12 +34,13 @@ public class Commandhat extends EssentialsCommand
|
||||
{
|
||||
if (user.getPlayer().getItemInHand().getType() != Material.AIR)
|
||||
{
|
||||
final ItemStack hand = user.getPlayer().getItemInHand();
|
||||
final ItemStack hand = user.getPlayer().getItemInHand().clone();
|
||||
if (hand.getType().getMaxDurability() == 0)
|
||||
{
|
||||
final PlayerInventory inv = user.getPlayer().getInventory();
|
||||
final ItemStack head = inv.getHelmet();
|
||||
inv.removeItem(hand);
|
||||
hand.setAmount(1);
|
||||
InventoryWorkaround.removeItem(inv, true, true, hand);
|
||||
inv.setHelmet(hand);
|
||||
inv.setItemInHand(head);
|
||||
user.sendMessage(_("hatPlaced"));
|
||||
|
Reference in New Issue
Block a user