diff --git a/src/me/yaruma/fightsystem/listener/InventoryListener.java b/src/me/yaruma/fightsystem/listener/InventoryListener.java index a5516aa..90a3013 100644 --- a/src/me/yaruma/fightsystem/listener/InventoryListener.java +++ b/src/me/yaruma/fightsystem/listener/InventoryListener.java @@ -2,6 +2,7 @@ package me.yaruma.fightsystem.listener; import me.yaruma.fightsystem.FightSystem; import me.yaruma.fightsystem.fight.FightState; +import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; @@ -26,12 +27,13 @@ public class InventoryListener implements Listener { if (clickedOn != null && event.getView().getTopInventory().getType() != InventoryType.CRAFTING && clicked == event.getWhoClicked().getInventory()) { event.setCancelled(true); } - }else if (clicked != event.getWhoClicked().getInventory()) { - ItemStack onCursor = event.getCurrentItem(); - - if (onCursor != null && event.getClickedInventory().getType() != InventoryType.PLAYER){ - event.setCancelled(true); - } + }else if ( + clicked != event.getWhoClicked().getInventory() && + clicked != null && + clicked.getType() != InventoryType.PLAYER && + event.getCursor() != null && + event.getCursor().getType() != Material.AIR){ + event.setCancelled(true); } }