public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if ($sender instanceof Player) {
         if (count($args) == 0) {
             $sender->sendMessage(TextFormat::RED . "Not enough arguments.");
             return;
         }
         if (count($args) == 1) {
             if ($this->getServer()->getPlayer($args[0])) {
                 $location = $this->getServer()->getPlayer($args[0])->getLocation();
                 $sender->teleport($location);
                 $sender->sendMessage(TextFormat::BLUE . "[Server] You have teleported to {$args['0']}");
                 return;
             } else {
                 $sender->sendMessage(TextFormat::RED . "[Server] That player isn't online!");
                 return;
             }
         }
         if (count($args) == 2) {
             if ($this->getServer()->getPlayer($args[0]) & getLocation() && $this->getServer()->getPlayer($args[1])) {
                 $location2 = $this->getServer()->getPlayer($args[1])->getLocation();
                 $player1 = $this->getServer()->getPlayer($args[0]);
                 $player2 = $this->getServer()->getPlayer($args[1]);
                 $player1->teleport($location2);
                 $player1->sendMessage(TextFormat::BLUE . "[Server] You have teleported to {$args['1']}");
                 return;
             }
         }
     }
 }
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if ($player->hasPermission("signstats.commands.stats")) {
         switch ($command->getName()) {
             case 'sethouse':
                 $this->config->player[$sender->getName()]['house']['x'] = $sender->x;
                 $this->config->player[$sender->getName()]['house']['y'] = $sender->y;
                 $this->config->player[$sender->getName()]['house']['z'] = $sender->z;
                 $sender->sendMessage(TextFormat::GREEN . '[EasyHouse] House set.');
                 break;
             case 'delhouse':
                 unset($this->config->player[$sender->getName()]['house']);
                 $sender->sendMessage(TextFormat::RED . '[EasyHouse] house Deleted');
                 break;
             case 'house':
                 if (isset($this->config->player[$sender->getName()]['house'])) {
                     $this->viellePosition[$sender->getName()] = array($sender->x, $sender->y, $sender->z);
                     $sender->teleport(new Vector3($this->config->player[$sender->getName()]['house']['x'], $this->config->player[$sender->getName()]['house']['y'], $this->config->player[$sender->getName()]['house']['z']));
                     $sender->sendMessage(TextFormat::GREEN . '[EasyHouse] Teleported.');
                 } else {
                     $sender->sendMessage(TextFormat::RED . 'House is not set.');
                 }
                 break;
         }
     } else {
         $player->sendMessage(TextFormat::RED . "[EasyHouse] You don't have permissions!");
     }
 }
Beispiel #3
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $sub)
 {
     $mm = "[TeleportView] ";
     if ($sender->getName() == "CONSOLE") {
         $sender->sendMessage($mm . ($this->isKorean() ? "게임내에서만 사용가능합니다." : "Please run this command in-game"));
         return true;
     }
     $yaw = $sender->getYaw();
     $ptch = $sender->getPitch();
     $yawS = -sin($yaw / 180 * M_PI);
     $yawC = cos($yaw / 180 * M_PI);
     $ptchS = -sin($ptch / 180 * M_PI);
     $ptchC = cos($ptch / 180 * M_PI);
     $x = $sender->getX();
     $y = $sender->getY() + $sender->getEyeHeight();
     $z = $sender->getZ();
     $l = $sender->getLevel();
     for ($f = 0; $f < 50; ++$f) {
         $x += $yawS * $ptchC;
         $y += $ptchS;
         $z += $yawC * $ptchC;
         $b = $l->getBlock(new Position($x, $y, $z, $l));
         if ($b->isSolid) {
             $sender->teleport(new Position($x - $yawS * $ptchC, $y - $ptchS + 0.1, $z - $yawC * $ptchC, $l));
             $f = true;
         }
     }
     if (!isset($f)) {
         $sender->sendMessage($mm . ($this->isKorean() ? "타겟 블럭이 너무 멉니다." : "TargetBlock is too far"));
     }
     return true;
 }
Beispiel #4
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $sub)
 {
     $mm = "[TeleportView] ";
     if ($sender->getName() == "CONSOLE") {
         $sender->sendMessage($mm . ($this->isKorean() ? "게임내에서만 사용가능합니다." : "Please run this command in-game"));
         return true;
     }
     $yaw = $sender->getYaw();
     $pitch = $sender->getPitch();
     $yawS = -sin($yaw / 180 * M_PI);
     $yawC = cos($yaw / 180 * M_PI);
     $pitchS = -sin($pitch / 180 * M_PI);
     $pitchC = cos($pitch / 180 * M_PI);
     $x = $sender->x;
     $y = $sender->y + $sender->getEyeHeight();
     $z = $sender->z;
     $l = $sender->getLevel();
     $ps = $this->getServer()->getOnlinePlayers();
     for ($f = 0; $f < 50; ++$f) {
         $x += $yawS * $pitchC;
         $y += $pitchS;
         $z += $yawC * $pitchC;
         $b = $l->getBlock(new Position($x, $y, $z, $l));
         if ($b->isSolid()) {
             break;
         }
         if ($f >= 50) {
             $sender->sendMessage($mm . ($this->isKorean() ? "타겟 블럭이 너무 멉니다." : "TargetBlock is too far"));
             return true;
         }
     }
     $sender->teleport(new Position($x, $y, $z, $sender->getLevel()));
     return true;
 }
Beispiel #5
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (!$sender instanceof Player) {
         $sender->sendMessage("This command must be used in-game.");
         return true;
     }
     switch (strtolower($command->getName())) {
         case "shop":
             $sender->teleport(new Location(-280.279358, 66.00000300000001, 368.750275, 179, -1, $this->getServer()->getLevelByName("Gorzen")));
             break;
         case "pvp":
             $sender->teleport(new Location(1701.638306, 12.663271, -1027.24585, 179, -1, $this->getServer()->getLevelByName("PvP")));
             break;
         default:
             $sender->sendMessage("Invalid command.");
             break;
     }
     return true;
 }
Beispiel #6
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command->getName()) === "spawnport") {
         if (!$sender instanceof Player) {
             $sender->sendMessage(TextFormat::AQUA . "Please run this command in game");
             return true;
         }
         $worldspawn = $sender->getLevel()->getSpawnLocation();
         $sender->teleport($worldspawn);
         $sender->sendMessage(TextFormat::AQUA . "Teleported to WorldSpawn");
     }
     return true;
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (strtolower($cmd->getName()) === "spawn" && $this->main->getConfig()->get("Spawn-Command-Enabled") === true) {
         if ($sender instanceof Player) {
             if ($sender->hasPermission("morecommands.command.spawn")) {
                 $sender->sendMessage($this->main->getConfig()->get("Teleport-to-Spawn-Message"));
                 $sender->teleport($this->main->getServer()->getDefaultLevel()->getSpawnLocation());
                 return true;
             } else {
                 $sender->sendMessage(TextFormat::RED . "You don't have permissions to use this command.");
             }
         } else {
             $sender->sendMessage(TextFormat::RED . "Please use this command in-game!");
             return true;
         }
     }
 }
Beispiel #8
0
 public function onCommand(CommandSender $player, Command $cmd, $label, array $args)
 {
     switch ($cmd->getName()) {
         case "bw":
             if ($player->isOp()) {
                 if ($this->mode == 0 and $args[0] == "addarena") {
                     $this->mode = 1;
                     $player->sendMessage(TextFormat::YELLOW . "Use /bw add [worldname] to add an arena");
                 } elseif ($this->mode == 1 and $args[0] == "add") {
                     if (file_exists($this->getServer()->getDataPath() . "/worlds/" . $args[0])) {
                         if (!$this->getServer()->getLevelByName($args[1]) instanceof Level) {
                             $this->getServer()->loadLevel($args[1]);
                         }
                         $spawn = $this->getServer()->getLevelByName($args[1])->getSafeSpawn();
                         $this->getServer()->getLevelByName($args[1])->loadChunk($spawn->x, $spawn->z);
                         if ($player instanceof Player) {
                             $player->teleport($spawn);
                         }
                         $this->arenaname = $args[1];
                         $player->sendMessage(TextFormat::GREEN . "You have successfully entered the arena! Now you have to set 4 bases");
                         $player->sendMessage(TextFormat::GOLD . "Touch" . TextFormat::BLUE . "Team blue" . TextFormat::GOLD . "'s bed now");
                         $this->mode = 2;
                     } else {
                         $player->sendMessage(TextFormat::RED . "This is not a valid name!");
                     }
                 } elseif ($this->mode == 0 and $args[0] == "regsign" and isset($args[1])) {
                     if (file_exists($this->getDataFolder() . "/arenas/" . $args[1])) {
                         $player->sendMessage(TextFormat::YELLOW . "You are about to register a sign for the arena {$args['1']}. Tap a sign to activate it!");
                         $this->regname = $args[1];
                         $this->mode = 10;
                     } else {
                         $player->sendMessage(TextFormat::RED . "This is not a valid name!");
                     }
                 } elseif ($this->mode == 0 and $args[0] == "regsign") {
                     $player->sendMessage(TextFormat::YELLOW . "Usage: /bw regsign [worldname]");
                 } elseif ($args[0] == "cancel") {
                     $this->mode = 0;
                     $player->sendMessage(TextFormat::GREEN . "Cancelled!");
                 }
             }
             return true;
     }
     return true;
 }
Beispiel #9
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     $cfg = $this->getConfig();
     $defgm = $cfg->get("Default-Game-Mode");
     $tptosp = $cfg->get("Teleport-To-Spawn");
     if (isset($args[0])) {
         switch ($args[0]) {
             case "on":
                 $sender->setGamemode(3);
                 $sender->sendMessage(TextFormat::GREEN . "You are now a Spectator!");
                 $this->getLogger()->info($sender->getName() . " Has changed his gamemode to Spectator");
                 return true;
             case "off":
                 $sender->setGamemode($defgm);
                 $sender->sendMessage(TextFormat::YELLOW . "You are no longer Espectator");
                 if ($tptosp === true) {
                     $sender->teleport($this->getServer()->getDefaultLevel()->getSpawn());
                 }
                 return true;
         }
     }
     return false;
 }
Beispiel #10
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     switch ($cmd->getName()) {
         case "skywarshowto":
             if ($sender->hasPermission("skywars.command.howto") or $sender->hasPermission("skywars.command") or $sender->hasPermission("skywars")) {
                 $sender->sendMessage("----How To Play skywars----");
                 $sender->sendMessage("/sk play = start a game");
                 $sender->sendMessage("/sk exit = exit from a game");
                 $sender->sendMessage("/sk stat [player] = get a player stats");
                 $sender->sendMessage("/sk skiptime = skip the waiting time");
                 return true;
             } else {
                 $sender->sendMessage("You haven't the permission to run this command");
             }
         case "skywars":
         case "sw":
             //same as setting aliases in plugin.yml, both cmds (skywars & sw) are usable
         //same as setting aliases in plugin.yml, both cmds (skywars & sw) are usable
         case "sk":
             switch ($args[0]) {
                 case "play":
                     if ($sender->hasPermission("skywars.command.play") or $sender->hasPermission("skywars.command") or $sender->hasPermission("skywars")) {
                         if ($this->aplayers >= $this->getConfig()->get('neededplayers') and $this->skywarsstarted == false) {
                             //if players in the world are more or equal as the max players
                             $sender->sendMessage("The game is full");
                             // game full
                             return true;
                         } elseif ($this->aplayers < $this->getConfig()->get('neededplayers') and $this->skywarsstarted == false) {
                             //if player number is less than the max.
                             $spawn = $this->getConfig()->get('spawns')[$this->aplayers];
                             //no need to do + 1 on this, because arrays start counting form 0 // get the correct spawn place
                             $sender->teleport(new Position($spawn[0], $spawn[1], $spawn[2], $this->getServer()->getLevelByName($this->getConfig()->get('aworld'))));
                             //teleport to it
                             $this->aplayers = $this->aplayers + 1;
                             //then add a player to the array
                             $sender->sendMessage("You have been teleported to the game world.");
                             if ($this->aplayers == $this->getConfig()->get('neededplayers')) {
                                 //if the players became the same as neededplayers
                                 $this->startGame($this->getConfig() > get('aworld'));
                                 //start the game
                             }
                             return true;
                         } elseif ($this->skywarsstarted == true) {
                             //if the game is already started
                             $sender->sendMessage("The game is already started");
                             return true;
                         }
                     } else {
                         $sender->sendMessage("You haven't the permission to run this command.");
                         return true;
                     }
                     break;
                 case "exit":
                     if ($sender->hasPermission("skywars.command.exit") or $sender->hasPermission("skywars.command") or $sender->hasPermission("skywars")) {
                         if ($sender->getLevel()->getName() == $this->getConfig()->get('aworld')) {
                             //if the level of the sender is a skywars one
                             $this->aplayers = $this->aplayers - 1;
                             //remove 1 to the array
                             $sender->teleport($this->getServer()->getLevelByName($this->getConfig() > get('lobby'))->getSafeSpawn());
                             //teleport to the lobby
                             $sender->sendMessage("You left the game.");
                             if ($this->aplayers <= 1) {
                                 //if only 1 player is left
                                 foreach ($this->getServer()->getLevelByName($this->getConfig()->get('aworld'))->getPlayers() as $p) {
                                     //detects the winner
                                     if ($p->getGameMode() == 0) {
                                         $p->sendMessage("You won the match!");
                                         $p->sendMessage("The game has finished, you will be teleported to the lobby.");
                                         $p->teleport($this->getServer()->getLevelByName($this->config->get('lobby'))->getSafeSpawn());
                                         //teleport to the lobby
                                         $points = $this->points->get($p)[2] + $this->getConfig()->get('points-per-match');
                                         //get points and add
                                         $deaths = $this->points->get($player)[0];
                                         //get the victim's deaths, add one and store in a variable
                                         $kills = $this->points->get($player)[1];
                                         //get the players kills and store in a var
                                         $this->getConfig()->set($p, array($deaths, $kills, $points));
                                     } else {
                                         $p->sendMessage("The match has finished, thanks for watching.");
                                         $p->teleport($this->getServer()->getLevelByName($this->getConfig()->get('lobby'))->getSafeSpawn());
                                         $p->setGameMode(0);
                                     }
                                     $this->stopGame($this->getConfig()->get('aworld'));
                                     //stop the game
                                 }
                             }
                             return true;
                         } else {
                             $sender->sendMessage("You are not in the SkyWars world.");
                             return true;
                         }
                     } else {
                         $sender->sendMessage("You haven't the permission to run this command.");
                         return true;
                     }
                     break;
                 case "stat":
                     if ($sender->hasPermission("skywars.command.stat") or $sender->hasPermission("skywars.command") or $sender->hasPermission("skywars")) {
                         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("You have " . $deaths . " deaths, " . $kills . " kills and " . $points . " points.");
                             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($player . " has " . $deaths . " deaths, " . $kills . " kills and " . $points . " points.");
                             return true;
                         }
                     } else {
                         $sender->sendMessage("You haven't the permission to run this command.");
                         return true;
                     }
                     break;
                 case "spawnpos":
                     if ($sender->hasPermission("skywars.command.pos") or $sender->hasPermission("skywars.command") or $sender->hasPermission("skywars")) {
                         $x = $sender->getX();
                         $y = $sender->getY();
                         //get coordinates and store in variables
                         $z = $sender->getZ();
                         $this->getConfig()->set('spawns', array($x, $y, $z));
                         $sender->sendMessage("Spawn position set to: " . $x . ", " . $y . ", " . $z . ", level: " . $sender->getLevel()->getName());
                         return true;
                     } else {
                         $sender->sendMessage("You haven't the permission to run this command.");
                         return true;
                     }
                     break;
                 case "skiptime":
                     if ($sender->hasPermission("skywars.command.skiptime") or $sender->hasPermission("skywars.command") or $sender->hasPermission("skywars")) {
                         if ($this->aplayers >= $this->getConfig()->get("minplayers")) {
                             $this->startGame($sender->getLevel()->getName());
                             //start game on the sender level
                             $sender->sendMessage("You started the game skipping the waiting time!");
                             return true;
                         } else {
                             $sender->sendMessage("There are less than 3 players, you can't start the game yet.");
                             return true;
                         }
                     } else {
                         $sender->sendMessage("You haven't the permission to run this command.");
                         return true;
                     }
                     break;
                 case "left":
                     if ($sender->hasPermission("skywars.command.left") or $sender->hasPermission("skywars.command") or $sender->hasPermission("skywars")) {
                         if ($sender->getLevel()->getName() == $this->getConfig()->get('aworld')) {
                             $playersleft = $this->getConfig()->get('neededplayers') - $this->aplayers;
                             $sender->sendMessage("Players left untill the game begin: " . $playersleft);
                             return true;
                         } else {
                             $sender->sendMessage("You are not in a SkyWars world.");
                             return true;
                         }
                     } else {
                         $sender->sendMessage("You haven't the permission to run this command.");
                         return true;
                     }
                     break;
                 case "see":
                     if ($sender->hasPermission("skywars.command.see") or $sender->hasPermission("skywars.command") or $sender->hasPermission("skywars")) {
                         $sender->sendMessage("You will join a match as a spectator");
                         $sender->setGamemode(3);
                         //Actually, this will crash mcpe I think.
                         $spawn = $this->getConfig()->get('spectatorspawn');
                         $sender->teleport(new Position($spawn[0], $spawn[1], $spawn[2], $this->getServer()->getLevelByName($this->getConfig()->get('aworld'))));
                     } else {
                         $sender->sendMessage("You haven't the permission to run this command.");
                         return true;
                     }
                     break;
                 default:
                     return false;
             }
     }
 }
