diff --git a/src/main/java/com/loganmagnan/unlimiteditems/listeners/EntityPickupItemListener.java b/src/main/java/com/loganmagnan/unlimiteditems/listeners/EntityPickupItemListener.java index 857f94e..b7d87d2 100644 --- a/src/main/java/com/loganmagnan/unlimiteditems/listeners/EntityPickupItemListener.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/listeners/EntityPickupItemListener.java @@ -35,6 +35,10 @@ public class EntityPickupItemListener implements Listener { ItemStack itemStackOne = event.getItem().getItemStack(); + if (!this.isMaterialStackable(itemStackOne)) { + return; + } + event.setCancelled(true); event.getItem().remove(); @@ -86,4 +90,12 @@ public class EntityPickupItemListener implements Listener { player.updateInventory(); } + + public boolean isMaterialStackable(ItemStack itemStack) { + if (itemStack == null || itemStack.getType() == Material.AIR) { + return false; + } + + return itemStack.getMaxStackSize() > 1; + } } \ No newline at end of file