public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (strtolower($cmd->getName()) === "sneak") {
         if (isset($args[0])) {
             $target = $this->plugin->getServer()->getPlayer($args[0]);
             if ($sender->hasPermission("sneak.command.other")) {
                 if ($target instanceof Player) {
                     $this->plugin->toggleSneak($target);
                     $target->sendMessage(TF::BOLD . TF::AQUA . $sender->getName() . TF::RESET . TF::GOLD . " has toggled sneaking for you!");
                     $sender->sendMessage(TF::GOLD . "Toggled sneaking for " . TF::BOLD . TF::AQUA . $target->getName()) . TF::RESET . TF::GOLD . "!";
                     return true;
                 } else {
                     $sender->sendMessage(TF::RED . $args[0] . "is not online!");
                     return true;
                 }
             } else {
                 $sender->sendMessage(TF::RED . "You do not have permissions to use the 'sneak' command!");
                 return true;
             }
         } elseif ($sender instanceof Player) {
             if ($sender->hasPermission("sneak.command.self")) {
                 $this->plugin->toggleSneak($sender);
                 $sender->sendMessage(TF::GOLD . "You have toggled sneaking!");
             } else {
                 $sender->sendMessage(TF::RED . "You do not have permissions to use the 'sneak' command!");
             }
         } else {
             $sender->sendMessage(TF::RED . "You must run the 'sneak' command in-game!");
         }
         return false;
     }
 }
Example #2
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;
                 }
             }
         }
     }
 }
Example #3
0
 public function onCommand(CommandSender $issuer, Command $cmd, $label, array $args)
 {
     switch ($cmd->getName()) {
         case "setjail":
             if ($issuer->hasPermission("jail.command") !== true && $issuer->hasPermission("jail.command.setjail") !== true) {
                 $issuer->sendMessage($this->plugin->colourMessage("&cYou don't have permission for this!"));
                 return true;
             }
             if (!isset($args[0])) {
                 return false;
             }
             $jail = $args[0];
             if ($this->plugin->jailExists($jail) !== false) {
                 $issuer->sendMessage($this->plugin->colourMessage("&cJail already exists!"));
                 return true;
             }
             if (!$issuer instanceof Player) {
                 $issuer->sendMessage($this->plugin->colourMessage("Command only works in-game!"));
                 return true;
             }
             $this->plugin->setJail($jail, $issuer->x, $issuer->y, $issuer->z, $issuer->getLevel());
             $issuer->sendMessage($this->plugin->colourMessage("&6You created jail: &c" . $jail . "&6!"));
             return true;
             break;
     }
 }
Example #4
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 $cmd, $label, array $args)
 {
     if (strtolower($cmd->getName('cratekey'))) {
         if (count($args) == 0) {
             $sender->sendMessage(TextFormat::RED . "/cratekey <give/giveall>");
         }
         if (count($args) == 1) {
             if ($args[0] == "giveall") {
                 if ($sender->hasPermission("mysterycrates.command.cratekey.giveall")) {
                     $this->plugin->giveCratekeyAll();
                     $sender->sendMessage(TextFormat::GOLD . "You have given a cratekey to everyone on the server!");
                     $sender->getServer()->broadcastMessage(TextFormat::BOLD . TextFormat::BLUE . "[MysteryCrates]" . TextFormat::GREEN . TextFormat::RESET . " Everyone has been given a cratekey by " . TextFormat::GOLD . $sender->getName() . "! ");
                 }
             }
         }
         if (count($args) == 2) {
             if ($args[0] == "give") {
                 if ($sender->hasPermission("mysterycrates.command.cratekey.give")) {
                     $player = $sender->getServer()->getPlayer($args[1]);
                     if ($player instanceof Player) {
                         $player->sendMessage(TextFormat::GREEN . "You have been given a cratekey by " . TextFormat::GOLD . $sender->getName());
                         $sender->sendMessage(TextFormat::GOLD . "Given a cratekey to " . TextFormat::GOLD . $player->getName());
                         $this->plugin->giveCratekey($player);
                     } else {
                         $sender->sendMessage(TextFormat::RED . "That player cannot be found");
                     }
                 }
             }
         }
     }
 }