Beispiel #11
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     $this->getLogger()->info("test");
     if ($command->getName() == "pk") {
         if ($args[0] == "join") {
             if (isset($args[1])) {
                 if (isset($this->arenas[strtolower($args[1])]) and substr(strtolower($args[1]), -5) != "_race") {
                     if (!isset($this->activeplayers[$sender->getName()])) {
                         $this->activeplayers[$sender->getName()] = array("current-map" => strtolower($args[1]), "last-set" => 0, "micro-seconds" => 0, "active" => false, "current-checkpoint" => 0);
                         $sender->teleport($this->arenas[strtolower($args[1])]->getStartPosition());
                         $sender->setRotation($this->arenas[strtolower($args[1])]->getStartYaw(), $sender->getPitch());
                         $sender->sendMessage("§cYou have started the map '§b" . $this->arenas[strtolower($args[1])]->getMapName() . "§c'.");
                     } else {
                         $sender->sendMessage("§cYou are currently still playing a different map\n§cUse §b/pk leave§c to leave this map.");
                     }
                 } else {
                     $sender->sendMessage("§cThe map '§b" . strtolower($args[1]) . "§c' doesn't exist.");
                 }
             } else {
                 $sender->sendMessage("§cUsage: §b/pk join [map name]");
             }
         } else {
             if ($args[0] == "leave") {
                 if (isset($this->activeplayers[$sender->getName()])) {
                     unset($this->activeplayers[$sender->getName()]);
                     $sender->sendMessage("§cYou have left your current map.");
                 } else {
                     $sender->sendMessage("§cYou aren't currently playing any maps.");
                 }
             } else {
                 if ($args[0] == "info") {
                     if (isset($args[1])) {
                         if (isset($this->arenas[strtolower($args[1])])) {
                             $map = $this->arenas[strtolower($args[1])];
                             $currentlyplaying = array();
                             foreach ($this->activeplayers as $player => $name) {
                                 if ($name['current-map'] == strtolower($args[1])) {
                                     array_push($currentlyplaying, $player);
                                 }
                             }
                             $sender->sendMessage("§cMap info:\n§cMap name: §b" . $map->getMapName() . "\n§cMap maker: §b" . $map->getMapMaker() . "\n§cDate of creation: §b" . $map->getDateOfCreation() . "\n§cMap world name: §b" . $map->getMapLevel()->getName() . "\n§cYour current highscore: §b" . ($map->getTime($sender) === null ? "none" : $map->getTime($sender)) . "\n§cCurrently playing: §b" . implode(", ", $currentlyplaying) . "\n§cFor leaderboards, please type §b/pk topten " . strtolower($args[1]));
                         } else {
                             $sender->sendMessage("§cThis map doesn't exist.");
                         }
                     } else {
                         $sender->sendMessage("§cUsage: §b/pk info [map name]");
                     }
                 } else {
                     if ($args[0] == "topten") {
                         if (isset($args[1])) {
                             if (isset($this->arenas[strtolower($args[1])])) {
                                 $sender->sendMessage("§cTop ten laps of the map §b" . $this->arenas[strtolower($args[1])]->getMapName() . "§c:");
                                 $count = 0;
                                 foreach ($this->arenas[strtolower($args[1])]->getTopTen() as $player) {
                                     $count++;
                                     $sender->sendMessage("§c" . $count . ") §b" . $player['username'] . "§c with §b" . $player['highscore']);
                                 }
                             } else {
                                 $sender->sendMessage("§cThis map doesn't exist.");
                             }
                         } else {
                             $sender->sendMessage("§cUsage: §b/pk topten [map name]");
                         }
                     }
                 }
             }
         }
         if ($args[0] == "create") {
             if (isset($args[1])) {
                 $this->arenaconf->set($args[1], array("date-of-creation" => date("d/m/Y"), "map-maker" => $sender->getName(), "level" => $sender->getLevel()->getName(), "floor-y" => 0, "start-position" => array("x" => 0, "y" => 0, "z" => 0, "yaw" => 360), "timer-block" => array("x" => 0, "y" => 0, "z" => 0), "end-block" => array("x" => 0, "y" => 0, "z" => 0)));
                 $sender->sendMessage("§cNew map '§b" . $args[1] . "§c' has been created.\n§cPlease use the follwing command to set the start position:\n§b/pk setstart " . strtolower($args[1]));
             } else {
                 $sender->sendMessage("§cUsage: §b/pk create [map name]");
             }
         } else {
             if ($args[0] == "setstart") {
                 if (isset($args[1])) {
                     if ($this->arenaconf->exists($args[1])) {
                         $newmap = $this->arenaconf->get($args[1]);
                         $newmap['start-position'] = array("x" => $sender->getFloorX(), "y" => $sender->getFloorY(), "z" => $sender->getFloorZ(), $sender->getYaw());
                         $this->arenaconf->set($args[1], $newmap);
                         $sender->sendMessage("§cAwesome! Now use the follwing command to set the floor that will reset you once you fall below/on it.\n§b/pk setfloor " . strtolower($args[1]));
                     } else {
                         $sender->sendMessage("§cThis map doesn't exist.");
                     }
                 } else {
                     $sender->sendMessage("§cUsage: §b/pk setfloor [map name]");
                 }
             } else {
                 if ($args[0] == "setfloor") {
                     if (isset($args[1])) {
                         if ($this->arenaconf->exists($args[1])) {
                             $newmap = $this->arenaconf->get($args[1]);
                             $newmap['floor-y'] = $sender->getFloorY();
                             $this->arenaconf->set($args[1], $newmap);
                             $sender->sendMessage("§cGreat! Now use the follwing command to set the timer start position.\n§b/pk settimer " . strtolower($args[1]));
                         } else {
                             $sender->sendMessage("§cThis map doesn't exist.");
                         }
                     } else {
                         $sender->sendMessage("§cUsage: §b/pk setfloor [map name]");
                     }
                 } else {
                     if ($args[0] == "settimer") {
                         if (isset($args[1])) {
                             if ($this->arenaconf->exists($args[1])) {
                                 $newmap = $this->arenaconf->get($args[1]);
                                 $newmap['timer-block'] = array("x" => $sender->getFloorX(), "y" => $sender->getFloorY(), "z" => $sender->getFloorZ());
                                 $this->arenaconf->set($args[1], $newmap);
                                 $sender->sendMessage("§cAlmost there! Use the following command to set the end of the map.\n§b/pk setend " . strtolower($args[1]) . "\n§cAfter that use §b/pk setcheckpoint " . strtolower($args[1]) . " §cfor every checkpoint you would like to set.");
                             } else {
                                 $sender->sendMessage("§cThis map doesn't exist.");
                             }
                         } else {
                             $sender->sendMessage("§cUsage: §b/pk settimer [map name]");
                         }
                     } else {
                         if ($args[0] == "setend") {
                             if (isset($args[1])) {
                                 if ($this->arenaconf->exists($args[1])) {
                                     $newmap = $this->arenaconf->get($args[1]);
                                     $newmap['end-block'] = array("x" => $sender->getFloorX(), "y" => $sender->getFloorY(), "z" => $sender->getFloorZ());
                                     $this->arenaconf->set($args[1], $newmap);
                                     $this->arenaconf->save();
                                     $sender->sendMessage("§cAwesome! Your new map is now ready to use.\n§cRestart the server to use the new map.\n§c(Refreshing maps would cause too much confusion)");
                                 } else {
                                     $sender->sendMessage("§cThis map doesn't exist.");
                                 }
                             } else {
                                 $sender->sendMessage("§cUsage: §b/pk setend [map name]");
                             }
                         } else {
                             if ($args[0] == "setcheckpoint") {
                                 if (isset($args[1])) {
                                     if ($this->arenaconf->exists($args[1])) {
                                         $checkpoints = $this->arenaconf->get($args[1]);
                                         $checkpoints['checkpoints'][count($checkpoints['checkpoints']) + 1] = array("yaw" => $sender->getYaw(), "x" => $sender->getFloorX(), "y" => $sender->getFloorY(), "z" => $sender->getFloorZ());
                                         $this->arenaconf->set($args[1], $checkpoints);
                                         $this->arenaconf->save();
                                         $sender->sendMessage("§cNew checkpoint set. Restart the server to apply the new changes.");
                                     } else {
                                         $sender->sendMessage("§cThis map doesn't exist.");
                                     }
                                 } else {
                                     $sender->sendMessage("§cUsage: §b/pk setcheckpoint [map name]");
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return true;
 }
Beispiel #12
0
 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;
 }
Beispiel #13
0
 public function onCommand(CommandSender $runner, Command $call, $alia, array $arg)
 {
     switch (strtolower($call->getName())) {
         case 'brawl':
             if (empty($arg) && $runner instanceof Player) {
                 $runner->sendMessage(TextFormat::RED . "Usage: /brawl <join|quit>");
             }
             if ($runner->hasPermission("brawl.cmd") && $runner instanceof Player && isset($arg[0])) {
                 switch (strtolower($arg[0])) {
                     case 'join':
                         if (!isset($this->brawl[$runner->getName()])) {
                             $this->cnt[$runner->getName()] = 0;
                             $this->brawl[$runner->getName()] = $runner;
                             $runner->teleport(new Position($this->wx, $this->wy, $this->wz, $this->wlvl), 0, 0);
                             foreach ($this->brawl as $pl) {
                                 $pl->sendMessage(TextFormat::GOLD . "[CL-BrawlArena] " . $runner->getName() . " joined the match.");
                             }
                             if (count($this->brawl) >= $this->min) {
                                 $t = new WaitTask($this);
                                 $h = $this->getServer()->getScheduler()->scheduleDelayedTask($t, 20 * $this->wait_time);
                                 $t->setHandler($h);
                                 foreach ($this->brawl as $pl) {
                                     $min = $this->wait_time / 60;
                                     $pl->sendMessage(TextFormat::GOLD . "[CL-BrawlArena] Game starting in " . ($this->wait_time <= 60 ? "{$this->wait_time} seconds" : "{$min} minutes."));
                                     break;
                                 }
                             }
                         } else {
                             $runner->sendMessage(TextFormat::RED . "[CL-BrawlArena] You already joined.");
                         }
                         if (count($this->brawl) >= $this->max) {
                             $runner->sendMessage(TextFormat::RED . "[CL-BrawlArena] Game full.");
                         }
                         if ($this->running) {
                             $runner->sendMessage(TextFormat::RED . "[CL-BrawlArena] Game already running.");
                         }
                         break;
                     case 'quit':
                         if (isset($this->brawl[$runner->getName()])) {
                             $runner->teleport(new Position($this->lx, $this->ly, $this->lz, $this->llvl), 0, 0);
                             $runner->sendMessage(TextFormat::GREEN . "[CL-BrawlArena] Teleporting...");
                             unset($this->brawl[$runner->getName()]);
                             unset($this->cnt[$runner->getName()]);
                             if (count($this->brawl) <= 0) {
                                 $this->getServer()->broadcastMessage(TextFormat::GREEN . "[CL-BrawlArena] Game is open.");
                                 $this->running = false;
                                 unset($this->brawl);
                                 unset($this->cnt);
                             }
                         }
                         break;
                 }
             }
             break;
     }
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     $name = $sender->getName();
     switch ($cmd->getName()) {
         case "vote":
             if (!isset($args[0])) {
                 $sender->sendMessage(MT::RED . 'Vote with /vote *arenanumber* (1-5)');
                 $this->getLogger()->info("{$name} benutzt vote befehl");
                 return true;
             } else {
                 if ($args[0] == 1 || $args[0] == 2 || $args[0] == 3 || $args[0] == 4 || $args[0] == 5) {
                     $sender->sendMessage(MT::RED . 'Thank u for voting the arena ' . MT::GREEN . $args[0]);
                     $this->getLogger()->info("{$name} hat gevotet Arena {$args['0']}");
                     if ($args[0] == 1) {
                         $this->arena1[$name] = 1;
                     }
                     if ($args[0] == 2) {
                         $this->arena2[$name] = 1;
                     }
                     if ($args[0] == 3) {
                         $this->arena3[$name] = 1;
                     }
                     if ($args[0] == 4) {
                         $this->arena4[$name] = 1;
                     }
                     if ($args[0] == 5) {
                         $this->arena5[$name] = 1;
                     }
                     return true;
                 } else {
                     $sender->sendMessage(MT::RED . 'Wrong arena number or arena not loaded');
                     return false;
                 }
             }
             break;
         case "watch":
             $level = $sender->getLevel()->getName();
             if ($level == $this->lobbyname) {
                 if (isset($this->selectarena)) {
                     $arenaname = $this->selectarena;
                     if ($this->arena1name == $arenaname) {
                         $pos111 = explode(",", $this->arena1areapos1);
                         $pos222 = explode(",", $this->arena1areapos2);
                     }
                     if ($this->arena2name == $arenaname) {
                         $pos111 = explode(",", $this->arena2areapos1);
                         $pos222 = explode(",", $this->arena2areapos2);
                     }
                     if ($this->arena3name == $arenaname) {
                         $pos111 = explode(",", $this->arena3areapos1);
                         $pos222 = explode(",", $this->arena3areapos2);
                     }
                     if ($this->arena4name == $arenaname) {
                         $pos111 = explode(",", $this->arena4areapos1);
                         $pos222 = explode(",", $this->arena4areapos2);
                     }
                     if ($this->arena5name == $arenaname) {
                         $pos111 = explode(",", $this->arena5areapos1);
                         $pos222 = explode(",", $this->arena5areapos2);
                     }
                     $randx = rand($pos111[0], $pos222[0]);
                     $randz = rand($pos111[2], $pos222[2]);
                     $randy = rand($pos111[1], $pos222[1]);
                     $sender->teleport($this->getServer()->getLevelByName($this->selectarena)->getSafeSpawn(new Position($randx, $randy, $randz)));
                     $sender->setGamemode(3);
                     return true;
                 } else {
                     $sender->sendMessage(MT::RED . 'Round isnt started yet!');
                     return false;
                 }
             } else {
                 $name = $sender->getName();
                 if (in_array($name, $this->players)) {
                     $sender->sendMessage(MT::RED . 'Your are not in Lobby and playing!');
                 } else {
                     $sender->teleport($this->getServer()->getLevelByName($this->lobbyname)->getSafeSpawn());
                     $sender->setGamemode(0);
                 }
                 return false;
             }
             break;
         case "playerspawn":
             $level = $sender->getLevel()->getName();
             if ($sender->isOp()) {
                 if (isset($args[0])) {
                     $config = $this->config->getAll();
                     $ppos = $config["PlayerspawnPos"];
                     $ppos2 = $config["PlayerspawnPos2"];
                     $ppos3 = $config["PlayerspawnPos3"];
                     $ppos4 = $config["PlayerspawnPos4"];
                     $ppos5 = $config["PlayerspawnPos5"];
                     if ($args[0] == "add") {
                         if (isset($args[1])) {
                             if ($this->arena1name == $level) {
                                 $commandpos = $args[1];
                                 if (!in_array($commandpos, $ppos)) {
                                     if (!is_array($ppos)) {
                                         $ppos = array($commandpos);
                                         return true;
                                     } else {
                                         $ppos[] = $commandpos;
                                         $sender->sendMessage(MT::GREEN . "Position setted " . $commandpos);
                                         $config["PlayerspawnPos"] = $ppos;
                                         $this->config->setAll($config);
                                         $this->config->save();
                                         return true;
                                     }
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position exist");
                                     return false;
                                 }
                             }
                             if ($this->arena2name == $level) {
                                 $commandpos = $args[1];
                                 if (!in_array($commandpos, $ppos2)) {
                                     if (!is_array($ppos2)) {
                                         $ppos2 = array($commandpos);
                                         return true;
                                     } else {
                                         $ppos2[] = $commandpos;
                                         $sender->sendMessage(MT::GREEN . "Position setted " . $commandpos);
                                         $config["PlayerspawnPos2"] = $ppos2;
                                         $this->config->setAll($config);
                                         $this->config->save();
                                         return true;
                                     }
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position exist");
                                     return false;
                                 }
                             }
                             if ($this->arena3name == $level) {
                                 $commandpos = $args[1];
                                 if (!in_array($commandpos, $ppos3)) {
                                     if (!is_array($ppos3)) {
                                         $ppos3 = array($commandpos);
                                         return true;
                                     } else {
                                         $ppos3[] = $commandpos;
                                         $sender->sendMessage(MT::GREEN . "Position setted " . $commandpos);
                                         $config["PlayerspawnPos3"] = $ppos3;
                                         $this->config->setAll($config);
                                         $this->config->save();
                                         return true;
                                     }
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position exist");
                                     return false;
                                 }
                             }
                             if ($this->arena4name == $level) {
                                 $commandpos = $args[1];
                                 if (!in_array($commandpos, $ppos4)) {
                                     if (!is_array($ppos4)) {
                                         $ppos4 = array($commandpos);
                                         return true;
                                     } else {
                                         $ppos4[] = $commandpos;
                                         $sender->sendMessage(MT::GREEN . "Position setted " . $commandpos);
                                         $config["PlayerspawnPos4"] = $ppos4;
                                         $this->config->setAll($config);
                                         $this->config->save();
                                         return true;
                                     }
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position exist");
                                     return false;
                                 }
                             }
                             if ($this->arena5name == $level) {
                                 $commandpos = $args[1];
                                 if (!in_array($commandpos, $ppos5)) {
                                     if (!is_array($ppos5)) {
                                         $ppos5 = array($commandpos);
                                         return true;
                                     } else {
                                         $ppos5[] = $commandpos;
                                         $sender->sendMessage(MT::GREEN . "Position setted " . $commandpos);
                                         $config["PlayerspawnPos5"] = $ppos5;
                                         $this->config->setAll($config);
                                         $this->config->save();
                                         return true;
                                     }
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position exist");
                                     return false;
                                 }
                             }
                         } else {
                             $sender->sendMessage(MT::RED . "Please select a position \nexample : /playerspawn add 10,5,25");
                             return false;
                         }
                     }
                     if ($args[0] == "dell") {
                         if (isset($args[1])) {
                             $commandpos = $args[1];
                             if ($this->arena1name == $level) {
                                 if (in_array($commandpos, $ppos)) {
                                     $key = array_search($commandpos, $ppos);
                                     unset($ppos[$key]);
                                     $sender->sendMessage(MT::GREEN . "Position deleted " . $commandpos);
                                     $config["PlayerspawnPos"] = $ppos;
                                     $this->config->setAll($config);
                                     $this->config->save();
                                     return true;
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position dont exist");
                                     return false;
                                 }
                             }
                             if ($this->arena2name == $level) {
                                 if (in_array($commandpos, $ppos2)) {
                                     $key = array_search($commandpos, $ppos2);
                                     unset($ppos2[$key]);
                                     $sender->sendMessage(MT::GREEN . "Position deleted " . $commandpos);
                                     $config["PlayerspawnPos2"] = $ppos2;
                                     $this->config->setAll($config);
                                     $this->config->save();
                                     return true;
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position dont exist");
                                     return false;
                                 }
                             }
                             if ($this->arena3name == $level) {
                                 if (in_array($commandpos, $ppos3)) {
                                     $key = array_search($commandpos, $ppos3);
                                     unset($ppos3[$key]);
                                     $sender->sendMessage(MT::GREEN . "Position deleted " . $commandpos);
                                     $config["PlayerspawnPos3"] = $ppos3;
                                     $this->config->setAll($config);
                                     $this->config->save();
                                     return true;
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position dont exist");
                                     return false;
                                 }
                             }
                             if ($this->arena4name == $level) {
                                 if (in_array($commandpos, $ppos4)) {
                                     $key = array_search($commandpos, $ppos4);
                                     unset($ppos4[$key]);
                                     $sender->sendMessage(MT::GREEN . "Position deleted " . $commandpos);
                                     $config["PlayerspawnPos4"] = $ppos4;
                                     $this->config->setAll($config);
                                     $this->config->save();
                                     return true;
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position dont exist");
                                     return false;
                                 }
                             }
                             if ($this->arena5name == $level) {
                                 if (in_array($commandpos, $ppos5)) {
                                     $key = array_search($commandpos, $ppos5);
                                     unset($ppos5[$key]);
                                     $sender->sendMessage(MT::GREEN . "Position deleted " . $commandpos);
                                     $config["PlayerspawnPos5"] = $ppos5;
                                     $this->config->setAll($config);
                                     $this->config->save();
                                     return true;
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position dont exist");
                                     return false;
                                 }
                             }
                         } else {
                             $sender->sendMessage(MT::RED . "Please select a position \nexample : /playerspawn dell 10,5,25");
                             return false;
                         }
                     }
                     if ($args[0] == "list") {
                         $sender->sendMessage(MT::GREEN . "Playerspawns: " . implode(", ", $ppos));
                         return true;
                     }
                 } else {
                     $sender->sendMessage(MT::RED . 'add / dell / list');
                     return true;
                 }
             } else {
                 $sender->sendMessage(MT::RED . 'Only for Operators');
                 return false;
             }
             break;
         case "chestspawn":
             $level = $sender->getLevel()->getName();
             if ($sender->isOp()) {
                 if (isset($args[0])) {
                     $config = $this->config->getAll();
                     $ppos = $config["ChestspawnPos"];
                     $ppos2 = $config["ChestspawnPos2"];
                     $ppos3 = $config["ChestspawnPos3"];
                     $ppos4 = $config["ChestspawnPos4"];
                     $ppos5 = $config["ChestspawnPos5"];
                     if ($args[0] == "add") {
                         if (isset($args[1])) {
                             $commandpos = $args[1];
                             if ($this->arena1name == $level) {
                                 if (!in_array($commandpos, $ppos)) {
                                     if (!is_array($ppos)) {
                                         $ppos = array($commandpos);
                                         return true;
                                     } else {
                                         $ppos[] = $commandpos;
                                         $sender->sendMessage(MT::GREEN . "Position setted " . $commandpos);
                                         $config["ChestspawnPos"] = $ppos;
                                         $this->config->setAll($config);
                                         $this->config->save();
                                         return true;
                                     }
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position exist");
                                     return false;
                                 }
                             }
                             if ($this->arena2name == $level) {
                                 if (!in_array($commandpos, $ppos2)) {
                                     if (!is_array($ppos2)) {
                                         $ppos2 = array($commandpos);
                                         return true;
                                     } else {
                                         $ppos2[] = $commandpos;
                                         $sender->sendMessage(MT::GREEN . "Position setted " . $commandpos);
                                         $config["ChestspawnPos2"] = $ppos2;
                                         $this->config->setAll($config);
                                         $this->config->save();
                                         return true;
                                     }
                                 } else {
                                     $player->sendMessage(MT::RED . "Position exist");
                                     return false;
                                 }
                             }
                             if ($this->arena3name == $level) {
                                 if (!in_array($commandpos, $ppos3)) {
                                     if (!is_array($ppos3)) {
                                         $ppos3 = array($commandpos);
                                         return true;
                                     } else {
                                         $ppos3[] = $commandpos;
                                         $sender->sendMessage(MT::GREEN . "Position setted " . $commandpos);
                                         $config["ChestspawnPos3"] = $ppos3;
                                         $this->config->setAll($config);
                                         $this->config->save();
                                         return true;
                                     }
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position exist");
                                     return false;
                                 }
                             }
                             if ($this->arena4name == $level) {
                                 if (!in_array($commandpos, $ppos4)) {
                                     if (!is_array($ppos4)) {
                                         $ppos4 = array($commandpos);
                                         return true;
                                     } else {
                                         $ppos4[] = $commandpos;
                                         $sender->sendMessage(MT::GREEN . "Position setted " . $commandpos);
                                         $config["ChestspawnPos4"] = $ppos4;
                                         $this->config->setAll($config);
                                         $this->config->save();
                                         return true;
                                     }
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position exist");
                                     return false;
                                 }
                             }
                             if ($this->arena5name == $level) {
                                 if (!in_array($commandpos, $ppos5)) {
                                     if (!is_array($ppos5)) {
                                         $ppos = array($commandpos);
                                         return true;
                                     } else {
                                         $ppos5[] = $commandpos;
                                         $sender->sendMessage(MT::GREEN . "Position setted " . $commandpos);
                                         $config["ChestspawnPos5"] = $ppos5;
                                         $this->config->setAll($config);
                                         $this->config->save();
                                         return true;
                                     }
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position exist");
                                     return false;
                                 }
                             }
                         } else {
                             $sender->sendMessage(MT::RED . "Please select a position \nexample : /playerspawn add 10,5,25");
                             return false;
                         }
                     }
                     if ($args[0] == "dell") {
                         if (isset($args[1])) {
                             $commandpos = $args[1];
                             if ($this->arena1name == $level) {
                                 if (in_array($commandpos, $ppos)) {
                                     $key = array_search($commandpos, $ppos);
                                     unset($ppos[$key]);
                                     $sender->sendMessage(MT::GREEN . "Position deleted " . $commandpos);
                                     $config["ChestspawnPos"] = $ppos;
                                     $this->config->setAll($config);
                                     $this->config->save();
                                     return true;
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position dont exist");
                                     return false;
                                 }
                             }
                             if ($this->arena2name == $level) {
                                 if (in_array($commandpos, $ppos2)) {
                                     $key = array_search($commandpos, $ppos2);
                                     unset($ppos2[$key]);
                                     $sender->sendMessage(MT::GREEN . "Position deleted " . $commandpos);
                                     $config["ChestspawnPos2"] = $ppos2;
                                     $this->config->setAll($config);
                                     $this->config->save();
                                     return true;
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position dont exist");
                                     return false;
                                 }
                             }
                             if ($this->arena3name == $level) {
                                 if (in_array($commandpos, $ppos3)) {
                                     $key = array_search($commandpos, $ppos3);
                                     unset($ppos3[$key]);
                                     $sender->sendMessage(MT::GREEN . "Position deleted " . $commandpos);
                                     $config["ChestspawnPos"] = $ppos3;
                                     $this->config->setAll($config);
                                     $this->config->save();
                                     return true;
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position dont exist");
                                     return false;
                                 }
                             }
                             if ($this->arena4name == $level) {
                                 if (in_array($commandpos, $ppos4)) {
                                     $key = array_search($commandpos, $ppos4);
                                     unset($ppos4[$key]);
                                     $sender->sendMessage(MT::GREEN . "Position deleted " . $commandpos);
                                     $config["ChestspawnPos4"] = $ppos4;
                                     $this->config->setAll($config);
                                     $this->config->save();
                                     return true;
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position dont exist");
                                     return false;
                                 }
                             }
                             if ($this->arena5name == $level) {
                                 if (in_array($commandpos, $ppos5)) {
                                     $key = array_search($commandpos, $ppos5);
                                     unset($ppos5[$key]);
                                     $sender->sendMessage(MT::GREEN . "Position deleted " . $commandpos);
                                     $config["ChestspawnPos5"] = $ppos5;
                                     $this->config->setAll($config);
                                     $this->config->save();
                                     return true;
                                 } else {
                                     $sender->sendMessage(MT::RED . "Position dont exist");
                                     return false;
                                 }
                             }
                         } else {
                             $sender->sendMessage(MT::RED . "Please select a position \nexample : /playerspawn dell 10,5,25");
                             return false;
                         }
                     }
                     if ($args[0] == "list") {
                         $sender->sendMessage(MT::GREEN . "Playerspawns: " . implode(", ", $ppos));
                         return true;
                     }
                 } else {
                     $sender->sendMessage(MT::RED . 'add / dell / list');
                     return true;
                 }
             } else {
                 $sender->sendMessage(MT::RED . 'Only for Operators');
                 return false;
             }
             break;
     }
 }
Beispiel #15
0
 function tpCommand(CommandSender $sender, array $args)
 {
     if (count($args) !== 0) {
         $sender->sendMessage($this->getMessage("l.tp.usage"));
         return true;
     }
     if (($pair = $this->provider->getPair($sender->getName())) === null) {
         $sender->sendMessage($this->getMessage("l.no-married"));
         return true;
     }
     if (!($Player = $this->getServer()->getPlayer($pair))) {
         $sender->sendMessage($this->getMessage("l.pair-offline"));
         return true;
     }
     $sender->teleport($Player);
     return true;
 }
Beispiel #16
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command->getName()) == "is") {
         if (!isset($args[0])) {
             $sender->sendMessage(TextFormat::YELLOW . "No pusiste un subcomando");
             $sender->sendMessage(TextFormat::GREEN . "Usa: " . TextFormat::RESET . "/is help");
             return true;
         } elseif (isset($args[0])) {
             if ($args[0] == "help") {
                 if ($sender->hasPermission("is") || $sender->hasPermission("is.help")) {
                     if (!isset($args[1]) or $args[1] == "1") {
                         $sender->sendMessage(TextFormat::GREEN . "[Skyblock] Enseñando lista de Ayuda");
                         $sender->sendMessage(TextFormat::GREEN . "/is help");
                         $sender->sendMessage(TextFormat::GREEN . "/is create");
                         $sender->sendMessage(TextFormat::GREEN . "/is home");
                         $sender->sendMessage(TextFormat::GREEN . "/is sethome");
                         $sender->sendMessage(TextFormat::GREEN . "/is find (Solo Op)");
                         return true;
                     } elseif ($args[1] == "2") {
                         $sender->sendMessage("Pronto habra mas Comandos");
                         return true;
                     }
                 } else {
                     $sender->sendMessage(TextFormat::RED . "[SkyBlock] No puedes ver el menu de ayuda");
                     return true;
                 }
             } elseif ($args[0] == "create") {
                 if ($sender->hasPermission("is") || $sender->hasPermission("is.command") || $sender->hasPermission("is.command.create")) {
                     $senderIs = $this->getDataFolder() . "Islands/" . $sender->getName() . ".txt";
                     if ($sender->getLevel()->getName() == $this->getConfig()->get("Lobby")) {
                         $sender->sendMessage(TextFormat::YELLOW . "[Skyblock] No Puedes Hacer una isla en Spawn, desgraciado :L");
                         return true;
                     } else {
                         if (!file_exists($senderIs)) {
                             $this->makeIsland($sender->getName());
                             return true;
                         } else {
                             $sender->sendMessage(TextFormat::YELLOW . "[Skyblock] Tu ya tienes una isla!");
                             return true;
                         }
                     }
                 } else {
                     $sender->sendMessage(TextFormat::RED . "[Skyblock] Tu No Puedes Crear una isla!");
                     return true;
                 }
             } elseif ($args[0] == "home") {
                 if ($sender->hasPermission("is") || $sender->hasPermission("is.command") || $sender->hasPermission("is.command.home")) {
                     if (!file_exists($this->getDataFolder() . "Islands/" . $sender->getName() . ".txt")) {
                         $sender->sendMessage("You don't have an island. Use /is create to make one");
                         return true;
                     } else {
                         $level = $this->getServer()->getLevelByName(yaml_parse_file($this->getDataFolder() . "Players/" . $sender->getName() . ".txt"));
                         if ($level !== null) {
                             $sender->sendMessage(TextFormat::GREEN . "Teleporting to your island...");
                             if ($sender->getLevel()->getName() !== $level->getName()) {
                                 $sender->sendMessage(TextFormat::RED . "[Skyblock] Tu no estas en el mismo mundo de tu isla. Usa " . TextFormat::YELLOW . "/mw tp " . $level->getName() . TextFormat::RESET . " E intenta de nuevo");
                                 return true;
                             } else {
                                 $sender->teleport(new Vector3(yaml_parse_file($this->getDataFolder() . "Islands/" . $sender->getName() . ".txt")));
                                 $sender->sendMessage(TextFormat::GREEN . "[Skyblock] Listo!");
                                 return true;
                             }
                         } else {
                             $sender->sendMessage(TextFormat::RED . "[Skyblock] Un Error a ocurrido.");
                             return true;
                         }
                     }
                 } else {
                     $sender->sendMessage(TextFormat::ORANGE . "[Skyblock] No Tienes permisos para hacer eso");
                     return true;
                 }
             } elseif ($args[0] == "find") {
                 if ($sender->hasPermission("is") || $sender->hasPermission("is.command") || $sender->hasPermission("is.command.find")) {
                     if (isset($args[1])) {
                         $p = $sender->getServer()->getPlayer($args[1]);
                         if ($p instanceof Player) {
                             $name = $p->getName();
                             if (file_exists($this->getDataFolder() . "Islands/" . $name . ".txt")) {
                                 $sender->sendMessage("The coords for " . $name . "'s island are");
                                 $sender->sendMessage(file_get_contents($this->getDataFolder() . "Islands/" . $name . ".txt"));
                                 $sender->sendMessage(file_get_contents($this->getDataFolder() . "Players/" . $name . ".txt"));
                                 return true;
                             } else {
                                 $sender->sendMessage(TextFormat::YELLOW . "[Skyblock] " . $name . " No Tiene una Isla");
                                 return true;
                             }
                         } elseif (file_exists($this->getDataFolder() . "Islands/" . $args[1] . ".txt")) {
                             $sender->sendMessage("The coords for " . $args[1] . "'s island are");
                             $sender->sendMessage(file_get_contents($this->getDataFolder() . "Islands/" . $args[1] . ".txt"));
                             $sender->sendMessage("in world " . file_get_contents($this->getDataFolder() . "Players/" . $args[1] . ".txt"));
                             return true;
                         }
                     } else {
                         $sender->sendMessage(TextFormat::YELLOW . "[Skyblock] Necesitas especificar un Jugador");
                         return true;
                     }
                 } else {
                     $sender->sendMessage(TextFormat::YELLOW . "[Skyblock] Tu no Puedes encontrar la s coordenadas de la isla de un jugador");
                     return true;
                 }
             } elseif ($args[0] == "delete") {
                 if ($sender->hasPermission("is") || $sender->hasPermission("is.command") || $sender->hasPermission("is.command.delete")) {
                     if (!isset($args[1])) {
                         $sender->sendMessage(TextFormat::RED . "[Skyblock] Estas Seguro? Usa /is delete yes para confirmar");
                         return true;
                     } elseif ($args[1] == "yes") {
                         if (file_exists($this->getDataFolder() . "Islands/" . $sender->getName() . ".txt")) {
                             unlink($this->getDataFolder() . "Islands/" . $sender->getName() . ".txt");
                             $sender->sendMessage(TextFormat::BLUE . "[Skyblock] Tu Isla a sido eliminada!");
                             return true;
                         } else {
                             $sender->sendMessage(TextFormat::YELLOW . "[Skyblock] Tu no Tienes una isla!");
                             return true;
                         }
                     } elseif ($args[1] == "no") {
                         $sender->sendMessage(TextFormat::GRAY . "[Skyblock] Ok, No eliminaremos tu isla, De todos modos nos vale queso :D");
                         return true;
                     } else {
                         return false;
                     }
                 } else {
                     $sender->sendMessage(TextFormat::RED . "[Skyblock] Tu No puedes eliminar tu Isla");
                     return true;
                 }
             } elseif ($args[0] == "sethome") {
                 if ($sender->hasPermission("is") || $sender->hasPermission("is.command") || $sender->hasPermission("is.command.sethome")) {
                     if (!isset($args[1])) {
                         $sender->sendMessage(TextFormat::RED . "[Skyblock] Estas seguro? Asegurate que estas en tu isla");
                         $sender->sendMessage(TextFormat::RED . "[Skyblock] Tu Isla se perdera si no estas en tu isla. Pon /is sethome yes para confirmar");
                         return true;
                     } elseif ($args[1] == "yes") {
                         if (file_exists($this->getDataFolder() . "Islands/" . $sender->getName() . ".txt")) {
                             $sender->sendMessage("[Skyblock] Setting your home...");
                             $file = $this->getDataFolder() . "Islands/" . $sender->getName() . ".txt";
                             unlink($file);
                             $newFile = fopen($file, "w");
                             fwrite($newFile, $sender->x . ", " . $sender->y . ", " . $sender->z);
                             $sender->sendMessage(TextFormat::GREEN . "[Skyblock] Pones Home en el lugar que quieres.");
                             return true;
                         } else {
                             $sender->sendMessage(TextFormat::RED . "[Skyblock] TU no tienes una isla!");
                             return true;
                         }
                     } elseif ($args[1] == "no") {
                         $sender->sendMessage(TextFormat::BLUE . "[Skyblock] Ok, no haremos eso....");
                         return true;
                     } else {
                         $sender->sendMessage(TextFormat::GRAY . "[Skyblock] Comando Desconosido: " . $args[1]);
                         $sender->sendMessage(TextFormat::GREEN . "[Skyblock] /sethome <yes | no>");
                         return true;
                     }
                 } else {
                     $sender->sendMessage(TextFormat::RED . "[Skyblock] No tienes permiso para Poner Home.");
                     return true;
                 }
             }
         }
     }
 }
Beispiel #17
0
 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;
 }
Beispiel #18
0
 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;
 }
Beispiel #19
0
 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;
 }
