Example #1
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     switch ($command->getName()) {
         case "sgw":
             if (count($args) != 2) {
                 return false;
             }
             if (!isset(self::$games[$args[0]])) {
                 $sender->sendMessage(TextFormat::RED . self::getTranslation("UNKNOWN_GAME"));
                 return true;
             }
             if ($this->getServer()->getLevelByName($args[1]) === null) {
                 $sender->sendMessage(TextFormat::RED . self::getTranslation("UNKNOWN_LEVEL"));
                 return true;
             }
             if (isset(self::$worlds[$args[1]])) {
                 $sender->sendMessage(TextFormat::RED . self::getTranslation("WORLD_ALREADY_OCCUPIED"));
                 return true;
             }
             $worlds = json_decode($this->getDataFolder() . "worlds.json", true);
             if (!isset($worlds[$args[0]])) {
                 $worlds[$args[0]] = [];
             }
             $worlds[$args[0]][$args[1]] = ["config" => self::$games[$args[0]]->getStaticPropertyValue("defaultConfigs")];
             file_put_contents($this->getDataFolder() . "worlds.json", json_encode($worlds));
             $sender->sendMessage(TextFormat::AQUA . self::getTranslation("PLEASE_RESTART_SERVER"));
     }
     return true;
 }
Example #2
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "motd") {
         return false;
     }
     if ($sender instanceof Player) {
         $world = $sender->getLevel()->getName();
     } else {
         $level = $this->owner->getServer()->getDefaultLevel();
         if ($level) {
             $world = $level->getName();
         } else {
             $world = null;
         }
     }
     if (isset($args[0]) && $this->owner->getServer()->isLevelGenerated($args[0])) {
         $world = array_shift($args);
     }
     if ($world === null) {
         $sender->sendMessage(mc::_("[WP] Must specify a world"));
         return false;
     }
     if (count($args) != 0) {
         return false;
     }
     $this->showMotd($sender, $world);
     return true;
 }
Example #3
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command->getName()) == "nf") {
         if (!($sender->hasPermission("notify") || $sender->hasPermission("notify.command") || $sender->hasPermission("notify.command.nf"))) {
             $sender->sendMessage(TextFormat::RED . "You don't have permission to use that command!");
             return true;
         } else {
             if (!isset($args[0])) {
                 return false;
             } else {
                 if ($args[0] == "on") {
                     if ($this->enabled[0] == "on") {
                         $sender->sendMessage("NotifySounds are already enabled!");
                         return true;
                     } else {
                         $this->enabled[0] = "on";
                         $sender->sendMessage("NotifySounds enabled!");
                         return true;
                     }
                 } elseif ($args[0] == "off") {
                     if ($this->enabled[0] == "off") {
                         $sender->sendMessage("NotifySounds are already disabled!");
                         return true;
                     } else {
                         $this->enabled[0] = "off";
                         $sender->sendMessage("NotifySounds disabled");
                     }
                 } else {
                     return false;
                 }
             }
         }
     }
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "near") {
         return false;
     }
     if (!MPMU::inGame($sender)) {
         return true;
     }
     switch (count($args)) {
         case 0:
             $radius = 64 * 64;
             break;
         case 1:
             $radius = (int) $args[0] * (int) $args[0];
             break;
         default:
             return false;
     }
     $players = [];
     foreach ($sender->getLevel()->getPlayers() as $pl) {
         $dist = $pl->distanceSquared($players);
         if ($dist < $radius) {
             $players[] = $pl->getDisplayName();
         }
     }
     if (count($players) == 0) {
         $sender->sendMessage(mc::_("No near by players found!"));
     } else {
         $sender->sendMessage(mc::_("Neighbors(%1%): %2%", count($players), implode(", ", $players)));
     }
     return true;
 }