Example #6
0
 public function onCommand(Issuer $issuer, Cmd $cmd, $alias, array $args)
 {
     if (!isset($args[0])) {
         if (!$issuer->hasPermission("iplogger.self.read")) {
             $issuer->sendMessage("You don't have permission to view your own IP log!");
             return true;
         }
         if (!$issuer instanceof Player) {
             return false;
             // request pass arg 0
         }
         $name = strtolower($issuer->getName());
     } else {
         if (!$issuer->hasPermission("iplogger.other.read")) {
             $issuer->sendMessage("You don't have permission to view otheres' IP log!");
             return true;
         }
         $name = strtolower(trim($args[0]));
     }
     $path = $this->getFileByString($name);
     if (!is_file($path)) {
         $issuer->sendMessage("{$name} has never been on this server!");
         return true;
     }
     $issuer->sendMessage("IP log of {$name}:");
     $msg = str_replace(PHP_EOL, ", ", file_get_contents($path));
     if (substr($msg, -2) === ", ") {
         $msg = substr($msg, 0, -2);
     }
     $issuer->sendMessage($msg);
     return true;
 }
Example #7
0
 public function onCommand(CommandSender $issuer, Command $cmd, $label, array $args)
 {
     switch ($cmd->getName()) {
         case "jailtp":
             if ($issuer->hasPermission("jail.command") !== true && $issuer->hasPermission("jail.command.jailtp") !== true) {
                 $issuer->sendMessage($this->plugin->colourMessage("&cYou don't have permission for this!"));
                 return true;
             }
             if (!isset($args[0])) {
                 return false;
             }
             $jail = $args[0];
             if ($this->plugin->jailExists($jail) !== true) {
                 $issuer->sendMessage($this->plugin->colourMessage("&cJail doesn't exist!"));
                 return true;
             }
             if (!$issuer instanceof Player) {
                 $issuer->sendMessage($this->plugin->colourMessage("Command only works in-game!"));
                 return true;
             }
             $this->plugin->teleportToJail($issuer, $jail);
             $issuer->sendMessage($this->plugin->colourMessage("&6You have been teleported to jail &c" . $jail));
             return true;
             break;
     }
 }
Example #8
0
 public function onCommand(CommandSender $issuer, Command $cmd, $label, array $args)
 {
     switch ($cmd->getName()) {
         case "deljail":
             if ($issuer->hasPermission("jail.command") !== true && $issuer->hasPermission("jail.command.deljail") !== true) {
                 $issuer->sendMessage($this->plugin->colourMessage("&cYou don't have permission for this!"));
                 return true;
             }
             if (!isset($args[0])) {
                 return false;
             }
             $jail = $args[0];
             if ($this->plugin->jailExists($jail) !== true) {
                 $issuer->sendMessage($this->plugin->colourMessage("&cJail doesn't exist!"));
                 return true;
             }
             $t = $this->plugin->data->getAll();
             $result = true;
             foreach (array_keys($t) as $name) {
                 if (isset($t[$name]["jail"]) && $t[$name]["jail"] == $jail) {
                     if ($result !== false) {
                         $result = false;
                     }
                 }
             }
             if ($result !== true) {
                 $issuer->sendMessage($this->plugin->colourMessage("&cUnable to delete jail.  Someone is still being jailed there!"));
                 return true;
             }
             $this->plugin->delJail($jail);
             $issuer->sendMessage($this->plugin->colourMessage("&6You deleted jail: &c" . $jail . "&6!"));
             return true;
             break;
     }
 }
 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!");
             }
         }
     }
 }
Example #10
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 #11
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command->getName()) == "bam") {
         if ($sender instanceof Player) {
             if (!($sender->hasPermission("bambam") || $sender->hasPermission("bambam.command") || $sender->hasPermission("bambam.command.bam"))) {
                 return false;
             }
             $chambers = $this->getConfig()->get("chambers");
             if ($chambers < 2) {
                 $sender->sendMessage(TextFormat::RED . "You don't have enough chambers!");
                 return true;
             }
             if (mt_rand(1, $chambers) == 1) {
                 $sender->setHealth(0);
                 $sender->sendMessage(TextFormat::RED . "Unlucky.");
             } else {
                 $sender->sendMessage(TextFormat::GREEN . "You survived.");
                 foreach ($this->getConfig()->get("commands") as $command) {
                     $this->getServer()->dispatchCommand(new ConsoleCommandSender(), str_replace("{player}", $sender->getName(), $command));
                 }
             }
         } else {
             $sender->sendMessage(TextFormat::RED . "You can only play in-game!");
         }
         return true;
     }
 }
