Example #1
0
 public function execute(CommandSender $sender, $command, array $args)
 {
     if (count($args) > 0) {
         if ($args[0] == "reload" && ($sender->isOp() || $sender->hasPermission("ballzauth.ba.reload"))) {
             if (isset($args[1])) {
                 if ($args[1] == "users") {
                     User::load();
                     $sender->sendMessage(TextFormat::GREEN . "The users where reloaded");
                     return true;
                 } elseif ($args[1] == "config") {
                     Config::load();
                     $sender->sendMessage(TextFormat::GREEN . "The config where reloaded");
                     return true;
                 }
             }
             $sender->sendMessage(TextFormat::GOLD . "Usage : /ba reload [config/users]");
             return true;
         } elseif ($args[0] == "help" && count($args) < 2) {
             $sender->sendMessage(TextFormat::GOLD . "------ Help ------");
             $sender->sendMessage(TextFormat::GOLD . "/ba reload : " . TextFormat::GRAY . "Reload the users or the config");
             return true;
         }
     }
     $sender->sendMessage(TextFormat::GREEN . "------" . TextFormat::GOLD . " BallzAuth " . TextFormat::GREEN . "------");
     $sender->sendMessage(TextFormat::GREEN . "  Created by Vavaballz");
     $sender->sendMessage(TextFormat::GREEN . "-----------------------");
     $sender->sendMessage(TextFormat::GOLD . "Type /ba help for command help");
     return true;
 }
Example #2
0
 private function checkPermission(CommandSender $sender)
 {
     if (!($sender->isOp() or $sender->hasPermission("nt.commmand"))) {
         $sender->sendMessage(TextFormat::RED . "You don't have permission to use this command.");
         return false;
     }
     return true;
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     switch ($cmd->getName()) {
         case "isop":
             $sender->sendMessage("[Server] " . TextFormat::GREEN . "You " . ($sender->isOp() ? "are" : "are not") . " op!");
             return true;
     }
 }
Example #4
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($sender->isOp() || $sender instanceof ConsoleCommandSender) {
         if (strtolower($cmd->getName()) == "rwl" && !isset($args[2])) {
             if (isset($args[0])) {
                 switch (strtolower($args[0])) {
                     case "add":
                         if (!isset($args[1])) {
                             $sender->sendMessage(TextFormat::RED . "/rwl add [player name]");
                             break;
                         }
                         if ($this->addPlayer($args[1]) === false) {
                             $sender->sendMessage(TextFormat::RED . "player is already whitelisted");
                         } else {
                             $this->addPlayer($args[1]);
                             $sender->sendMessage(TextFormat::GREEN . "added " . $args[1] . " to the whitelist");
                         }
                         break;
                     case "remove":
                         if (!isset($args[1])) {
                             $sender->sendMessage(TextFormat::RED . "/rwl remove [player name]");
                             break;
                         }
                         if ($this->removePlayer($args[1]) === false) {
                             $sender->sendMessage(TextFormat::RED . "player is not whitelisted");
                         } else {
                             $this->removePlayer($args[1]);
                             $sender->sendMessage(TextFormat::GREEN . "removed " . $args[1] . " from whitelist");
                         }
                         break;
                     case "on":
                         $this->turnWl("on");
                         $sender->sendMessage(TextFormat::GREEN . "Whitelist truned on");
                         break;
                     case "off":
                         $this->turnWl("off");
                         $sender->sendMessage(TextFormat::GREEN . "Whitelist truned off");
                         break;
                 }
                 if ($args[0] !== "add" && $args[0] !== "remove" && $args[0] !== "off" && $args[0] !== "on") {
                     $sender->sendMessage(TextFormat::RED . "/rwl add [player name]");
                 }
             } else {
                 $sender->sendMessage(TextFormat::RED . "/rwl add [player name]");
             }
         }
     }
 }
Example #5
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (!$sender->isOp()) {
         return false;
     }
     if (!isset($args[0]) or !is_numeric($args[0])) {
         $sender->sendMessage("[CustomPacket] type : /custompacket <port>");
         return true;
     }
     $this->getConfig()->set("port", intval($args[0]));
     $this->getConfig()->save();
     self::$interface->shutdown();
     self::$interface = new SocketInterface($this->getServer(), $this->getConfig()->get("port", 19131));
     $sender->sendMessage("[CustomPacket] Settings have been applied successfully");
     return true;
 }
 public function onCommand(CommandSender $sender, Command $cmd, $l, array $args)
 {
     if (!$sender instanceof Player or $sender->isOp()) {
         if (!isset($args[0])) {
             return false;
         }
         $kicked = $this->getServer()->getPlayer($k = array_shift($args));
         if ($kicked !== null and $kicked->isOnline()) {
             isset($args[0]) ? $kicked->kick(implode(" ", $args), false) : $kicked->kick();
             $sender->sendMessage("Kicked " . $args[0] . " with custom message");
         } else {
             $sender->sendMessage("Player " . $args[0] . " is not online");
         }
     } else {
         $sender->sendMessage("You don't have permission to use this command");
     }
     return true;
 }
Example #7
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;
 }
Example #8
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($sender->isOp()) {
         switch ($cmd->getName()) {
             case "setpos":
                 $pos = $args[0];
                 $this->writeCoords($pos, $sender);
                 // When issued, saves in the config the coordinates and the spawnpoint nubmer
                 break;
             case "s1":
                 $this->getConfig()->set("pos1", array((int) $sender->x, (int) $sender->y, (int) $sender->z));
                 break;
             case 's2':
                 $this->getConfig()->set("pos2", array(round($sender->getX(), $sender->getY(), $sender->getZ())));
                 break;
             default:
                 $sender->sendMessage(TextFormat::RED . 'You must be op to use these commands');
                 break;
         }
     }
 }
