-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InteractEvent is fired for main and offhand, when right-clicking on block with main hand #969
Comments
Not a bug, this is sadly intentional (and is the behavior of CraftBukkit). It's up to plugin authors to filter the events properly, e.g. check if the action is a right click and only fire if the hand is the correct hand. |
But why is the event fired for the offhand, when i right click on a block with the main hand |
Because that is shamefully what vanilla does to process such interactions, there is no way we can modify this behavior without breaking plugins that are expecting this to happen. |
then... |
The event has a method to get the Action and the hand associated with the event, it will fire with OFF_HAND and another time with HAND, you just need to basically ignore if they right click air and their main hand fires with the event or something similar to that |
now i disabled the OFF_HAND events with a early-out pattern |
Incompatibility (Bug)
I tried the PlayerInteractEvent and noticed a wiered issue:
When the ground is clicked with the main hand, the event is fired twice.
Here are my testresults:
https://imgur.com/qPh5J49
I split up the different actions with the yellow line.
As you can see some events are fired not correctly (marked red)
Steps to reproduce:
This is my Code: https://pastebin.com/D6AHsqcK
Just reproduce the issue by testing different actions (see the image)
Paper build number:
git-Paper-1298 (MC: 1.12.2) (Implementing API version 1.12.2-R0.1-SNAPSHOT)
The text was updated successfully, but these errors were encountered: