From bff3897fab36faac74e210ee8d9e9e18f8d6832b Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 7 Jul 2015 12:30:20 +1200 Subject: [PATCH 1/3] Perks and kits: Change priority for unregistering to high, add new method to Perk firing when perk listener is registered. --- .../src/nautilus/game/arcade/kit/Perk.java | 5 +++++ .../src/nautilus/game/arcade/managers/GameManager.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java index 5b8af51b1..aecdbf572 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java @@ -54,4 +54,9 @@ public abstract class Perk implements Listener { //Null Default } + + public void registeredEvents() + { + // When listener has been registered + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 561ebbb7f..119179fb8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -307,7 +307,7 @@ public class GameManager implements Listener event.GetGame().RegisterKits(); } - @EventHandler + @EventHandler(priority = EventPriority.HIGH) public void KitDeregister(GameStateChangeEvent event) { if (event.GetState() != GameState.Dead) From 804d6695135f76d460529a8eb5c46ebdb981efb5 Mon Sep 17 00:00:00 2001 From: Cheese Date: Tue, 7 Jul 2015 10:44:24 +1000 Subject: [PATCH 2/3] return types --- .../game/components/world/WorldComponent.php | 18 ++++++++++++++++-- 1 file changed, 16 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 e1d69501b..45a2601a9 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 @@ -11,6 +11,7 @@ namespace mineplex\plugin\gameengine\game\components\world; 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\UtilArray; use mineplex\plugin\util\UtilString; use pocketmine\event\Listener; use pocketmine\level\Position; @@ -231,19 +232,33 @@ class WorldComponent implements Listener } } + /** + * @return Position[][] + */ public function getTeams() { return $this->mapTeams; } + /** + * @param $key + * @return int + */ public function getSetting($key) { return $this->mapSettings[$key]; } + /** + * @param $key + * @return Position[] + */ public function getData($key) { - return $this->mapData[$key]; + if (UtilArray::hasKey($key, $this->mapData)) + return $this->mapData[$key]; + + return []; } public function getPosition() @@ -251,7 +266,6 @@ class WorldComponent implements Listener return $this->getTeams()[0][0]; } - protected function strToPos($str) { if (strlen($str) < 5) From 769d50f1c7481c493837399657f791ee7fb12bc5 Mon Sep 17 00:00:00 2001 From: Cheese Date: Tue, 7 Jul 2015 12:22:37 +1000 Subject: [PATCH 3/3] removed test code --- .../gameengine/game/components/world/WorldComponent.php | 5 ----- 1 file changed, 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 45a2601a9..84d3caba1 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 @@ -261,11 +261,6 @@ class WorldComponent implements Listener return []; } - public function getPosition() - { - return $this->getTeams()[0][0]; - } - protected function strToPos($str) { if (strlen($str) < 5)