diff --git a/games/Example.php b/games/Example.php index 56f40b3..390f6e8 100644 --- a/games/Example.php +++ b/games/Example.php @@ -30,7 +30,8 @@ class Example extends Game { } - public function onPlayerDeath(\pocketmine\event\PlayerDeathEvent $event) { + public function onPlayerDeath(\pocketmine\event\player\PlayerDeathEvent $event) { + $event->getPlayer()->setGamemode(3); if(($this->getPlugin()->getInGamePlayers($this->getLevel()) - 1) == 0) { $this->stop(); } diff --git a/src/Ad5001/GameManager/tasks/SignReloadTask.php b/src/Ad5001/GameManager/tasks/SignReloadTask.php index 42eadf7..309d88e 100644 --- a/src/Ad5001/GameManager/tasks/SignReloadTask.php +++ b/src/Ad5001/GameManager/tasks/SignReloadTask.php @@ -24,15 +24,11 @@ class SignReloadTask extends PluginTask { public function onRun($tick) { - // echo "Running..."; foreach($this->server->getLevels() as $level) { foreach($level->getTiles() as $t) { if($t instanceof \pocketmine\tile\Sign) { - // echo "Sign."; foreach($this->gameManager->getLevels() as $name => $class) { - // echo PHP_EOL . strtolower($t->getText()[0]) . " == " . strtolower("[GAME]") . " and " . strtolower($class->getLevel()->getName()) . " == " . strtolower($t->getText()[1]); if(strtolower($t->getText()[0]) == strtolower("[GAME]") and strtolower($class->getLevel()->getName()) == strtolower($t->getText()[1])) { - // echo "Found\n"; $texts = $t->getText(); $texts[0] = str_ireplace("{players}", count($this->main->getInGamePlayers($class->getLevel())), str_ireplace("{max}", $class->getMaxPlayers(), str_ireplace("{game}", $class->getName(), str_ireplace("{level}", $class->getLevel()->getName(), $this->cfg->get("Game1"))))); $texts[1] = str_ireplace("{players}", count($this->main->getInGamePlayers($class->getLevel())), str_ireplace("{max}", $class->getMaxPlayers(), str_ireplace("{game}", $class->getName(), str_ireplace("{level}", $class->getLevel()->getName(), $this->cfg->get("Game2"))))); @@ -40,13 +36,11 @@ class SignReloadTask extends PluginTask { $texts[3] = str_ireplace("{players}", count($this->main->getInGamePlayers($class->getLevel())), str_ireplace("{max}", $class->getMaxPlayers(), str_ireplace("{game}", $class->getName(), str_ireplace("{level}", $class->getLevel()->getName(), $this->cfg->get("GameWait4"))))); $t->setText($texts[0], $texts[1], $texts[2], $texts[3]); } - /*if(str_ireplace("{game}", $class->getName(), $this->cfg->get("Game1")) == $t->getText()[0]) {*/ $lvlex = explode("{level}", $this->cfg->get("Game2")); $lvl = str_ireplace($lvlex[0], "", $t->getText()[1]); $lvl = str_ireplace($lvlex[1], "", $lvl); - $lvl = $this->main->getServer()->getLevelByName($lvl); - // $this->main->getLogger()->info($name . " == " . $lvl . " . Game: " . $t->getText()[0]); if($name == $lvl) { + $lvl = $this->main->getServer()->getLevelByName($lvl); if($this->gameManager->getLevels()[$lvl->getName()]->isStarted()) { $l3 = str_ireplace("{players}", count($lvl->getPlayers()), $this->cfg->get("InGame3")); $l3 = str_ireplace("{max}", $class->getMaxPlayers(), $l3); @@ -61,8 +55,15 @@ class SignReloadTask extends PluginTask { $t->setText($t->getText()[0], $t->getText()[1], $l3, $t4); } } - // } } + /*if($t->getText()[0] == "FillIt") { // Was just pure curiosity xD + $text = []; + for($i = 0; $i < 60; $i++) { + $text[] = "ยง4<><>"; + } + $text = implode("", $text); + $t->setText($text, $text, $text); + }*/ } } }