Skip to content

Fix PlayerSit being blocked/warned by PlotSquared (#333) - #335

Open
whilowcx wants to merge 1 commit into
gecolay:mainfrom
whilowcx:fix/playersit-plotsquared-333
Open

Fix PlayerSit being blocked/warned by PlotSquared (#333)#335
whilowcx wants to merge 1 commit into
gecolay:mainfrom
whilowcx:fix/playersit-plotsquared-333

Conversation

@whilowcx

Copy link
Copy Markdown

Fixes #333.

Two separate issues stacked on top of each other in PlayerSitEventHandler, both related to how the player-sit click is handled relative to other plugins listening on the same events.

1. playerInteractAtEntityEvent never cancelled the event, and ran at HIGHEST

PlotSquared has its own listener on PlayerInteractAtEntityEvent that runs at a lower priority than GSit's (which was HIGHEST), and cancels the event itself when the clicking player isn't trusted on the plot. Since GSit's handler uses ignoreCancelled = true, it never got a chance to run once PlotSquared had already cancelled it, regardless of trusted-region-only. That option only controls GSit's own internal PlotSquared check, it can't affect a third-party plugin's native protection reacting to the raw event first.

Moved the listener to LOWEST (so GSit's own checks run before any protection plugin can react) and made it cancel the event once sitOnPlayer actually succeeds, instead of leaving it uncancelled.

2. PlayerInteractEntityEvent was never touched

Right-clicking a player fires both PlayerInteractAtEntityEvent and, independently, PlayerInteractEntityEvent. Cancelling the first doesn't stop the second from firing. PlotSquared has a separate listener on the plain PlayerInteractEntityEvent too, which is what still produced a permission warning (plots.admin.interact.road) even after fixing 1, despite the sit already working by that point.

Added a LOWEST priority listener for PlayerInteractEntityEvent that cancels it, but only when the clicking player is already a passenger of the right-clicked target, i.e. only for the interaction GSit itself just handled, so it doesn't swallow unrelated interactions.

Testing

Built and ran on a local Paper 26.2 server with PlotSquared (built from source) and GSit patched:

  • trusted-region-only: false: sitting on another player now works both outside plots and inside plots you're not trusted on, no PlotSquared errors or messages.
  • trusted-region-only: true: sitting on a player inside a plot you're not trusted on is correctly blocked by GSit itself; still allowed on the road, as expected.

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.

PlayerSit broken with PlotSquared: "You are lacking the permission node: plots.admin.interact.other" (regression after update)

1 participant