Example #5
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (strtolower($cmd->getName()) === "warn") {
         if (!(isset($args[0]) and isset($args[1]))) {
             $sender->sendMessage(TF::RED . "Error: not enough args. Usage: /warn <player> < reason >");
             return true;
         } else {
             $name = $args[0];
             $player = $this->getServer()->getPlayer($name);
             $player_name = $player->getName();
             $sender_name = $sender->getName();
             $sender_display_name = $sender->getDisplayName();
             unset($args[0]);
             $reason = implode(" ", $args);
             if ($player === null) {
                 $sender->sendMessage(TF::RED . "Player " . $name . " could not be found.");
                 return true;
             } else {
                 $player->sendMessage(TF::RED . "You have been warned by " . $sender_name . " for " . $reason);
                 $sender->sendMessage(TF::GREEN . "You have warned " . $player_name . " for " . $reason);
                 $this->getServer()->broadcastMessage(TF::YELLOW . $player_name . " has been warned by " . $sender_name . " for " . $reason);
                 return true;
             }
         }
     }
 }
Example #6
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     $fcmd = strtolower($cmd->getName());
     switch ($fcmd) {
         case "mute":
             if ($sender->hasPermission("chatcensor.command.mute")) {
                 if (isset($args[0])) {
                     $args[0] = strtolower($args[0]);
                     //Check if player exists
                     if ($this->plugin->getServer()->getPlayer($args[0]) != null) {
                         $player = $args[0];
                         //Check if player is already muted
                         if ($this->plugin->mutePlayer($player)) {
                             $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&aYou muted &b" . $player));
                         } else {
                             $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&cPlayer " . $player . " is already muted!"));
                         }
                     } else {
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&cPlayer not found!"));
                     }
                 } else {
                     $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&cUsage: /mute <player>"));
                 }
             } else {
                 $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                 break;
             }
     }
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "players") {
         return false;
     }
     $tab = [[mc::_("Player"), mc::_("World"), mc::_("Pos"), mc::_("Health"), mc::_("Mode")]];
     $cnt = 0;
     foreach ($this->owner->getServer()->getOnlinePlayers() as $player) {
         if (!$player->isOnline() || $sender instanceof Player && !$sender->canSee($player)) {
             continue;
         }
         $pos = $player->getPosition();
         $j = count($tab);
         $mode = substr(MPMU::gamemodeStr($player->getGamemode()), 0, 4);
         $tab[] = [$player->getName(), $player->getLevel()->getName(), $pos->getFloorX() . "," . $pos->getFloorY() . "," . $pos->getFloorZ(), intval($player->getHealth()) . '/' . intval($player->getMaxHealth()), $mode];
         ++$cnt;
     }
     if (!$cnt) {
         $sender->sendMessage(TextFormat::RED . mc::_("Nobody is on-line at the moment"));
         return true;
     }
     $tab[0][0] = mc::_("Players: %1%", $cnt);
     $pageNumber = $this->getPageNumber($args);
     return $this->paginateTable($sender, $pageNumber, $tab);
 }
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if ($sender instanceof Player) {
         $name = $sender->getName();
         if (strtolower($command->getName()) == 'heal') {
             if (count($args) > 0) {
                 $player = $args[0];
                 if ($this->getServer()->getPlayer($player)) {
                     $player = $this->getServer()->getPlayer($player);
                     $player->setHealth(20);
                     $sender->sendMessage(TextFormat::BLUE . "[Server] Player " . $player->getName() . " has been healed!");
                     $player->sendMessage(TextFormat::RED . "You have been healed!");
                     return;
                 } else {
                     $sender->sendMessage(TextFormat::BLUE . "[Server] {$player} isn't online at the moment. Please try again when he returns!");
                     return;
                 }
             } else {
                 $sender->setHealth(20);
                 $sender->sendMessage(TextFormat::RED . "You have been healed!");
                 return;
             }
         }
     }
 }