Beispiel #20
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $sub)
 {
     $ik = $this->isKorean();
     $rm = TextFormat::RED . "Usage: /";
     $wm = $this->wm;
     switch (strtolower($cmd->getName())) {
         case "worldmanager":
             if (!isset($sub[0])) {
                 return false;
             }
             $mm = "[WorldManager] ";
             $rm .= "WorldManager ";
             switch (strtolower($sub[0])) {
                 case "generate":
                 case "generator":
                 case "g":
                 case "생성":
                 case "add":
                 case "a":
                 case "추가":
                     if (!isset($sub[1])) {
                         $r = $rm . ($ik ? "생성 <이름> <타입> <시드>" : "Generate <Name> <Type> <Seed>");
                     } else {
                         $seed = isset($sub[3]) ? $sub[3] : null;
                         $gn = $this->getServer()->getLevelType();
                         $this->getServer()->setConfigString("level-type", isset($sub[2]) ? $sub[2] : null);
                         $this->getServer()->generateLevel(strtolower($sub[1]), $seed);
                         $this->getServer()->setConfigString("level-type", $gn);
                         $r = $mm . ($ik ? "월드가 생성되었습니다. 월드명: " : "World is generate. World: ") . strtolower($sub[1]);
                     }
                     break;
                 case "load":
                 case "l":
                 case "로딩":
                 case "로드":
                 case "불러오기":
                     if (!isset($sub[1])) {
                         $r = $rm . ($ik ? "로드 <이름>" : "Load <Name>");
                     } else {
                         $ln = strtolower($sub[1]);
                         if (!$this->getServer()->loadLevel($ln)) {
                             $r = $mm . $ln . ($ik ? "는 잘못된 월드명입니다." : "is invalid world name");
                         } else {
                             $wm["Load"][$ln] = true;
                             $r = $mm . ($ik ? "{$ln} 월드를 로딩햇습니다." : "Load {$ln} world");
                         }
                     }
                     break;
                 case "list":
                 case "목록":
                     $page = 1;
                     if (isset($sub[0]) && is_numeric($sub[0])) {
                         $page = max(floor($sub[0]), 1);
                     }
                     $list = array_chunk($this->getServer()->getLevels(), 5, true);
                     if ($page >= ($c = count($list))) {
                         $page = $c;
                     }
                     $r = $mm . ($ik ? "월드 목록 (페이지" : "World List (Page") . " {$page}/{$c}) \n";
                     $num = ($page - 1) * 5;
                     if ($c > 0) {
                         foreach ($list[$page - 1] as $v) {
                             $num++;
                             $r .= "  [{$num}] " . $v->getName() . " : " . $v->getFolderName() . "\n";
                         }
                     }
                     break;
                 case "spawn":
                 case "s":
                 case "스폰":
                     $wm["MainSpawn"] = !$wm["MainSpawn"];
                     $r = $mm . ($wm["MainSpawn"] ? $ik ? "스폰시 메인월드에서 스폰합니다." : "Main spawn is On" : ($ik ? "스폰시 해당 월드에서 스폰합니다." : "Main spawn is off"));
                     break;
                 default:
                     return false;
                     break;
             }
             break;
         case "worldprotect":
             if (!isset($sub[0])) {
                 return false;
             }
             $mm = "[WorldProtect] ";
             $rm .= "WorldProtect ";
             $wp = $wm["Protect"];
             switch (strtolower($sub[0])) {
                 case "add":
                 case "a":
                 case "추가":
                     if (!isset($sub[1]) || !$sub[1]) {
                         $r = $rm . ($ik ? "추가 <월드명>" : "Add(A) <WorldName>");
                     } else {
                         $w = strtolower($sub[1]);
                         if (!in_array($w, $wp)) {
                             $wp[] = $w;
                         }
                         $r = $mm . ($ik ? " 추가됨 " : "Add") . " : {$w}";
                     }
                     break;
                 case "del":
                 case "d":
                 case "삭제":
                 case "제거":
                     if (!isset($sub[1])) {
                         $r = $rm . ($ik ? "제거 <월드명>" : "Del(D) <WorldName>");
                     } else {
                         $w = strtolower($sub[1]);
                         if (!in_array($w, $wp)) {
                             $r = " [{$w}] " . ($ik ? "목록에 존재하지 않습니다.\n {$rm} 목록 " : "does not exist.\n {$rm} List(L)");
                         } else {
                             foreach ($wp as $k => $v) {
                                 if ($v == $w) {
                                     unset($wp[$k]);
                                     $r = $mm . ($ik ? " 제거됨 " : "Del") . " : {$w}";
                                     break;
                                 }
                             }
                         }
                     }
                     break;
                 case "reset":
                 case "r":
                 case "리셋":
                 case "초기화":
                     $wp = [];
                     $r = $mm . ($ik ? " 리셋됨." : " Reset");
                     break;
                 case "list":
                 case "l":
                 case "목록":
                 case "리스트":
                     $page = 1;
                     if (isset($sub[0]) && is_numeric($sub[0])) {
                         $page = max(floor($sub[0]), 1);
                     }
                     $list = array_chunk($wp, 5, true);
                     if ($page >= ($c = count($list))) {
                         $page = $c;
                     }
                     $r = $mm . ($ik ? "월드보호 목록 (페이지" : "WorldProtect List (Page") . " {$page}/{$c}) \n";
                     $num = ($page - 1) * 5;
                     if ($c > 0) {
                         foreach ($list[$page - 1] as $v) {
                             $num++;
                             $r .= "  [{$num}] {$v}\n";
                         }
                     }
                     break;
                 default:
                     return false;
                     break;
             }
             $wm["Protect"] = $wp;
             break;
         case "worldpvp":
             if (!isset($sub[0])) {
                 return false;
             }
             $mm = "[WorldPVP] ";
             $rm .= "WorldPVP ";
             $wpvp = $wm["PVP"];
             switch (strtolower($sub[0])) {
                 case "add":
                 case "a":
                 case "추가":
                     if (!isset($sub[1]) || !$sub[1]) {
                         $r = $rm . ($ik ? "추가 <월드명>" : "Add(A) <WorldName>");
                     } else {
                         $w = strtolower($sub[1]);
                         if (!in_array($w, $wpvp)) {
                             $wpvp[] = $w;
                         }
                         $r = $mm . ($ik ? " 추가됨 " : "Add") . " : {$w}";
                     }
                     break;
                 case "del":
                 case "d":
                 case "삭제":
                 case "제거":
                     if (!isset($sub[1])) {
                         $r = $rm . ($ik ? "제거 <월드명>" : "Del(D) <WorldName>");
                     } else {
                         $w = strtolower($sub[1]);
                         if (!in_array($w, $wpvp)) {
                             $r = " [{$w}] " . ($ik ? "목록에 존재하지 않습니다.\n {$rm} 목록 " : "does not exist.\n {$rm} List(L)");
                         } else {
                             foreach ($wpvp as $k => $v) {
                                 if ($v == $w) {
                                     unset($wpvp[$k]);
                                     $r = $mm . ($ik ? " 제거됨 " : "Del") . " : {$w}";
                                     break;
                                 }
                             }
                         }
                     }
                     break;
                 case "reset":
                 case "r":
                 case "리셋":
                 case "초기화":
                     $wpvp = [];
                     $r = $mm . ($ik ? " 리셋됨." : " Reset");
                     break;
                 case "list":
                 case "l":
                 case "목록":
                 case "리스트":
                     $page = 1;
                     if (isset($sub[0]) && is_numeric($sub[0])) {
                         $page = max(floor($sub[0]), 1);
                     }
                     $list = array_chunk($wpvp, 5, true);
                     if ($page >= ($c = count($list))) {
                         $page = $c;
                     }
                     $r = $mm . ($ik ? "PVP 월드 목록 (페이지" : "PVP World List (Page") . " {$page}/{$c}) \n";
                     $num = ($page - 1) * 5;
                     if ($c > 0) {
                         foreach ($list[$page - 1] as $v) {
                             $num++;
                             $r .= "  [{$num}] {$v}\n";
                         }
                     }
                     break;
                 default:
                     return false;
                     break;
             }
             $wm["PVP"] = $wpvp;
             break;
         case "worldinv":
             if (!isset($sub[0])) {
                 return false;
             }
             $mm = "[WorldInv] ";
             $rm .= "WorldInv ";
             $winv = $wm["Inv"];
             switch (strtolower($sub[0])) {
                 case "add":
                 case "a":
                 case "추가":
                     if (!isset($sub[1]) || !$sub[1]) {
                         $r = $rm . ($ik ? "추가 <월드명>" : "Add(A) <WorldName>");
                     } else {
                         $w = strtolower($sub[1]);
                         if (!in_array($w, $winv)) {
                             $winv[] = $w;
                         }
                         $r = $mm . ($ik ? " 추가됨 " : "Add") . " : {$w}";
                     }
                     break;
                 case "del":
                 case "d":
                 case "삭제":
                 case "제거":
                     if (!isset($sub[1])) {
                         $r = $rm . ($ik ? "제거 <월드명>" : "Del(D) <WorldName>");
                     } else {
                         $w = strtolower($sub[1]);
                         if (!in_array($w, $winv)) {
                             $r = " [{$w}] " . ($ik ? "목록에 존재하지 않습니다.\n {$rm} 목록 " : "does not exist.\n {$rm} List(L)");
                         } else {
                             foreach ($winv as $k => $v) {
                                 if ($v == $w) {
                                     unset($winv[$k]);
                                     $r = $mm . ($ik ? " 제거됨 " : "Del") . " : {$w}";
                                     break;
                                 }
                             }
                         }
                     }
                     break;
                 case "reset":
                 case "r":
                 case "리셋":
                 case "초기화":
                     $winv = [];
                     $r = $mm . ($ik ? " 리셋됨." : " Reset");
                     break;
                 case "list":
                 case "l":
                 case "목록":
                 case "리스트":
                     $page = 1;
                     if (isset($sub[0]) && is_numeric($sub[0])) {
                         $page = max(floor($sub[0]), 1);
                     }
                     $list = array_chunk($winv, 5, true);
                     if ($page >= ($c = count($list))) {
                         $page = $c;
                     }
                     $r = $mm . ($ik ? "인벤세이브 월드 목록 (페이지" : "InventorySave World List (Page") . " {$page}/{$c}) \n";
                     $num = ($page - 1) * 5;
                     if ($c > 0) {
                         foreach ($list[$page - 1] as $v) {
                             $num++;
                             $r .= "  [{$num}] {$v}\n";
                         }
                     }
                     break;
                 default:
                     return false;
                     break;
             }
             $wm["Inv"] = $winv;
             break;
         case "setspawn":
             if (isset($sub[0]) && ($player = $this->getServer()->getPlayer($sub[0]))) {
             } else {
                 $player = $sender;
             }
             $ln = strtolower($player->getLevel()->getFolderName());
             $wm["Spawn"][$ln] = $player->x . ":" . $player->y . ":" . $player->z;
             $r = "[SetSpawn] " . ($ik ? "스폰 설정되었습니다.  월드명: {$ln} , 좌표: " : "Spawn set. World: {$ln} , Position: ") . $wm["Spawn"][$ln];
             break;
         case "spawn":
             if ($wm["MainSpawn"]) {
                 $world = $this->getServer()->getDefaultLevel();
             } else {
                 $world = $sender->getLevel();
             }
             $sender->teleport($world->getSpawn());
             $r = "[Spawn] " . ($ik ? "스폰으로 텔레포트되었습니다. 월드명: " : "Teleport to spawn. World: ") . $world->getFolderName();
             break;
     }
     if (isset($r)) {
         $sender->sendMessage($r);
     }
     if ($this->wm !== $wm) {
         $this->wm = $wm;
         $this->saveYml();
     }
     $this->loadWorlds();
     return true;
 }
