From 4b800340d883891c64b86ca083effe6f10bcac8c Mon Sep 17 00:00:00 2001 From: Aaron Brock Date: Thu, 9 Jul 2015 18:52:40 -0400 Subject: [PATCH] Added things... Signed-off-by: Aaron Brock --- .../components/feature/ListenerFeature.php | 2 -- .../components/feature/features/NoDamage.php | 19 ++----------------- .../components/victorytype/LMSVictoryType.php | 5 ++++- .../game/games/sg/SurvivalGames.php | 18 +++++++++++------- .../src/mineplex/plugin/util/UtilArray.php | 12 +++++++++++- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/feature/ListenerFeature.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/feature/ListenerFeature.php index e6e9a3896..a45be076b 100644 --- a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/feature/ListenerFeature.php +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/feature/ListenerFeature.php @@ -8,11 +8,9 @@ namespace mineplex\plugin\gameengine\game\components\feature; - use mineplex\plugin\gameengine\arenas\Arena; use pocketmine\event\HandlerList; use pocketmine\event\Listener; -use pocketmine\plugin\Plugin; use pocketmine\Server; class ListenerFeature implements Feature, Listener { diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/feature/features/NoDamage.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/feature/features/NoDamage.php index f8113ee0c..b47145899 100644 --- a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/feature/features/NoDamage.php +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/feature/features/NoDamage.php @@ -10,9 +10,7 @@ namespace mineplex\plugin\gameengine\game\components\feature\features; use mineplex\plugin\gameengine\arenas\Arena; -use mineplex\plugin\gameengine\arenas\events\ArenaJoinEvent; use mineplex\plugin\gameengine\game\components\feature\ListenerFeature; -use mineplex\plugin\gameengine\game\components\spectate\SpectateComponent; use pocketmine\event\entity\EntityDamageEvent; use pocketmine\Server; @@ -23,24 +21,11 @@ class NoDamage extends ListenerFeature { parent::__construct($arena); } - function onJoin(EntityDamageEvent $event) + function onDamage(EntityDamageEvent $event) { if (!$this->getArena()->hasPlayer($event->getEntity())) return; + Server::getInstance()->broadcastMessage("Stopped!"); $event->setCancelled(); } - - public function enable() - { - Server::getInstance()->broadcastMessage("Death enable!"); - parent::enable(); - } - - public function disable() - { - Server::getInstance()->broadcastMessage("Death disable!"); - parent::disable(); - } - - } \ No newline at end of file diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/victorytype/LMSVictoryType.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/victorytype/LMSVictoryType.php index 51d50ed7c..621ebbd3f 100644 --- a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/victorytype/LMSVictoryType.php +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/victorytype/LMSVictoryType.php @@ -105,6 +105,8 @@ class DuringGame extends ListenerFeature implements BenchTask { if (!$this->spectateComponent->isSpectating($event->getPlayer())) array_push($this->rank, $event->getPlayer()); + + $this->checkEndGame(); } @@ -115,7 +117,8 @@ class DuringGame extends ListenerFeature implements BenchTask { array_push($this->rank, $event->getPlayer()); - $this->checkEndGame(true); + //Meh, don't like doing things this way, but I need it to call sendWinners after the player is added to spectating from spectating. + BenchSchedule::runTaskLater($this, 0); } public function checkEndGame($subtract = false) diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/games/sg/SurvivalGames.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/games/sg/SurvivalGames.php index fc4673846..c5b86fca4 100644 --- a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/games/sg/SurvivalGames.php +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/games/sg/SurvivalGames.php @@ -20,10 +20,12 @@ use mineplex\plugin\gameengine\game\components\feature\features\NoPickUpItem; use mineplex\plugin\gameengine\game\components\feature\managers\GameStateFeatureManager; use mineplex\plugin\gameengine\game\components\gamestate\GameState; use mineplex\plugin\gameengine\game\components\gamestate\GameStateComponent; +use mineplex\plugin\gameengine\game\components\lobby\LobbyComponent; use mineplex\plugin\gameengine\game\components\spectate\GameModeSpectateComponent; use mineplex\plugin\gameengine\game\Game; - - +use mineplex\plugin\gameengine\game\components\countdown\LobbyCountdown; +use mineplex\plugin\gameengine\game\components\feature\Feature; +use mineplex\plugin\gameengine\game\components\victorytype\LMSVictoryType; class SurvivalGames implements Game { function start(Arena $arena) @@ -42,7 +44,7 @@ class SurvivalGames implements Game { $features = array( //Just here cause I'm not using LobbyComponent atm - GameState::LOBBY => array( $stopEveryThing, $noDamage, ), + //GameState::LOBBY => array( $stopEveryThing, $noDamage, ), GameState::PRE_GAME => array( $stopEveryThing, $noDamage, $joinSpectate), @@ -52,16 +54,18 @@ class SurvivalGames implements Game { ); + new LobbyComponent($arena); + new GameStateFeatureManager($arena, $features); - //new LobbyCountdown( $arena, $gameStateComponent, null, GameState::LOBBY, GameState::PRE_GAME, 10, 2); + new LobbyCountdown( $arena, $gameStateComponent, null, GameState::LOBBY, GameState::PRE_GAME, 10, 2); - new GameStateCountdown($arena, $gameStateComponent, 5, GameState::LOBBY, GameState::PRE_GAME); + //new GameStateCountdown($arena, $gameStateComponent, 5, GameState::LOBBY, GameState::PRE_GAME); new GameStateCountdown($arena, $gameStateComponent, 5, GameState::PRE_GAME, GameState::GAME); - new GameStateCountdown($arena, $gameStateComponent, 5, GameState::GAME, GameState::POST_GAME); - //new LMSVictoryType( $arena, $spectateComponent, $gameStateComponent); + //new GameStateCountdown($arena, $gameStateComponent, 5, GameState::GAME, GameState::POST_GAME); + new LMSVictoryType( $arena, $spectateComponent, $gameStateComponent); new GameStateCountdown($arena, $gameStateComponent, 5, GameState::POST_GAME, GameState::RESTARTING); diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/util/UtilArray.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/util/UtilArray.php index aaf6f4bd6..db867477e 100644 --- a/Pocket/plugins/Mineplex/src/mineplex/plugin/util/UtilArray.php +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/util/UtilArray.php @@ -18,7 +18,17 @@ class UtilArray { public static function arrayDiff(array $array, array $subtract) { - return array_udiff($array, $subtract, ['mineplex\plugin\util\UtilArray', 'comp']); + //THIS IS TEMP FIX LATER!! + $return = []; + foreach ($array as $value) + { + if (!in_array($value, $subtract)) + array_push($return, $value); + } + + return $return; + + //return array_udiff($array, $subtract, ['mineplex\plugin\util\UtilArray', 'comp']); }