1.15.2 protocollib detect keypress?

Discussion in 'Spigot Plugin Development' started by to0ns, Mar 1, 2020.

  1. I am currently using STEER_VEHICLE to detect player WASD/SHIFT/SPACE, but is there a way to do it when player is not in the vehicle? I can't seem to find any leads on it. Thanks
  2. To my best knowledge, key presses are handled client-sided only. The only thing that gets transmitted to the server are the effects of that key-press; so I‘m afraid there is no other way..
    • Agree Agree x 2
  3. Yeah, not possible. Minecraft only sends packets based on some controls, not just simple keypresses.
  4. maybe you have to create a specific minecraft client for your server that detect all keys and send it through packets.
  5. Benz56

    Moderator Supporter

    Using vector math you can based on movement, however, you can’t be sure that the player actually pressed a key or was affected by something external that caused the player to move.
  6. Also, maybe the player uses other keys for moving, not WASD and SPACE. So detecting what key was pressed is impossible
  7. Sorry I took so long to reply, thanks for the info guys, I kinda figured that would be the case.

    Any idea on how I could start with this?, Like resources or library I could use?