Beispiel #21
0
 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;
 }
Beispiel #22
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     switch ($command->getName()) {
         case "pvp":
             $name = $sender->getName();
             echo 1;
             if (isset($this->joinedpvp[$name])) {
                 echo 2;
                 if ($this->joinedpvp[$name] == 1) {
                     $sender->sendMessage(TextFormat::RED . "[WallPVP]あなたはすでにpvpに参加しています。");
                     break;
                 }
             }
             if (time() - @$this->teamc[1][$name] <= 30 * 1) {
                 echo "a2";
                 $this->team[1][$name] = 1;
                 $teamname = "S";
                 $tcolor = TextFormat::LIGHT_PURPLE;
                 $pos1 = new Position(73, 72, 132);
                 //座標を指定
                 $sender->sendMessage(TextFormat::LIGHT_PURPLE . "[WallPVP]あなたは" . $teamname . "チームです。");
             } elseif (time() - @$this->teamc[2][$name] <= 30 * 1) {
                 echo "b1";
                 $this->team[2][$name] = 1;
                 $teamname = "M";
                 $tcolor = TextFormat::AQUA;
                 $pos1 = new Position(64, 76, 28);
                 //座標を指定
                 $sender->sendMessage(TextFormat::AQUA . "[WallPVP]あなたは" . $teamname . "チームです。");
             } else {
                 echo 3;
                 $this->joinedpvp[$name] = 1;
                 if (count($this->team[1]) <= count($this->team[2])) {
                     $this->team[1][$name] = 1;
                     $teamname = "S";
                     $tcolor = TextFormat::LIGHT_PURPLE;
                     $pos1 = new Position(73, 72, 132);
                     //座標を指定
                     $sender->sendMessage(TextFormat::LIGHT_PURPLE . "[WallPVP]あなたは" . $teamname . "チームです。");
                 } else {
                     $this->team[2][$name] = 1;
                     $teamname = "M";
                     $tcolor = TextFormat::AQUA;
                     $pos1 = new Position(64, 76, 28);
                     //座標を指定
                     $sender->sendMessage(TextFormat::AQUA . "[WallPVP]あなたは" . $teamname . "チームです。");
                 }
             }
             if (isset($this->team[1][$name])) {
                 $teamname = "[S]";
                 $tcolor = TextFormat::LIGHT_PURPLE;
             } elseif (isset($this->team[2][$name])) {
                 $teamname = "[M]";
                 $tcolor = TextFormat::AQUA;
             } else {
                 $teamname = null;
                 $tcolor = null;
             }
             if ($sender->isOp()) {
                 $op = "[OP]";
             } else {
                 $op = null;
             }
             $sender->setDisPlayName($tcolor . $op . $teamname . $name . "[" . $this->hapi->getkill($name) . "kill]");
             $sender->setNameTag($tcolor . $op . $teamname . $name . "[" . $this->hapi->getkill($name) . "kill]");
             $sender->teleport($pos1);
             $effect = Effect::getEffect(11);
             //Effect ID
             $effect->setVisible(true);
             //Particles
             $effect->setAmplifier(1000);
             $effect->setDuration(100);
             //Ticks
             $sender->addEffect($effect);
             break;
         case "rekit":
             $this->setKit($sender);
             break;
         case "ok":
             $cfg = $this->settings->getAll();
             $name = $sender->getName();
             if (isset($this->buy[$name])) {
                 if (time() - $this->buy[$name]["time"] <= 20) {
                     $amount = $cfg[$this->buy[$name]["id"]];
                     if ($this->hapi->getkit1($name) == $this->buy[$name]["id"]) {
                         $sender->sendMessage(TextFormat::RED . "[WallPVP]購入済みです。");
                     } else {
                         if ($this->hapi->useexp($name, $amount)) {
                             $this->hapi->setkit1($name, $this->buy[$name]["id"]);
                             $this->setKit($sender);
                             $sender->sendMessage(TextFormat::RED . "[WallPVP]" . $amount . "EXPの" . $this->buy[$name]["id"] . "を購入しました。");
                         } else {
                             $sender->sendMessage(TextFormat::RED . "[WallPVP]EXPが足りません。");
                         }
                     }
                 }
             }
             break;
         case "buy":
             $name = $sender->getName();
             if (!isset($args[0])) {
                 $sender->sendMessage("Usege: /buy '[effectID]'");
                 break;
             }
             if (!ctype_digit($args[0])) {
                 $sender->sendMessage("Usege: /buy '[effectID]'");
                 break;
             }
             $cfg = $this->settings->getAll();
             $ecost = $cfg[$args[0]];
             $sender->sendMessage("ID " . $args[0] . ": 値段\$" . $ecost . "を買うのなら/ok");
             if (isset($this->buy[$name])) {
                 unset($this->buy[$name]);
             }
             $this->buy[$name]["time"] = time();
             $this->buy[$name]["id"] = $args[0];
             unset($cfg);
             unset($ecost);
             break;
         case "shop":
             $cfg = $this->settings->getAll();
             if (!isset($args[0])) {
                 $sender->sendMessage("Usege: /shop [effectID] [price]");
                 break;
             }
             if (!ctype_digit($args[0])) {
                 $sender->sendMessage("Usege: /shop '[effectID]' [price]");
                 break;
             }
             if (!isset($args[1])) {
                 $sender->sendMessage("Usege: /shop [effectID] '[price]'");
                 break;
             }
             if (!$this->settings->exists($args[1])) {
                 $sender->sendMessage("EffectID is wrong.");
                 break;
             }
             if (!ctype_digit($args[1])) {
                 $sender->sendMessage("Usege: /shop [effectID] '[price]'");
                 break;
             }
             $this->settings->set($args[0], $args[1]);
             $this->settings->save();
             $sender->sendMessage("You changed EffectID " . $args[0] . " 's price \$" . $args[1]);
             $this->settings->reload();
             break;
             break;
         case "c":
             $name = $sender->getName();
             $players = Server::getInstance()->getOnlinePlayers();
             if (isset($this->team[1][$name])) {
                 foreach ($players as $player) {
                     if (isset($this->team[1][$player->getName()])) {
                         $player->sendMessage(TextFormat::YELLOW . "[SチームC]" . $name . "|" . $args);
                     }
                 }
             } elseif (isset($this->team[2][$name])) {
                 foreach ($players as $player) {
                     if (isset($this->team[2][$player->getName()])) {
                         $player->sendMessage(TextFormat::YELLOW . "[MチームC]" . $name . "|" . $args);
                     }
                 }
             }
             break;
         case "mi":
             $name = $sender->getName();
             if (isset($this->team[1][$name])) {
                 $teamname = "S";
             } elseif (isset($this->team[2][$name])) {
                 $teamname = "M";
             }
             $name = $sender->getName();
             $sender->sendMessage(TextFormat::RED . "//////" . $name . "さんの情報/////");
             if (isset($teamname)) {
                 $sender->sendMessage(TextFormat::RED . "[チーム] " . $teamname . "チーム");
             }
             #		$sender->sendMessage(TextFormat::RED ."[KIT] ".$this->hapi->getkit1($name));
             $sender->sendMessage(TextFormat::RED . "[レベル] " . $this->getServer()->getPluginManager()->getPlugin("hapi")->getlevel($name));
             $sender->sendMessage(TextFormat::RED . "[EXP] " . $this->getServer()->getPluginManager()->getPlugin("hapi")->getexp($name));
             $sender->sendMessage(TextFormat::RED . "[キル数] " . $this->getServer()->getPluginManager()->getPlugin("hapi")->getkill($name) . "回");
             $sender->sendMessage(TextFormat::RED . "[連続キル数] " . $this->getServer()->getPluginManager()->getPlugin("hapi")->getrenkill($name) . "回");
             if ($this->getServer()->getPluginManager()->getPlugin("hapi")->getexp($name) != 0 and $this->getServer()->getPluginManager()->getPlugin("hapi")->getdes($name) != 0) {
                 $sender->sendMessage(TextFormat::RED . "[キルレート] " . $this->getServer()->getPluginManager()->getPlugin("hapi")->getkill($name) / $this->getServer()->getPluginManager()->getPlugin("hapi")->getdes($name));
             }
             $sender->sendMessage(TextFormat::RED . "/////////////////////////////");
             break;
         case "stat":
             $sender->sendMessage(TextFormat::RED . "[WallPVP]各チームの人数です。");
             $sender->sendMessage(TextFormat::RED . "[S]" . count($this->team[1]) . "人、[コア]" . $this->teamcore[1] . "HP");
             $sender->sendMessage(TextFormat::RED . "[M]" . count($this->team[2]) . "人、[コア]" . $this->teamcore[2] . "HP");
     }
 }
