1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Stop Movement

Discussion in 'Development' started by LucGamesDE, May 27, 2017.

  1. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    Is there a way to stop PlayerMoveEvent of a player moves but not if he only jumps or turns his hat?
     
  2. SalmonDE

    SalmonDE Zombie Pigman

    Messages:
    739
    GitHub:
    SalmonDE
    Yes.
    When the x and z coordinates of $event->getTo() are the same as the ones from $event->getFrom() the player didn't move. And when the y coordinate of $event->getTo() is bigger than the one of $event->getFrom() you know that the player jumped and let it go through. Else you cancel the event.

    You don't have to specifically do anything for the head movement.
     
    Last edited: May 27, 2017
  3. SkySeven

    SkySeven Baby Zombie

    Messages:
    145
    GitHub:
    SkySevenMC
    You Can stop movement with $player->setImmobile(true);
     
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Technically, unless your connection is extremely good, the client will jump up to the highest point before the network latency of (client move packet -> server cancel move event -> server packet to teleport back to original position) completes.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.