Don't remove the whole stack after drinking - #218
Conversation
Minecraft0122
left a comment
There was a problem hiding this comment.
The stacked-potion logic works on current Spigot, but this direct call is not compatible with BreweryX's advertised 1.8.9+ range:
player.getInventory().setItem(event.getHand(), remaining);PlayerItemConsumeEvent#getHand() was added with the hand-aware constructor in 1.19.2. On older servers the listener will hit a NoSuchMethodError when a custom potion stack is consumed. PlayerInventory#setItem(EquipmentSlot, ...) is also a newer API than the oldest supported versions.
Please resolve the consume hand through a compatibility layer (reflective getHand where present, held-stack fallback otherwise), then use the version-appropriate setItemInMainHand / setItemInOffHand / legacy setItemInHand. I applied and compiled that approach in Minecraft0122/BreweryX@7afa8cf while integrating this PR into the fork.
Seems to be working fine after a short test session with clumsy.