diff --git a/Changelog.txt b/Changelog.txt index eb04894ea..6379e4105 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -3,6 +3,7 @@ Version 2.2.049 Sweet berry bushes now work with Herbalism (thanks dnocturne) (Codebase) Fixed unit tests for Java 25 (thanks Warriorrrr) Fixed copper items not giving XP for Repair (thanks Remski01) + Fixed edge case where mcMMO could drop items with stack size set outside normal bounds NOTES: As a semi-permanent work around, mcMMO keeps track of when players swing their weapon, if they have swung it recently enough combat skills will work even if you have a spear in your off-hand. diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index ca83de6cb..e42bc2e76 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -147,12 +147,14 @@ public class BlockListener implements Listener { } int amountToAddFromBonus = bonusDropMeta.asInt(); - final McMMOModifyBlockDropItemEvent modifyBlockDropItemEvent + final McMMOModifyBlockDropItemEvent modifyDropEvent = new McMMOModifyBlockDropItemEvent(event, item, amountToAddFromBonus); - plugin.getServer().getPluginManager().callEvent(modifyBlockDropItemEvent); - if (!modifyBlockDropItemEvent.isCancelled() - && modifyBlockDropItemEvent.getModifiedItemStackQuantity() > originalAmount) { - eventItemStack.setAmount(modifyBlockDropItemEvent.getModifiedItemStackQuantity()); + plugin.getServer().getPluginManager().callEvent(modifyDropEvent); + if (!modifyDropEvent.isCancelled() + && modifyDropEvent.getModifiedItemStackQuantity() > originalAmount) { + eventItemStack.setAmount( + Math.min(modifyDropEvent.getModifiedItemStackQuantity(), + item.getItemStack().getMaxStackSize())); } } }