Example #9
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     $username = $sender->getName();
     switch ($command->getName()) {
         case "ht":
             if ($sender->isOp()) {
                 if ($this->isEnabled !== false) {
                     $this->isEnabled = false;
                 } else {
                     $this->isEnabled = true;
                 }
                 foreach ($this->getServer()->getOnlinePlayers() as $player) {
                     $this->renderNameTag($player);
                 }
             } else {
                 $sender->sendMessage(TextFormat::RED . "You don't have permission to use this command");
             }
             return true;
             break;
     }
 }
 public function execute(CommandSender $sender, $label, array $params)
 {
     if (!$this->plugin->isEnabled()) {
         return false;
     }
     if (!$sender instanceof Player) {
         $sender->sendMessage("Please use the command in-game");
         return true;
     }
     if ($sender->isOp()) {
         // Get current op location
         $playerLocation = $sender->getLocation();
         $this->plugin->getLogger()->info("location" . $sender->getLocation());
         // Add the arena
         $this->arenaManager->referenceNewArena($playerLocation);
         // Notify the op
         $sender->sendMessage("[1vs1] A new arena has been created at your position ! There are " . $this->arenaManager->getNumberOfArenas() . " arenas.");
         return true;
     } else {
         $sender->sendMessage(TextFormat::RED . "You must be op for use this command !");
     }
 }
 private function hasCommandAccess(CommandSender $sender)
 {
     if ($sender->getName() == "CONSOLE") {
         return true;
     } elseif ($sender->isOp()) {
         return true;
     }
     return false;
 }
Example #12
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     switch (strtolower($command->getName())) {
         case "onigo":
             if ($sender->isOp()) {
                 if (!isset($args[0])) {
                     return false;
                 }
                 switch (strtolower($args[0])) {
                     case "start":
                         $this->setStartGame();
                         break;
                     case "stop":
                         $this->setStopGame();
                         break;
                     case "skip":
                         $this->setTime(0);
                         break;
                 }
                 return true;
             } else {
                 return false;
             }
             break;
     }
     return false;
 }
 public function onCommandUser(CommandSender $sender, array $args)
 {
     $MessageManager = $this->MessageManager;
     $MessageManager = $this->SignShop->messageManager();
     if ($this->SignShop->getProvider()->getPlayer($sender->getName())["authorized"] != "denied") {
         switch (strtolower($args[0])) {
             case "?":
             case "h":
             case "help":
                 if ($sender->isOp() || $this->SignShop->getProvider()->getPlayer($sender->getName())["authorized"] == "root") {
                     $sender->sendMessage($this->showHelp(false, true, true));
                 } else {
                     $sender->sendMessage($this->showHelp());
                 }
                 return;
             case "echo":
             case "say":
                 $get = $this->SignShop->getProvider()->getPlayer($sender->getName());
                 switch (strtolower(trim($args[1]))) {
                     case "on":
                     case "true":
                         $get["echo"] = true;
                         $this->SignShop->getProvider()->setPlayer($sender->getName(), $get);
                         $MessageManager->send($sender, "The_action_has_been_executed_successfully");
                         return;
                     case "off":
                     case "false":
                         $get["echo"] = false;
                         $this->SignShop->getProvider()->setPlayer($sender->getName(), $get);
                         $MessageManager->send($sender, "The_action_has_been_executed_successfully");
                         return;
                 }
                 $MessageManager->send($sender, "Invalid_arguments");
                 return;
             case "v":
             case "view":
                 $this->SignShop->temp[$sender->getName()] = ["action" => "view"];
                 $MessageManager->send($sender, "Now_touch_on_the_Sign_that_you_want_to_do_this_action");
                 return;
             case "remove":
                 $this->SignShop->temp[$sender->getName()] = ["action" => "remove"];
                 $MessageManager->send($sender, "Now_touch_on_the_Sign_that_you_want_to_do_this_action");
                 return;
             case "empty":
                 $this->SignShop->temp[$sender->getName()] = ["action" => "empty"];
                 $MessageManager->send($sender, "Now_touch_on_the_Sign_that_you_want_to_do_this_action");
                 return;
             case "s":
             case "set":
                 if (count($args) == 3) {
                     switch (strtolower($args[1])) {
                         case "amount":
                             if (is_numeric($args[2]) && $args[2] > 0) {
                                 $this->SignShop->temp[$sender->getName()] = ["action" => "set", "arg" => "amount", "value" => $args[2]];
                                 $MessageManager->send($sender, "Now_touch_on_the_Sign_that_you_want_to_do_this_action");
                             } else {
                                 $MessageManager->send($sender, "Invalid_value_of_@@", $MessageManager->getMessage("cost"));
                             }
                             return;
                         case "available":
                             if (is_numeric($args[2]) && $args[2] > 0 && $args[2] < 64 * 45) {
                                 $this->SignShop->temp[$sender->getName()] = ["action" => "set", "arg" => "available", "value" => $args[2]];
                                 $MessageManager->send($sender, "Now_touch_on_the_Sign_that_you_want_to_do_this_action");
                             } else {
                                 if (strtolower($args[2]) == "unlimited") {
                                     if ($this->SignShop->getProvider()->getPlayer($sender->getName())["authorized"] == "root") {
                                         $this->SignShop->temp[$sender->getName()] = ["action" => "set", "arg" => "unlimited"];
                                         $MessageManager->send($sender, "Now_touch_on_the_Sign_that_you_want_to_do_this_action");
                                     } else {
                                         $MessageManager->send($sender, "You_are_not_authorized_to_run_this_command");
                                     }
                                 } else {
                                     $MessageManager->send($sender, "Invalid_value_of_@@", $MessageManager->getMessage("available"));
                                 }
                             }
                             return;
                         case "cost":
                             if (is_numeric($args[2]) && $args[2] >= 0) {
                                 $this->SignShop->temp[$sender->getName()] = ["action" => "set", "arg" => "cost", "value" => $args[2]];
                                 $MessageManager->send($sender, "Now_touch_on_the_Sign_that_you_want_to_do_this_action");
                             } else {
                                 $MessageManager->send($sender, "Invalid_value_of_@@", $MessageManager->getMessage("cost"));
                             }
                             return;
                         case "maker":
                             if ($args[2] != " ") {
                                 $this->SignShop->temp[$sender->getName()] = ["action" => "set", "arg" => "maker", "name" => $args[2]];
                                 $MessageManager->send($sender, "Now_touch_on_the_Sign_that_you_want_to_do_this_action");
                             } else {
                                 $MessageManager->send($sender, "Invalid_value_of_@@", $MessageManager->getMessage("maker"));
                             }
                             return;
                     }
                 }
                 $MessageManager->send($sender, "Invalid_arguments");
                 return;
         }
         return true;
     } else {
         $MessageManager->send($sender, "You_are_not_authorized_to_run_this_command");
     }
     return;
 }
