It might be a client sided bug.
I have a Listener listening to the PlayerInteractEvent.
When left clicking the air, i get the correct type.
When left clicking a block (in any gamemode), nothing happens
When right clicking the air, i get the correct type.
When right clicking a block i receive the event twice, once RIGHT_CLICK_BLOCK and once RIGHT_CLICK_AIR
I am not entirely sure if the client is joking around in this case, or the server.
If the issue is not reproducible without plugins:
selfmade plugin including only the listener:
public function onInteract(PlayerInteractEvent $event){
var_dump($event->getAction());
}
Please use gist or anything else to add other files and add links here
...
Yes, this is a client-sided bug, it's been around as long as I can remember (0.14 at least).
I know this is an old issue, but since GitHub decided to stuff it in my face -
In 4.0, PlayerInteractEvent will no longer fire for the so-called "right click air" action (which is actually an activate-item action). You'll be required to handle PlayerItemUseEvent to intercept item-activations instead.
Most helpful comment
I know this is an old issue, but since GitHub decided to stuff it in my face -
In 4.0,
PlayerInteractEventwill no longer fire for the so-called "right click air" action (which is actually an activate-item action). You'll be required to handlePlayerItemUseEventto intercept item-activations instead.