Beispiel #23
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command->getName()) == "is") {
         if (!isset($args[0])) {
             $sender->sendMessage(TextFormat::YELLOW . "You didn't add a subcommand");
             $sender->sendMessage(TextFormat::GREEN . "Use: " . TextFormat::RESET . "/is help");
             return true;
         } elseif (isset($args[0])) {
             if ($args[0] == "help") {
                 if ($sender->hasPermission("is") || $sender->hasPermission("is.help")) {
                     if (!isset($args[1]) or $args[1] == "1") {
                         $sender->sendMessage(TextFormat::GREEN . "Showing help page 1 of 1");
                         $sender->sendMessage(TextFormat::GREEN . "/is help");
                         $sender->sendMessage(TextFormat::GREEN . "/is create");
                         $sender->sendMessage(TextFormat::GREEN . "/is home");
                         $sender->sendMessage(TextFormat::GREEN . "/is sethome");
                         $sender->sendMessage(TextFormat::GREEN . "/is find (op only)");
                         return true;
                     } elseif ($args[1] == "2") {
                         $sender->sendMessage("More commands coming soon");
                         return true;
                     }
                 } else {
                     $sender->sendMessage(TextFormat::RED . "You cannot view the help menu");
                     return true;
                 }
             } elseif ($args[0] == "create") {
                 if ($sender->hasPermission("is") || $sender->hasPermission("is.command") || $sender->hasPermission("is.command.create")) {
                     $senderIs = $this->getDataFolder() . "Islands/" . $sender->getName() . ".txt";
                     if ($sender->getLevel()->getName() == $this->getConfig()->get("Lobby")) {
                         $sender->sendMessage(TextFormat::YELLOW . "You can't make an island in spawn, silly");
                         return true;
                     } else {
                         if (!file_exists($senderIs)) {
                             $this->makeIsland($sender->getName());
                             return true;
                         } else {
                             $sender->sendMessage(TextFormat::YELLOW . "You already have an island");
                             return true;
                         }
                     }
                 } else {
                     $sender->sendMessage(TextFormat::RED . "You cannot create an island");
                     return true;
                 }
             } elseif ($args[0] == "home") {
                 if ($sender->hasPermission("is") || $sender->hasPermission("is.command") || $sender->hasPermission("is.command.home")) {
                     if (!file_exists($this->getDataFolder() . "Islands/" . $sender->getName() . ".txt")) {
                         $sender->sendMessage("You don't have an island. Use /is create to make one");
                         return true;
                     } else {
                         $level = $this->getServer()->getLevelByName(yaml_parse_file($this->getDataFolder() . "Players/" . $sender->getName() . ".txt"));
                         if ($level !== null) {
                             $sender->sendMessage(TextFormat::GREEN . "Teleporting to your island...");
                             if ($sender->getLevel()->getName() !== $level->getName()) {
                                 $sender->sendMessage("You are not in the same world as your island. Use " . TextFormat::YELLOW . "/mw tp " . $level->getName() . TextFormat::RESET . " and try again");
                                 return true;
                             } else {
                                 $sender->teleport(new Vector3(yaml_parse_file($this->getDataFolder() . "Islands/" . $sender->getName() . ".txt")));
                                 $sender->sendMessage(TextFormat::GREEN . "Done!");
                                 return true;
                             }
                         } else {
                             $sender->sendMessage("An error has occored.");
                             return true;
                         }
                     }
                 } else {
                     $sender->sendMessage("You do not have permission to do that");
                     return true;
                 }
             } elseif ($args[0] == "find") {
                 if ($sender->hasPermission("is") || $sender->hasPermission("is.command") || $sender->hasPermission("is.command.find")) {
                     if (isset($args[1])) {
                         $p = $sender->getServer()->getPlayer($args[1]);
                         if ($p instanceof Player) {
                             $name = $p->getName();
                             if (file_exists($this->getDataFolder() . "Islands/" . $name . ".txt")) {
                                 $sender->sendMessage("The coords for " . $name . "'s island are");
                                 $sender->sendMessage(file_get_contents($this->getDataFolder() . "Islands/" . $name . ".txt"));
                                 $sender->sendMessage(file_get_contents($this->getDataFolder() . "Players/" . $name . ".txt"));
                                 return true;
                             } else {
                                 $sender->sendMessage($name . " does not have an island");
                                 return true;
                             }
                         } elseif (file_exists($this->getDataFolder() . "Islands/" . $args[1] . ".txt")) {
                             $sender->sendMessage("The coords for " . $args[1] . "'s island are");
                             $sender->sendMessage(file_get_contents($this->getDataFolder() . "Islands/" . $args[1] . ".txt"));
                             $sender->sendMessage("in world " . file_get_contents($this->getDataFolder() . "Players/" . $args[1] . ".txt"));
                             return true;
                         }
                     } else {
                         $sender->sendMessage(TextFormat::YELLOW . "You need to specify a player");
                         return true;
                     }
                 } else {
                     $sender->sendMessage(TextFormat::YELLOW . "You cannot find the coords of a player's island");
                     return true;
                 }
             } elseif ($args[0] == "delete") {
                 if ($sender->hasPermission("is") || $sender->hasPermission("is.command") || $sender->hasPermission("is.command.delete")) {
                     if (!isset($args[1])) {
                         $sender->sendMessage("Are you sure? Use /is delete yes to confirm");
                         return true;
                     } elseif ($args[1] == "yes") {
                         if (file_exists($this->getDataFolder() . "Islands/" . $sender->getName() . ".txt")) {
                             unlink($this->getDataFolder() . "Islands/" . $sender->getName() . ".txt");
                             $sender->sendMessage("Your island has been deleted");
                             return true;
                         } else {
                             $sender->sendMessage("You don't have an island");
                             return true;
                         }
                     } elseif ($args[1] == "no") {
                         $sender->sendMessage("Okay, we won't delete your island");
                         return true;
                     } else {
                         return false;
                     }
                 } else {
                     $sender->sendMessage("You cannot delete your island");
                     return true;
                 }
             } elseif ($args[0] == "sethome") {
                 if ($sender->hasPermission("is") || $sender->hasPermission("is.command") || $sender->hasPermission("is.command.sethome")) {
                     if (!isset($args[1])) {
                         $sender->sendMessage("Are you sure? Make sure you are on your island");
                         $sender->sendMessage("Your island will be lost if you're not on your island. Do /is sethome yes to confirm");
                         return true;
                     } elseif ($args[1] == "yes") {
                         if (file_exists($this->getDataFolder() . "Islands/" . $sender->getName() . ".txt")) {
                             $sender->sendMessage("Setting your home...");
                             $file = $this->getDataFolder() . "Islands/" . $sender->getName() . ".txt";
                             unlink($file);
                             $newFile = fopen($file, "w");
                             fwrite($newFile, $sender->x . ", " . $sender->y . ", " . $sender->z);
                             $sender->sendMessage("Set your home.");
                             return true;
                         } else {
                             $sender->sendMessage("You don't have an island");
                             return true;
                         }
                     } elseif ($args[1] == "no") {
                         $sender->sendMessage("Okay, we won't set your home");
                         return true;
                     } else {
                         $sender->sendMessage("Unknown subcommand: " . $args[1]);
                         $sender->sendMessage("/sethome <yes | no>");
                         return true;
                     }
                 } else {
                     $sender->sendMessage("You don't have permission to set your home");
                     return true;
                 }
             }
         }
     }
 }
