Fix: Resolve EntityMountEvent registration failure on modern Paper#400
Conversation
Newer Paper builds (e.g. 26.1.2) removed org.spigotmc.event.entity.EntityMountEvent, causing KnockbackRegionController registration to fail and region knockback protection to be disabled. Resolve EntityMountEvent at runtime (checking Bukkit, Paper, and Spigot packages) and register it reflectively while preserving the 1.19.3 compile target for compatibility.
There was a problem hiding this comment.
Code Review
This pull request introduces KnockbackMountController to dynamically resolve and handle EntityMountEvent at runtime using reflection, which improves compatibility across different server environments (Spigot, Paper, and Bukkit) where the event class package has changed. It also removes the static event handler from KnockbackRegionController. The review feedback suggests storing the resolved getMount method as a volatile instance field to avoid lambda capturing, ensure thread safety in concurrent environments like Folia, and simplify the event handler signature, while also calling setAccessible(true) to prevent potential access issues.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
I like the idea; I'll make a few small changes. |
📝 Description
Newer Paper builds (e.g. 26.1.2) removed
org.spigotmc.event.entity.EntityMountEvent, causingKnockbackRegionControllerregistration to fail and region knockback protection to be disabled.This change resolves
EntityMountEventat runtime by checking Bukkit, Paper, and Spigot packages and registering it reflectively while preserving the 1.19.3 compile target for compatibility.🎯 Type of Change
Test Environment:
📸 Screenshots (if applicable)
N/A