/** * @param $currentTick */ public function onRun($currentTick) { if ($this->index < 0) { Cameraman::getInstance()->sendMessage($this->getCamera()->getTarget(), "message-travelling-started", ["slowness" => $this->getCamera()->getSlowness()]); $this->index = 0; } if ($this->index >= count($this->getCamera()->getMovements())) { $this->getCamera()->stop(); return; } if (($location = $this->getCamera()->getMovement($this->index)->tick($this->getCamera()->getSlowness())) === null) { $this->index++; return; } $this->getCamera()->getTarget()->setPositionAndRotation($location, $location->getYaw(), $location->getPitch()); Cameraman::sendMovePlayerPacket($this->getCamera()->getTarget()); }
public function onRun($currentTick) { Cameraman::getInstance()->saveConfigs(); }
public function stop() { if ($this->isRunning()) { Cameraman::getInstance()->getServer()->getScheduler()->cancelTask($this->taskId); $this->taskId = -1; $this->getTarget()->teleport($this->location); $this->getTarget()->setGamemode($this->gamemode); Cameraman::getInstance()->sendMessage($this->getTarget(), "message-travelling-finished"); } }