From 82673d923f3e6f83de89cdc30e923bd02883b131 Mon Sep 17 00:00:00 2001 From: Logan Magnan Date: Sun, 8 Dec 2024 20:41:50 -0500 Subject: [PATCH] updates --- .../listeners/EntityPickupItemListener.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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