This commit is contained in:
Logan Magnan 2024-12-08 20:41:50 -05:00
parent 1a64fa6daa
commit 82673d923f

View File

@ -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;
}
}