Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Rotate and PlayerMoveEvent

Comments in 'Plugin Development' started by Cristalix, Jul 22, 2016.

  1. Cristalix
    Offline

    Cristalix New Member

    Joined:
    Sep 10, 2015
    Posts:
    38
    Minecraft User:
    Gistrec
    Hi, when I cancel PlayerMoveEvent, I cancel RotateEvent (?) :3
    How can I cancel only change X or Y or Z and no cancel Rotation
  2. Cristalix
    Offline

    Cristalix New Member

    Joined:
    Sep 10, 2015
    Posts:
    38
    Minecraft User:
    Gistrec
    Code:
    public function onMove(PlayerMoveEvent $e){
            $from = $e->getFrom();
            $to = $e->getTo();
    
            if($from->x !== $to->x ||/*if you don't want to allow jump*/ $from->y !== $to->y || $from->z !== $to->z){
                $e->setCancelled();
            }
        }

Share This Page

Advertisement