Ejemplo n.º 1
0
 /**
  * @param EntityMotionEvent $event
  */
 public function onPlayerMotion(EntityMotionEvent $event)
 {
     if (isset($this->blockMans[spl_object_hash($event->getEntity())])) {
         foreach ($this->blockMans[spl_object_hash($event->getEntity())] as $p) {
             /** @var $p Player */
             $motion = $event->getEntity()->getMotion();
             $p->addEntityMotion($event->getEntity()->getId(), $motion->getX(), $motion->getY(), $motion->getZ());
         }
     }
 }
Ejemplo n.º 2
0
 public function onEntityMotion(EntityMotionEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $et = $ev->getEntity();
     if (!$et instanceof Living) {
         return;
     }
     if ($et instanceof Player) {
         return;
     }
     // Handled through PlayerMoveEvent
     $this->checkMove($et);
 }
Ejemplo n.º 3
0
 public function onEntityMotion(EntityMotionEvent $event)
 {
     $levelName = $event->getEntity()->getLevel()->getName();
     if (!$this->plugin->isLevelLoaded($levelName)) {
         return;
     }
     $settings = $this->plugin->getLevelSettings($levelName);
     if ($settings->restrictEntityMovement and !$event->getEntity() instanceof Player) {
         $event->setCancelled(true);
     }
 }
Ejemplo n.º 4
0
 public function onPlayerMotion(EntityMotionEvent $event)
 {
     if ($this->gameStatus > 1 && $event->getEntity() instanceof Player && $this->playerIsInGame($event->getEntity()->getName()) === 2) {
         foreach ($event->getEntity()->getLevel()->getPlayers() as $p) {
             $motion = $event->getEntity()->getMotion();
             $p->addEntityMotion($event->getEntity()->getId(), $motion->getX(), $motion->getY(), $motion->getZ());
         }
     }
 }