diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/countdown/LobbyCountdown.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/countdown/LobbyCountdown.php new file mode 100644 index 000000000..2c61747cd --- /dev/null +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/countdown/LobbyCountdown.php @@ -0,0 +1,103 @@ +arena = $arena; + $this->gameStateComponent = $gameStateComponent; + + $this->startCount = $count; + $this->count = $count; + + $this->startGameState = $startGameState; + $this->setGameState = $setGameState; + + Server::getInstance()->getPluginManager()->registerEvents($this, $arena->getPlugin()); + } + + + + function checkCountdown() + { + + } + + + + public function onGameStateChange(GameStateChangeEvent $event) + { + if ($event->getArena() !== $this->arena) + return; + + if ($event->getToGameState() == $this->startGameState) + { + BenchSchedule::runTaskTimer($this, 1000, 1000); + } + else + { + BenchSchedule::cancelTask($this); + $this->count = $this->startCount; + } + } + + + public function onEnd(ArenaEndEvent $event) + { + if ($event->getArena() !== $this->arena) + return; + HandlerList::unregisterAll($this); + } + + public function run(BenchTaskData $data) + { + print "Count: $this->count"."\n"; + + if ($this->count <= 0) + { + $this->gameStateComponent->setGameState($this->setGameState); + $data->end(); + } + + $this->popup(); + + $this->count--; + + + } + + public function popup() + { + foreach ($this->arena->getPlayers() as $player) + { + $player->sendPopup("Countdown: $this->count"); + } + } + +} \ No newline at end of file diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/world/WorldComponent.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/world/WorldComponent.php index 6609349f0..8f6a4f65a 100644 --- a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/world/WorldComponent.php +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/world/WorldComponent.php @@ -52,7 +52,7 @@ class WorldComponent implements Listener $this->loadWorld("Super Smash Mobs"); } - //This is just some wierd testiong. Ignore it :P +// This is just some wierd testiong. Ignore it :P // public function onJoin(PlayerJoinEvent $event) // { // $this->player = $event->getPlayer(); @@ -128,6 +128,8 @@ class WorldComponent implements Listener print("Error Loading World: " . $this->gameFolder . "\n"); Server::getInstance()->getPluginManager()->callEvent(new WorldLoadFailEvent($this->arena)); + + $this->arena->endGame(); } }