Example #14
0
 public function opmsgCmd(CommandSender $sender, array $args)
 {
     if (count($args) == 0) {
         return false;
     }
     $ms = TextFormat::BLUE . mc::_("OpMsg [%1%] ", $sender->getName()) . TextFormat::YELLOW . implode(" ", $args);
     $this->owner->getLogger()->info($ms);
     $count = 0;
     foreach ($this->owner->getServer()->getOnlinePlayers() as $pl) {
         if (!$pl->isOp()) {
             continue;
         }
         $pl->sendMessage($ms);
         ++$count;
     }
     if ($sender instanceof Player && !$sender->isOp()) {
         if ($count) {
             $sender->sendMessage(mc::_("(ops:%1%) ", $count) . implode(" ", $args));
         } else {
             $sender->sendMessage(mc::_("Message sent to console only"));
             if ($sender->hasPermission("gb.cmd.rpt")) {
                 $sender->sendMessage(mc::_("Try /rpt instead"));
             }
         }
     }
     return true;
 }
Example #15
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command) == $this->get("command")) {
         // TODO <- 빈칸에 명령어
         if (!isset($args[0])) {
             if ($sender->isOp()) {
                 $this->alert($sender, $this->get("command-ophelp"));
             } else {
                 $this->alert($sender, $this->get("command-help"));
             }
             return true;
         }
         switch (strtolower($args[0])) {
             case $this->get("command-participation"):
                 if (!$this->war->isPlay()) {
                     $this->alert($sender, $this->get("not-resume-war"));
                     break;
                 }
                 if ($this->war->getSoldier($sender) != null) {
                     $this->alert($sender, $this->get("already-participate"));
                     break;
                 }
                 $this->war->participate($sender);
                 $this->message($sender, str_replace("%team%", $this->war->getSoldier($sender)->getTeam()->getTeamName(), $this->get("success-participate")));
                 break;
             case $this->get("command-spawn"):
                 if (!$sender->isOp()) {
                     $this->alert($sender, $this->get("dont-have-permission"));
                     break;
                 }
                 if (!isset($args[1])) {
                     $this->alert($sender, $this->get("spawn-help"));
                     break;
                 }
                 $pos = new Position($sender->getX(), $sender->getY(), $sender->getZ(), $sender->getLevel());
                 switch (strtolower($args[1])) {
                     case $this->get("command-red"):
                         $this->war->redteam->setSpawnPoint($pos);
                         $this->message($sender, str_replace("%team%", $args[1], $this->get("success-setspawn")));
                         break;
                     case $this->get("command-blue"):
                         $this->war->blueteam->setSpawnPoint($pos);
                         $this->message($sender, str_replace("%team%", $args[1], $this->get("success-setspawn")));
                         break;
                     case $this->get("command-lobby"):
                         $this->war->setLobby($pos);
                         $this->message($sender, $this->get("success-setlobby"));
                         break;
                     default:
                         $this->alert($sender, $this->get("spawn-help"));
                 }
                 break;
             case $this->get("command-leave"):
                 if ($this->war->leaveWar($sender)) {
                     $this->message($sender, $this->get("leave-from-war"));
                 } else {
                     $this->alert($sender, $this->get("you-dont-participate"));
                 }
                 break;
             default:
                 if ($sender->isOp()) {
                     $this->alert($sender, $this->get("command-ophelp"));
                 } else {
                     $this->alert($sender, $this->get("command-help"));
                 }
                 break;
         }
     }
     return true;
 }
