
Canceled interaction events are not ignored
blablubbabc opened this issue ยท 2 comments
Observed Behavior
- A player interacts with some item (e.g. spawn egg) or some block (e.g. chest) in a protected region.
- Some other plugin cancels the PlayerInteractEvent at event priority lowest and prints some message reasoning why the interaction was canceled. Just as an example, the Shopkeepers plugin cancels interactions with a specially named villager spawn egg when the player has not yet selected some chest to create the shop with.
- The GP plugin handles the event on low priority anyway, not ignoring the already canceled event, and additionally shows its own cancellation message ("You are not allowed to do X").
Expected Behavior
- Ignore the PlayerInteractEvent (and other similar interaction events) if it is already canceled.
Since Jikoo@ee0d17b the event priority was changed from LOWEST to LOW. The PR also mentions compatibility with other plugins as one benefit. I think it might be possible to ignore the event and not send any additional messages if the event was already canceled by another plugin.
Reproduction steps
See observed behavior above.
Stack trace or error log
Server version
This server is running CraftBukkit version 4477-Spigot-e339edc-ba251cc (MC: 1.21.5) (Implementing API version 1.21.5-R0.1-SNAPSHOT)
GriefPrevention version
GriefPrevention version 16.18.4
Configuration
Untouched from default.
Plugin list
GriefPrevention, Shopkeepers
Running without GriefPrevention
- I attempted running the server without GriefPrevention installed.
- The problem does not occur when GriefPrevention is removed from the server.
Running with only GriefPrevention
- I attempted running only GriefPrevention on the server.
- The issue still occurs when GriefPrevention is the only plugin running.
Running on a fresh, clean server installation
- I attempted testing for the issue on a new server.
- The issue still occurs on a new server.
Using unmodified client
- I attempted testing for the issue with the vanilla client.
- The issue still occurs when using the vanilla client.
We appreciate you taking the time to fill out a bug report!
- I searched for similar issues before submitting this bug report.
Definitely agree that GP should do better here, but it's not as simple as adding ignoreCancelled because there are edge cases where cancellation is expected. I believe Bukkit fires right clicking air pre-cancelled, for example, which would break using the claim management tools.
Realistically GP needs to move away from the design of a single listener covering everything and move to more focused listeners with single responsibilities instead of the horrific 600-line mess of every single supported interaction in a single method. The "easiest" bandaid is to just shift around the features and ignore most cancelled interactions manually.