mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-17 12:01:20 +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)
|
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)
|
if (hand.getType().getMaxDurability() == 0)
|
||||||
{
|
{
|
||||||
final PlayerInventory inv = user.getPlayer().getInventory();
|
final PlayerInventory inv = user.getPlayer().getInventory();
|
||||||
final ItemStack head = inv.getHelmet();
|
final ItemStack head = inv.getHelmet();
|
||||||
inv.removeItem(hand);
|
hand.setAmount(1);
|
||||||
|
InventoryWorkaround.removeItem(inv, true, true, hand);
|
||||||
inv.setHelmet(hand);
|
inv.setHelmet(hand);
|
||||||
inv.setItemInHand(head);
|
inv.setItemInHand(head);
|
||||||
user.sendMessage(_("hatPlaced"));
|
user.sendMessage(_("hatPlaced"));
|
||||||
|
Reference in New Issue
Block a user