1.15.2 Keyboard Input?

Discussion in 'Spigot Plugin Development' started by Miinoo, Mar 12, 2020.

  1. Is there any way to get a keyboard input?

    for example: when a player press key "s" and is a passenger of an armorstand, the armorstand should move backwards (per velocity)
  2. No.
  3. But how is it possible, that some car plugins can check if the player pressed a key?
  4. I think you can check if the "F" key is pressed for item hand change.
  5. They can't. They probably just listen to player movement events and check the player's vector.
    • Agree Agree x 1
  6. No, theres no way to check if any key is pressed. They check using player move, player interact, etc.

    THANK YOU omg
  7. How can I check if the player is in a Minecart and is jumping?
  8. Packets listening
  9. Listen for this packet with ProtocolLib when the player is in the vehicle.
    • Informative Informative x 1
  10. If you change controls to set your 'P' key to move forward, I'm pretty sure the vehicle will more forward too.

    Listen for VehicleEnterEvent and VehicleExitEvent to keep track whether the Player is in a minecart or not. And I doubt that you can check if a Player is trying to jump in a minecart with the API. I don't know if packets will fire.
  11. DavidDevelops


    Alright before I provide any useful advice... I'd like the mention this thread is already trashed as hell, Short agruing responces not actually help, So far its been:
    OP: "Is XYZ possible"
    Response: "No, XYZ is not possible"
    OP: "XYZ is possible."
    Response: "No, But XYZ can be done by doing ZYX"
    Why are we doing this back and forth instead of just "No you can't do XYZ you can complete what you're trying to do by doing ZYX" and get a single response that provides the help needed?
    Please learn how to format and ask a question, If you want a detailed and helpful response, Give a detailed and useful question, You should of told us in the first place you're trying to make something like that plugin and we'd been able to help a lot more, (You kind of did but not explaining near well enough for me to of helped)
    @Everyone else
    Please don't reply if you don't know what you're talking about or if you only want to provide a QUICK response, These people need help and telling them it's not possible because the WAY they are trying to do it is not helpful for anyone and causes more hassle than just telling them what they SHOULD be doing to complete this.

    For the record, As far as I know for this you'll just need to look at movement packets and change the velocity from that. You can't check rather or not ANY key is pressed (As the server doesn't have that information nor does the client send it) You can check if they are holding a movement key through via packets (Personally I think packets is a better way than events but you, in theory, could use events)
    • Like Like x 1
  12. drives_a_ford


    You cannot specifically get keyboard input of clients.
    This would allow you to create a keylogger. Not a good idea for a commercial game client.

    What you can do, is listen to packets or implement your own controllers to make it possible to ride mobs. You still don't know what key somebody pressed - they might have changed their keybinds.
    The Ridables plugin did this rather well. It's open source so you can take some inspiration. The controller package might be of interest. However, as you can clearly see, it's not been maintained (for Spigot at least) since 1.13.2 so make sure to take that into consideration.
    • Like Like x 1
  13. Thanks, i appreciate.