Example #9
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     switch ($command->getName()) {
         case "consoleclients":
             if (!$sender->hasPermission("pocketdockconsole.command.consoleclients")) {
                 $sender->sendMessage(TextFormat::RED . "[PDC] Get some permissions...");
                 return true;
             }
             $authedclients = explode(";", $this->thread->connectedips);
             if (count($authedclients) < 2) {
                 $sender->sendMessage("[PDC] There are no connected clients");
                 return true;
             }
             $sender->sendMessage("[PDC] Connected client(s) are: " . implode("; ", $authedclients));
             return true;
         case "killclient":
             if (!$sender->hasPermission("pocketdockconsole.command.killclient")) {
                 $sender->sendMessage(TextFormat::RED . "[PDC] Get some permissions...");
                 return true;
             }
             if (!isset($args[0])) {
                 $sender->sendMessage($command->getUsage());
                 return true;
             }
             $sender->sendMessage("[PDC] Killing client: " . $args[0]);
             $this->thread->clienttokill = $args[0];
             return true;
         default:
             return false;
     }
 }
Example #10
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     switch ($cmd->getName()) {
         case "banhammer":
             if ($args[0] == "edit") {
                 if ($args[1] == "type") {
                     if ($args[2] == "banip") {
                     } elseif ($args[2] == "ban") {
                     } elseif ($args[2] == "kick") {
                     } else {
                         $sender->sendMessage("Usage: /banhammer edit <type> <banip|ban|kick>");
                     }
                 }
             } elseif ($args[0] == "get") {
                 if ($sender->isOP) {
                     //I'll figure our the real way to do that later
                     //TODO Give BanHammer
                     return true;
                 } else {
                     $sender->sendMessage("[BanHammer] You do not have permission to obtain the BanHammer!");
                     return false;
                 }
             } elseif ($args[0] == "allow") {
                 //TODO Add $args[1] to a config
             } else {
                 $sender->sendMessage("Usage: /banhammer <get|edit|allow> [player]");
             }
             break;
     }
 }
Example #11
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command->getName()) === "tz") {
         $sender->sendMessage($this->colorlist[strtolower($this->getConfig()->get("color"))] . $this->getTime());
         return true;
     }
 }
Example #12
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     $cmd = strtolower($command->getName());
     switch ($cmd) {
         case "social":
             if (!$sender instanceof Player) {
                 $sender->sendMessage(TEXTFORMAT::BLUE . "- " . $this->getConfig()->get("name"));
                 $sender->sendMessage(TEXTFORMAT::GOLD . "-  Our Website!");
                 $sender->sendMessage(TEXTFORMAT::GREEN . "-  Use /website");
                 $sender->sendMessage(TEXTFORMAT::GOLD . "-  Our Facebook!");
                 $sender->sendMessage(TEXTFORMAT::GREEN . "-  Use /facebook");
                 $sender->sendMessage(TEXTFORMAT::GOLD . "-  Our YouTube!");
                 $sender->sendMessage(TEXTFORMAT::GREEN . "-  Use /youtube");
                 $sender->sendMessage(TEXTFORMAT::GOLD . "-  Our GitHub!");
                 $sender->sendMessage(TEXTFORMAT::GREEN . "-  Use /github");
                 return true;
             }
             $player = $this->getServer()->getPlayer($sender->getName());
             if ($player->hasPermission("gamecraftpe.social")) {
                 $sender->sendMessage("§3 " . $this->getConfig->get("name"));
                 $sender->sendMessage("§2-  Our Website!");
                 $sender->sendMessage("§a-  Use /website");
                 $sender->sendMessage("§2-  Our Facebook!");
                 $sender->sendMessage("§a-  Use /facebook");
                 $sender->sendMessage("§2-  Our YouTube!");
                 $sender->sendMessage("§a-  Use /youtube");
                 $sender->sendMessage("§2-  Our GitHub!");
                 $sender->sendMessage("§a-  Use /github");
                 return true;
             }
             break;
     }
 }
