diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/SimpleTeam.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/SimpleTeam.php index 2074b2597..0daba5e9b 100644 --- a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/SimpleTeam.php +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/SimpleTeam.php @@ -64,7 +64,12 @@ class SimpleTeam implements Team { */ function getName() { - $this->name; + return $this->name; + } + + function getDisplayName() + { + return $this->getColor() . $this->getName(); } /** @@ -72,7 +77,8 @@ class SimpleTeam implements Team { */ function getColor() { - $this->color; + return $this->color; } -} \ No newline at end of file +} + diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/SimpleTeamManager.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/SimpleTeamManager.php index f0b2cc655..e08968b23 100644 --- a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/SimpleTeamManager.php +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/SimpleTeamManager.php @@ -11,6 +11,7 @@ namespace mineplex\plugin\gameengine\game\components\team; use mineplex\plugin\gameengine\arenas\Arena; use mineplex\plugin\util\UtilArray; +use pocketmine\item\LeatherTunic; use pocketmine\Player; use InvalidArgumentException; @@ -36,6 +37,7 @@ class SimpleTeamManager implements TeamManager { function addTeam(Team $team) { + print "adding team: " . $team->getDisplayName() ."\n"; $this->teams[$team->getName()] = $team; } @@ -91,5 +93,4 @@ class SimpleTeamManager implements TeamManager { $team->addPlayer_forUseByManagerOnly($player); } - } \ No newline at end of file diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/Team.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/Team.php index 68d0721c6..0a36cedb0 100644 --- a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/Team.php +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/Team.php @@ -8,26 +8,10 @@ namespace mineplex\plugin\gameengine\game\components\team; - use pocketmine\Player; interface Team { - function addPlayer_forUseByManagerOnly(Player $player); - - function removePlayer_forUseByManagerOnly(Player $player); - - /** - * @return Player[] - */ - function getPlayers(); - - /** - * @param Player $player - * @return bool - */ - function hasPlayer(Player $player); - /** * @return string */ @@ -36,6 +20,9 @@ interface Team { /** * @return string */ + function getDisplayName(); + + function getColor(); -} \ No newline at end of file +} diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/TeamDealer.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/TeamDealer.php index c2e31bcea..5d5747907 100644 --- a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/TeamDealer.php +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/components/team/TeamDealer.php @@ -43,12 +43,18 @@ class TeamDealer implements Listener { function deal() { $teams = array_values($this->teamManager->getTeams()); + $counter = 0; + foreach ($this->arena->getPlayers() as $player) { - Server::getInstance()->broadcastMessage($counter % count($teams)); - $this->teamManager->setPlayersTeam($player, $teams[$counter % count($teams)]); + $counter++; + Server::getInstance()->broadcastMessage("counter: " . ($counter)); + Server::getInstance()->broadcastMessage("count: " . count($teams)); + Server::getInstance()->broadcastMessage("total: " . ($counter % count($teams))); + $this->teamManager->setPlayersTeam($player, $teams[$counter % count($teams)]); + } } diff --git a/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/games/sg/ChestComponent.php b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/games/sg/ChestComponent.php new file mode 100644 index 000000000..278baceb0 --- /dev/null +++ b/Pocket/plugins/Mineplex/src/mineplex/plugin/gameengine/game/games/sg/ChestComponent.php @@ -0,0 +1,82 @@ +arena = $arena; + $this->worldComponent = $worldComponent; + Server::getInstance()->getPluginManager()->registerEvents($this, $arena->getPlugin()); + //Don't to game start stuff here cause there might be other components not enabled yet + } + + function onStart(ArenaStartEvent $event) + { + if ($event->getArena() !== $this->arena) + return; + //Do stuff on Game start if you want + } + + function onLoad(WorldLoadSuccessEvent $event) + { + if ($event->getArena() !== $this->arena) + return; + + //Called after the world is loaded + } + + function onStateChange(GameStateChangeEvent $event) + { + if ($event->getArena() !== $this->arena) + return; + //Change this to what ever state you want + if ($event->getToGameState() == GameState::GAME) + { + //Do this when the state becomes GAME + } + elseif ($event->getFromGameState() == GameState::GAME) + { + //Do this when the state is no longer GAME + } + } + + + function onEnd(ArenaEndEvent $event) + { + if ($event->getArena() !== $this->arena) + return; + + HandlerList::unregisterAll($this); + + //Do end of game stuff if you need to + } +} \ No newline at end of file