public function onRun($currentTick) { Server::getInstance()->broadcastTip(TextFormat::DARK_BLUE . "[HungerGames]" . TextFormat::WHITE . " Match will end in " . $this->countdownVal, $this->arena->getPlayers()); $this->countdownVal--; if ($this->countdownVal == 0) { $this->arena->onMatchEnd(); } }
public function onRun($currentTick) { $this->arena->setInUse(true); $playersOnline = true; foreach ($this->arena->players as $player) { if (!$this->arena->isOnline($player)) { $playersOnline = false; } } if ($playersOnline && $this->countdownVal >= 0) { $this->arena->broadcastTip("Match starts in: " . $this->countdownVal); $this->arena->inUse = false; $this->countdownVal--; } else { if (!$playersOnline) { $this->arena->abortMatch(); } } if ($this->countdownVal <= 0) { $this->arena->inUse = true; $this->arena->onStartCountdownEnd(); $this->arena->broadcastTip("GO!"); } }
/** * Reset the arena * @param Arena $arena */ public function clearArena(Arena $arena) { $arena->reset(); foreach ($arena->players as $player) { $player->teleport($this->getLobbySpawn()); $player->removeAllEffects(); } }