public function onCommand(CommandSender $sender, Command $command, $label, array $args) { if ($command->getName() == "lobby") { if ($this->gameStatus >= 2) { $sender->sendMessage("[SurvivalGames] The game was started,you can't back to lobby."); return; } if (isset($this->players[$sender->getName()])) { unset($this->players[$sender->getName()]); $sender->setLevel($this->signlevel); $sender->teleport($this->signlevel->getSpawnLocation()); $sender->sendMessage("[SurvivalGames] Back to lobby..."); $this->sendToAll("[SurvivalGames] Player " . $sender->getName() . " exit from game"); $this->changeStatusSign(); if ($this->gameStatus == 1 && count($this->players) < 2) { $this->gameStatus = 0; $this->lastTime = 0; $this->sendToAll("[SurvivalGames] Less than 2 players,stopped countdown"); /*foreach($this->players as $pl) { $p=$this->getServer()->getPlayer($pl["id"]); $p->setLevel($this->signlevel); $p->teleport($this->signlevel->getSpawnLocation()); unset($p,$pl); }*/ } } else { $sender->sendMessage("[SurvivalGames] You are not in the game."); } return true; } if (!isset($args[0])) { unset($sender, $cmd, $label, $args); return false; } switch ($args[0]) { case "set": if ($this->config->exists("lastpos")) { $sender->sendMessage("[SurvivalGames] The game was set before,please use /fsg remove and try again."); } else { $name = $sender->getName(); $this->SetStatus[$name] = 0; $sender->sendMessage("[SurvivalGames] Please tap the status sign."); } break; case "remove": $this->config->remove("sign"); $this->config->remove("pos1"); $this->config->remove("pos2"); $this->config->remove("pos3"); $this->config->remove("pos4"); $this->config->remove("pos5"); $this->config->remove("pos6"); $this->config->remove("pos7"); $this->config->remove("pos8"); $this->config->remove("lastpos"); $this->config->save(); unset($this->sign, $this->pos1, $this->pos2, $this->pos3, $this->pos4, $this->pos5, $this->pos6, $this->pos7, $this->pos8, $this->lastpos); $sender->sendMessage("[SurvivalGames] succeeded in deleting game settings"); break; case "start": $this->sendToAll("[SurvivalGames] Force start game..."); $this->gameStatus = 1; $this->lastTime = 5; break; case "reload": unset($this->config); @mkdir($this->getDataFolder(), 0777, true); $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array()); if ($this->config->exists("lastpos")) { $this->sign = $this->config->get("sign"); $this->pos1 = $this->config->get("pos1"); $this->pos2 = $this->config->get("pos2"); $this->pos3 = $this->config->get("pos3"); $this->pos4 = $this->config->get("pos4"); $this->pos5 = $this->config->get("pos5"); $this->pos6 = $this->config->get("pos6"); $this->pos7 = $this->config->get("pos7"); $this->pos8 = $this->config->get("pos8"); $this->lastpos = $this->config->get("lastpos"); $this->level = $this->getServer()->getLevelByName($this->config->get("pos1")["level"]); $this->signlevel = $this->getServer()->getLevelByName($this->config->get("sign")["level"]); $this->sign = new Vector3($this->sign["x"], $this->sign["y"], $this->sign["z"]); $this->pos1 = new Vector3($this->pos1["x"] + 0.5, $this->pos1["y"], $this->pos1["z"] + 0.5); $this->pos2 = new Vector3($this->pos2["x"] + 0.5, $this->pos2["y"], $this->pos2["z"] + 0.5); $this->pos3 = new Vector3($this->pos3["x"] + 0.5, $this->pos3["y"], $this->pos3["z"] + 0.5); $this->pos4 = new Vector3($this->pos4["x"] + 0.5, $this->pos4["y"], $this->pos4["z"] + 0.5); $this->pos5 = new Vector3($this->pos5["x"] + 0.5, $this->pos5["y"], $this->pos5["z"] + 0.5); $this->pos6 = new Vector3($this->pos6["x"] + 0.5, $this->pos6["y"], $this->pos6["z"] + 0.5); $this->pos7 = new Vector3($this->pos7["x"] + 0.5, $this->pos7["y"], $this->pos7["z"] + 0.5); $this->pos8 = new Vector3($this->pos8["x"] + 0.5, $this->pos8["y"], $this->pos8["z"] + 0.5); $this->lastpos = new Vector3($this->lastpos["x"] + 0.5, $this->lastpos["y"], $this->lastpos["z"] + 0.5); } if (!$this->config->exists("endTime")) { $this->config->set("endTime", 600); } if (!$this->config->exists("gameTime")) { $this->config->set("gameTime", 300); } if (!$this->config->exists("waitTime")) { $this->config->set("waitTime", 180); } if (!$this->config->exists("godTime")) { $this->config->set("godTime", 15); } $this->endTime = (int) $this->config->get("endTime"); //游戏时间 $this->gameTime = (int) $this->config->get("gameTime"); //游戏时间 $this->waitTime = (int) $this->config->get("waitTime"); //等待时间 $this->godTime = (int) $this->config->get("godTime"); //无敌时间 $this->gameStatus = 0; //当前状态 $this->lastTime = 0; //还没开始 $this->players = array(); //加入游戏的玩家 $this->SetStatus = array(); //设置状态 $this->all = 0; //最大玩家数量 $this->config->save(); $sender->sendMessage("[SurvivalGame] Config reloaded"); break; default: return false; break; } return true; }
public function onCommand(CommandSender $sender, Command $command, $label, array $args) { if ($command->getName() == "lobby") { if ($this->gameStatus >= 2) { $In - Match == $this->getConfig()->get("In-Match"); $sender->sendMessage("[{$this->getConfig()->get("prefix")}] {$In}-Match"); return; } if (isset($this->players[$sender->getName()])) { unset($this->players[$sender->getName()]); $sender->setLevel($this->signlevel); $sender->teleport($this->signlevel->getSpawnLocation()); $sender->sendMessage(TextFormat::GREEN . "[{$this->getConfig()->get("prefix")}] Teleporting to lobby..."); $event->getPlayer()->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}]Player " . $sender->getName() . " left the match."); $this->changeStatusSign(); if ($this->gameStatus == 1 && count($this->players) < 2) { $this->gameStatus = 0; $this->lastTime = 0; $Arena - Join == $this->getConfig()->get("Arena-Join"); $event->getPlayer()->sendMessage("[{$this->getConfig()->get("prefix")}] {$Arena}-Join"); /*foreach($this->players as $pl) { $p=$this->getServer()->getPlayer($pl["id"]); $p->setLevel($this->signlevel); $p->teleport($this->signlevel->getSpawnLocation()); unset($p,$pl); }*/ } } else { $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] You are not in a match."); } return true; } if (!isset($args[0])) { unset($sender, $cmd, $label, $args); return false; } switch ($args[0]) { case "stats": if ($sender->hasPermission("sg.command.stats") or $sender->hasPermission("sg.command") or $sender->hasPermission("sg")) { if (!isset($args[1])) { $player = $sender->getName(); $deaths = $this->points->get($player)[0]; $kills = $this->points->get($player)[1]; $points = $this->points->get($player)[2]; $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] You have " . $deaths . " deaths and " . $kills . " kills. "); return true; } else { $player = $args[1]; $deaths = $this->points->get($player)[0]; $kills = $this->points->get($player)[1]; $points = $this->points->get($player)[2]; $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}]" . $player . " has " . $deaths . " deaths and " . $kills . " kills. "); return true; } } else { $sender->sendMessage("You dont have permissions to run this command."); return true; } break; case "set": if ($this->config->exists("lastpos")) { $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] You already setup the arena. use /sg remove to remove the current arena."); } else { $name = $sender->getName(); $this->SetStatus[$name] = 0; $sender->sendMessage(TextFormat::DARK_BLUE . "[{$this->getConfig()->get("prefix")}] Tap a sign to set join sign."); } break; case "remove": $this->config->remove("sign"); $this->config->remove("pos1"); $this->config->remove("pos2"); $this->config->remove("pos3"); $this->config->remove("pos4"); $this->config->remove("pos5"); $this->config->remove("pos6"); $this->config->remove("pos7"); $this->config->remove("pos8"); $this->config->remove("pos9"); $this->config->remove("pos10"); $this->config->remove("pos11"); $this->config->remove("pos12"); $this->config->remove("pos13"); $this->config->remove("pos14"); $this->config->remove("pos15"); $this->config->remove("pos16"); $this->config->remove("lastpos"); $this->config->save(); unset($this->sign, $this->pos1, $this->pos2, $this->pos3, $this->pos4, $this->pos5, $this->pos6, $this->pos7, $this->pos8, $this->pos9, $this->pos10, $this->pos11, $this->pos12, $this->pos13, $this->pos14, $this->pos15, $this->pos16, $this->pos17, $this->pos18, $this->pos19, $this->pos20, $this->pos21, $this->pos22, $this->pos23, $this->pos24, $this->lastpos); $sender->sendMessage(TextFormat::GREEN . "[SG]Game settings successfully removed."); break; case "start": Server::getInstance()->broadcastMessage(TextFormat::BLUE . "[Game] The Tournament has been forced to start."); $this->gameStatus = 1; $this->lastTime = 5; break; case "reload": @mkdir($this->getDataFolder(), 0777, true); $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array()); if ($this->config->exists("lastpos")) { $this->sign = $this->config->get("sign"); $this->pos1 = $this->config->get("pos1"); $this->pos2 = $this->config->get("pos2"); $this->pos3 = $this->config->get("pos3"); $this->pos4 = $this->config->get("pos4"); $this->pos5 = $this->config->get("pos5"); $this->pos6 = $this->config->get("pos6"); $this->pos7 = $this->config->get("pos7"); $this->pos8 = $this->config->get("pos8"); $this->pos9 = $this->config->get("pos9"); $this->pos10 = $this->config->get("pos10"); $this->pos11 = $this->config->get("pos11"); $this->pos12 = $this->config->get("pos12"); $this->pos13 = $this->config->get("pos13"); $this->pos14 = $this->config->get("pos14"); $this->pos15 = $this->config->get("pos15"); $this->pos16 = $this->config->get("pos16"); $this->lastpos = $this->config->get("lastpos"); $this->signlevel = $this->getServer()->getLevelByName($this->config->get("sign")["level"]); $this->sign = new Vector3($this->sign["x"], $this->sign["y"], $this->sign["z"]); $this->pos1 = new Vector3($this->pos1["x"] + 0.5, $this->pos1["y"], $this->pos1["z"] + 0.5); $this->pos2 = new Vector3($this->pos2["x"] + 0.5, $this->pos2["y"], $this->pos2["z"] + 0.5); $this->pos3 = new Vector3($this->pos3["x"] + 0.5, $this->pos3["y"], $this->pos3["z"] + 0.5); $this->pos4 = new Vector3($this->pos4["x"] + 0.5, $this->pos4["y"], $this->pos4["z"] + 0.5); $this->pos5 = new Vector3($this->pos5["x"] + 0.5, $this->pos5["y"], $this->pos5["z"] + 0.5); $this->pos6 = new Vector3($this->pos6["x"] + 0.5, $this->pos6["y"], $this->pos6["z"] + 0.5); $this->pos7 = new Vector3($this->pos7["x"] + 0.5, $this->pos7["y"], $this->pos7["z"] + 0.5); $this->pos8 = new Vector3($this->pos8["x"] + 0.5, $this->pos8["y"], $this->pos8["z"] + 0.5); $this->pos9 = new Vector3($this->pos9["x"] + 0.5, $this->pos9["y"], $this->pos9["z"] + 0.5); $this->pos10 = new Vector3($this->pos10["x"] + 0.5, $this->pos10["y"], $this->pos10["z"] + 0.5); $this->pos11 = new Vector3($this->pos11["x"] + 0.5, $this->pos11["y"], $this->pos11["z"] + 0.5); $this->pos12 = new Vector3($this->pos12["x"] + 0.5, $this->pos12["y"], $this->pos12["z"] + 0.5); $this->pos13 = new Vector3($this->pos13["x"] + 0.5, $this->pos13["y"], $this->pos13["z"] + 0.5); $this->pos14 = new Vector3($this->pos14["x"] + 0.5, $this->pos14["y"], $this->pos14["z"] + 0.5); $this->pos15 = new Vector3($this->pos15["x"] + 0.5, $this->pos15["y"], $this->pos15["z"] + 0.5); $this->pos16 = new Vector3($this->pos16["x"] + 0.5, $this->pos16["y"], $this->pos16["z"] + 0.5); $this->lastpos = new Vector3($this->lastpos["x"] + 0.5, $this->lastpos["y"], $this->lastpos["z"] + 0.5); } if (!$this->config->exists("gameTime")) { $this->config->set("gameTime", 300); } if (!$this->config->exists("prefix")) { $this->config->set("prefix", "Game"); } $this->gameTime = (int) $this->config->get("gameTime"); //how long a match is $this->prefix = (int) $this->config->get("prefix"); $this->gameStatus = 0; //status of the game (sign) $this->lastTime = 0; //just a variable :P $this->players = array(); //players $this->SetStatus = array(); $this->all = 0; // $this->config->save(); $sender->sendMessage(TextFormat::GREEN . "[SG] Config reloaded"); break; default: return false; break; } return true; }
public function onCommand(CommandSender $sender, Command $command, $label, array $args) { if ($command->getName() == "lobby") { if ($this->gameStatus >= 2) { $sender->sendMessage("[游戏系统] [饥饿游戏] 游戏已开始 ,不能退出"); return; } if (isset($this->players[$sender->getName()])) { unset($this->players[$sender->getName()]); $sender->setLevel($this->signlevel); $sender->teleport($this->signlevel->getSpawnLocation()); $sender->sendMessage("[游戏系统] [饥饿游戏] 成功退出"); $this->sendToAll("[游戏系统] [饥饿游戏] 玩家" . $sender->getName() . "退出了游戏"); $this->changeStatusSign(); if ($this->gameStatus == 1 && count($this->players) < 2) { $this->gameStatus = 0; $this->lastTime = 0; $this->sendToAll("[游戏系统] [饥饿游戏] 人数不足 ,已停止倒计时"); /*foreach($this->players as $pl) { $p=$this->getServer()->getPlayer($pl["id"]); $p->setLevel($this->signlevel); $p->teleport($this->signlevel->getSpawnLocation()); unset($p,$pl); }*/ } } else { $sender->sendMessage("[游戏系统] [饥饿游戏] 你不在游戏中"); } return true; } if (!isset($args[0])) { unset($sender, $cmd, $label, $args); return false; } switch ($args[0]) { case "set": if ($this->config->exists("lastpos")) { $sender->sendMessage("[游戏系统] [饥饿游戏] 游戏已经设置,请先删除设置"); } else { $name = $sender->getName(); $this->SetStatus[$name] = 0; $sender->sendMessage("[游戏系统] [饥饿游戏] 已进入设置模式 ,请先设置状态牌子"); } break; case "remove": $this->config->remove("sign"); $this->config->remove("pos1"); $this->config->remove("pos2"); $this->config->remove("pos3"); $this->config->remove("pos4"); $this->config->remove("pos5"); $this->config->remove("pos6"); $this->config->remove("pos7"); $this->config->remove("pos8"); $this->config->remove("lastpos"); $this->config->save(); unset($this->sign, $this->pos1, $this->pos2, $this->pos3, $this->pos4, $this->pos5, $this->pos6, $this->pos7, $this->pos8, $this->lastpos); $sender->sendMessage("[游戏系统] [饥饿游戏] 已删除游戏设置"); break; case "start": $this->sendToAll("[游戏系统] [饥饿游戏] 已强制开始游戏"); $this->gameStatus = 1; $this->lastTime = 5; break; case "reload": unset($this->config); @mkdir($this->getDataFolder(), 0777, true); $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array()); if ($this->config->exists("lastpos")) { $this->sign = $this->config->get("sign"); $this->pos1 = $this->config->get("pos1"); $this->pos2 = $this->config->get("pos2"); $this->pos3 = $this->config->get("pos3"); $this->pos4 = $this->config->get("pos4"); $this->pos5 = $this->config->get("pos5"); $this->pos6 = $this->config->get("pos6"); $this->pos7 = $this->config->get("pos7"); $this->pos8 = $this->config->get("pos8"); $this->lastpos = $this->config->get("lastpos"); $this->level = $this->getServer()->getLevelByName($this->config->get("pos1")["level"]); $this->signlevel = $this->getServer()->getLevelByName($this->config->get("sign")["level"]); $this->sign = new Vector3($this->sign["x"], $this->sign["y"], $this->sign["z"]); $this->pos1 = new Vector3($this->pos1["x"] + 0.5, $this->pos1["y"], $this->pos1["z"] + 0.5); $this->pos2 = new Vector3($this->pos2["x"] + 0.5, $this->pos2["y"], $this->pos2["z"] + 0.5); $this->pos3 = new Vector3($this->pos3["x"] + 0.5, $this->pos3["y"], $this->pos3["z"] + 0.5); $this->pos4 = new Vector3($this->pos4["x"] + 0.5, $this->pos4["y"], $this->pos4["z"] + 0.5); $this->pos5 = new Vector3($this->pos5["x"] + 0.5, $this->pos5["y"], $this->pos5["z"] + 0.5); $this->pos6 = new Vector3($this->pos6["x"] + 0.5, $this->pos6["y"], $this->pos6["z"] + 0.5); $this->pos7 = new Vector3($this->pos7["x"] + 0.5, $this->pos7["y"], $this->pos7["z"] + 0.5); $this->pos8 = new Vector3($this->pos8["x"] + 0.5, $this->pos8["y"], $this->pos8["z"] + 0.5); $this->lastpos = new Vector3($this->lastpos["x"] + 0.5, $this->lastpos["y"], $this->lastpos["z"] + 0.5); } if (!$this->config->exists("endTime")) { $this->config->set("endTime", 600); } if (!$this->config->exists("gameTime")) { $this->config->set("gameTime", 300); } if (!$this->config->exists("waitTime")) { $this->config->set("waitTime", 180); } if (!$this->config->exists("godTime")) { $this->config->set("godTime", 15); } $this->endTime = (int) $this->config->get("endTime"); //游戏时间 $this->gameTime = (int) $this->config->get("gameTime"); //游戏时间 $this->waitTime = (int) $this->config->get("waitTime"); //等待时间 $this->godTime = (int) $this->config->get("godTime"); //无敌时间 $this->gameStatus = 0; //当前状态 $this->lastTime = 0; //还没开始 $this->players = array(); //加入游戏的玩家 $this->SetStatus = array(); //设置状态 $this->all = 0; //最大玩家数量 $this->config->save(); $sender->sendMessage("[游戏系统] [饥饿游戏] 重载完成"); break; default: return false; break; } return true; }
public function onCommand(CommandSender $sender, Command $command, $label, array $args) { if ($command->getName() == "lobby") { if (isset($this->players[$sender->getName()])) { unset($this->players[$sender->getName()]); $sender->setLevel($this->signlevel); $sender->teleport($this->signlevel->getSpawnLocation()); $sender->sendMessage("§3> §eBack to lobby..."); $this->sendToAll("§3> §7Player " . $sender->getName() . " left the game"); $this->changeStatusSign(); if ($this->gameStatus == 1 && count($this->players) < 2) { $this->gameStatus = 0; $this->lastTime = 0; $this->sendPopup("§3> §eGame taking to long to start invite your friends"); /*foreach($this->players as $pl) { $p=$this->getServer()->getPlayer($pl["id"]); $p->setLevel($this->signlevel); $p->teleport($this->signlevel->getSpawnLocation()); unset($p,$pl); }*/ } } } if (!isset($args[0])) { unset($sender, $cmd, $label, $args); return false; } switch ($args[0]) { case "set": if ($this->config->exists("lastpos")) { $sender->sendMessage("GAME HAS ALREADY BEEN SET"); } else { $name = $sender->getName(); $this->SetStatus[$name] = 0; $sender->sendMessage("PLEASE TAP A SIGN."); } break; case "remove": $this->config->remove("sign"); $this->config->remove("pos1"); $this->config->remove("pos2"); $this->config->remove("pos3"); $this->config->remove("pos4"); $this->config->remove("pos5"); $this->config->remove("pos6"); $this->config->remove("pos7"); $this->config->remove("pos8"); $this->config->remove("lastpos"); $this->config->save(); unset($this->sign, $this->pos1, $this->pos2, $this->pos3, $this->pos4, $this->pos5, $this->pos6, $this->pos7, $this->pos8, $this->pos9, $this->pos10, $this->pos11, $this->pos12, $this->pos13, $this->pos14, $this->pos15, $this->pos16, $this->pos17, $this->pos18, $this->pos19, $this->pos20, $this->pos21, $this->pos22, $this->pos23, $this->pos24, $this->lastpos); $sender->sendMessage("YOU HAVE DELETED THE SETTINGS"); break; case "start": $this->sendPopup("§6§lBeing Force to Start"); $this->gameStatus = 1; $this->lastTime = 5; break; case "reload": unset($this->config); @mkdir($this->getDataFolder(), 0777, true); $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array()); if ($this->config->exists("lastpos")) { $this->sign = $this->config->get("sign"); $this->pos1 = $this->config->get("pos1"); $this->pos2 = $this->config->get("pos2"); $this->pos3 = $this->config->get("pos3"); $this->pos4 = $this->config->get("pos4"); $this->pos5 = $this->config->get("pos5"); $this->pos6 = $this->config->get("pos6"); $this->pos7 = $this->config->get("pos7"); $this->pos8 = $this->config->get("pos8"); $this->lastpos = $this->config->get("lastpos"); $this->level = $this->getServer()->getLevelByName($this->config->get("pos1")["level"]); $this->signlevel = $this->getServer()->getLevelByName($this->config->get("sign")["level"]); $this->sign = new Vector3($this->sign["x"], $this->sign["y"], $this->sign["z"]); $this->pos1 = new Vector3($this->pos1["x"] + 0.5, $this->pos1["y"] + 1, $this->pos1["z"] + 0.5); $this->pos2 = new Vector3($this->pos2["x"] + 0.5, $this->pos2["y"] + 1, $this->pos2["z"] + 0.5); $this->pos3 = new Vector3($this->pos3["x"] + 0.5, $this->pos3["y"] + 1, $this->pos3["z"] + 0.5); $this->pos4 = new Vector3($this->pos4["x"] + 0.5, $this->pos4["y"] + 1, $this->pos4["z"] + 0.5); $this->pos5 = new Vector3($this->pos5["x"] + 0.5, $this->pos5["y"] + 1, $this->pos5["z"] + 0.5); $this->pos6 = new Vector3($this->pos6["x"] + 0.5, $this->pos6["y"] + 1, $this->pos6["z"] + 0.5); $this->pos7 = new Vector3($this->pos7["x"] + 0.5, $this->pos7["y"] + 1, $this->pos7["z"] + 0.5); $this->pos8 = new Vector3($this->pos8["x"] + 0.5, $this->pos8["y"] + 1, $this->pos8["z"] + 0.5); $this->lastpos = new Vector3($this->lastpos["x"] + 0.5, $this->lastpos["y"] + 1, $this->lastpos["z"] + 0.5); } if (!$this->config->exists("endTime")) { $this->config->set("endTime", 600); } if (!$this->config->exists("gameTime")) { $this->config->set("gameTime", 300); } if (!$this->config->exists("waitTime")) { $this->config->set("waitTime", 180); } if (!$this->config->exists("godTime")) { $this->config->set("godTime", 15); } $this->endTime = (int) $this->config->get("endTime"); $this->gameTime = (int) $this->config->get("gameTime"); $this->waitTime = (int) $this->config->get("waitTime"); $this->godTime = (int) $this->config->get("godTime"); $this->gameStatus = 0; $this->lastTime = 0; $this->players = array(); $this->SetStatus = array(); $this->all = 0; $this->config->save(); $sender->sendPopup("RELOADED"); break; default: return false; break; } return true; }
public function onCommand(CommandSender $sender, Command $command, $label, array $args) { if ($command->getName() == "lobby") { if ($this->gameStatus >= 2) { $sender->sendMessage("[{$this->getConfig()->get("prefix")}] {$Already_Playing}"); return; } if (isset($this->players[$sender->getName()])) { unset($this->players[$sender->getName()]); $sender->setLevel($this->signlevel); $sender->teleport($this->signlevel->getSpawnLocation()); $sender->sendMessage(TextFormat::GREEN . "[{$this->getConfig()->get("prefix")}] Teleporting to lobby..."); $this->getServer()->broadcastMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}]Player " . $sender->getName() . " left the match."); $this->changeStatusSign(); if ($this->gameStatus == 1 && count($this->players) < 2) { $this->gameStatus = 0; $this->lastTime = 0; $event->getPlayer()->sendMessage("[{$this->getConfig()->get("prefix")}] {$Arena}"); /*foreach($this->players as $pl) { $p=$this->getServer()->getPlayer($pl["id"]); $p->setLevel($this->signlevel); $p->teleport($this->signlevel->getSpawnLocation()); unset($p,$pl); }*/ } } else { $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] {$Not_In_Match}"); } return true; } if (!isset($args[0])) { unset($sender, $cmd, $label, $args); return false; } switch ($args[0]) { case "help": if ($sender->hasPermission("sg.command.help") or $sender->hasPermission("sg.command") or $sender->hasPermission("sg")) { $sender->sendMessage("§d§o-------SurvivalGames Help-------"); $sender->sendMessage("§d§oUse §e/sg stats - View your stats"); $sender->sendMessage("§d§oUse §e/sg set - Set up an arena"); $sender->sendMessage("§d§oUse §e/sg remove - Remove a arena"); $sender->sendMessage("§d§oUse §e/sg start - Force start a match"); $sender->sendMessage("§d§oUse §e/sg reload - Reload the spawn positions"); $sender->sendMessage("§d§o--------------------------------"); return true; } break; case "stats": if ($sender instanceof Player) { if ($sender->hasPermission("sg.command.stats") or $sender->hasPermission("sg.command") or $sender->hasPermission("sg")) { if (!isset($args[1])) { $player = $sender->getName(); $deaths = $this->points->get($player)[0]; $kills = $this->points->get($player)[1]; $points = $this->points->get($player)[2]; $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] ---------------"); $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] §bYou're stats"); $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] §lDeaths: §9{$deaths}"); $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] §lKills: §9{$kills}"); $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] ---------------"); return true; } else { $player = $args[1]; $deaths = $this->points->get($player)[0]; $kills = $this->points->get($player)[1]; $points = $this->points->get($player)[2]; $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] ---------------"); $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] §bPlayer: §9{$player} Stats"); $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] §lDeaths: §9{$deaths}"); $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] §lKills: §9{$kills}"); $sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] ---------------"); return true; } } else { $sender->sendMessage("{$No_Permission}"); return true; } } else { $sender->sendMessage(TextFormat::RED . "That command can only be used in-game!"); return true; } break; case "set": if ($sender instanceof Player) { if ($this->config->exists("lastpos")) { $sender->sendMessage("Seems like you have already setup an arena"); } else { $name = $sender->getName(); $this->SetStatus[$name] = 0; $sender->sendMessage("Tap a sign to set it as join sign!"); } } else { $sender->sendMessage(TextFormat::RED . "You may only use ths command in-game!"); return true; } break; case "remove": $this->config->remove("sign"); $this->config->remove("pos1"); $this->config->remove("pos2"); $this->config->remove("pos3"); $this->config->remove("pos4"); $this->config->remove("pos5"); $this->config->remove("pos6"); $this->config->remove("pos7"); $this->config->remove("pos8"); $this->config->remove("pos9"); $this->config->remove("pos10"); $this->config->remove("pos11"); $this->config->remove("pos12"); $this->config->remove("pos13"); $this->config->remove("pos14"); $this->config->remove("pos15"); $this->config->remove("pos16"); $this->config->remove("pos17"); $this->config->remove("pos18"); $this->config->remove("pos19"); $this->config->remove("pos20"); $this->config->remove("pos21"); $this->config->remove("pos22"); $this->config->remove("pos23"); $this->config->remove("pos24"); $this->config->remove("lastpos"); $this->config->save(); unset($this->sign, $this->pos1, $this->pos2, $this->pos3, $this->pos4, $this->pos5, $this->pos6, $this->pos7, $this->pos8, $this->pos9, $this->pos10, $this->pos11, $this->pos12, $this->pos13, $this->pos14, $this->pos15, $this->pos16, $this->pos17, $this->pos18, $this->pos19, $this->pos20, $this->pos21, $this->pos22, $this->pos23, $this->pos24, $this->lastpos); $sender->sendMessage(TextFormat::GREEN . "Game settings successfully removed."); break; case "start": $this->getServer()->broadcastMessage(TextFormat::BLUE . "{$Force_Start}"); $this->gameStatus = 1; $this->lastTime = 5; break; case "reload": @mkdir($this->getDataFolder(), 0777, true); $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array()); if ($this->config->exists("lastpos")) { $this->sign = $this->config->get("sign"); $this->pos1 = $this->config->get("pos1"); $this->pos2 = $this->config->get("pos2"); $this->pos3 = $this->config->get("pos3"); $this->pos4 = $this->config->get("pos4"); $this->pos5 = $this->config->get("pos5"); $this->pos6 = $this->config->get("pos6"); $this->pos7 = $this->config->get("pos7"); $this->pos8 = $this->config->get("pos8"); $this->pos9 = $this->config->get("pos9"); $this->pos10 = $this->config->get("pos10"); $this->pos11 = $this->config->get("pos11"); $this->pos12 = $this->config->get("pos12"); $this->pos13 = $this->config->get("pos13"); $this->pos14 = $this->config->get("pos14"); $this->pos15 = $this->config->get("pos15"); $this->pos16 = $this->config->get("pos16"); $this->pos17 = $this->config->get("pos17"); $this->pos18 = $this->config->get("pos18"); $this->pos19 = $this->config->get("pos19"); $this->pos20 = $this->config->get("pos20"); $this->pos21 = $this->config->get("pos21"); $this->pos22 = $this->config->get("pos22"); $this->pos23 = $this->config->get("pos23"); $this->pos24 = $this->config->get("pos24"); $this->lastpos = $this->config->get("lastpos"); $this->signlevel = $this->getServer()->getLevelByName($this->config->get("sign")["level"]); $this->sign = new Vector3($this->sign["x"], $this->sign["y"], $this->sign["z"]); $this->pos1 = new Vector3($this->pos1["x"] + 0.5, $this->pos1["y"], $this->pos1["z"] + 0.5); $this->pos2 = new Vector3($this->pos2["x"] + 0.5, $this->pos2["y"], $this->pos2["z"] + 0.5); $this->pos3 = new Vector3($this->pos3["x"] + 0.5, $this->pos3["y"], $this->pos3["z"] + 0.5); $this->pos4 = new Vector3($this->pos4["x"] + 0.5, $this->pos4["y"], $this->pos4["z"] + 0.5); $this->pos5 = new Vector3($this->pos5["x"] + 0.5, $this->pos5["y"], $this->pos5["z"] + 0.5); $this->pos6 = new Vector3($this->pos6["x"] + 0.5, $this->pos6["y"], $this->pos6["z"] + 0.5); $this->pos7 = new Vector3($this->pos7["x"] + 0.5, $this->pos7["y"], $this->pos7["z"] + 0.5); $this->pos8 = new Vector3($this->pos8["x"] + 0.5, $this->pos8["y"], $this->pos8["z"] + 0.5); $this->pos9 = new Vector3($this->pos9["x"] + 0.5, $this->pos9["y"], $this->pos9["z"] + 0.5); $this->pos10 = new Vector3($this->pos10["x"] + 0.5, $this->pos10["y"], $this->pos10["z"] + 0.5); $this->pos11 = new Vector3($this->pos11["x"] + 0.5, $this->pos11["y"], $this->pos11["z"] + 0.5); $this->pos12 = new Vector3($this->pos12["x"] + 0.5, $this->pos12["y"], $this->pos12["z"] + 0.5); $this->pos13 = new Vector3($this->pos13["x"] + 0.5, $this->pos13["y"], $this->pos13["z"] + 0.5); $this->pos14 = new Vector3($this->pos14["x"] + 0.5, $this->pos14["y"], $this->pos14["z"] + 0.5); $this->pos15 = new Vector3($this->pos15["x"] + 0.5, $this->pos15["y"], $this->pos15["z"] + 0.5); $this->pos16 = new Vector3($this->pos16["x"] + 0.5, $this->pos16["y"], $this->pos16["z"] + 0.5); $this->pos17 = new Vector3($this->pos17["x"] + 0.5, $this->pos17["y"], $this->pos17["z"] + 0.5); $this->pos18 = new Vector3($this->pos18["x"] + 0.5, $this->pos18["y"], $this->pos18["z"] + 0.5); $this->pos19 = new Vector3($this->pos19["x"] + 0.5, $this->pos19["y"], $this->pos19["z"] + 0.5); $this->pos20 = new Vector3($this->pos20["x"] + 0.5, $this->pos20["y"], $this->pos20["z"] + 0.5); $this->pos21 = new Vector3($this->pos21["x"] + 0.5, $this->pos21["y"], $this->pos21["z"] + 0.5); $this->pos22 = new Vector3($this->pos22["x"] + 0.5, $this->pos22["y"], $this->pos22["z"] + 0.5); $this->pos23 = new Vector3($this->pos23["x"] + 0.5, $this->pos23["y"], $this->pos23["z"] + 0.5); $this->pos24 = new Vector3($this->pos24["x"] + 0.5, $this->pos24["y"], $this->pos24["z"] + 0.5); $this->lastpos = new Vector3($this->lastpos["x"] + 0.5, $this->lastpos["y"], $this->lastpos["z"] + 0.5); } if (!$this->config->exists("gameTime")) { $this->config->set("gameTime", 300); } if (!$this->config->exists("prefix")) { $this->config->set("prefix", "Game"); } $this->gameTime = (int) $this->config->get("gameTime"); $this->prefix = (int) $this->config->get("prefix"); $this->gameStatus = 0; $this->lastTime = 0; $this->players = array(); $this->SetStatus = array(); $this->all = 0; // $this->config->save(); $sender->sendMessage(TextFormat::GREEN . "All SurvivalGames configuration has been reloaded"); break; default: return false; break; } return true; }