/** * @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()); } } }
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); }
public function setMotion(Vector3 $motion) { if (!$this->justCreated) { $this->server->getPluginManager()->callEvent($ev = new EntityMotionEvent($this, $motion)); if ($ev->isCancelled()) { return false; } } $this->motionX = $motion->x; $this->motionY = $motion->y; $this->motionZ = $motion->z; if (!$this->justCreated) { $this->updateMovement(); } return true; }
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); } }
public function setMotion(Vector3 $motion) { if (!$this->justCreated) { $this->server->getPluginManager()->callEvent($ev = new EntityMotionEvent($this, $motion)); if ($ev->isCancelled()) { return false; } } $this->motionX = $motion->x; $this->motionY = $motion->y; $this->motionZ = $motion->z; if (!$this->justCreated) { if ($this instanceof Player) { $pk = new SetEntityMotionPacket(); $pk->entities = [[0, $this->motionX, $this->motionY, $this->motionZ]]; $this->dataPacket($pk); } $this->updateMovement(); } return true; }
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()); } } }