[SPIGOT-5610] Missing player interact event Created: 04/Mar/20 Updated: 01/Sep/20 |
|
| Status: | Open |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | blablubbabc | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | event, interact | ||
| Version: | This server is running CraftBukkit version git-Spigot-8faa8b4-13ed05d (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT) |
| Guidelines Read: | Yes |
| Description |
|
When holding an interactable item (I tested with a trident), and then right-clicking an entity (eg. a Pig), plugins receive:
However, when first right clicking an interactable block (eg. a chest) while holding the trident in hand, and then right-clicking an entity, plugins only receive the 2 entity interaction events. The PlayerInteractEvent for the item interaction is omitted. I assume the cause of this is that CraftBukkit caches the interaction result for the chest interaction inside PlayerInteractManager (fields 'firedInteract' and 'interactResult'). The cached result of that is then used during the later entity interaction (inside PlayerConnectionManager). The problem with that is that the chest interaction and the later entity interaction in this test scenario have nothing to do with each other (the entity interaction can happen quite some time later). If a plugin wants to prevent the item interaction when a player right-clicks an entity (my usecase), the plugin may miss some events depending on the player's previous actions and the state of that interaction result cache.
Example plugin (simply logs interact events): https://pastebin.com/LYARYWDZ |
| Comments |
| Comment by blablubbabc [ 01/Sep/20 ] |
|
I have not tested this again yet, but this might have been resolved with: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/00bff02703914a4656c43afa5991db84626d0cb8 which seems to have completely removed the mentioned caching mechanism. |