Skip to content

Fix: Resolve EntityMountEvent registration failure on modern Paper#400

Merged
vLuckyyy merged 2 commits into
EternalCodeTeam:masterfrom
YoshiroMaximus:fix/entity-mount-event-relocation
Jun 21, 2026
Merged

Fix: Resolve EntityMountEvent registration failure on modern Paper#400
vLuckyyy merged 2 commits into
EternalCodeTeam:masterfrom
YoshiroMaximus:fix/entity-mount-event-relocation

Conversation

@YoshiroMaximus

Copy link
Copy Markdown
Contributor

📝 Description

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.

This change resolves EntityMountEvent at 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

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 🔧 Refactoring
  • 🎨 Style/Cosmetic
  • 📚 Documentation
  • 🤖 CI/CD/Build

Test Environment:

  • Minecraft Version: 26.1.2
  • Java Version: 25
  • Platform: Linux

📸 Screenshots (if applicable)

N/A

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vLuckyyy

Copy link
Copy Markdown
Member

I like the idea; I'll make a few small changes.

@vLuckyyy vLuckyyy merged commit 93d7ffd into EternalCodeTeam:master Jun 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants