Solved Player riding a player can exit

Discussion in 'Spigot Plugin Development' started by MartinPL, Jul 17, 2018.

Thread Status:
Not open for further replies.
  1. Hello! I'm making police plugin in Minecraft. I can chain a player. The chained player will sit on me. But now i don't know how to make, that he can't exit that player. I'm doing this by VehicleExitEvent but Player isn't vehicle :p Is there another event for that? Maybe an alternative way?

    Thanks in advance :)
     
  2. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    • Winner Winner x 1
  3. Yea i want that, but it isn't cancellable :C So i have to mount him again?
     
  4. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    Strange, I thought it was cancellable at some point. You're sure that the player does dismount when pressing the crouch key?
     
    • Agree Agree x 1
  5. Yup i'm testing it and player by pressing crouch key is dismounting. Mounting him again doesn't work

    e.getDismounted().setPassenger(e.getEntity());
     
  6. Other function - nothing change
     
  7. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    Mount them a tick afterwards, and that'll work

    Your best bet, for the cleanest look, is to cancel the crouch packet coming from the client so it never gets processed by the server. You will need ProtocolLib or similar library to do it, though.
     
  8. Okay, thanks. To do that 1 tick do a scheduler?
     
  9. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    Yes.
     
  10. I got it, thanks ScarabCoder. VehicleExitEvent doesn't work, because player isn't vehicle.
     
    • Funny Funny x 1
Thread Status:
Not open for further replies.