Example #13
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "entities") {
         return false;
     }
     if (count($args) == 0) {
         $args = ["ls"];
     }
     $scmd = strtolower(array_shift($args));
     switch ($scmd) {
         case "count":
             return $this->cmdCount($sender);
         case "nuke":
             return $this->cmdNuke($sender, $args);
         case "ls":
             return $this->cmdEtList($sender, $args);
         case "tiles":
         case "tile":
             return $this->cmdTileList($sender, $args);
         case "info":
         case "nbt":
             return $this->cmdEtInfo($sender, $args);
         case "rm":
             return $this->cmdEtRm($sender, $args);
         case "sign1":
         case "sign2":
         case "sign3":
         case "sign4":
             return $this->cmdEtSign($sender, $scmd, $args);
     }
     return false;
 }
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command->getName()) === "buyworld") {
         if (count($args) < 1 || count($args) > 4) {
             return false;
         }
         if (EconomyAPI::getInstance()->myMoney($sender->getName()) < 10000) {
             $sender->sendMessage(TextFormat::RED . "[HyperPlot] You don't have enought money. It cost \$10000");
             return true;
         }
         $world = array_shift($args);
         if (strlen($world) < 3) {
             $sender->sendMessage(TextFormat::RED . "[HyperPlot] Small World name");
             return true;
         }
         if ($this->getServer()->isLevelGenerated($world)) {
             $sender->sendMessage(TextFormat::RED . "[HyperPlot] A world named " . $world . " already exists");
             return true;
         }
         EconomyAPI::getInstance()->reduceMoney($sender->getName(), 10000);
         $this->getServer()->broadcastMessage($sender->sendMessage(TextFormat::RED . "[HyperPlot]  Creating level " . $sender->getName() . "-" . $world . "..."));
         $generator = Generator::getGenerator("ownworld");
         $this->getServer()->generateLevel($sender->getName() . "-" . $world, null, $generator, []);
         $this->getServer()->loadLevel($sender->getName() . "-" . $world);
         return true;
     }
     return false;
 }
Example #15
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (!isset($args[0])) {
         return false;
     }
     if ($cmd->getName() == "gift") {
         if (($receiver = $this->owner->getServer()->getPlayer($args[0])) == null) {
             if (!MPMU::inGame($sender)) {
                 return true;
             }
             $receiver = $sender;
         } else {
             array_shift($args);
         }
     } else {
         if (!MPMU::inGame($sender)) {
             return true;
         }
         $receiver = $sender;
     }
     if ($receiver->isCreative()) {
         if ($receiver === $sender) {
             $receiver->sendMessage(mc::_("You are in creative mode"));
         } else {
             $sender->sendMessage(mc::_("%1% is in creative mode", $receiver->getDisplayName()));
         }
         return true;
     }
     if (count($args) > 1 && is_numeric($args[count($args) - 1])) {
         $amt = (int) array_pop($args);
     } else {
         $amt = -1;
     }
     $args = strtolower(implode("_", $args));
     if ($args == "more") {
         $item = clone $receiver->getInventory()->getItemInHand();
         if ($item->getId() == 0) {
             $sender->sendMessage(TextFormat::RED . mc::_("Must be holding something"));
             return true;
         }
     } else {
         $item = Item::fromString($args);
         if ($item->getId() == 0) {
             $sender->sendMessage(TextFormat::RED . mc::_("There is no item called %1%", $args));
             return true;
         }
     }
     if ($amt != -1) {
         $item->setCount($amt);
     } else {
         if (isset(self::$stacks[$item->getId()])) {
             $item->setCount(self::$stacks[$item->getId()]);
         } else {
             $item->setCount($item->getMaxStackSize());
         }
     }
     $receiver->getInventory()->addItem(clone $item);
     $this->owner->getServer()->broadcastMessage(mc::_("%1% got %2% of %3% (%4%:%5%)", $receiver->getDisplayName(), $item->getCount(), ItemName::str($item), $item->getId(), $item->getDamage()));
     return true;
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "servicemode") {
         return false;
     }
     if (count($args) == 0) {
         if ($this->mode !== false) {
             $sender->sendMessage(TextFormat::RED . mc::_("In Service Mode: %1%", $this->mode));
         } else {
             $sender->sendMessage(TextFormat::GREEN . mc::_("In Normal operating mode"));
         }
         return true;
     }
     if (in_array(strtolower(array_shift($args)), ["on", "up", "true", 1])) {
         $msg = implode(" ", $args);
         if (!$msg) {
             $msg = mc::_("Scheduled maintenance");
         }
         $this->owner->getServer()->broadcastMessage(TextFormat::RED . mc::_("ATTENTION: Entering service mode"));
         $this->owner->getServer()->broadcastMessage(TextFormat::YELLOW . " - " . $msg);
     } else {
         $msg = false;
         $this->owner->getServer()->broadcastMessage(TextFormat::GREEN . mc::_("ATTENTION: Leaving service mode"));
     }
     $this->mode = $msg;
     return true;
 }
