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

Cancell Event PlayerMoveEvent

Comments in 'Plugin Development' started by Praxthisnovcht, Oct 26, 2015.

  1. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    hi I want to know how to block movement but allow the head to move.

    Thank You !
  2. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    hehe :3
    PHP:
    $event->setTo(new Vector3($event->getFrom()->getX$event-getFrom()->getY$event->getFrom()->getZ));
    SeifValkierks and Praxthisnovcht like this.
  3. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    PHP:
    public function onMove(PlayerMoveEvent $e){
            
    $from $e->getFrom();
            
    $to $e->getTo();

            if(
    $from->!== $to->||/*if you don't want to allow jump*/ $from->!== $to->|| $from->!== $to->z){
                
    $e->setCancelled();
            }
        }
    SeifValkierks and Praxthisnovcht like this.
  4. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    Thank for Help !
  5. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    you are welcome xD
    Praxthisnovcht likes this.
  6. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
  7. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    spam! xD
    SeifValkierks likes this.
  8. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
  9. TheDiamondYT
    Offline

    TheDiamondYT New Member

    Joined:
    Dec 20, 2014
    Posts:
    44
    Minecraft User:
    TheDiamondYT7
    Or just $e->setCancelled()
  10. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    read what I ask ...
    and look at the label [SOLVED]
    if you done this you can not move, not turning his head, not jump no need for me
    Legoboy0215 likes this.
  11. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    Best way to do it is
    PHP:
    $from = clone $event->getFrom();
    $event->to->$from->x;
    $event->to->$from->z;
    I don't see the need to construct a Vector, you can simply do this....
    Last edited: Oct 29, 2015
  12. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    SOLVEDSOLVED
  13. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    Then add the Solved tag.

Share This Page

Advertisement