Example #16
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command->getName() == $this->get("snow"))) {
         if (!$sender->hasPermission("snowhalation")) {
             return false;
         }
         if (!isset($args[0])) {
             $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("on-help"));
             $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("off-help"));
             if ($sender->isOp()) {
                 $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("enable-help"));
                 $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("disable-help"));
                 $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("sunlight-help"));
             }
             return true;
         }
         switch ($args[0]) {
             case $this->get("enable"):
                 if (!$sender->isOp()) {
                     return false;
                 }
                 $this->config["enable-snowing"] = 1;
                 $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("snow-enabled"));
                 break;
             case $this->get("disable"):
                 if (!$sender->isOp()) {
                     return false;
                 }
                 $this->config["enable-snowing"] = 0;
                 $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("snow-disabled"));
                 break;
             case $this->get("on"):
                 if (isset($this->denied[$sender->getName()])) {
                     unset($this->denied[$sender->getName()]);
                 }
                 $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("snow-on"));
                 break;
             case $this->get("off"):
                 $this->denied[$sender->getName()] = 1;
                 $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("snow-off"));
             case $this->get("sunlight"):
                 if (!$sender->isOp()) {
                     return false;
                 }
                 if ($this->config["enable-sunlight"] == 0) {
                     $this->config["enable-sunlight"] = 1;
                     $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("sunlight-on-1"));
                     $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("sunlight-on-2"));
                     $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("sunlight-on-3"));
                 } else {
                     $this->config["enable-sunlight"] = 0;
                     $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("sunlight-off-1"));
                     $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("sunlight-off-2"));
                 }
                 break;
             default:
                 $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("on-help"));
                 $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("off-help"));
                 if ($sender->isOp()) {
                     $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("enable-help"));
                     $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("disable-help"));
                     $sender->sendMessage(TextFormat::DARK_AQUA . $this->get("sunlight-help"));
                 }
                 break;
         }
         return true;
     }
 }
 /**
  * Handle CTF Commands
  *
  * @param CommandSender $sender        	
  * @param Command $command        	
  * @param unknown $label        	
  * @param array $args        	
  * @return boolean
  */
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     $player = null;
     if (!$sender instanceof PLayer) {
         $sender->sendMessage($this->getMsg("ctf.error.wrong-sender"));
         return;
     }
     $player = $sender->getPlayer();
     if (strtolower($command->getName()) == self::CTF_COMMAND && isset($args[0])) {
         if (strtolower($args[0]) == self::CTF_COMMAND_CREATE_ARENA || strtolower($args[0]) == self::CTF_COMMAND_RESET_ARENA) {
             if (!$sender->isOp()) {
                 $sender->sendMessage($this->getMsg("ctf.error.no-permission"));
                 return;
             }
             $this->buildGameArena($sender);
             $output = TextFormat::BLUE . "----------------------------------\n";
             $output .= TextFormat::BLUE . $this->getMsg("arena.created") . "\n";
             $output .= TextFormat::BLUE . "----------------------------------\n";
             $sender->sendMessage($output);
             return true;
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_BLOCK_DISPLAY_ON) {
             if (!$sender->isOp()) {
                 $sender->sendMessage($this->getMsg("ctf.error.no-permission"));
                 return;
             }
             $this->getPlugIn()->pos_display_flag = 1;
             $sender->sendMessage($this->getMsg("block.display-on"));
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_BLOCK_DISPLAY_OFF) {
             if (!$sender->isOp()) {
                 $sender->sendMessage($this->getMsg("ctf.error.no-permission"));
                 return;
             }
             $this->getPlugIn()->pos_display_flag = 0;
             $sender->sendMessage($this->getMsg("block.display-off"));
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_JOIN_BLUE_TEAM) {
             $sender->sendMessage($this->getMsg("team.join-blue"));
             $this->handleJoinBlueTeam($player);
             return;
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_JOIN_RED_TEAM) {
             $sender->sendMessage($this->getMsg("team.join-red"));
             $this->handleJoinRedTeam($player);
             return;
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_LEAVE) {
             $sender->sendMessage($this->getMsg("game.player-left"));
             $this->handleLeaveTheGame($player);
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_STOP) {
             $sender->sendMessage($this->getMsg("game.player-stop"));
             $this->stopGame($player);
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_HOME) {
             $sender->sendMessage($this->getMsg("sign.teleport.ctf"));
             $this->teleportPlayerToHome($player);
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_START) {
             $sender->sendMessage($this->getMsg("game.player-start"));
             $this->handleStartTheGame($player->getLevel());
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_STATS) {
             $sender->sendMessage($this->getMsg("game.stats"));
             $this->displayTeamScores($sender);
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_SET_SIGN_JOIN_BLUE_TEAM) {
             if (!$sender->isOp()) {
                 $sender->sendMessage($this->getMsg("ctf.error.no-permission"));
                 return;
             }
             $this->getPlugIn()->setupModeAction = self::CTF_COMMAND_SET_SIGN_JOIN_BLUE_TEAM;
             $sender->sendMessage($this->getMsg("ctf.setup.action") . self::CTF_COMMAND_SET_SIGN_JOIN_BLUE_TEAM);
             $sender->sendMessage($this->getMsg("ctf.setup.select"));
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_SET_SIGN_JOIN_RED_TEAM) {
             if (!$sender->isOp()) {
                 $sender->sendMessage($this->getMsg("ctf.error.no-permission"));
                 return;
             }
             $this->getPlugIn()->setupModeAction = self::CTF_COMMAND_SET_SIGN_JOIN_RED_TEAM;
             $sender->sendMessage($this->getMsg("ctf.setup.action") . self::CTF_COMMAND_SET_SIGN_JOIN_RED_TEAM);
             $sender->sendMessage($this->getMsg("ctf.setup.select"));
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_SET_SIGN_NEW_GAME) {
             if (!$sender->isOp()) {
                 $sender->sendMessage($this->getMsg("ctf.error.no-permission"));
                 return;
             }
             $this->getPlugIn()->setupModeAction = self::CTF_COMMAND_SET_SIGN_NEW_GAME;
             $sender->sendMessage($this->getMsg("ctf.setup.action") . self::CTF_COMMAND_SET_SIGN_NEW_GAME);
             $sender->sendMessage($this->getMsg("ctf.setup.select"));
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_SET_SIGN_VIEW_STATS) {
             if (!$sender->isOp()) {
                 $sender->sendMessage($this->getMsg("ctf.error.no-permission"));
                 return;
             }
             $this->getPlugIn()->setupModeAction = self::CTF_COMMAND_SET_SIGN_VIEW_STATS;
             $sender->sendMessage($this->getMsg("ctf.setup.action") . self::CTF_COMMAND_SET_SIGN_VIEW_STATS);
             $sender->sendMessage($this->getMsg("ctf.setup.select"));
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_SETBLOCK_ID_TEAM_BORDER) {
             if (!$sender->isOp()) {
                 $sender->sendMessage($this->getMsg("ctf.error.no-permission"));
                 return;
             }
             $this->getPlugIn()->setupModeAction = self::CTF_COMMAND_SETBLOCK_ID_TEAM_BORDER;
             $sender->sendMessage($this->getMsg("ctf.setup.action") . self::CTF_COMMAND_SETBLOCK_ID_TEAM_BORDER);
             $sender->sendMessage($this->getMsg("ctf.setup.select"));
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_SETBLOCK_ID_DEFENCE_WALL_BLUE_TEAM) {
             if (!$sender->isOp()) {
                 $sender->sendMessage($this->getMsg("ctf.error.no-permission"));
                 return;
             }
             $this->getPlugIn()->setupModeAction = self::CTF_COMMAND_SETBLOCK_ID_DEFENCE_WALL_BLUE_TEAM;
             $sender->sendMessage($this->getMsg("ctf.setup.action") . self::CTF_COMMAND_SETBLOCK_ID_DEFENCE_WALL_BLUE_TEAM);
             $sender->sendMessage($this->getMsg("ctf.setup.select"));
         } elseif (strtolower($args[0]) == self::CTF_COMMAND_SETBLOCK_ID_DEFENCE_WALL_RED_TEAM) {
             if (!$sender->isOp()) {
                 $sender->sendMessage($this->getMsg("ctf.error.no-permission"));
                 return;
             }
             $this->getPlugIn()->setupModeAction = self::CTF_COMMAND_SETBLOCK_ID_DEFENCE_WALL_RED_TEAM;
             $sender->sendMessage($this->getMsg("ctf.setup.action") . self::CTF_COMMAND_SETBLOCK_ID_DEFENCE_WALL_RED_TEAM);
             $sender->sendMessage($this->getMsg("ctf.setup.select"));
         }
     }
 }
 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;
     }
 }