Example #17
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "manyworlds") {
         return false;
     }
     return $this->dispatchSCmd($sender, $cmd, $args);
 }
Example #18
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if ($command->getName() === "boom") {
         if (count($args)) {
             if (!isset($args[1])) {
                 $sender->sendMessage("Usage: /boom <radius> true|false");
                 return false;
             }
             if (is_numeric($args[0])) {
                 $sender->sendMessage(TextFormat::YELLOW . "Boom!");
                 $e = new Explosion($sender, $args[0]);
                 switch ($args[1]) {
                     case "true":
                         $e->explodeA();
                         $e->explodeB();
                         break;
                     case "false":
                         $e->explodeB();
                         break;
                 }
             } else {
                 $sender->sendMessage(TextFormat::RED . "Select radius in numeric value!");
                 return;
             }
         }
     }
 }
Example #19
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     $cmd = strtolower($command->getName());
     if ($cmd === "helper") {
         $line1 = $this->getConfig()->get("line1");
         $line2 = $this->getConfig()->get("line2");
         $line3 = $this->getConfig()->get("line3");
         $line4 = $this->getConfig()->get("line4");
         $line5 = $this->getConfig()->get("line5");
         $line6 = $this->getConfig()->get("line6");
         $line7 = $this->getConfig()->get("line7");
         $line8 = $this->getConfig()->get("line8");
         $line9 = $this->getConfig()->get("line9");
         $line10 = $this->getConfig()->get("line10");
         $sender->sendMessage("{$line1}");
         $sender->sendMessage("{$line2}");
         $sender->sendMessage("{$line3}");
         $sender->sendMessage("{$line4}");
         $sender->sendMessage("{$line5}");
         $sender->sendMessage("{$line6}");
         $sender->sendMessage("{$line7}");
         $sender->sendMessage("{$line8}");
         $sender->sendMessage("{$line9}");
         $sender->sendMessage("{$line10}");
         return true;
     }
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "top") {
         return false;
     }
     switch (count($args)) {
         case 0:
             if (!MPMU::inGame($sender)) {
                 return true;
             }
             $pl = $sender;
             break;
         case 1:
             if (!MPMU::access($sender, "gb.cmd.top.others")) {
                 return true;
             }
             $pl = $this->owner->getServer()->getPlayer($args[0]);
             if (!$pl) {
                 $sender->sendMessage(mc::_("%1% not found", $args[0]));
                 return true;
             }
             break;
         default:
             return false;
     }
     $y = $pl->getLevel()->getHighestBlockAt($pl->getX(), $pl->getZ()) + 1;
     $pl->teleport(new Vector3($pl->getX(), $y, $pl->getZ()));
     return true;
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (strtolower($cmd->getName()) === "stats") {
         if (isset($args[0])) {
             $name = $args[0];
             if ($sender->hasPermission("pvp-stats.command.other")) {
                 if ($this->plugin->getData($name) !== null) {
                     if ($this->plugin->getData($name)["kills"] >= 1 and $this->plugin->getData($name)["deaths"] >= 1) {
                         $sender->sendMessage($this->plugin->translateColors(str_replace(array("@player", "@kills", "@deaths", "@kdratio"), array($name, $this->plugin->getData($name)["kills"], $this->plugin->getData($name)["deaths"], round($this->plugin->getData($name)["kills"] / $this->plugin->getData($name)["deaths"], 3)), (new Config($this->plugin->getDataFolder() . "Settings.yml"))->getAll()["other-command-format"])));
                     } else {
                         $sender->sendMessage($this->plugin->translateColors(str_replace(array("@player", "@kills", "@deaths", "@kdratio"), array($name, $this->plugin->getData($name)["kills"], $this->plugin->getData($name)["deaths"], "&r&cN&r&7/&r&cA&r"), (new Config($this->plugin->getDataFolder() . "Settings.yml"))->getAll()["other-command-format"])));
                     }
                 } else {
                     $sender->sendMessage(TextFormat::RED . "Sorry, stats for " . $name . " don't exist.");
                 }
             } else {
                 $sender->sendMessage(TextFormat::RED . "You don't have permissions to use this command.");
             }
         } else {
             if ($sender instanceof Player) {
                 if ($sender->hasPermission("pvp-stats.command.self")) {
                     if ($this->plugin->getPlayer($sender)["kills"] >= 1 and $this->plugin->getPlayer($sender)["deaths"] >= 1) {
                         $sender->sendMessage($this->plugin->translateColors(str_replace(array("@kills", "@deaths", "@kdratio"), array($this->plugin->getPlayer($sender)["kills"], $this->plugin->getPlayer($sender)["deaths"], round($this->plugin->getPlayer($sender)["kills"] / $this->plugin->getPlayer($sender)["deaths"], 3)), (new Config($this->plugin->getDataFolder() . "Settings.yml"))->getAll()["self-command-format"])));
                     } else {
                         $sender->sendMessage($this->plugin->translateColors(str_replace(array("@kills", "@deaths", "@kdratio"), array($this->plugin->getPlayer($sender)["kills"], $this->plugin->getPlayer($sender)["deaths"], "&r&cN&r&7/&r&cA&r"), (new Config($this->plugin->getDataFolder() . "Settings.yml"))->getAll()["self-command-format"])));
                     }
                 } else {
                     $sender->sendMessage(TextFormat::RED . "You don't have permissions to use this command.");
                 }
             } else {
                 $sender->sendMessage(TextFormat::RED . "Please run this command in-game!");
             }
         }
     }
 }
 public function onCommand(CommandSender $sender, Command $command, $label, array $params)
 {
     $username = strtolower($sender->getName());
     $player = $this->getServer()->getPlayer($username);
     if (!$player instanceof Player) {
         $sender->sendMessage("Use this command in-game!");
         return true;
     }
     switch ($command->getName()) {
         case "pvppon":
             $this->getConfig()->set(strtolower($sender->getName()), true);
             $this->getConfig()->save();
             $sender->sendMessage("PvP enabled for you.\nUse '/pvppoff' for disable.");
             break;
         case "pvppoff":
             $this->getConfig()->set(strtolower($sender->getName()), false);
             $this->getConfig()->save();
             $sender->sendMessage("PvP disabled for you.\nUse '/pvppon' for enable.");
             break;
         case "pvpp":
             if ($this->getConfig()->get(strtolower($sender->getName()))) {
                 $sender->sendMessage("How PvP enabled for you.\nUse '/pvppoff' for disable.");
             } else {
                 $sender->sendMessage("How PvP disabled for you.\nUse '/pvppon' for enable.");
             }
             break;
     }
     return true;
 }
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if ($player->hasPermission("signstats.commands.stats")) {
         switch ($command->getName()) {
             case 'sethouse':
                 $this->config->player[$sender->getName()]['house']['x'] = $sender->x;
                 $this->config->player[$sender->getName()]['house']['y'] = $sender->y;
                 $this->config->player[$sender->getName()]['house']['z'] = $sender->z;
                 $sender->sendMessage(TextFormat::GREEN . '[EasyHouse] House set.');
                 break;
             case 'delhouse':
                 unset($this->config->player[$sender->getName()]['house']);
                 $sender->sendMessage(TextFormat::RED . '[EasyHouse] house Deleted');
                 break;
             case 'house':
                 if (isset($this->config->player[$sender->getName()]['house'])) {
                     $this->viellePosition[$sender->getName()] = array($sender->x, $sender->y, $sender->z);
                     $sender->teleport(new Vector3($this->config->player[$sender->getName()]['house']['x'], $this->config->player[$sender->getName()]['house']['y'], $this->config->player[$sender->getName()]['house']['z']));
                     $sender->sendMessage(TextFormat::GREEN . '[EasyHouse] Teleported.');
                 } else {
                     $sender->sendMessage(TextFormat::RED . 'House is not set.');
                 }
                 break;
         }
     } else {
         $player->sendMessage(TextFormat::RED . "[EasyHouse] You don't have permissions!");
     }
 }
