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 . $this->translateString("notinplot")); return true; } if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.removehelper")) { $sender->sendMessage(TextFormat::RED . $this->translateString("notowner")); return true; } if (!$plot->removeHelper($helper)) { $sender->sendMessage(TextFormat::RED . $this->translateString("removehelper.notone", [$helper])); return true; } if ($this->getPlugin()->getProvider()->savePlot($plot)) { $sender->sendMessage($this->translateString("removehelper.success", [$helper])); } else { $sender->sendMessage(TextFormat::RED . $this->translateString("error")); } return true; }
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { // TODO: Change command structure // TODO: - /action: Please write your command into chat, other players won't be able to see it! // TODO: - Use %player% to replace with the player name // TODO: - /actionDelAll: Remove all actions assigned to the block switch (strtolower($cmd->getName())) { case "action": if (!$sender instanceof Player) { $sender->sendMessage("This command should not be run on console."); return true; } $sender->sendMessage("Please tap a block to assign your command."); $this->normalSessions[$sender->getName()] = 'action'; break; case "actiondelall": if (!$sender instanceof Player) { $sender->sendMessage("This command should not be run on console."); return true; } $sender->sendMessage("Select the target block to continue."); $this->normalSessions[$sender->getName()] = 'actionDelAll'; break; default: break; } return true; }
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 on an island"); return true; } if ($plot->owner !== $sender->getName() and !$sender->hasPermission("skyblock.admin.clear")) { $sender->sendMessage(TextFormat::RED . "You are not the owner of this island"); return true; } $economy = $this->getPlugin()->getEconomyProvider(); $price = $this->getPlugin()->getLevelSettings($plot->levelName)->clearPrice; if ($economy !== null and !$economy->reduceMoney($player, $price)) { $sender->sendMessage(TextFormat::RED . "You don't have enough money to clear this island"); return true; } if ($this->getPlugin()->clearPlot($plot, $player)) { $sender->sendMessage("Island is being cleared..."); } else { $sender->sendMessage(TextFormat::RED . "Could not clear this island"); } return true; }
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"); } } } } } }
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 . $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; } $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; } if ($this->getPlugin()->resetPlot($plot)) { $sender->sendMessage($this->translateString("reset.success")); } else { $sender->sendMessage(TextFormat::RED . $this->translateString("error")); } return true; }
public function execute(CommandSender $sender, array $args) { if (count($args) === 0) { $biomes = TextFormat::WHITE . implode(", ", array_keys($this->biomes)); $sender->sendMessage($this->translateString("biome.possible", [$biomes])); return true; } elseif (count($args) !== 1) { return false; } $player = $sender->getServer()->getPlayer($sender->getName()); $biome = strtoupper($args[0]); $plot = $this->getPlugin()->getPlotByPosition($player->getPosition()); if ($plot === null) { $sender->sendMessage(TextFormat::RED . $this->translateString("notinplot")); return true; } if ($plot->owner !== $sender->getName()) { $sender->sendMessage(TextFormat::RED . $this->translateString("notowner")); return true; } if (!isset($this->biomes[$biome])) { $sender->sendMessage(TextFormat::RED . $this->translateString("biome.invalid")); $biomes = implode(", ", array_keys($this->biomes)); $sender->sendMessage(TextFormat::RED . $this->translateString("biome.possible", [$biomes])); return true; } $biome = Biome::getBiome($this->biomes[$biome]); if ($this->getPlugin()->setPlotBiome($plot, $biome)) { $sender->sendMessage($this->translateString("biome.success", [$biome->getName()])); } else { $sender->sendMessage(TextFormat::RED . $this->translateString("error")); } return true; }
public function exec(CommandSender $sender, array $args) { $username = $sender->getName(); $result = $this->getPlugin()->myMoney($username); $sender->sendMessage($this->getPlugin()->getMessage("mymoney-mymoney", $sender->getName(), array($result, "%2", "%3", "%4"))); return true; }
public function execute(CommandSender $sender, array $args) { if (count($args) !== 1) { return false; } $player = $sender->getServer()->getPlayer($sender->getName()); $biome = strtoupper($args[0]); $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()) { $sender->sendMessage(TextFormat::RED . "You are not the owner of this island"); return true; } if (!isset($this->biomes[$biome])) { $sender->sendMessage(TextFormat::RED . "That biome doesn't exist"); $biomes = implode(", ", array_keys($this->biomes)); $sender->sendMessage(TextFormat::RED . "The possible biomes are: {$biomes}"); return true; } $biome = Biome::getBiome($this->biomes[$biome]); if ($this->getPlugin()->setPlotBiome($plot, $biome)) { $sender->sendMessage(TextFormat::GREEN . "Changed the island biome"); } else { $sender->sendMessage(TextFormat::RED . "Could not change the island biome"); } return true; }
public function onCommand(CommandSender $sender, Command $command, $label, array $args) { if ($command->getName() === "tc") { if (!isset($args[0])) { $sender->sendMessage("/tc add <command> : Add command to a block."); $sender->sendMessage("/tc delete : Deletes commands from block."); return true; } elseif ($args[0] === "add") { if (!isset($args[1])) { $sender->sendMessage("/tc add <command>"); return true; } else { $moved_args = array(); foreach ($args as $argss) { array_push($moved_args, $argss); } unset($moved_args[array_search("add", $moved_args)]); $command = implode(" ", $moved_args); array_push($this->tapwait, array("plyr" => $sender->getName(), "command" => $command)); $sender->sendMessage("Tap on the block to add the command to.."); return true; } } elseif ($args[0] == "delete") { if (!isset($args[1])) { $sender->sendMessage("/tc delete"); return true; } else { array_push($this->tapwait, array("plyrv" => $sender->getName(), "dell" => "yes")); $sender->sendMessage("Tap on the block to delete commands from.."); return true; } } } }
public function execute(CommandSender $sender, array $args) { if (empty($args)) { $plotNumber = 1; } elseif (count($args) === 1 and is_numeric($args[0])) { $plotNumber = (int) $args[0]; } else { return false; } $plots = $this->getPlugin()->getProvider()->getPlotsByOwner($sender->getName()); if (empty($plots)) { $sender->sendMessage(TextFormat::RED . "You don't have any plots"); return true; } if (!isset($plots[$plotNumber - 1])) { $sender->sendMessage(TextFormat::RED . "You don't have a plot with home number {$plotNumber}"); return true; } $player = $this->getPlugin()->getServer()->getPlayer($sender->getName()); $plot = $plots[$plotNumber - 1]; if ($this->getPlugin()->teleportPlayerToPlot($player, $plot)) { $sender->sendMessage(TextFormat::GREEN . "Teleported to " . TextFormat::WHITE . $plot); } else { $sender->sendMessage(TextFormat::GREEN . "Could not teleport because plot world " . $plot->levelName . " is not loaded"); } return true; }
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; }
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; }
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()) { $sender->sendMessage(TextFormat::RED . "You are not the owner of this plot"); return true; } if (!$plot->removeHelper($helper)) { $sender->sendMessage($helper . " was never a helper of this plot."); 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; }
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 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 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; } }
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()) { $sender->sendMessage(TextFormat::RED . "You are not the owner of this plot"); return true; } $economy = $this->getPlugin()->getEconomyProvider(); $price = $this->getPlugin()->getLevelSettings($plot->levelName)->resetPrice; if ($economy !== null and !$economy->reduceMoney($player, $price)) { $sender->sendMessage(TextFormat::RED . "You don't have enough money to reset this plot"); return true; } if ($this->getPlugin()->resetPlot($plot)) { $sender->sendMessage(TextFormat::GREEN . "Plot reset"); } else { $sender->sendMessage(TextFormat::RED . "Could not reset this plot"); } return true; }
public function execute(CommandSender $sender, array $args) { if (!empty($args)) { return false; } $player = $sender->getServer()->getPlayer($sender->getName()); $levelName = $player->getLevel()->getName(); $plots = $this->getPlugin()->getProvider()->getPlotsByOwner($sender->getName()); if (empty($plots)) { $sender->sendMessage(TextFormat::RED . $this->translateString("homes.noplots")); return true; } $sender->sendMessage(TextFormat::DARK_GREEN . $this->translateString("homes.header")); usort($plots, function ($plot1, $plot2) { /** @var $plot1 Plot */ /** @var $plot2 Plot */ if ($plot1->levelName == $plot2->levelName) { return 0; } return $plot1->levelName < $plot2->levelName ? -1 : 1; }); for ($i = 0; $i < count($plots); $i++) { $plot = $plots[$i]; $message = TextFormat::DARK_GREEN . ($i + 1) . ") "; $message .= TextFormat::WHITE . $levelName . " " . $plot; if ($plot->name !== "") { $message .= " = " . $plot->name; } $sender->sendMessage($message); } return true; }
public function execute(CommandSender $sender, $command, array $args) { if ($sender instanceof Player) { if (count($args) == 2) { if (!User::exist($sender->getName())) { if ($args[0] == $args[1]) { $user = new User(); $user->username = $sender->getName(); $user->password = hash("sha512", $args[0]); $user->register(); $sender->sendMessage(TextFormat::GREEN . "You are now registered"); } else { $sender->sendMessage(TextFormat::RED . "The passwords does not match"); } } else { $sender->sendMessage(TextFormat::RED . "An account already exist with this username"); } } else { $sender->sendMessage(TextFormat::RED . $this->getUsage()); } } else { $sender->sendMessage(TextFormat::GOLD . "You need to be in-game to perform this command"); } return true; }
public function execute(CommandSender $sender, array $args) { if (empty($args)) { $plotNumber = 1; } elseif (count($args) === 1 and is_numeric($args[0])) { $plotNumber = (int) $args[0]; } else { return false; } $plots = $this->getPlugin()->getProvider()->getPlotsByOwner($sender->getName()); if (empty($plots)) { $sender->sendMessage(TextFormat::RED . $this->translateString("home.noplots")); return true; } if (!isset($plots[$plotNumber - 1])) { $sender->sendMessage(TextFormat::RED . $this->translateString("home.notexist", [$plotNumber])); return true; } usort($plots, function ($plot1, $plot2) { /** @var $plot1 Plot */ /** @var $plot2 Plot */ if ($plot1->levelName == $plot2->levelName) { return 0; } return $plot1->levelName < $plot2->levelName ? -1 : 1; }); $player = $this->getPlugin()->getServer()->getPlayer($sender->getName()); $plot = $plots[$plotNumber - 1]; if ($this->getPlugin()->teleportPlayerToPlot($player, $plot)) { $sender->sendMessage($this->translateString("home.success", [$plot])); } else { $sender->sendMessage(TextFormat::RED . $this->translateString("home.error")); } return true; }
public function execute(CommandSender $sender, $command, array $args) { if ($sender instanceof Player) { if (count($args) == 1) { if (User::exist($sender->getName())) { $user = User::get($sender->getName()); if (!$user->isLogged()) { if ($user->login($args[0])) { $sender->sendMessage(TextFormat::GREEN . "You are logged in !"); } else { $sender->sendMessage(TextFormat::RED . "Wrong password !"); } } else { $sender->sendMessage(TextFormat::RED . "You are already logged in !"); } } else { $sender->sendMessage(TextFormat::RED . "You need to register first !"); } } else { $sender->sendMessage(TextFormat::RED . $this->getUsage()); } } else { $sender->sendMessage(TextFormat::GOLD . "You need to be in-game to perform this command"); } return true; }
public function execute(CommandSender $sender, $label, array $args) { if (!$this->getPlugin()->getConfig()->get('disableBuyCommand')) { $pageToView = 0; $categoryToView = false; if (count($args) > 0) { if ($args[0] == "page" && count($args) == 2 || count($args) == 3) { if (count($args) == 2) { $pageToView = $args[1]; } else { $categoryToView = $args[1]; $pageToView = $args[2]; } } else { if (count($args) == 1 && is_numeric($args[0])) { $package = $this->getPlugin()->getPackageManager()->getPackage($args[0]); if ($package !== false) { if ($this->getPlugin()->getConfig()->get('directPay')) { $link = $this->getPlugin()->getAuthPayloadSetting('serverStore') . "/checkout/packages?popup=true&action=add&direct=true&package=" . $package->getId() . "&ign=" . $sender->getName(); } else { $link = $this->getPlugin()->getAuthPayloadSetting('serverStore') . "/checkout/packages?action=add&package=" . $package->getId() . "&ign=" . $sender->getName(); } $linkTask = new VisitLinkTask($this->getPlugin(), ['url' => $link], $sender instanceof Player ? $sender->getName() : false); $linkTask->call(); } else { $sender->sendMessage($this->getPlugin()->getConfig()->get('packageNotFound')); } return true; } else { $sender->sendMessage($this->getPlugin()->getConfig()->get('invalidBuyCommand')); return true; } } } if (is_numeric($pageToView) && is_numeric($categoryToView) || $categoryToView === false) { $packages = $this->getPlugin()->getPackageManager()->getPage($pageToView, $categoryToView); if ($packages !== false) { if (count($packages) > 0) { foreach ($packages as $package) { $sender->sendMessage($this->getPlugin()->getConfig()->get('packageId') . ": " . $package->getNiceId()); $sender->sendMessage($this->getPlugin()->getConfig()->get('packageName') . ": " . $package->getName()); $sender->sendMessage($this->getPlugin()->getConfig()->get('packagePrice') . ": " . $package->getPrice() . ' ' . $this->getPlugin()->getAuthPayloadSetting('serverCurrency')); $sender->sendMessage("--------"); } } else { $sender->sendMessage($this->getPlugin()->getConfig()->get('pageNotFound')); } } else { $sender->sendMessage($this->getPlugin()->getConfig()->get('noPackagesForSale')); } } else { $sender->sendMessage($this->getPlugin()->getConfig()->get('invalidBuyCommand')); } } else { $sender->sendMessage("Buy command is disabled on this server."); return true; } }
public function onCommand(CommandSender $sender, Command $command, $label, array $args) { switch (strtolower($command->getName())) { case "tban": if (!isset($args[1])) { return false; } $name = array_shift($args); $time = array_shift($args); $dateTime = $this->getDateTime($time); $reason = implode(" ", $args); Server::getInstance()->getNameBans()->addBan($name, $reason, $dateTime, $sender->getName()); if (($player = $sender->getServer()->getPlayerExact($name)) instanceof Player) { $player->kick($reason !== "" ? "Banned by admin for " . $time . " minutes Reason: " . $reason : "", true); } $sender->sendMessage("[TBan] " . $name . "さんを" . $time . "分間Banしました。"); return true; break; case "tban-ip": if (!isset($args[1])) { return false; } $value = array_shift($args); $time = array_shift($args); $dateTime = $this->getDateTime($time); $reason = implode(" ", $args); $ip = $value; $isIp = false; if (!preg_match("/^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\$/", $value)) { if (($player = Server::getInstance()->getPlayer($value)) instanceof Player) { $ip = $player->getAddress(); } else { $sender->sendMessage("[TBan] " . $value . "さんはサーバーに接続していません。"); return true; } } else { $isIp = true; } Server::getInstance()->getIPBans()->addBan($ip, $reason, $dateTime, $sender->getName()); foreach (Server::getInstance()->getOnlinePlayers() as $player) { if ($player->getAddress() === $ip) { $player->kick($reason !== "" ? $reason : "IP Banned for " . $time . " minutes.", true); } } Server::getInstance()->getNetwork()->blockAddress($ip, $time * 60); if ($isIp) { $sender->sendMessage("[TBan] IPアドレス " . $value . " を" . $time . "分間IPBanしました。"); } else { $sender->sendMessage("[TBan] " . $value . "さんを" . $time . "分間IPBanしました。"); } return true; break; } return false; }
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!"); } }
public function setAdminSay(CommandSender $player) { if (!isset($this->configData[$player->getName()])) { $this->configData[$player->getName()] = 1; $player->sendMessage(TextFormat::DARK_AQUA . $this->configData["default-prefix"] . " adminSay가 설정 되었습니다."); $player->sendMessage(TextFormat::DARK_AQUA . $this->configData["default-prefix"] . " ( 한번 더 입력시 해제됩니다. )"); } else { unset($this->configData[$player->getName()]); $player->sendMessage(TextFormat::DARK_AQUA . $this->configData["default-prefix"] . " adminSay 설정이 해제되었습니다."); } }
public function onCommand(CommandSender $sender, Command $cmd, $label, array $sub) { $ik = $this->isKorean(); if ($sender->getName() == "CONSOLE") { $r = $ik ? "게임내에서만 실행해주세요." : "Please run this command in-game"; } else { $this->pla[$sender->getName()] = true; $r = $ik ? " [CutMap] 중심점이될 블럭을 터치해주세요. 맵을 붙여넣습니다." : " [CutMap] Touch the Center Block -> Paste Map"; } $sender->sendMessage($r); return true; }
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { if (strtolower($cmd->getName() == "staffchests")) { } if (!$sender instanceof Player) { $sender->sendMessage(Colour::DARK_RED . "{$this->consoleMsg}"); return true; } $player = $this->getServer()->getPlayer($sender->getName()); if ($player->hasPermission("staffchests.staffchests")) { if (!isset($args[0])) { $sender->sendMessage(Colour::BLACK . "---[" . Colour::GOLD . "StaffChests" . Colour::BLACK . "]---"); $sender->sendMessage(Colour::BLACK . "- " . Colour::WHITE . "/staffchests key" . Colour::DARK_GREEN . " Get key to open StaffChest"); $sender->sendMessage(Colour::BLACK . "- " . Colour::WHITE . "/staffchests chest" . Colour::DARK_GREEN . " Get StaffChest"); } else { switch ($args[0]) { case "chest": $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "give {$player} chest 1 {display:{Name:§6§6StaffChest},BlockEntityTag:{Lock:§6§6StaffChest Key,Items:[{id:264,Count:64,Slot:0}]}}"); $sender->sendMessage(Colour::AQUA . "You have received a StaffChest"); return true; break; case "key": $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "give {$player} stick 1 {display:{Name:§6§6StaffChest Key}}"); $sender->sendMessage(Colour::AQUA . "You have received a StaffChest Key"); return true; break; } } } else { $sender->sendMessage(Colour::DARK_RED . "{$this->permMessage}"); return true; } break; if (strtolower($cmd->getName() == "loopychest")) { } if (!$sender instanceof Player) { $sender->sendMessage(Colour::DARK_RED . "{$this->consoleMsg}"); return true; } $player = $this->getServer()->getPlayer($sender->getName()); if ($player->hasPermission("staffchests.loopychest")) { $this->getServer->dispatchCommand(new ConsoleCommandSender(), "give {$player} chest 1 {display:{Name:§6§6LoopyChest},BlockEntityTag :{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1,Slot:0,tag:{BlockEntityTag:{Items:[{id:54,Count:1i,Slot:0,tag:{BlockEntityTag:{Items:[{id:7,Count:1,Slot:0,tag:{display:{Name:§7Place Me On Bedrock :)},CanPlaceOn:[bedrock]}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}}]}}"); $sender->sendMessage(Colour::AQUA . "You have received a LoopyChest"); return true; } else { $sender->sendMessage(Colour::DARK_RED . "{$this->permMessage}"); return true; } break; }
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; } } } }
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 exec(CommandSender $sender, array $params) { $money = $this->getPlugin()->getAllMoney(); $allMoney = 0; foreach ($money["money"] as $m) { $allMoney += $m; } $topMoney = 0; if ($allMoney > 0) { $topMoney = round($money["money"][strtolower($sender->getName())] / $allMoney * 100, 2); } $sender->sendMessage($this->getPlugin()->getMessage("mystatus-show", $sender->getName(), array($topMoney, "%2", "%3", "%4"))); return true; }