From b618c7b255d0c1cf02c88c267da0dd415d53c1ed Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 6 Jul 2015 09:46:49 +1000 Subject: [PATCH 1/2] IS THE WORLD READY PLEASE --- .../game/components/world/WorldComponent.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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..f8265b30d 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 @@ -12,15 +12,10 @@ use mineplex\plugin\gameengine\arenas\Arena; use mineplex\plugin\gameengine\game\components\world\event\WorldLoadFailEvent; use mineplex\plugin\gameengine\game\components\world\event\WorldLoadSuccessEvent; use mineplex\plugin\util\UtilString; -use mineplex\plugin\core\updater\UpdateEvent; -use mineplex\plugin\core\updater\UpdateType; -use pocketmine\event\level\LevelUnloadEvent; -use pocketmine\event\player\PlayerJoinEvent; use pocketmine\event\Listener; use pocketmine\level\Position; use pocketmine\math\Vector3; use pocketmine\Server; -use pocketmine\Player; use ZipArchive; use Exception; @@ -41,6 +36,8 @@ class WorldComponent implements Listener private $mapData = array(); private $mapSettings = array(); + private $ready = false; + public function __construct(Arena $arena) { $this->arena = $arena; @@ -122,6 +119,8 @@ class WorldComponent implements Listener print("Successfully Loaded World: " . $this->gameFolder . "\n"); Server::getInstance()->getPluginManager()->callEvent(new WorldLoadSuccessEvent($this->arena)); + + $this->ready = true; } else { @@ -271,5 +270,10 @@ class WorldComponent implements Listener { return rand(0, 999999); //Make this acutally unique } + + public function isWorldReady() + { + return $this->ready; + } } From 79cb4ee114d7ebd8c3e99bf41b68c03e45144c28 Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 6 Jul 2015 09:48:00 +1000 Subject: [PATCH 2/2] fixed ready --- .../gameengine/game/components/world/WorldComponent.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 f8265b30d..5203f76c0 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 @@ -105,6 +105,10 @@ class WorldComponent implements Listener else { print("Error Extracting: " . $this->gameFolder . "\n"); + + Server::getInstance()->getPluginManager()->callEvent(new WorldLoadFailEvent($this->arena)); + + return; } //Load World @@ -116,11 +120,11 @@ class WorldComponent implements Listener $this->loadWorldData(); + $this->ready = true; + print("Successfully Loaded World: " . $this->gameFolder . "\n"); Server::getInstance()->getPluginManager()->callEvent(new WorldLoadSuccessEvent($this->arena)); - - $this->ready = true; } else {