Example #24
0
 public function onCommand(CommandSender $issuer, Command $cmd, $label, array $args)
 {
     switch ($cmd->getName()) {
         case "unjail":
             if ($issuer->hasPermission("jail.command") !== true && $issuer->hasPermission("jail.command.unjail") !== true) {
                 $issuer->sendMessage($this->plugin->colourMessage("&cYou don't have permission for this!"));
                 return true;
             }
             if (!isset($args[0])) {
                 return false;
             }
             $target = $this->plugin->getServer()->getPlayer($args[0]);
             if ($target === null) {
                 $issuer->sendMessage($this->plugin->colourMessage("&cInvalid target!"));
                 return true;
             }
             if ($this->plugin->isJailed($target) !== true) {
                 $issuer->sendMessage($this->plugin->colourMessage("&cTarget is not jailed!"));
                 return true;
             }
             $this->plugin->unjail($target);
             $issuer->sendMessage($this->plugin->colourMessage("&6You unjailed &e" . $target->getName() . " &6!"));
             $target->sendMessage($this->plugin->colourMessage("&6You have been unjailed!"));
             return true;
             break;
     }
 }
 public function onCommand(CommandSender $sender, Command $command, $label, array $params)
 {
     switch ($command->getName()) {
         case "secure":
             $player = array_shift($params);
             $ip = implode(" ", $params);
             if (!empty($player) && !empty($ip)) {
                 $this->getConfig()->set(strtolower($player), $ip);
                 $this->getConfig()->save();
                 $sender->sendMessage("Now this account is secured!");
             } else {
                 $sender->sendMessage("Write nickname and IP!");
             }
             break;
         case "unsecure":
             $player = array_shift($params);
             if (!empty($player)) {
                 if (!empty($this->getConfig()->get(strtolower($player)))) {
                     $this->getConfig()->remove(strtolower($player));
                     $this->getConfig()->save();
                     $sender->sendMessage("Now this account is unsecured!");
                 } else {
                     $sender->sendMessage("Account not found in list of secure!");
                 }
             } else {
                 $sender->sendMessage("Write nickname!");
             }
             break;
     }
     return true;
 }
