-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
None
-
3635-Spigot-d90018e-941d7e9 (MC: 1.19.3) (Implementing API version 1.19.3-R0.1-SNAPSHOT)
-
Yes
The PlayerToggleSneakEvent is not called when sneaking while riding an entity. This is only really an issue when you are cancelling the EntityDismountEvent.
I also believe this is a fixable issue because whether or not the player is sneaking while on a horse is available to the server by calling `Player.isSneaking()` (and it does update properly).
I'm not entirely sue how the patching system works, but I believe you would have to modify the nms PlayerConnection.java's `handlePlayerInput` function
@Override public void handlePlayerInput(PacketPlayInSteerVehicle packetplayinsteervehicle) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinsteervehicle, this, this.player.getLevel()); this.player.setPlayerInput(packetplayinsteervehicle.getXxa(), packetplayinsteervehicle.getZza(), packetplayinsteervehicle.isJumping(), packetplayinsteervehicle.isShiftKeyDown()); }
to something like
@Override public void handlePlayerInput(PacketPlayInSteerVehicle packetplayinsteervehicle) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinsteervehicle, this, this.player.getLevel()); if (packetplayinsteervehicle.isShiftKeyDown() != this.player.isShiftKeyDown()) { PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getCraftPlayer(), packetplayinsteervehicle.isShiftKeyDown()); this.cserver.getPluginManager().callEvent(event); } this.player.setPlayerInput(packetplayinsteervehicle.getXxa(), packetplayinsteervehicle.getZza(), packetplayinsteervehicle.isJumping(), packetplayinsteervehicle.isShiftKeyDown()); }