prevent item stack size from going outside normal bounds
Some checks failed
EpicKnarvik97/mcMMO/pipeline/head There was a failure building this commit

This commit is contained in:
nossr50
2026-01-17 13:38:29 -08:00
parent db5654dbe6
commit 9c9e5313ca
2 changed files with 8 additions and 5 deletions

View File

@@ -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.

View File

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