Skip to content

Comments

Fix NETHER_PORTAL flag bypass when paper misc.enable-nether is false#2802

Open
tastybento wants to merge 1 commit intodevelopfrom
2796_nether_portal_flag_disabled_nether
Open

Fix NETHER_PORTAL flag bypass when paper misc.enable-nether is false#2802
tastybento wants to merge 1 commit intodevelopfrom
2796_nether_portal_flag_disabled_nether

Conversation

@tastybento
Copy link
Member

Summary

Fixes #2796

When paper-global.yml misc.enable-nether: false (or enable-end: false) is set, Paper does not fire PlayerPortalEvent for portals. BentoBox's EntityPortalEnterEvent handler compensated by manually constructing a PlayerPortalEvent and calling portalProcess() on it directly — completely bypassing the Bukkit event bus.

This meant PortalListener (which enforces the NETHER_PORTAL / END_PORTAL protection flags) never saw the event, so:

  • Visitors could use nether portals even when the flag blocked them
  • /bsb why returned nothing (no flag check was ever recorded)

Fix: replace the direct portalProcess() call with Bukkit.getPluginManager().callEvent(en). The event now travels through the event bus normally:

  1. PortalListener (LOW priority) checks the protection flag and cancels the event if the player lacks permission
  2. PlayerTeleportListener.onPlayerPortalEvent (HIGH priority, ignoreCancelled = true) processes the teleport only if the flag allowed it

The same fix applies to the end portal / end gateway path under !Bukkit.getAllowEnd().

Test plan

  • Set paper-global.yml misc.enable-nether: false, keep the BentoBox skyblock nether world enabled
  • Set the NETHER_PORTAL flag to block visitors on an island
  • Verify a visitor with a nether portal on the island cannot enter it (blocked with protection message)
  • Verify /bsb why now reports the flag decision
  • Verify island members can still use the portal correctly
  • Run ./gradlew test — all tests pass

🤖 Generated with Claude Code

…2796)

When the server nether (or end) is disabled via paper-global.yml, Paper
does not fire PlayerPortalEvent, so BentoBox's EntityPortalEnterEvent
handler manually created one and passed it directly to portalProcess().
This bypassed the Bukkit event bus entirely, meaning PortalListener
(which checks the NETHER_PORTAL / END_PORTAL protection flags) never
ran and /bsb why returned nothing.

Fix: post the manually-constructed PlayerPortalEvent through
Bukkit.getPluginManager().callEvent() instead. This lets PortalListener
(LOW priority) inspect and potentially cancel the event before
PlayerTeleportListener.onPlayerPortalEvent (HIGH priority) processes
the teleport, restoring correct flag behaviour for both nether and end
portals when the server dimension is disabled.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

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.

Nether Portal flag not working when paper-global.yml misc.enable-nether: false

1 participant