Example #26
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "blowup") {
         return false;
     }
     if (count($args) == 0) {
         return false;
     }
     if (($pl = MPMU::getPlayer($sender, $args[0])) === null) {
         return true;
     }
     array_shift($args);
     $yield = 5;
     $magic = false;
     foreach ($args as $i) {
         if (is_numeric($i)) {
             $yield = intval($i);
             if ($yield < 1) {
                 $yield = 1;
             }
         } elseif (strtolower($i) == "magic") {
             $magic = true;
         } elseif (strtolower($i) == "normal") {
             $magic = false;
         }
     }
     $this->blowPlayer($pl, $yield, $magic);
     return true;
 }
Example #27
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     $cmd = strtolower($command->getName());
     $command = $this->getConfig()->get("Command");
     switch ($cmd) {
         case $this->getConfig()->get($command):
             if (!$sender instanceof Player) {
                 $sender->sendMessage(TEXTFORMAT::GOLD . $this->getConfig()->get("Name"));
                 $sender->sendMessage . $this->getConfig()->get("Slot1");
                 $sender->sendMessage . $this->getConfig()->get("Slot2");
                 $sender->sendMessage . $this->getConfig()->get("Slot3");
                 $sender->sendMessage . $this->getConfig()->get("Slot4");
                 $sender->sendMessage . $this->getConfig()->get("Slot5");
                 $sender->sendMessage . $this->getConfig()->get("Slot6");
                 return true;
             }
             $player = $this->getServer()->getPlayer($sender->getName());
             if ($player->hasPermission("yourplugin.command")) {
                 $sender->sendMessage . $this->getConfig()->get("Name");
                 $sender->sendMessage . $this->getConfig()->get("Slot1");
                 $sender->sendMessage . $this->getConfig()->get("Slot2");
                 $sender->sendMessage . $this->getConfig()->get("Slot3");
                 $sender->sendMessage . $this->getConfig()->get("Slot4");
                 $sender->sendMessage . $this->getConfig()->get("Slot5");
                 $sender->sendMessage . $this->getConfig()->get("Slot6");
                 return true;
             }
             break;
     }
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "blowup") {
         return false;
     }
     if (count($args) == 0) {
         return false;
     }
     $pl = $this->owner->getServer()->getPlayer($args[0]);
     if (!$pl) {
         $sender->sendMessage(mc::_("%1% not found.", $args[0]));
         return true;
     }
     array_shift($args);
     $yield = 5;
     $magic = false;
     foreach ($args as $i) {
         if (is_numeric($i)) {
             $yield = intval($i);
             if ($yield < 1) {
                 $yield = 1;
             }
         } elseif (strtolower($i) == "magic") {
             $magic = true;
         } elseif (strtolower($i) == "normal") {
             $magic = false;
         }
     }
     $this->blowPlayer($pl, $yield, $magic);
     return true;
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "throw") {
         return false;
     }
     if (count($args) > 2 || count($args) == 0) {
         return false;
     }
     $pl = $this->owner->getServer()->getPlayer($args[0]);
     if (!$pl) {
         $sender->sendMessage(mc::_("%1% not found", $args[0]));
         return true;
     }
     if (MPMU::apiVersion("1.12.0")) {
         $pl->teleport(new Vector3($pl->getX(), 128, $pl->getZ()));
     } else {
         $force = 64;
         if (isset($args[1])) {
             $force = intval($args[1]);
         }
         if ($force <= 4) {
             $force = 64;
         }
         $pl->setMotion(new Vector3(0, $force, 0));
     }
     return true;
 }
Example #30
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "heal") {
         return false;
     }
     if (count($args) == 0) {
         if (!MPMU::inGame($sender)) {
             return true;
         }
         $sender->setHealth($sender->getMaxHealth());
         $sender->sendMessage(mc::_("You have been healed"));
         return true;
     }
     if (($patient = MPMU::getPlayer($sender, $args[0])) === null) {
         return true;
     }
     if (isset($args[1]) && is_numeric($args[1])) {
         $health = $patient->getHealth() + intval($args[1]);
         if ($health > $patient->getMaxHealth()) {
             $health = $patient->getMaxHealth();
         }
     } else {
         $health = $patient->getMaxHealth();
     }
     $patient->setHealth($health);
     $sender->sendMessage(mc::_("%1% was healed.", $args[0]));
     return true;
 }