-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Minor
-
None
-
Affects Version/s: None
-
None
-
Environment:
Just built a clean server an hour ago with Spigot 1.20.1, 1 plugin for testing the bug
-
This server is running CraftBukkit version 3830-Spigot-0ca4eb6-36b1076 (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT)
-
Yes
Here is a video explaining the issue in detail: https://youtu.be/F4PjLW__G0w
Source code (+built plugin) below.
Basically, the issue is that spectators (and some entities) are interfering with ray tracing, which causes the PlayerInteractEvent to be skipped when it should be called for LEFT_CLICK_AIR.
This predicate should be good to solve it (untested):
in ServerGamePacketListenerImpl#handleAnimate
!((CraftEntity)entity).getHandle().isSpectator() && ((CraftEntity)entity).getHandle().isPickable()
import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin implements Listener { @Override public void onEnable() { getServer().getPluginManager().registerEvents(this, this); } @EventHandler public void onInteract(PlayerInteractEvent event) { Bukkit.broadcastMessage("Interaction: " + event.getAction()); } }