Example #19
0
 /**
  * Handles command prefixes before dispatching commands.
  *
  * The following prefixes are recognized:
  * - "+op:", temporarily gives the player Op (if the player is not Op yet)
  * - "+console:", runs the command as if it was run from the console.
  * - "+rcon:", runs the command as if it was run from a RemoteConsole,
  *   capturing all output which is then send to the player.
  *
  * @param CommandSender $ctx - running context
  * @param str $cmdline - command line to execute
  */
 public static function opexec(CommandSender $ctx, $cmdline)
 {
     if (($cm = MPMU::startsWith($cmdline, "+op:")) !== null) {
         if (!$ctx->isOp()) {
             $ctx->setOp(true);
             $ctx->getServer()->distpatchCommand($ctx, $cm);
             $ctx->setOp(false);
             return;
         }
         $ctx->getServer()->distpatchCommand($ctx, $cm);
         return;
     }
     if (($cm = MPMU::startsWith($cmdline, "+console:")) !== null) {
         $ctx->getServer()->distpatchCommand(new ConsoleCommandSender(), $cm);
         return;
     }
     if (($cm = MPMU::startsWith($cmdline, "+rcon:")) !== null) {
         if ($ctx instanceof Player) {
             $rcon = new RemoteConsoleCommandSender();
             $ctx->getServer()->distpatchCommand($rcon, $cm);
             if (trim($rcon->getMessage()) != "") {
                 $ctx->sendMessage($rcon->getMessage());
             }
         } else {
             $ctx->getServer()->distpatchCommand($ctx, $cm);
         }
         return;
     }
     $ctx->getServer()->dispatchCommand($ctx, $cmdline);
 }
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if ($command->getName() == "hunger" || $command->getName() == "food") {
         if ($sender->isOp()) {
             if ($args == true) {
                 switch ($args[0]) {
                     case "set":
                         $this->chat($sender, "Using /" . $command->getName() . " " . $args[0], 4);
                         if (count($args) != 4) {
                             $this->chat($sender, "Invalid arguments", 1);
                             $mex = array("/food set <food> <value> <player>", "/food set <saturation> <value> <player>");
                             foreach ($mex as $var) {
                                 $this->chat($sender, $var, 4);
                             }
                             break;
                         }
                         if ($args[1] == "food") {
                             if (is_numeric($args[2])) {
                                 if ($args[3] != "") {
                                     if ($this->plr->exists($args[3])) {
                                         $get = $this->plr->get($args[3]);
                                         $get["foodLevel"] = $args[2];
                                         $this->plr->set($args[3], array_merge($get));
                                         $this->plr->save();
                                         $this->chat($sender, "FoodLevel of the player " . $args[3] . " set to " . $args[2], 3);
                                     } else {
                                         $this->chat($sender, "The player does not exist, or you have the wrong name", 1);
                                         break;
                                     }
                                 } else {
                                     $this->chat($sender, "Invalid arguments", 1);
                                     break;
                                 }
                             } else {
                                 $this->chat($sender, "Invalid arguments", 1);
                                 break;
                             }
                         } else {
                             if ($args[1] == "saturation") {
                                 if (is_numeric($args[2])) {
                                     if ($args[3] != "") {
                                         if ($this->plr->exists($args[3])) {
                                             $get = $this->plr->get($args[3]);
                                             $get["foodSaturationLevel"] = $args[2];
                                             $this->plr->set($args[3], array_merge($get));
                                             $this->plr->save();
                                             $this->chat($sender, "SaturationLevel of the player " . $args[3] . " set to " . $args[2], 3);
                                         } else {
                                             $this->chat($sender, "The player does not exist, or you have the wrong name", 1);
                                             break;
                                         }
                                     } else {
                                         $this->chat($sender, "Invalid arguments", 1);
                                         break;
                                     }
                                 } else {
                                     $this->chat($sender, "Invalid arguments", 1);
                                     break;
                                 }
                             } else {
                                 $this->chat($sender, "Invalid arguments", 1);
                                 break;
                             }
                         }
                         break;
                     case "info":
                         $this->chat($sender, "Using /" . $command->getName() . " " . $args[0], 4);
                         if (count($args) == 2) {
                             if ($args[1] != "") {
                                 $get = $this->plr->get($args[1]);
                                 $mex = array("Info of the player " . $args[1], "foodLevel = " . $get["foodLevel"], "foodSaturationLevel = " . $get["foodSaturationLevel"], "foodExaustionLevel = " . $get["foodExaustionLevel"]);
                                 foreach ($mex as $var) {
                                     $this->chat($sender, $var, 4);
                                 }
                             } else {
                                 $this->chat($sender, "Invalid arguments", 1);
                                 break;
                             }
                         } else {
                             $this->chat($sender, "Invalid arguments", 1);
                             break;
                         }
                         break;
                     case "difficult":
                         $this->chat($sender, "Using /" . $command->getName() . " " . $args[0], 4);
                         if (count($args) == 3) {
                             if (($args[1] == "easy" || $args[1] == "normal" || $args[1] == "hard") && $args[2] != "") {
                                 $get = $this->plr->get($args[2]);
                                 $get["difficult"] = $args[1];
                                 $this->plr->set($args[2], array_merge($get));
                                 $this->chat($sender, "Difficulty of the player " . $args[2] . " set to " . $args[1], 3);
                             } else {
                                 $this->chat($sender, "Invalid arguments", 1);
                                 break;
                             }
                         } else {
                             $this->chat($sender, "Invalid arguments", 1);
                             break;
                         }
                         break;
                     case "setup":
                         $this->chat($sender, "Using /" . $command->getName() . " " . $args[0], 4);
                         if (count($args) == 3) {
                             if ($args[1] == "difficult" && ($args[2] == "easy" || $args[2] == "normal" || $args[2] == "hard")) {
                                 $this->config->set("defaultDifficult", $args[2]);
                                 $this->config->save();
                                 $this->chat($sender, "The default difficulty set to " . $args[2], 3);
                             } else {
                                 $this->chat($sender, "Invalid arguments", 1);
                                 break;
                             }
                         } else {
                             $this->chat($sender, "Invalid arguments", 1);
                             break;
                         }
                         break;
                 }
             } else {
                 $mex = array("/hunger set <food-saturation> <value> <player>", "/hunger info <player>", "/hunger difficult <easy-normal-hard> <player>", "/hunger setup difficult <easy-normal-hard>");
                 foreach ($mex as $var) {
                     $this->chat($sender, $var, 4);
                 }
             }
         } else {
             if ($args == false) {
                 $perc = $this->plr->get($sender->getName())["foodLevel"] / 2 * 10;
                 $this->chat($sender, "You have " . $perc . "% of the level of food", 4);
             } else {
                 $this->chat($sender, "Using /" . $command->getName() . " " . $args[0], 4);
                 $this->chat($sender, "You need to be admin/OP to run this command", 1);
             }
         }
     }
 }
