From e24890d292790b0a821fac115113762dfb134c69 Mon Sep 17 00:00:00 2001 From: Cheese Date: Sun, 5 Jul 2015 15:26:56 +1000 Subject: [PATCH] fixed some buggies --- .../game/components/world/WorldComponent.php | 62 +++++++------------ 1 file changed, 23 insertions(+), 39 deletions(-) diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/bench/game/components/world/WorldComponent.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/bench/game/components/world/WorldComponent.php index 72aefb56a..22daaf0fa 100644 --- a/Pocket/plugins/Mineplex/src/mineplex/plugin/bench/game/components/world/WorldComponent.php +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/bench/game/components/world/WorldComponent.php @@ -26,19 +26,13 @@ class WorldComponent implements Listener private $world; private $worldName; - private $mapName; private $mapAuthor; private $mapTeams = array(); private $mapData = array(); - private $minX = -256; - private $maxX = 256; - private $minY = -256; - private $maxY = 256; - private $minZ = -256; - private $maxZ = 256; + private $mapSettings = array(); public function __construct(Arena $arena) { @@ -91,43 +85,28 @@ class WorldComponent implements Listener { $this->mapName = $tokens[1]; } - else if (strcmp($tokens[0], "MAP_AUTHOR") === 0) + elseif (strcmp($tokens[0], "MAP_AUTHOR") === 0) { $this->mapAuthor = $tokens[1]; } //Map Boundaries - else if (strcmp($tokens[0], "MIN_X") === 0) + elseif (strcmp($tokens[0], "MIN_X") === 0 || + strcmp($tokens[0], "MAX_X") === 0 || + strcmp($tokens[0], "MIN_Y") === 0 || + strcmp($tokens[0], "MAX_Y") === 0 || + strcmp($tokens[0], "MIN_Z") === 0 || + strcmp($tokens[0], "MAX_Z") === 0) { - $this->minX = $tokens[1]; - } - else if (strcmp($tokens[0], "MAX_X") === 0) - { - $this->maxX = $tokens[1]; - } - else if (strcmp($tokens[0], "MIN_Y") === 0) - { - $this->minY = $tokens[1]; - } - else if (strcmp($tokens[0], "MAX_Y") === 0) - { - $this->maxY = $tokens[1]; - } - else if (strcmp($tokens[0], "MIN_Z") === 0) - { - $this->minZ = $tokens[1]; - } - else if (strcmp($tokens[0], "MAX_Z") === 0) - { - $this->maxZ = $tokens[1]; + $this->mapSettings[$tokens[0]] = $tokens[1]; } //Team Spawns - else if (strcmp($tokens[0], "TEAM_NAME") === 0) + elseif (strcmp($tokens[0], "TEAM_NAME") === 0) { $currentTeamName = $tokens[1]; } - else if (strcmp($tokens[0], "TEAM_SPAWNS") === 0) + elseif (strcmp($tokens[0], "TEAM_SPAWNS") === 0) { $positions = array(); @@ -145,11 +124,11 @@ class WorldComponent implements Listener } //Data - else if (strcmp($tokens[0], "DATA_NAME") === 0) + elseif (strcmp($tokens[0], "DATA_NAME") === 0) { $currentDataName = $tokens[1]; } - else if (strcmp($tokens[0], "DATA_LOCS") === 0) + elseif (strcmp($tokens[0], "DATA_LOCS") === 0) { $positions = array(); @@ -180,9 +159,14 @@ class WorldComponent implements Listener return $this->mapTeams; } + public function getSetting($key) + { + return $this->mapSettings[$key]; + } + public function getData($key) { - return $this->worldData[$key]; + return $this->mapData[$key]; } protected function strToLoc($str) @@ -199,12 +183,12 @@ class WorldComponent implements Listener } return null; - } + } //This will return a UID for the game public function getNewGameId() -{ - return rand(0, 999999); //Make this acutally unique -} + { + return rand(0, 999999); //Make this acutally unique + } }