Beispiel #24
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     $teams = array("red", "blue");
     switch ($cmd->getName()) {
         case "team":
             switch (strtolower($args[0])) {
                 case "red":
                     if ($sender instanceof Player) {
                         $this->setTeam($sender->getName(), "red");
                         $sender->inGame = true;
                         $sender->teleport(new Vector3($this->yml["red_enter_x"], $this->yml["red_enter_y"], $this->yml["red_enter_z"]));
                         return true;
                     } else {
                         return false;
                     }
                 case "blue":
                     if ($sender instanceof Player) {
                         $this->setTeam($sender->getName(), "blue");
                         $sender->inGame = true;
                         $sender->teleport(new Vector3($this->yml["blue_enter_x"], $this->yml["blue_enter_y"], $this->yml["blue_enter_z"]));
                         return true;
                     } else {
                         return false;
                     }
                 case "var":
                     var_dump($this->red);
                     var_dump($this->blue);
                     return true;
                 default:
                     return false;
             }
     }
 }
Beispiel #25
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $sub)
 {
     if (!isset($sub[0])) {
         return false;
     }
     $ik = $this->isKorean();
     $rm = TextFormat::RED . "Usage: /";
     $mm = "[MineFarm] ";
     $smd = strtolower(array_shift($sub));
     $n = strtolower($sender->getName());
     $mn = $this->mn;
     $c = false;
     $sh = $this->sh;
     $t = $this->touch;
     switch (strtolower($cmd->getName())) {
         case "myfarm":
             if (!$sender instanceof Player) {
                 $r = $mm . ($ik ? "게임내에서만 실행해주세요." : "Please run this command in-game");
             } else {
                 $rm .= "MyFarm ";
                 switch ($smd) {
                     case "move":
                     case "my":
                     case "me":
                     case "m":
                     case "이동":
                         if (!in_array($n, $this->mf["Farm"])) {
                             $r = $mm . ($ik ? "팜을 보유하고있지 않습니다." : "You don't have farm");
                         } else {
                             $sender->teleport($this->getPosition($n));
                             $r = $mm . ($ik ? "나의 팜으로 텔레포트되었습니다. : " : "Teleported to your farm. : ") . $this->getNum($sender);
                         }
                         break;
                     case "buy":
                     case "b":
                     case "구매":
                         if (in_array($n, $this->mf["Farm"])) {
                             $r = $mm . ($ik ? "이미 팜을 보유하고있습니다." : "You already have farm");
                         } elseif (!$this->mf["Sell"]) {
                             $r = $mm . ($ik ? "이 서버는 팜을 판매하지 않습니다.." : "This server not sell the farm");
                         } elseif (!$this->hasMoney($n, $pr = $this->mf["Price"])) {
                             $r = $mm . ($ik ? "당신은 {$pr} 보다 돈이 적습니다. 나의 돈 : " : "You don't have {$pr} \$. Your money : ") . $this->getMoney($n);
                         } else {
                             $this->takeMoney($n, $pr);
                             $this->giveFarm($n);
                             $r = $mm . ($ik ? "팜을 구매하였습니다. 나의 돈 : " : "Buy the farm. Your money : ") . $this->getMoney($n) . "\n/‡ " . $mm . ($ik ? "팜 번호 : " : "Farm Number : ") . $this->getNum($n);
                         }
                         break;
                     case "visit":
                     case "v":
                     case "방문":
                         if (!isset($sub[0]) || !$sub[0] || is_numeric($sub[0]) && $sub[0] < 1) {
                             $r = $mm . ($ik ? "이동 <팜번호 or 플레이어명>" : "Move <FarmNum or PlayerName>");
                         } else {
                             if (is_numeric($sub[0])) {
                                 $fn = floor($sub[0]);
                                 $nm = $ik ? "번" : "";
                             } else {
                                 $fn = strtolower($sub[0]);
                                 if (!in_array($fn, $this->mf["Farm"])) {
                                     $r = $mm . $fn . ($ik ? "는 잘못된 플레이어명입니다." : " is invalid player");
                                 } else {
                                     $nm = $ik ? "님의" : "'s ";
                                 }
                             }
                             if (!isset($r)) {
                                 if (!$this->isInvite($n, $fn)) {
                                     $r = $mm . ($ik ? "{$fn} {$nm} 팜에 초대받지 않았습니다." : "You don't invited to {$fn} {$nm} farm");
                                 } else {
                                     $sender->teleport($this->getPosition($fn));
                                     $r = $mm . ($ik ? "{$fn} {$nm} 팜으로 텔레포트되었습니다." : "Teleported to {$fn} {$nm} Minefarm");
                                     if ($p = $this->getServer()->getplayerExact($this->getOwnName($fn))) {
                                         $p->sendMessage("/☜ [MineFarm] " . $n . ($ik ? "님이 당신의 팜에 방문햇습니다." : " is invited to your farm."));
                                     }
                                 }
                             }
                         }
                         break;
                     case "invite":
                     case "i":
                     case "초대":
                         if (!in_array($n, $this->mf["Farm"])) {
                             $r = $mm . ($ik ? "팜을 보유하고있지 않습니다." : "You don't have farm");
                         } elseif (!isset($sub[0])) {
                             $r = $rm . ($ik ? "초대 <플레이어명>" : "Invite <PlayerName");
                         } elseif ($this->isInvite($sub[0] = strtolower($sub[0]), $n)) {
                             $r = $mm . $sub[0] . ($ik ? "님은 이미 초대된 상태입니다." : " is already invited");
                         } else {
                             $this->mf["Invite"][$n][$sub[0]] = false;
                             $this->saveYml();
                             $r = $mm . ($ik ? "{$sub['0']} 님을 팜에 초대합니다." : "Invite {$sub['0']} on my farm");
                             if ($p = $this->getServer()->getplayerExact($sub[0])) {
                                 $p->sendMessage("/☜ [MineFarm] " . $n . ($ik ? "님이 당신을 팜에 초대하였습니다." : " invite you out to farm"));
                             }
                         }
                         break;
                     case "share":
                     case "s":
                     case "초대":
                         if (!in_array($n, $this->mf["Farm"])) {
                             $r = $mm . ($ik ? "마인팜을 보유하고있지 않습니다." : "You don't have MineFarm");
                         } elseif (!isset($sub[0])) {
                             $r = $rm . ($ik ? "공유 <플레이어명>" : "Share <PlayerName");
                         } elseif ($this->isShare($sub[0] = strtolower($sub[0]), $n)) {
                             $r = $mm . $sub[0] . ($ik ? "님은 이미 공유된 상태입니다." : " is already shared");
                         } else {
                             $this->mf["Invite"][$n][$sub[0]] = true;
                             $this->saveYml();
                             $r = $mm . ($ik ? "{$sub['0']} 님에게 팜을 공유합니다." : "Shared your farm to {$sub['0']}");
                             if ($p = $this->getServer()->getplayerExact($sub[0])) {
                                 $p->sendMessage("/☜ [MineFarm] " . $n . ($ik ? "님이 당신에게 팜을 공유하였습니다." : " shared the farm with you"));
                             }
                         }
                         break;
                     case "kick":
                     case "k":
                     case "강퇴":
                         if (!in_array($n, $this->mf["Farm"])) {
                             $r = $mm . ($ik ? "마인팜을 보유하고있지 않습니다." : "You don't have MineFarm");
                         } elseif (!isset($sub[0])) {
                             $r = $rm . ($ik ? "강퇴 <플레이어명>" : "Kick <PlayerName");
                         } elseif (!$this->isInvite($sub[0] = strtolower($sub[0]), $n)) {
                             $r = $mm . $sub[0] . ($ik ? "님은 초대되지 않았습니다." : " is not invited");
                         } else {
                             unset($this->mf["Invite"][$n][$sub[0]]);
                             $this->saveYml();
                             $r = $mm . ($ik ? "{$sub['0']} 님을 마인팜에서 강퇴합니다." : "Kick {$sub['0']} on my minefarm");
                             if ($p = $this->getServer()->getplayerExact($sub[0])) {
                                 $p->sendMessage("/☜ [MineFarm] " . ($ik ? "{$n} 님의 팜에서 강퇴되었습니다." : "You are kicked from {$n}'s Minefarm."));
                             }
                         }
                         break;
                     case "list":
                     case "l":
                     case "목록":
                         if (!in_array($n, $this->mf["Farm"])) {
                             $r = $mm . ($ik ? "마인팜을 보유하고있지 않습니다." : "You don't have MineFarm");
                         } else {
                             $page = 1;
                             if (isset($sub[0]) && is_numeric($sub[0])) {
                                 $page = round($sub[0]);
                             }
                             $list = array_chunk($this->mf["Invite"][$n], 5, true);
                             if ($page >= ($c = count($list))) {
                                 $page = $c;
                             }
                             $r = $mm . ($ik ? "초대 (공유) 목록 (페이지" : "Invite(Share) List (Page") . " {$page}/{$c}) \n";
                             $num = ($page - 1) * 5;
                             if ($c > 0) {
                                 foreach ($list[$page - 1] as $k => $v) {
                                     $num++;
                                     $r .= "  [{$num}] " . (strlen($k) <= 3 ? $ik ? "오류." : "Error." : "[" . ($ik ? $v ? "공유" : "초대" : ($v ? "Share" : "Invite")) . "] {$k}\n");
                                 }
                             }
                         }
                         break;
                     case "message":
                     case "msg":
                     case "메세지":
                     case "tip":
                     case "t":
                     case "팁":
                         if (in_array($n, $this->mf["Edge"])) {
                             unset($this->mf["Edge"][array_search($n, $this->mf["Edge"])]);
                             $a = false;
                         } else {
                             $this->mf["Edge"][] = $n;
                             $a = true;
                         }
                         $this->saveYml();
                         $r = $mm . ($ik ? "이제 팁 메세지를 받" . ($a ? "" : "지않") . "습니다." : "Now " . ($a ? "" : "not ") . "show tip message");
                         break;
                     case "here":
                     case "h":
                     case "여기":
                         if (!$this->isFarm($sender)) {
                             $r = $mm . ($ik ? "이곳은 팜이 아닙니다." : "Here is not Farm");
                         } else {
                             $r = $mm . ($ik ? "이곳의 팜 번호 : " : "Here farm number : ") . $this->getNum($sender, true) . ",  " . ($this->getOwnName($sender, true) !== false ? ($ik ? "주인 : " : "Own : ") . $this->getOwnName($sender, true) : "");
                         }
                         break;
                     default:
                         return false;
                         break;
                 }
             }
             break;
         case "minefarm":
             $rm .= "MineFarm ";
             switch ($smd) {
                 case "give":
                 case "g":
                 case "지급":
                     if (!isset($sub[0])) {
                         $r = $rm . ($ik ? "지급 <플레이어명> (지역번호)" : "Give(G) <PlayerName> (FarmNumber)");
                     } elseif (!($p = $this->getServer()->getPlayer($sub[0]))) {
                         $r = $mm . $sub[0] . ($ik ? "는 잘못된 플레이어명입니다." : " is invalid player");
                     } elseif (in_array(strtolower($p->getName()), $this->mf["Farm"])) {
                         $r = $mm . $sub[0] . ($ik ? "님은 이미 마인팜을 소유중입니다. " : " is already have minefarm");
                     } else {
                         $num = $this->giveFarm($p) + 1;
                         $pn = $p->getName();
                         $r = $mm . ($ik ? "{$pn} 님에게 마인팜을 지급했습니다. : " : "Give the minefarm to {$pn} : ") . ($num = $this->getNum($p));
                         $p->sendMessage($mm . ($ik ? "마인팜을 지급받았습니다. : " : "Now you have your minefarm : ") . $num);
                     }
                     break;
                 case "move":
                 case "m":
                 case "이동":
                     if (!isset($sub[0]) || !$sub[0] || is_numeric($sub[0]) && $sub[0] < 1) {
                         $r = $mm . ($ik ? "이동 <땅번호 or 플레이어명>" : "Move <FarmNum or PlayerName>");
                     } else {
                         if (is_numeric($sub[0])) {
                             $n = floor($sub[0]);
                             $nm = $ik ? "번" : "";
                         } else {
                             $n = $sub[0];
                             if (!in_array($n, $this->mf["Farm"])) {
                                 $r = $mm . $n . ($ik ? "는 잘못된 플레이어명입니다." : " is invalid player");
                             } else {
                                 $nm = $ik ? "님의" : "'s ";
                             }
                         }
                         if (!isset($r)) {
                             $sender->teleport($this->getPosition($n));
                             $r = $mm . ($ik ? "{$n} {$nm} 마인팜으로 텔레포트되었습니다." : "Teleported to {$n} {$nm} Minefarm");
                         }
                     }
                     break;
                 case "here":
                 case "h":
                 case "여기":
                     if (!$sender instanceof Player) {
                         $r = $mm . ($ik ? "게임내에서만 실행해주세요." : "Please run this command in-game");
                     } elseif (!$this->isFarm($sender)) {
                         $r = $mm . ($ik ? "이곳은 팜이 아닙니다." : "Here is not Farm");
                     } else {
                         $r = $mm . ($ik ? "이곳의 팜 번호 : " : "Here farm number : ") . $this->getNum($sender, true) . ",  " . ($this->getOwnName($sender, true) !== false ? ($ik ? "주인 : " : "Own : ") . $this->getOwnName($sender, true) : "");
                     }
                     break;
                 case "distace":
                 case "d":
                 case "거리":
                 case "간격":
                     if (!isset($sub[0])) {
                         $r = $rm . ($ik ? "거리 <숫자>" : "Distance(D) (Number)");
                     } elseif (!is_numeric($sub[0]) || $sub[0] < 0) {
                         $r = $mm . $sub[0] . ($ik ? "는 잘못된 숫자입니다." : " is invalid number");
                     } else {
                         $this->mf["Distance"] = floor($sub[0]);
                         $this->saveYml();
                         $r = $mm . ($ik ? " 마인팜간 간격이 {$sub['0']} 으로 설정되엇습니다." : "minefarm distance is set to {$sub['0']}");
                     }
                     break;
                 case "size":
                 case "sz":
                 case "크기":
                     if (!isset($sub[0])) {
                         $r = $rm . ($ik ? "크기 <숫자>" : "Size(SZ) (Number)");
                     } elseif (!is_numeric($sub[0])) {
                         $r = $mm . $sub[0] . ($ik ? "는 잘못된 숫자입니다." : " is invalid number");
                     } else {
                         $this->mf["Size"] = floor($sub[0]);
                         $this->saveYml();
                         $r = $mm . ($ik ? " 마인팜의 크기가 {$sub['0']} 으로 설정되엇습니다." : "minefarm size is set to {$sub['0']}");
                     }
                     break;
                 case "air":
                 case "a":
                 case "공기":
                     if (!isset($sub[0])) {
                         $r = $rm . ($ik ? "공기 <숫자>" : "Air(A) (Number)");
                     } elseif (!is_numeric($sub[0]) || $sub[0] < 0) {
                         $r = $mm . $sub[0] . ($ik ? "는 잘못된 숫자입니다." : " is invalid number");
                     } else {
                         $this->mf["Air"] = floor($sub[0]);
                         $this->saveYml();
                         $r = $mm . ($ik ? " 마인팜의 공기지역 크기가 {$sub['0']} 으로 설정되엇습니다." : "minefarm air place size is set to {$sub['0']}");
                     }
                     break;
                 case "sell":
                 case "s":
                 case "판매":
                     $a = !$this->mf["Sell"];
                     $this->mf["Sell"] = $a;
                     $this->saveYml();
                     $m = $mm . ($ik ? "이제 마인팜을 판매" . ($a ? "합" : "하지않습") . "니다." : "Now " . ($a ? "" : "not ") . "sell the minefarm");
                     break;
                 case "price":
                 case "p":
                 case "가격":
                     if (!isset($sub[0])) {
                         $r = $rm . ($ik ? "가격 <숫자>" : "Money(Mn) (Number)");
                     } elseif (!$sub[0] || !is_numeric($sub[0])) {
                         $r = $mm . $sub[0] . ($ik ? "는 잘못된 숫자입니다." : " is invalid number");
                     } else {
                         $this->mf["Price"] = floor($sub[0]);
                         $this->saveYml();
                         $m = $mm . ($ik ? "마인팜의 가격이 {$sub['0']} 으로 설정되엇습니다." : "minefarm distance is set to {$sub['0']}");
                     }
                     break;
                 case "auto":
                 case "at":
                 case "자동":
                     $a = !$this->mf["Auto"];
                     $this->mf["Auto"] = $a;
                     $this->saveYml();
                     if ($a) {
                         foreach ($this->getServer()->getOnlinePlayers() as $p) {
                             if ($this->giveFarm($p)) {
                                 $p->sendMessage("[MineFarm] [Auto] " . ($ik ? "마인팜을 지급받았습니다. : " : "Now you gave minefarm. : ") . $this->getNum($p));
                             }
                         }
                     }
                     $m = $mm . ($ik ? "이제 마인팜을 자동 분배" . ($a ? "합" : "하지않습") . "니다." : "Now " . ($a ? "" : "not ") . "auto give the minefarm");
                     break;
                 case "item":
                 case "i":
                 case "아이템":
                     $a = !$this->mf["Item"];
                     $this->mf["Item"] = $a;
                     $this->saveYml();
                     $m = $mm . ($ik ? "이제 기초 지급템을 " . ($a ? "줍" : "주지않습") . "니다." : "Now " . ($a ? "" : "not ") . "give the first item");
                     break;
                 case "list":
                 case "l":
                 case "목록":
                     $page = 1;
                     if (isset($sub[0]) && is_numeric($sub[0])) {
                         $page = max(floor($sub[0]), 1);
                     }
                     $list = array_chunk($this->mf["Farm"], 5, true);
                     if ($page >= ($c = count($list))) {
                         $page = $c;
                     }
                     $r = $mm . ($ik ? "마인팜 목록 (페이지" : "MineFarm List (Page") . " {$page}/{$c}) \n";
                     $num = ($page - 1) * 5;
                     if ($c > 0) {
                         foreach ($list[$page - 1] as $v) {
                             $num++;
                             $r .= "  [{$num}] {$v}\n";
                         }
                     }
                     break;
                 case "reset":
                 case "r":
                 case "리셋":
                     $this->mf["Farm"] = [];
                     $this->mf["Invite"] = [];
                     $this->saveYml();
                     if ($this->mf["Auto"]) {
                         foreach ($this->getServer()->getOnlinePlayers() as $p) {
                             if ($this->giveFarm($p)) {
                                 $p->sendMessage("[MineFarm] [Auto] " . ($ik ? "마인팜을 지급받았습니다. : " : "Now you gave minefarm. : ") . $this->getNum($p));
                             }
                         }
                     }
                     $r = $mm . ($ik ? "리셋됨" : "Reset");
                     break;
                 case "trim":
                     $full = count($this->mf["Edge"]);
                     $count = 0;
                     foreach ($this->mf["Edge"] as $k => $v) {
                         if (is_bool($v)) {
                             unset($this->mf["Edge"][$k]);
                             $count++;
                         }
                     }
                     if ($count > 0) {
                         $this->saveYml();
                     }
                     $r = $mm . ($ik ? "필요없는 데이터를 제거했습니다. 갯수 : " : "Delete useless data. Count : ") . $count . " [{$full} => " . count($this->mf["Edge"]) . "]";
                     break;
                 default:
                     return false;
                     break;
             }
             break;
         case "money":
             $mm = "[Money] ";
             $rm = TextFormat::RED . "Usage: /Money ";
             switch ($smd) {
                 case "me":
                 case "my":
                 case "m":
                 case "내돈":
                 case "나":
                     $r = $mm . ($ik ? "나의 돈 : " : "Your Money : ") . $this->getMoney($n) . ($ik ? "원  ,  랭킹 : " : "\$  ,  Rank : ") . $this->getRank($n);
                     break;
                 case "see":
                 case "view":
                 case "v":
                 case "보기":
                     if (!isset($sub[0])) {
                         $r = $rm . ($ik ? "보기 <플레이어명>" : "View(V) <PlayerName>");
                     } elseif (!($p = $this->getPlayer($sub[0]))) {
                         $r = $mm . $sub[0] . ($ik ? "은 잘못된 이름입니다." : " is invalid name");
                     } else {
                         $r = $mm . $p . ($ik ? "의 돈 : " : "'s Money : ") . $this->getMoney($p) . ($ik ? "원  ,  랭킹 : " : "\$  ,  Rank : ") . $this->getRank($p);
                     }
                     break;
                 case "pay":
                 case "p":
                 case "지불":
                     if (!$sender instanceof Player) {
                         $r = $mm . ($ik ? "게임내에서 실행해주세요." : "Please run this command in-game");
                     } elseif (!isset($sub[1])) {
                         $r = $rm . ($ik ? "지불 <플레이어명> <돈> " : "Pay <PlayerName> <Money>");
                     } elseif (!($p = $this->getPlayer($sub[0])) || strtolower($n) == strtolower($sub[0])) {
                         $r = $mm . $sub[0] . ($ik ? "은 잘못된 이름입니다." : " is invalid name");
                     } elseif (!is_numeric($sub[1]) || $sub[1] < 1) {
                         $r = $mm . $sub[1] . ($ik ? "은 잘못된 숫자입니다." : " is invalid number");
                     } elseif (!$this->hasMoney($n, $sub[1])) {
                         $r = $mm . ($ik ? "돈이 {$sub['1']} 보다 부족합니다. (나의 돈 : " : "You don't have {$sub['1']} \$ (You have : ") . $this->getMoney($n) . ($ik ? " 원" : "\$");
                     } else {
                         $sub[1] = $sub[1] < 0 ? 0 : floor($sub[1]);
                         $this->takeMoney($n, $sub[1]);
                         $this->giveMoney($p, $sub[1]);
                         $r = $mm . ($ik ? "당신은 {$sub['1']} 원을  {$p} 님에게 지불햇습니다. " : "You pay {$sub['1']} \$ (To : {$p})");
                         if ($player = $this->getServer()->getPlayerExact($p)) {
                             $player->sendMessage($mm . $n . ($ik ? "님이 당신에게 {$sub['1']} 원을 지불햇습니다. " : "{$n} pay {$sub['2']}\$ to you"));
                         }
                     }
                     break;
                 case "rank":
                 case "r":
                 case "랭킹":
                 case "순위":
                     if (isset($sub[0]) && is_numeric($sub[0]) && $sub[0] > 1) {
                         $r = $this->getRanks(round($sub[0]));
                     } else {
                         $r = $this->getRanks(1);
                     }
                     break;
                 default:
                     return false;
                     break;
             }
             break;
         case "moneyop":
             $mm = "[Money] ";
             $rm = TextFormat::RED . "Usage: /MoneyOP ";
             switch ($smd) {
                 case "set":
                 case "s":
                 case "설정":
                     if (!isset($sub[1])) {
                         $r = $rm . ($ik ? "설정 <플레이어명> <돈>" : "Set(S) <PlayerName> <Money>");
                     } elseif (!($p = $this->getPlayer($sub[0]))) {
                         $r = $mm . $sub[0] . ($ik ? "은 잘못된 이름입니다." : " is invalid name");
                     } elseif (!is_numeric($sub[1]) || $sub[1] < 0) {
                         $r = $mm . $sub[1] . ($ik ? "은 잘못된 숫자입니다." : " is invalid number");
                     } else {
                         $sub[1] = $sub[1] < 0 ? 0 : floor($sub[1]);
                         $this->setMoney($p, $sub[1]);
                         $r = $mm . $p . ($ik ? "의 돈을 {$sub['1']} 원으로 설정했습니다.  " : "'s money is set to {$sub['1']} \$");
                         if ($player = $this->getServer()->getPlayerExact($p)) {
                             $player->sendMessage($mm . ($ik ? "당신의 돈이 어드민에 의해 변경되었습니다. 나의 돈 : " : "Your money is change by admin. Your money : ") . $this->getMoney($p) . ($ik ? "원" : "\$"));
                         }
                     }
                     break;
                 case "give":
                 case "g":
                 case "지급":
                     if (!isset($sub[1])) {
                         $r = $rm . ($ik ? "지급 <플레이어명> <돈>" : "Give(G) <PlayerName> <Money>");
                     } elseif (!($p = $this->getPlayer($sub[0]))) {
                         $r = $mm . $sub[0] . ($ik ? "은 잘못된 이름입니다." : " is invalid name");
                     } elseif (!is_numeric($sub[1]) || $sub[1] < 0) {
                         $r = $mm . $sub[1] . ($ik ? "은 잘못된 숫자입니다." : " is invalid number");
                     } else {
                         $sub[1] = $sub[1] < 0 ? 0 : floor($sub[1]);
                         $this->giveMoney($p, $sub[1]);
                         $r = $mm . ($ik ? "{$p} 님에게 {$sub['1']} 원을 지급햇습니다. " : "Give the {$sub['1']} \$ to {$p}");
                     }
                     break;
                 case "take":
                 case "t":
                 case "뺏기":
                     if (!isset($sub[1])) {
                         $r = $rm . ($ik ? "뺏기 <플레이어명> <돈>" : "Take(T) <PlayerName> <Money>");
                     } elseif (!($p = $this->getPlayer($sub[0]))) {
                         $r = $mm . $sub[0] . ($ik ? "은 잘못된 이름입니다." : " is invalid name");
                     } elseif (!is_numeric($sub[1]) || $sub[1] < 0) {
                         $r = $mm . $sub[1] . ($ik ? "은 잘못된 숫자입니다." : " is invalid number");
                     } else {
                         $sub[1] = $sub[1] < 0 ? 0 : floor($sub[1]);
                         $this->takeMoney($p, $sub[1]);
                         $r = $mm . ($ik ? "{$p} 님에게서 {$sub['1']} 원을 빼앗았습니다. " : "Take the {$sub['1']} \$ to {$p}");
                     }
                     break;
                     break;
                 case "clear":
                 case "c":
                 case "초기화":
                     foreach ($mn["Money"] as $k => $v) {
                         $mn["Money"][$k] = $mn["Default"];
                     }
                     $m = $mm . ($ik ? "모든 플레이어의 돈이 초기화되었습다." : "All Player's money is reset");
                     $c = true;
                     break;
                 case "default":
                 case "d":
                 case "기본":
                     if (!isset($sub[0])) {
                         $r = $rm . ($ik ? "기본 <돈>" : "Defualt(D) <Money>");
                     } elseif (!is_numeric($sub[0]) || $sub[0] < 0) {
                         $r = $mm . $sub[0] . ($ik ? "은 잘못된 숫자입니다." : " is invalid number");
                     } else {
                         $sub[0] = floor($sub[0]);
                         $mn["Default"] = $sub[0];
                         $r = $mm . ($ik ? "기초자금이 {$sub['0']} 로 설정되었습니다." : "Defualt money is set to {$sub['0']} \$");
                         $c = true;
                     }
                     break;
                 case "nick":
                 case "n":
                 case "닉네임":
                     $mn["Nick"] = !$mn["Nick"];
                     $r = $mm . ($ik ? "닉네임 모드를 " . ($mn["Nick"] ? "켭" : "끕") . "니다." : "MickName mode is " . ($mn["Nick"] ? "On" : "Off"));
                     $c = true;
                     break;
                 case "op":
                 case "o":
                 case "오피":
                     $mn["OP"] = !$mn["OP"];
                     $r = $mm . ($ik ? "오피를 랭킹에 포함" . ($mn["OP"] ? "" : "안") . "합니다." : "Show on rank the Op is " . ($mn["OP"] ? "On" : "Off"));
                     $c = true;
                     break;
                 case "trim":
                     $full = count($mn["Money"]);
                     $count = 0;
                     foreach ($mn["Money"] as $k => $v) {
                         if ($mn["Money"][$k] == $mn["Default"] || $this->getServer()->getNameBans()->isBanned($k) || !file_exists($this->getServer()->getDataPath() . "players/" . $k . ".dat")) {
                             unset($mn["Money"][$k]);
                             $count++;
                         }
                     }
                     if ($count > 0) {
                         $c = true;
                     }
                     $r = $mm . ($ik ? "필요없는 데이터를 제거했습니다. 갯수 : " : "Delete useless data. Count : ") . $count . " [{$full} => " . count($mn["Money"]) . "]";
                     break;
                 default:
                     return false;
                     break;
             }
             break;
         case "shop":
             $mm = "[Shop] ";
             $rm = TextFormat::RED . "Usage: /Shop ";
             switch ($smd) {
                 case "add":
                 case "a":
                 case "추가":
                     if (isset($t[$n])) {
                         $r = $mm . ($ik ? "상점 추가 해제" : " Shop Add Touch Disable");
                         unset($t[$n]);
                     } else {
                         if (!isset($sub[3])) {
                             $r = $rm . ($ik ? "추가 <구매|판매> <아이템ID> <갯수> <가격>" : "Add(A) <Buy|Sell> <ItemID> <Amount> <Price>");
                         } else {
                             switch (strtolower($sub[0])) {
                                 case "buy":
                                 case "b":
                                 case "shop":
                                 case "구매":
                                     $mode = "Buy";
                                     break;
                                 case "sell":
                                 case "s":
                                 case "판매":
                                     $mode = "Sell";
                                     break;
                             }
                             $i = Item::fromString($sub[1]);
                             if (!isset($mode)) {
                                 $r = "{$sub['0']} " . ($ik ? "는 잘못된 모드입니다. (구매/판매)" : "is invalid Mode (Buy/Sell)");
                             } elseif ($i->getID() == 0) {
                                 $r = "{$sub['1']} " . ($ik ? "는 잘못된 아이템ID입니다." : "is invalid ItemID");
                             } elseif (!is_numeric($sub[2]) || $sub[2] < 1) {
                                 $r = "{$sub['2']} " . ($ik ? "는 잘못된 갯수입니다." : "is invalid count");
                             } elseif (!is_numeric($sub[3]) || $sub[3] < 0) {
                                 $r = "{$sub['3']} " . ($ik ? "는 잘못된 가격입니다." : "is invalid price");
                             } else {
                                 $id = $i->getID() . ":" . $i->getDamage();
                                 $r = $mm . ($ik ? "대상 블럭을 터치해주세요." : "Touch the target block");
                                 $t[$n] = ["Type" => "Add", "Mode" => $mode, "Item" => $id, "Count" => floor($sub[2]), "Price" => floor($sub[3])];
                             }
                         }
                     }
                     break;
                 case "del":
                 case "d":
                 case "삭제":
                 case "제거":
                     if (isset($t[$n])) {
                         $r = $mm . ($ik ? "상점 제거 해제" : " Shop Del Touch Disable");
                         unset($t[$n]);
                     } else {
                         $r = $mm . ($ik ? "대상 블럭을 터치해주세요. " : "Touch the block");
                         $t[$n] = ["Type" => "Del"];
                     }
                     break;
                 case "reset":
                 case "r":
                 case "리셋":
                 case "초기화":
                     $sh = [];
                     $r = $mm . ($ik ? " 리셋됨." : " Reset");
                     $this->spawnCase();
                     break;
                 default:
                     return false;
                     break;
             }
         case "login":
             if ($this->isLogin($sender)) {
                 $sender->sendMessage($mm . ($ik ? "이미 로그인되었습니다." : "Already logined"));
             } else {
                 $this->login($sender, $smd, false, isset($sub[0]) ? $sub[0] : "");
             }
             break;
         case "register":
             if ($this->isRegister($sender)) {
                 $sender->sendMessage($mm . ($ik ? "이미 가입되었습니다." : "Already registered"));
             } elseif (!isset($sub[0]) || $sub[0] == "" || $smd !== $sub[0]) {
                 return false;
             } elseif (strlen($smd) < 5) {
                 $sender->sendMessage($mm . ($ik ? "비밀번호가 너무 짧습니다." : "Password is too short"));
                 return false;
             } else {
                 $this->register($sender, $smd);
                 if (!$sender->isOp()) {
                     $this->login($sender, $smd);
                 }
             }
             break;
         case "loginop":
             if (isset($sub[0])) {
                 $sub[0] = strtolower($sub[0]);
             }
             switch (strtolower($smd)) {
                 case "del":
                 case "d":
                 case "제거":
                 case "탈퇴":
                     if (!isset($sub[0]) || $sub[0] == "" || !isset($this->lg[$sub[0]])) {
                         $sender->sendMessage($mm . ($ik ? "<플레이어명>을 확인해주세요." : "Please check <PlayerName>"));
                         return false;
                     } else {
                         unset($this->lg[$sub[0]]);
                         $sender->sendMessage($mm . ($ik ? "{$sub['0']} 님의 비밀번호을 제거합니다." : "Delete {$sub['0']} 's password"));
                     }
                     break;
                 case "change":
                 case "c":
                     if (!isset($sub[0]) || $sub[0] == "" || !isset($this->lg[$sub[0]])) {
                         $sender->sendMessage($mm . ($ik ? "<플레이어명>을 확인해주세요." : "Please check <PlayerName>"));
                         return false;
                     } else {
                         $this->lg[$sub[0]]["PW"] = hash("sha256", $sub[1]);
                         $sender->sendMessage($mm . $sub[0] . ($ik ? "님의 비밀번호를 바꿨습니다. : " : "'s Password is changed : ") . "{$sub['1']}");
                     }
                     break;
                 case "reset":
                 case "r":
                 case "리셋":
                 case "초기화":
                     $this->lg = [];
                     $r = $mm . ($ik ? " 리셋됨." : " Reset");
                     break;
                 case "trim":
                     $full = count($list = glob($a = $this->getServer()->getDataPath() . "players/*.dat"));
                     $count = 0;
                     foreach ($list as $v) {
                         if (!isset($this->lg[$n = strtolower(str_replace([$this->getServer()->getDataPath() . "players/", ".dat"], ["", ""], $v))])) {
                             if ($p = $this->getServer()->getPlayerExact($n)) {
                                 $p->close($ik ? "플레이어 데이터 제거" : "Delete player data");
                             }
                             @unlink($v);
                             $count++;
                         }
                     }
                     if ($count > 0) {
                         $c = true;
                     }
                     $r = $mm . ($ik ? "필요없는 데이터를 제거했습니다. 갯수 : " : "Delete useless data. Count : ") . $count . " [{$full} => " . count(glob($this->getServer()->getDataPath() . "/players/*.dat")) . "]";
                     break;
             }
             $this->saveYml();
             break;
     }
     if (isset($r)) {
         $sender->sendMessage($r);
     }
     if (isset($m)) {
         $this->getServer()->broadcastMessage($m);
     }
     if ($c && $this->mn !== $mn) {
         $this->mn = $mn;
     }
     if ($this->sh !== $sh) {
         $this->sh = $sh;
         $this->saveYml();
     }
     $this->touch = $t;
     return true;
 }