Example #12
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     $fcmd = strtolower($cmd->getName());
     switch ($fcmd) {
         case "broadcaster":
             if (isset($args[0])) {
                 $args[0] = strtolower($args[0]);
                 if ($args[0] == "reload") {
                     if ($sender->hasPermission("broadcaster.reload")) {
                         $this->plugin->reloadConfig();
                         $this->cfg = $this->plugin->getConfig()->getAll();
                         $time = intval($this->cfg["time"]) * 20;
                         $this->plugin->task->remove();
                         $this->plugin->ptask->remove();
                         $this->plugin->task = $this->plugin->getServer()->getScheduler()->scheduleRepeatingTask(new Task($this->plugin), $time);
                         $this->plugin->ptask = $this->plugin->getServer()->getScheduler()->scheduleRepeatingTask(new PopupTask($this->plugin), $time);
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&aConfiguration Reloaded."));
                         return true;
                     } else {
                         $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                         return true;
                     }
                 } elseif ($args[0] == "info") {
                     if ($sender->hasPermission("broadcaster.info")) {
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&2BroadCaster &9v" . Main::VERSION . " &2developed by&9 " . Main::PRODUCER));
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&2Website &9" . Main::MAIN_WEBSITE));
                         return true;
                     } else {
                         $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                         return true;
                     }
                 } else {
                     if ($sender->hasPermission("broadcaster")) {
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&cSubcommand &9" . $args[0] . "&c not found. Use &9/bc &cto show available commands"));
                         break;
                     } else {
                         $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                         break;
                     }
                     return true;
                 }
             } else {
                 if ($sender->hasPermission("broadcaster")) {
                     $sender->sendMessage($this->plugin->translateColors("&", "&2- &9Available Commands &2-"));
                     $sender->sendMessage($this->plugin->translateColors("&", "&9/bc info &2- &9Show info about this plugin"));
                     $sender->sendMessage($this->plugin->translateColors("&", "&9/bc reload &2- &9Reload the config"));
                     $sender->sendMessage($this->plugin->translateColors("&", "&9/sendmessage &2- &9Send message to the specified player (* for all players)"));
                     $sender->sendMessage($this->plugin->translateColors("&", "&9/sendpopup &2- &9Send popup to the specified player (* for all players)"));
                     break;
                 } else {
                     $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                     break;
                 }
                 return true;
             }
     }
     return true;
 }
Example #13
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     $subcmd = array_shift($args);
     switch (strtolower($subcmd)) {
         case null:
             if ($sender->hasPermission("notice.broadcast")) {
                 $this->broadcast();
             } else {
                 $sender->sendMesage(new TranslationContainer("%commands.generic.permission"));
             }
             return true;
         case "message":
             if ($sender->hasPermission("notice.message")) {
                 $message = "------- メッセージ -------\n";
                 foreach ($this->getMessages() as $number => $text) {
                     $message .= $number . ": " . $text . "\n";
                 }
             } else {
                 $message = new TranslationContainer("%commands.generic.permission");
             }
             $sender->sendMessage($message);
             return true;
         case "reload":
             if ($sender->hasPermission("notice.reload")) {
                 $this->reload();
                 $sender->sendMessage("configファイルを再読み込みしました");
             } else {
                 $sender->sendMesage(new TranslationContainer("%commands.generic.permission"));
             }
             return true;
         case "help":
         default:
             if ($this->messageExists($subcmd)) {
                 if ($sender->hasPermission("notice.broadcast")) {
                     $this->broadcast($subcmd);
                 } else {
                     $sender->sendMesage(new TranslationContainer("%commands.generic.permission"));
                 }
             } else {
                 if ($sender->hasPermission("notice.help")) {
                     $message = "--- コマンド一覧 ---\n";
                     $message .= "/notice [キー]   >> メッセージをブロードキャストします\n";
                     $message .= "/notice message >> メッセージ一覧を取得します\n";
                     $message .= "/notice reload  >> configファイルを再読み込みしました\n";
                     $message .= "/notice help    >> コマンドを確認します";
                     $sender->sendMessage($message);
                 } else {
                     $sender->sendMesage(new TranslationContainer("%commands.generic.permission"));
                 }
             }
             return true;
     }
 }