Example #21
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");
     }
 }
Example #22
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $params)
 {
     switch ($command->getName()) {
         case "casino":
             $sub = array_shift($params);
             switch ($sub) {
                 case "start":
                     if (!$sender instanceof Player) {
                         $sender->sendMessage("Please run this command in-game.");
                         break;
                     }
                     if (!$sender->hasPermission("economycasino.command.casino.start")) {
                         return true;
                     }
                     if ($this->config->get("max-game") <= count($this->casino)) {
                         $sender->sendMessage("There are too many games in progress. Please join the other games.");
                         break;
                     }
                     if (isset($this->casino[$sender->getName()])) {
                         $sender->sendMessage("You already have joined casino.");
                         return true;
                     } else {
                         foreach ($this->casino as $player => $casino) {
                             if (isset($casino["players"][$sender->getName()])) {
                                 $sender->sendMessage("You already have joined casino.");
                                 return true;
                             }
                         }
                     }
                     $this->casino[$sender->getName()] = array("players" => array($sender->getName() => true));
                     $this->getServer()->broadcastMessage("[EconomyCasino] Casino of " . $sender->getName() . " has just started.");
                     break;
                 case "stop":
                     if (!$sender instanceof Player) {
                         $sender->sendMessage("Please run this command in-game.");
                         break;
                     }
                     if (!$sender->hasPermission("economycasino.command.casino.stop")) {
                         return true;
                     }
                     if ($sender instanceof Player and !$sender->isOp()) {
                         if (isset($this->casino[$sender->getName()])) {
                             foreach ($this->casino[$sender->getName()]["players"] as $player => $v) {
                                 $this->getServer()->getPlayerExact($player)->sendMessage("[EconomyCasino] You have left the casino due to stop.");
                             }
                             unset($this->casino[$sender->getName()]);
                             $sender->sendMessage("You have stopped your casino.");
                         } else {
                             $sender->sendMessage("You don't have any casino game to quit.");
                         }
                     } else {
                         $player = array_shift($params);
                         if (trim($player) === "") {
                             $sender->sendMessage("Usage: /casino stop <player>");
                             break;
                         }
                         if (isset($this->casino[$player])) {
                             foreach ($this->casino[$player]["players"] as $player => $v) {
                                 $this->getServer()->getPlayerExact($player)->sendMessage("[EconomyCasino] You have left the casino game due to stop.");
                             }
                             $sender->sendMessage("[EconomyCasino] The game by \"{$player}\" has successfully stopped.");
                             unset($this->casino[$player]);
                         }
                     }
                     break;
                 case "join":
                     if (!$sender instanceof Player) {
                         $sender->sendMessage("Please run this command in-game.");
                         break;
                     }
                     if (!$sender->hasPermission("economycasino.command.casino.join")) {
                         return true;
                     }
                     $player = array_shift($params);
                     if (trim($player) === "") {
                         $sender->sendMessage("Usage: /casino join <player>");
                         break;
                     }
                     if (isset($this->casino[$player])) {
                         foreach ($this->casino[$player]["players"] as $player => $v) {
                             if (($p = $this->getServer()->getPlayerExact($player)) instanceof Player) {
                                 $p->sendMessage("[EconomyCasino] " . $sender->getName() . " has joined the game.");
                             }
                         }
                         $this->casino[$player]["players"][$sender->getName()] = true;
                         $sender->sendMessage("You've joined the casino.");
                     } else {
                         $sender->sendMessage("There's no casino where are looking for.");
                     }
                     break;
                 case "leave":
                     if (!$sender instanceof Player) {
                         $sender->sendMessage("Please run this command in-game.");
                         break;
                     }
                     if (!$sender->hasPermission("economycasino.command.casino.leave")) {
                         return true;
                     }
                     foreach ($this->casino as $player => $casino) {
                         if (isset($casino["players"][$sender->getName()])) {
                             unset($this->casino[$player]["players"][$sender->getName()]);
                             foreach ($casino["players"] as $p => $v) {
                                 $this->getServer()->getPlayerExact($p)->sendMessage("[EconomyCasino] " . $sender->getName() . " left the game.");
                             }
                             break;
                         }
                     }
                     $sender->sendMessage("[EconomyCasino] You have no casino game to leave.");
                     break;
                 case "list":
                     if (!$sender->hasPermission("economycasino.command.casino.list")) {
                         return true;
                     }
                     $player = array_shift($params);
                     if (trim($player) === "") {
                         list_general:
                         $output = "[EconomyCasino] Game list : \n";
                         foreach ($this->casino as $player => $casino) {
                             $output .= "{$player} : " . count($this->casino[$player]["players"]) . " \n";
                         }
                         $output = substr($output, 0, -2);
                         $sender->sendMessage($output);
                     } else {
                         if (isset($this->casino[$player])) {
                             $output = "[EconomyCasino] Player list of casino game by : {$player} \n";
                             foreach ($this->casino[$player]["players"] as $p) {
                                 $output .= "{$p}, ";
                             }
                             $output = substr($output, 0, -2);
                         } else {
                             goto list_general;
                         }
                     }
                     break;
                 case "gamble":
                     if (!$sender instanceof Player) {
                         $sender->sendMessage("Please run this command in-game.");
                         break;
                     }
                     if (!$sender->hasPermission("economycasino.command.casino.gamble")) {
                         return true;
                     }
                     $money = array_shift($params);
                     if (!is_numeric($money)) {
                         $sender->sendMessage("Usage: /casino gamble <money>");
                         break;
                     }
                     $money = (int) $money;
                     if ($this->api->myMoney($sender) < $money) {
                         $sender->sendMessage("You don't have money to gamble " . $this->api->getMonetaryUnit() . "{$money}");
                         break;
                     }
                     if (isset($this->casino[$sender->getName()])) {
                         $all = 0;
                         foreach ($this->casino[$sender->getName()]["players"] as $player => $v) {
                             $tmp = min($money, $this->api->myMoney($player));
                             $this->api->reduceMoney($player, $tmp);
                             $all += $tmp;
                         }
                         $got = array_rand($this->casino[$sender->getName()]["players"]);
                         $this->api->addMoney($got, $all, true, "EconomyCasino");
                         foreach ($this->casino[$sender->getName()]["players"] as $p => $v) {
                             if ($got === $p) {
                                 $this->getServer()->getPlayerExact($p)->sendMessage("You've win " . $this->api->getMonetaryUnit() . "{$all}!");
                             } else {
                                 $this->getServer()->getPlayerExact($p)->sendMessage("You've lost " . $this->api->getMonetaryUnit() . "{$money}");
                             }
                         }
                     } else {
                         foreach ($this->casino as $player => $casino) {
                             if (isset($casino["players"][$sender->getName()])) {
                                 $all = 0;
                                 foreach ($this->casino[$player]["players"] as $p => $true) {
                                     $tmp = min($this->api->myMoney($p), $money);
                                     $this->api->reduceMoney($p, $tmp);
                                     $all += $tmp;
                                 }
                                 $got = array_rand($this->casino[$player]["players"]);
                                 $this->api->addMoney($got, $all, true, "EconomyCasino");
                                 foreach ($this->casino[$player]["players"] as $p => $v) {
                                     if ($got === $p) {
                                         $this->getServer()->getPlayerExact($p)->sendMessage("You've win " . $this->api->getMonetaryUnit() . "{$all}!");
                                     } else {
                                         $this->getServer()->getPlayerExact($p)->sendMessage("You've lost " . $this->api->getMonetaryUnit() . "{$money}");
                                     }
                                 }
                             }
                         }
                     }
                     break;
                 default:
                     $sender->sendMessage("Usage: " . $command->getUsage());
             }
             break;
         case "jackpot":
             if (!$sender instanceof Player) {
                 $sender->sendMessage("Please run this command in-game.");
                 break;
             }
             $money = array_shift($params);
             if (!is_numeric($money)) {
                 $sender->sendMessage("Usage: " . $command->getUsage());
                 break;
             }
             $money = (int) $money;
             if ($this->api->myMoney($sender) < $money) {
                 $sender->sendMessage("You don't have money to jackpot " . $this->api->getMonetaryUnit() . "{$money}");
                 break;
             }
             $rand = rand(0, $this->config->get("jackpot-winning"));
             if ($rand === 0) {
                 $this->api->addMoney($sender, $money);
                 $sender->sendMessage("You've wined jackpot! You've got " . $this->api->getMonetaryUnit() . "{$money}");
             } else {
                 $this->api->reduceMoney($sender, $money);
                 $sender->sendMessage("You've failed your jackpot! You've lost " . $this->api->getMonetaryUnit() . "{$money}");
             }
             break;
     }
     return true;
 }
