public function onEnable() { self::$instance = $this; PluginUtils::consoleLog("Initializing"); // Get arena positions from arenas.yml @mkdir($this->getDataFolder()); $this->arenaConfig = new Config($this->getDataFolder() . "config.yml", Config::YAML, array()); $this->arenaManager = new ArenaManager(); $this->arenaManager->init($this->arenaConfig); //Register events $this->getServer()->getPluginManager()->registerEvents(new EventManager($this->arenaManager), $this); //Register commands $addArenaCommand = new AddArenaCommand($this, $this->arenaManager); $this->getServer()->getCommandMap()->register($addArenaCommand->commandName, $addArenaCommand); $chestPlaceCmd = new ChestPlaceCommand($this, $this->arenaManager); $this->getServer()->getCommandMap()->register($chestPlaceCmd->commandName, $chestPlaceCmd); $spawnAddCmd = new SpawnAddCommand($this, $this->arenaManager); $this->getServer()->getCommandMap()->register($spawnAddCmd->commandName, $spawnAddCmd); $spawnToArenaCmd = new SpawnToArenaCommand($this, $this->arenaManager); $this->getServer()->getCommandMap()->register($spawnToArenaCmd->commandName, $spawnToArenaCmd); $addLobbyCmd = new AddLobbyCommand($this, $this->arenaManager); $this->getServer()->getCommandMap()->register($addLobbyCmd->commandName, $addLobbyCmd); $task = new MatchStarter($this->getInstance(), $this->arenaManager); Server::getInstance()->getScheduler()->scheduleDelayedRepeatingTask($task, 20, 20); $chestTask = new ChestRefreshTask($this->getInstance(), $this->arenaManager); Server::getInstance()->getScheduler()->scheduleDelayedRepeatingTask($chestTask, 20 * 120, 20 * 120); }
public function onStartCountdownEnd() { Server::getInstance()->getScheduler()->cancelTask($this->countdownTaskHandler); $this->broadcastTip("GO!"); $this->arenaManager->refreshChests(); }
public function onRun($currentTick) { $this->arenaManager->refreshChests(); Server::getInstance()->broadcastMessage(TextFormat::DARK_BLUE . "[HungerGames]" . TextFormat::WHITE . " Chests have been reset!", $this->arenaManager->getPlayers()); }