Example #14
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     $fcmd = strtolower($cmd->getName());
     switch ($fcmd) {
         case "chestlocker":
             if (isset($args[0])) {
                 $args[0] = strtolower($args[0]);
                 if ($args[0] == "help") {
                     if ($sender->hasPermission("chestlocker.commands.help")) {
                         $sender->sendMessage($this->plugin->translateColors("&", "&c|| &8Available Commands &c||"));
                         $sender->sendMessage($this->plugin->translateColors("&", "&c/chlock info &8> Show info about this plugin"));
                         $sender->sendMessage($this->plugin->translateColors("&", "&c/chlock reload &8> Reload the config"));
                         $sender->sendMessage($this->plugin->translateColors("&", "&c/lockchest &8> Lock a " . Main::ITEM_NAME_2));
                         $sender->sendMessage($this->plugin->translateColors("&", "&c/unlockchest &8> Unlock a " . Main::ITEM_NAME_2));
                         break;
                     } else {
                         $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                         break;
                     }
                 } elseif ($args[0] == "reload") {
                     if ($sender->hasPermission("chestlocker.commands.reload")) {
                         $this->plugin->reloadConfig();
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&aConfiguration Reloaded."));
                         break;
                     } else {
                         $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                         break;
                     }
                 } elseif ($args[0] == "info") {
                     if ($sender->hasPermission("chestlocker.commands.info")) {
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&8ChestLocker &cv" . Main::VERSION . " &8developed by&c " . Main::PRODUCER));
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&8Website &c" . Main::MAIN_WEBSITE));
                         break;
                     } else {
                         $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                         break;
                     }
                 }
             } else {
                 if ($sender->hasPermission("chestlocker.commands.help")) {
                     $sender->sendMessage($this->plugin->translateColors("&", "&c|| &8Available Commands &c||"));
                     $sender->sendMessage($this->plugin->translateColors("&", "&c/chlock info &8> Show info about this plugin"));
                     $sender->sendMessage($this->plugin->translateColors("&", "&c/chlock reload &8> Reload the config"));
                     $sender->sendMessage($this->plugin->translateColors("&", "&c/lockchest &8> Lock a " . Main::ITEM_NAME_2));
                     $sender->sendMessage($this->plugin->translateColors("&", "&c/unlockchest &8> Unlock a " . Main::ITEM_NAME_2));
                     break;
                 } else {
                     $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                     break;
                 }
             }
     }
 }
Example #15
0
 public function onCommand(CommandSender $issuer, Command $cmd, $label, array $args)
 {
     switch ($cmd->getName()) {
         case "jails":
             if ($issuer->hasPermission("jail.command") !== true && $issuer->hasPermission("jail.command.jails") !== true) {
                 $issuer->sendMessage($this->plugin->colourMessage("&cYou don't have permission for this!"));
                 return true;
             }
             $issuer->sendMessage($this->plugin->colourMessage("&6Jails: &f" . implode(", ", $this->plugin->getJails())));
             return true;
             break;
     }
 }
Example #16
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     $fcmd = strtolower($cmd->getName());
     switch ($fcmd) {
         case "chatlogin":
             if (isset($args[0])) {
                 $args[0] = strtolower($args[0]);
                 if ($args[0] == "reload") {
                     if ($sender->hasPermission("chatlogin.reload")) {
                         $this->plugin->reloadConfig();
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&aConfiguration Reloaded."));
                         return true;
                     } else {
                         $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                         return true;
                     }
                 } elseif ($args[0] == "info") {
                     if ($sender->hasPermission("chatlogin.info")) {
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&7ChatLogin &bv" . Main::VERSION . " &7developed by&b " . Main::PRODUCER));
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&7Website &b" . Main::MAIN_WEBSITE));
                         return true;
                     } else {
                         $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                         return true;
                     }
                 } else {
                     if ($sender->hasPermission("chatlogin")) {
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&cSubcommand &9" . $args[0] . "&c not found. Use &9/chlogin &cto show available commands"));
                         break;
                     } else {
                         $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                         break;
                     }
                     return true;
                 }
             } else {
                 if ($sender->hasPermission("chatlogin")) {
                     $sender->sendMessage($this->plugin->translateColors("&", "&7// &bAvailable Commands &7\\\\"));
                     $sender->sendMessage($this->plugin->translateColors("&", "&9/chatlogin help &b-> &7Show help about this plugin"));
                     $sender->sendMessage($this->plugin->translateColors("&", "&9/chatlogin info &b-> &7Show info about this plugin"));
                     $sender->sendMessage($this->plugin->translateColors("&", "&9/chatlogin reload &b-> &7Reload the config"));
                     break;
                 } else {
                     $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                     break;
                 }
                 return true;
             }
     }
     return true;
 }