Example #23
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command) == '확성기') {
         if (!isset($args[0])) {
             return false;
         }
         if ($this->economy == null) {
             $sender->sendMessage("EconomyAPI 플러그인이 없어서 이 명령어를 사용할 수 없습니다.");
             return true;
         }
         if ($this->isMute() && !$sender->isOp()) {
             $sender->sendMessage(TextFormat::RED . "현재 채팅을 할 수 없습니다.");
             return true;
         }
         if ($this->economy->reduceMoney($sender, $this->config["speaker-cost"]) != EconomyAPI::RET_SUCCESS) {
             $sender->sendMessage(TextFormat::RED . "확성기를 사용할 돈이 부족합니다. (비용: {$this->config["speaker-cost"]})");
             return true;
         }
         $message = implode(" ", $args);
         $this->getServer()->broadcastMessage(TextFormat::AQUA . "[확성기] " . $sender->getName() . " > " . $message);
         $sender->sendMessage("{$this->config["speaker-cost"]}원을 내고 확성기를 사용하였습니다.");
     } else {
         if (strtolower($command) == 'mute') {
             if ($this->isMute()) {
                 $this->setMute(false);
                 $this->getServer()->broadcastMessage(TextFormat::DARK_AQUA . "관리자가 채팅을 허용상태로 변경했습니다.");
             } else {
                 $this->setMute(true);
                 $this->getServer()->broadcastMessage(TextFormat::DARK_AQUA . "관리자가 채팅을 비허용상태로 변경했습니다.");
             }
         }
     }
     return true;
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     switch ($cmd->getName()) {
         case "opms":
             if (count($args) == 0) {
                 return false;
             }
             $ms = TextFormat::BLUE . mc::_("OpMsg [%1%] ", $sender->getName()) . TextFormat::YELLOW . implode(" ", $args);
             $this->owner->getLogger()->info($ms);
             $count = 0;
             foreach ($this->owner->getServer()->getOnlinePlayers() as $pl) {
                 if (!$pl->isOp()) {
                     continue;
                 }
                 $pl->sendMessage($ms);
                 ++$count;
             }
             if ($sender instanceof Player && !$sender->isOp()) {
                 if ($count) {
                     $sender->sendMessage(mc::_("(ops:%1%) ", $count) . implode(" ", $args));
                 } else {
                     $sender->sendMessage(mc::_("Message sent to console only"));
                     if ($sender->hasPermission("gb.cmd.rpt")) {
                         $sender->sendMessage(mc::_("Try /rpt instead"));
                     }
                 }
             }
             return true;
         case "rpt":
             if (count($args) == 0) {
                 return false;
             }
             list($id, $rpt) = $this->rpt->getAll();
             if ($args[0] == "read" && (count($args) == 1 || count($args) == 2 && is_numeric($args[1]))) {
                 if (!MPMU::access($sender, "gb.cmd.rpt.read")) {
                     return false;
                 }
                 if (count($rpt) == 0) {
                     $sender->sendMessage(TextFormat::RED . mc::_("No reports on file!"));
                     return true;
                 }
                 $pageNumber = $this->getPageNumber($args);
                 $tab = [[mc::_("ID"), mc::_("Date"), mc::_("Name"), mc::_("Reports: %1%", count($rpt))]];
                 foreach ($rpt as $i => $ln) {
                     list($tm, $name, $ms) = $ln;
                     $tm = date(mc::_("d-M H:i"), $tm);
                     $tab[] = [$i, $tm, $name, $ms];
                 }
                 $this->paginateTable($sender, $pageNumber, $tab);
                 return true;
             }
             if ($args[0] == "clear" && count($args) == 2) {
                 if (!MPMU::access($sender, "gb.cmd.rpt.read")) {
                     return false;
                 }
                 if ($args[1] == "all") {
                     $rpt = [];
                     $sender->sendMessage(TextFormat::RED . mc::_("All reports deleted"));
                 } else {
                     $i = intval($args[1]);
                     if (!isset($rpt[$i])) {
                         $sender->sendMessage(mc::_("Unknown report #%1%", $i));
                         return true;
                     }
                     unset($rpt[$i]);
                     $sender->sendMessage(mc::_("Deleting report #%1%", $i));
                 }
             } else {
                 $rpt[++$id] = [time(), $sender->getName(), implode(" ", $args)];
                 $sender->sendMessage(mc::_("Report filed as #%1%", $id));
                 $ms = TextFormat::BLUE . mc::_("Rpt[#%1% from %2%] ", $id, $sender->getName()) . TextFormat::YELLOW . implode(" ", $args);
                 $this->owner->getLogger()->info($ms);
                 foreach ($this->owner->getServer()->getOnlinePlayers() as $pl) {
                     if (!$pl->isOp()) {
                         continue;
                     }
                     $pl->sendMessage($ms);
                 }
             }
             $this->rpt->setAll([$id, $rpt]);
             $this->rpt->save();
             return true;
     }
     return false;
 }