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

Lock Move but not screen movement

Comments in 'Plugin Development' started by Guillaume351, Mar 29, 2015.

  1. Guillaume351
    Offline

    Guillaume351 Active Member Plugin Developer

    Joined:
    Oct 11, 2013
    Posts:
    150
    Plugins:
    1
    Minecraft User:
    Guillaume351
    Hi,
    I know we can easily lock the movement, but I want to block only x,y and z movement not when the player moves the "camera" (I mean his point of view)

    Thanks
    LDX likes this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    public function onMove(PlayerMoveEvent $event){
      if(
    condition()){
        
    $to = clone $event->getFrom();
        
    $to->yaw $event->getTo()->yaw;
        
    $to->pitch $event->getTo()->pitch;
        
    $event->setTo($to);
      }
    }
    Check if this works. Don't forget the "clone" on line 3.
    Guillaume351 and LDX like this.
  3. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    I was going to ask about this, too. :p
    Guillaume351 likes this.
  4. Guillaume351
    Offline

    Guillaume351 Active Member Plugin Developer

    Joined:
    Oct 11, 2013
    Posts:
    150
    Plugins:
    1
    Minecraft User:
    Guillaume351
    I will try in some hours
  5. Guillaume351
    Offline

    Guillaume351 Active Member Plugin Developer

    Joined:
    Oct 11, 2013
    Posts:
    150
    Plugins:
    1
    Minecraft User:
    Guillaume351
    work perfectly thanks !
    LDX likes this.

Share This Page

Advertisement