Example #17
0
 public function onCommand(CommandSender $p, Command $cmd, $label, array $args)
 {
     if (!$p instanceof Player) {
         $p->sendMessage("Command must be used in-game.");
         return true;
     }
     if ($p->hasPermission("votereward") || $p->hasPermission("votereward.vote")) {
         $query = new QueryTask("http://minecraftpocket-servers.com/api/?object=votes&element=claim&key=" . $this->key . "&username="******"You do not have permission to vote.");
     }
     return true;
 }
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (strtolower($cmd->getName()) === "togglepos") {
         if (isset($args[0])) {
             if ($sender->hasPermission("positionteller.command.togglepos.other")) {
                 $name = $args[0];
                 $target = $this->getPlugin()->getServer()->getPlayer($name);
                 if ($target instanceof Player) {
                     if ($this->getPlugin()->isActive($target)) {
                         $this->getPlugin()->removeActive($target);
                         $sender->sendMessage(str_replace("@reciver", $target->getName(), Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.other.succeed.de-activate.sender"))));
                         $target->sendMessage(str_replace("@sender", $sender->getName(), Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.other.succeed.de-activate.reciver"))));
                         return true;
                     } else {
                         $this->getPlugin()->addActive($target);
                         $sender->sendMessage(str_replace("@reciver", $target->getName(), Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.other.succeed.activate.sender"))));
                         $target->sendMessage(str_replace("@sender", $sender->getName(), Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.other.succeed.activate.reciver"))));
                         return true;
                     }
                 } else {
                     $sender->sendMessage(str_replace("@reciver", $name, Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.other.fail.default"))));
                     return true;
                 }
             } else {
                 $sender->sendMessage(Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.other.fail.permisson")));
                 return true;
             }
         } else {
             if ($sender instanceof Player) {
                 if ($sender->hasPermission("positionteller.command.togglepos.self")) {
                     if ($this->getPlugin()->isActive($sender)) {
                         $this->getPlugin()->removeActive($sender);
                         $sender->sendMessage(Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.self.succeed.de-activate")));
                         return true;
                     } else {
                         $this->getPlugin()->addActive($sender);
                         $sender->sendMessage(Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.self.succeed.activate")));
                         return true;
                     }
                 } else {
                     $sender->sendMessage(Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.self.fail.permission")));
                     return true;
                 }
             } else {
                 $sender->sendMessage(Main::translateColors($this->getPlugin()->getConfigValue("messages.togglepos.self.fail.game")));
                 return true;
             }
         }
     }
 }
Example #19
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (strtolower($cmd->getName()) === "fly") {
         if (empty($args)) {
             if (!$sender->hasPermission("flycommand.me")) {
                 $sender->sendMessage(TextFormat::RED . "You do not have permission to use this command");
                 return true;
             } else {
                 if (!$sender instanceof Player) {
                     $sender->sendMessage(TextFormat::RED . "Command only allowed in-game");
                     return true;
                 }
                 if ($sender->getAllowFlight()) {
                     $sender->setAllowFlight(false);
                     $sender->sendMessage(TextFormat::GREEN . "Flight mode disabled");
                     return true;
                 } else {
                     $sender->setAllowFlight(true);
                     $sender->sendMessage(TextFormat::GREEN . "Flight mode enabled");
                     return true;
                 }
             }
         } else {
             if (count($args === 1)) {
                 $player = $this->getServer()->getPlayer($args[0]);
                 if (!$sender->hasPermission("flycommand.others")) {
                     $sender->sendMessage(TextFormat::RED . "You do not have permission to use this command");
                     return true;
                 } else {
                     if ($player === null) {
                         $sender->sendMessage(TextFormat::RED . "Player not online");
                         return true;
                     }
                     if ($player->getAllowFlight()) {
                         $player->setAllowFlight(false);
                         $player->sendMessage(TextFormat::GREEN . "Flight mode disabled");
                         $sender->sendMessage(TextFormat::GREEN . "Flight mode disabled for player: " . TextFormat::WHITE . $player->getName());
                         return true;
                     } else {
                         $player->setAllowFlight(true);
                         $player->sendMessage(TextFormat::GREEN . "Flight mode enabled");
                         $sender->sendMessage(TextFormat::GREEN . "Flight mode enabled for player: " . TextFormat::WHITE . $player->getName());
                         return true;
                     }
                 }
             }
         }
     }
     return false;
 }
Example #20
0
 /**
  * @param CommandSender $sender
  * @param string $commandLabel
  * @param string[] $args
  *
  * @return mixed
  */
 public function execute(CommandSender $sender, $commandLabel, array $args)
 {
     if ($sender->hasPermission(SimpleWarpPermissions::WARP_COMMAND)) {
         if (isset($args[0])) {
             if (isset($this->api->getWarpManager()[$args[0]])) {
                 if (isset($args[1])) {
                     if ($sender->hasPermission(SimpleWarpPermissions::WARP_OTHER_COMMAND)) {
                         if (($player = $this->api->getSimpleWarp()->getServer()->getPlayer($args[1])) instanceof Player) {
                             /** @var Warp $warp */
                             $warp = $this->api->getWarpManager()[$args[0]];
                             if ($warp->canUse($sender)) {
                                 $this->displaySmoke($player);
                                 $player->sendPopup($this->api->executeTranslationItem("warping-popup", $args[0]));
                                 $warp->teleport($player);
                                 $sender->sendMessage($this->api->executeTranslationItem("other-player-warped", $player->getName(), $args[0]));
                             } else {
                                 $sender->sendMessage($this->api->executeTranslationItem("no-permission-warp"));
                             }
                         } else {
                             $sender->sendMessage($this->api->executeTranslationItem("player-not-loaded"));
                         }
                     } else {
                         $sender->sendMessage($this->api->executeTranslationItem("no-permission-warp-other"));
                     }
                 } elseif ($sender instanceof Player) {
                     /** @var Warp $warp */
                     $warp = $this->api->getWarpManager()[$args[0]];
                     if ($warp->canUse($sender)) {
                         $this->displaySmoke($sender);
                         $sender->sendPopup($this->api->executeTranslationItem("warping-popup", $args[0]));
                         $warp->teleport($sender);
                         $sender->sendMessage($this->api->executeTranslationItem("warp-done"));
                     } else {
                         $sender->sendMessage($this->api->executeTranslationItem("no-permission-warp"));
                     }
                 } else {
                     $sender->sendMessage($this->getUsage());
                 }
             } else {
                 $sender->sendMessage($this->api->executeTranslationItem("warp-doesnt-exist"));
             }
         } else {
             $sender->sendMessage($this->getUsage());
             Version::sendVersionMessage($sender);
         }
     } else {
         $sender->sendMessage($this->api->executeTranslationItem("warp-noperm"));
     }
 }
Example #21
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     $fcmd = strtolower($cmd->getName());
     switch ($fcmd) {
         case "lockchest":
             if ($sender->hasPermission("chestlocker.commands.lockchest")) {
                 //Player Sender
                 if ($sender instanceof Player) {
                     if ($this->plugin->getCommandStatus($sender->getName()) == 0 || $this->plugin->getCommandStatus($sender->getName()) == 2) {
                         $this->plugin->setCommandStatus(1, $sender->getName());
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&2" . Main::ITEM_NAME . " lock command enabled. Click the " . Main::ITEM_NAME_2 . " to lock"));
                     } else {
                         $this->plugin->setCommandStatus(0, $sender->getName());
                         $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&4" . Main::ITEM_NAME . " lock command disabled."));
                     }
                 } else {
                     $sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&cYou can only perform this command as a player"));
                     return true;
                 }
             } else {
                 $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command"));
                 break;
             }
             return true;
     }
 }
Example #22
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 #23
0
 public function execute(CommandSender $sender, array $args)
 {
     if (!empty($args)) {
         return false;
     }
     $player = $sender->getServer()->getPlayer($sender->getName());
     $plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
     if ($plot === null) {
         $sender->sendMessage(TextFormat::RED . "You are not standing inside a plot");
         return true;
     }
     if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.dispose")) {
         $sender->sendMessage(TextFormat::RED . "You are not the owner of this plot");
         return true;
     }
     $economy = $this->getPlugin()->getEconomyProvider();
     $price = $this->getPlugin()->getLevelSettings($plot->levelName)->disposePrice;
     if ($economy !== null and !$economy->reduceMoney($player, $price)) {
         $sender->sendMessage(TextFormat::RED . "You don't have enough money to dispose this plot");
         return true;
     }
     if ($this->getPlugin()->disposePlot($plot)) {
         $sender->sendMessage(TextFormat::GREEN . "Plot disposed");
     } else {
         $sender->sendMessage(TextFormat::RED . "Could not dispose this plot");
     }
     return true;
 }
Example #24
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 execute(CommandSender $sender, array $args)
 {
     if (count($args) !== 1) {
         return false;
     }
     $helper = $args[0];
     $player = $sender->getServer()->getPlayer($sender->getName());
     $plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
     if ($plot === null) {
         $sender->sendMessage(TextFormat::RED . "You are not standing on an island");
         return true;
     }
     if ($plot->owner !== $sender->getName() and !$sender->hasPermission("skyblock.admin.removehelper")) {
         $sender->sendMessage(TextFormat::RED . "You are not the owner of this island");
         return true;
     }
     if (!$plot->removeHelper($helper)) {
         $sender->sendMessage($helper . " was never a helper of this island.");
         return true;
     }
     if ($this->getPlugin()->getProvider()->savePlot($plot)) {
         $sender->sendMessage(TextFormat::GREEN . $helper . " has been removed.");
     } else {
         $sender->sendMessage(TextFormat::RED . "Could not remove that player.");
     }
     return true;
 }
Example #26
0
 public function onCommand(CommandSender $sender, Command $command, $commandAlias, array $args)
 {
     if (!$this->isEnabled() or !$sender->hasPermission("PMSocket.commands")) {
         return false;
     }
     if (!isset($args[0])) {
         $sender->sendMessage(TextFormat::GOLD . "/pmsocket password <password>");
         return true;
     }
     switch (strToLower($args[0])) {
         case "password":
             if (!isset($args[1])) {
                 $sender->sendMessage(TextFormat::GOLD . "[PMSocket] /pmsocket password <password>");
                 return true;
             }
             array_shift($args);
             $this->db["password"] = implode(" ", $args);
             $sender->sendMessage(TextFormat::GOLD . "[PMSocket] The password has been registered!");
             if ($this->resender == null) {
                 $this->registerAttachment();
             }
             break;
     }
     return true;
 }
Example #27
0
 public function execute(CommandSender $sender, array $args)
 {
     if (count($args) !== 1) {
         return false;
     }
     $helper = $args[0];
     $player = $sender->getServer()->getPlayer($sender->getName());
     $plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
     if ($plot === null) {
         $sender->sendMessage(TextFormat::RED . "You are not standing inside a plot");
         return true;
     }
     if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.addhelper")) {
         $sender->sendMessage(TextFormat::RED . "You are not the owner of this plot");
         return true;
     }
     if (!$plot->addHelper($helper)) {
         $sender->sendMessage($helper . " was already a helper of this plot");
         return true;
     }
     if ($this->getPlugin()->getProvider()->savePlot($plot)) {
         $sender->sendMessage(TextFormat::GREEN . $helper . " is now a helper of this plot");
     } else {
         $sender->sendMessage(TextFormat::RED . "Helper could not be added");
     }
     return true;
 }
 public function execute(CommandSender $issuer, $alias, array $args)
 {
     if ($issuer instanceof Player) {
         if (isset($args[0])) {
             if (($name = strtolower($args[0])) === "-all") {
                 if (!$issuer->hasPermission("lagfixer.show.all")) {
                     $issuer->sendMessage("You don't have permission to show all invisible players in once.");
                     return false;
                 }
                 foreach ($this->plugin->getServer()->getOnlinePlayers() as $player) {
                     if ($player->getID() !== $issuer->getID()) {
                         $player->spawnTo($issuer);
                     }
                 }
                 $issuer->sendMessage("All visible players have been sent to you.");
                 return true;
             } else {
                 if (!$issuer->hasPermission("lagfixer.show.player")) {
                     $issuer->sendMessage("You don't have permission to show an invisible player.");
                     return false;
                 }
                 $player = $this->plugin->getServer()->getPlayer($args[0]);
                 if ($player instanceof Player and $player->getID() !== $issuer->getID()) {
                     $player->spawnTo($issuer);
                     return true;
                 }
             }
         }
         $issuer->sendMessage("Wrong usage: Argument 1 must be a player name or part of it.");
         $issuer->sendMessage("Usage: " . $this->getUsage());
         return false;
     }
     $issuer->sendMessage("Please run this command in-game. You shouldn't see any graphical players here.");
     return false;
 }
 /**
  * @param CommandSender $sender
  * @param string $commandLabel
  * @param string[] $args
  *
  * @return mixed
  */
 public function execute(CommandSender $sender, $commandLabel, array $args)
 {
     if ($sender->hasPermission(SimpleWarpPermissions::LIST_WARPS_COMMAND)) {
         $ret = $this->api->executeTranslationItem("listwarps-list-title");
         /** @var Warp[] $iterator */
         $iterator = $this->api->getWarpManager()->getIterator();
         foreach ($iterator as $w) {
             if ($w->canUse($sender)) {
                 $ret .= " * " . $w->getName() . " ";
                 if ($sender->hasPermission(SimpleWarpPermissions::LIST_WARPS_COMMAND_XYZ)) {
                     $dest = $w->getDestination();
                     $ret .= $dest->toString();
                 }
                 $ret .= "\n";
             }
         }
         /**
          * EASTER EGG!
          */
         if ($sender instanceof Player && $sender->hasPermission(SimpleWarpPermissions::LIST_WARPS_COMMAND_VISUAL) && isset($args[0]) && $args[0] === "v") {
             foreach ($iterator as $warp) {
                 if ($warp->getDestination()->isInternal() && $warp->getDestination()->getPosition()->getLevel() === $sender->getLevel()) {
                     $particle = new FloatingTextParticle($warp->getDestination()->getPosition(), "(X: {$warp->getDestination()->getPosition()->getFloorX()}}, Y: {$warp->getDestination()->getPosition()->getFloorY()}, Z: {$warp->getDestination()->getPosition()->getFloorZ()}, LEVEL: {$warp->getDestination()->getPosition()->getLevel()->getName()})", "WARP: " . TextFormat::AQUA . $warp->getName() . TextFormat::RESET);
                     $sender->getLevel()->addParticle($particle, [$sender]);
                 }
             }
         }
         $sender->sendMessage($ret !== $this->api->executeTranslationItem("listwarps-list-title") ? $ret : $this->api->executeTranslationItem("listwarps-no-warps"));
     } else {
         $sender->sendMessage($this->api->executeTranslationItem("listwarps-noperm"));
     }
 }
Example #30
0
 public function execute(CommandSender $sender, array $args)
 {
     $confirm = (count($args) == 1 and $args[0] == $this->translateString("confirm"));
     if (count($args) != 0 and !$confirm) {
         return false;
     }
     $player = $sender->getServer()->getPlayer($sender->getName());
     $plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
     if ($plot === null) {
         $sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
         return true;
     }
     if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.reset")) {
         $sender->sendMessage(TextFormat::RED . $this->translateString("notowner"));
         return true;
     }
     if ($confirm) {
         $economy = $this->getPlugin()->getEconomyProvider();
         $price = $this->getPlugin()->getLevelSettings($plot->levelName)->resetPrice;
         if ($economy !== null and !$economy->reduceMoney($player, $price)) {
             $sender->sendMessage(TextFormat::RED . $this->translateString("reset.nomoney"));
             return true;
         }
         $maxBlocksPerTick = $this->getPlugin()->getConfig()->get("ClearBlocksPerTick", 256);
         if ($this->getPlugin()->resetPlot($plot, $maxBlocksPerTick)) {
             $sender->sendMessage($this->translateString("reset.success"));
         } else {
             $sender->sendMessage(TextFormat::RED . $this->translateString("error"));
         }
     } else {
         $plotId = TextFormat::GREEN . $plot . TextFormat::WHITE;
         $sender->sendMessage($this->translateString("reset.confirm", [$plotId]));
     }
     return true;
 }