当前位置: 首页>>代码示例>>PHP>>正文


PHP Command::getName方法代码示例

本文整理汇总了PHP中pocketmine\command\Command::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::getName方法的具体用法?PHP Command::getName怎么用?PHP Command::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\command\Command的用法示例。


在下文中一共展示了Command::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (strtolower($cmd->getName()) === "report") {
         if (!isset($args[0])) {
             $sender->sendMessage(TF::RED . "Error: not enough args. Usage: /report < problem >");
             return true;
         } else {
             chdir($this->dataFolder());
             $player_name = $sender->getName();
             $player_display_name = $sender->getDisplayName();
             $problem = implode(" ", $args);
             file_put_contents("reports.txt", $player_name . " || " . $problem . "\n", FILE_APPEND);
             $sender->sendMessage(TF::GREEN . "Successfully saved your report!");
             return true;
         }
     }
     if (strtolower($cmd->getName()) === "reports") {
         chdir($this->dataFolder());
         $reports = file("reports.txt");
         foreach ($reports as $report) {
             $sender->sendMessage(TF::YELLOW . $report);
         }
         return true;
     }
 }
开发者ID:applqpak,项目名称:ReportPE,代码行数:25,代码来源:Main.php

示例2: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     $pageNumber = $this->getPageNumber($args);
     if (count($args) != 1) {
         $sender->sendMessage(mc::_("You must specify a player's name"));
         return false;
     }
     if (($target = MPMU::getPlayer($sender, $args[0])) === null) {
         return true;
     }
     if ($cmd->getName() == "seeinv") {
         $tab = [[$args[0], mc::_("Count"), mc::_("Damage")]];
         $max = $target->getInventory()->getSize();
         foreach ($target->getInventory()->getContents() as $slot => &$item) {
             if ($slot >= $max) {
                 continue;
             }
             $tab[] = [ItemName::str($item) . " (" . $item->getId() . ")", $item->getCount(), $item->getDamage()];
         }
         if (count($tab) == 1) {
             $sender->sendMessage(mc::_("The inventory for %1% is EMPTY", $args[0]));
             return true;
         }
     } elseif ($cmd->getName() == "seearmor") {
         $tab = [[mc::_("Armor for"), TextFormat::RED . $args[0]]];
         foreach ([0 => "head", 1 => "body", 2 => "legs", 3 => "boots"] as $slot => $attr) {
             $item = $target->getInventory()->getArmorItem($slot);
             if ($item->getID() == 0) {
                 continue;
             }
             $tab[] = [$attr . TextFormat::BLUE, ItemName::str($item) . " (" . $item->getId() . ":" . $item->getDamage() . ")"];
         }
     }
     return $this->paginateTable($sender, $pageNumber, $tab);
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:35,代码来源:CmdShowInv.php

示例3: onCommand

 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if ($command->getName() == "resign" or $command->getName() == "재생성") {
         $sender->sendMessage(TextFormat::DARK_AQUA . "표지판 재생이 시작됩니다");
         $this->SignRegeneration();
         return true;
     }
     return false;
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:9,代码来源:SignRegeneration.php

示例4: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() == "rminv") {
         return $this->rmInvItem($sender, $args);
     }
     if (count($args) > 1) {
         return false;
     }
     if (count($args) == 0) {
         if (!MPMU::inGame($sender)) {
             return true;
         }
         $target = $sender;
         $other = false;
     } else {
         if (!MPMU::access($sender, "gb.cmd." . $cmd->getName() . ".others")) {
             return true;
         }
         $target = $this->owner->getServer()->getPlayer($args[0]);
         if ($target === null) {
             $sender->sendMessage(mc::_("%1% can not be found.", $args[0]));
             return true;
         }
         $other = true;
     }
     switch ($cmd->getName()) {
         case "fixit":
             $item = clone $target->getInventory()->getItemInHand();
             if ($item->getDamage() == 0) {
                 $sender->sendMessage(mc::_("That item is brand NEW!"));
                 return true;
             }
             $item->setDamage(0);
             $target->getInventory()->setItemInHand($item);
             $target->getInventory()->sendContents($target);
             if ($other) {
                 $target->sendMessage(mc::_("Your currently held item has been fixed by %1%", $sender->getName()));
             }
             $sender->sendMessage(mc::_("%1%'s held item has been fixed", $target->getName()));
             return true;
         case "clearinv":
             InvUtils::clearInventory($target);
             if ($other) {
                 $target->sendMessage(mc::_("Your inventory has been cleared by %1%", $sender->getName()));
             }
             $sender->sendMessage(mc::_("%1%'s inventory cleared", $target->getName()));
             return true;
         case "clearhotbar":
             InvUtils::clearHotbar($target);
             if ($other) {
                 $target->sendMessage(mc::_("Your hotbar has been cleared by %1%", $sender->getName()));
             }
             $sender->sendMessage(mc::_("%1%'s hotbar cleared", $target->getName()));
             return true;
     }
     return false;
 }
开发者ID:0-DevMatthew-0,项目名称:pocketmine-plugins,代码行数:57,代码来源:CmdClearInv.php

示例5: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     $array = array("true", "false");
     if (strtolower($cmd->getName()) === "reason") {
         if (!isset($args[0])) {
             $sender->sendMessage(TF::RED . "Error: not enough args. Usage: /reason < reason >");
             return true;
         } else {
             $new_reason = implode(" ", $args);
             $this->cfg->set("Reason", $new_reason);
             $this->cfg->save();
             $sender->sendMessage(TF::GREEN . "Successfully updated the reason of WhitelistReason!");
             return true;
         }
     }
     if (strtolower($cmd->getName()) === "wr") {
         if (!isset($args[0])) {
             $sender->sendMessage(TF::RED . "Error: not enough args. Usage: /wr < true | false >");
             return true;
         } else {
             if (!in_array($args[0], $array)) {
                 $sender->sendMessage(TF::RED . "Error: invalid argument. Usage: /wr < true | false >");
                 return true;
             } else {
                 $this->cfg->set("Whitelist", $args[0]);
                 $this->cfg->save();
                 $sender->sendMessage(TF::GREEN . "Successfully updated the state of WhitelistReason!");
                 return true;
             }
         }
     }
     if (strtolower($cmd->getName()) === "add") {
         if (!isset($args[0])) {
             $sender->sendMessage(TF::RED . "Error: not enough args. Usage: /add <player>");
             return true;
         } else {
             $players = $this->cfg->get("Players");
             if (in_array($args[0], $players)) {
                 $sender->sendMessage(TF::RED . "Error: " . $args[0] . " is already in the Whitelist!");
                 return true;
             } else {
                 array_push($players, $args[0]);
                 $this->cfg->set("Players", $players);
                 $this->cfg->save();
                 $sender->sendMessage(TF::GREEN . "Successfully added " . $args[0] . " to the Whitelist!");
                 return true;
             }
         }
     }
 }
开发者ID:applqpak,项目名称:WhitelistReason_v2.2.0,代码行数:50,代码来源:Main.php

示例6: onCommand

 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;
 }
开发者ID:BoxOfDevs,项目名称:StaffChests,代码行数:50,代码来源:Main.php

示例7: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (strtolower($cmd->getName()) === "vote") {
         if (isset($args[0]) && isset($args[1])) {
             $answer = $args[0];
             if ($answer === null) {
                 $sender->sendMessage("usage: /vote (yes) or (no)");
                 return false;
             }
             foreach ($this->openVotes as $votes) {
                 if ($answer === "no") {
                     if (in_array($sender->getName(), $this->voters)) {
                         $sender->sendMessage("you voted " . $answer . " on " . $votes . "!");
                         $this->updateNo();
                         return true;
                     } else {
                         $sender->sendMessage("there are no open votes!");
                         return false;
                     }
                 }
                 if ($answer === "yes") {
                     if (in_array($sender->getName(), $this->voters)) {
                         $sender->sendMessage("you voted " . $answer . " on " . $votes . "!");
                         $this->updateYes();
                         return true;
                     } else {
                         $sender->sendMessage("there are no open votes!");
                         return false;
                     }
                 }
             }
         }
     }
     if (strtolower($cmd->getName()) === "newvote") {
         if (!in_array($sender->getName(), $this->voters)) {
             $question = implode(" ", $args);
             foreach ($this->getServer()->getOnlinePlayers() as $onlinep) {
                 $this->getServer()->broadcastMessage($sender->getName() . " made a new vote called " . $question . "! use /vote yes or no to choose your vote");
                 $this->addVote($sender, $question);
                 array_push($this->voters, $onlinep);
                 $task = new task($this, $onlinep);
                 $this->getServer()->getScheduler()->scheduleDelayedTask($task, 20 * 60);
             }
         } else {
             $sender->sendMessage("There is already an open vote!");
             return false;
         }
         return true;
     }
 }
开发者ID:TheGoldenPickle,项目名称:Vote,代码行数:50,代码来源:Main.php

示例8: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() == "rminv") {
         return $this->rmInvItem($sender, $args);
     }
     if (count($args) > 1) {
         return false;
     }
     if (count($args) == 0) {
         if (!MPMU::inGame($sender)) {
             return true;
         }
         $target = $sender;
         $other = false;
     } else {
         if (!MPMU::access($sender, "gb.cmd." . $cmd->getName() . ".others")) {
             return true;
         }
         $target = $this->owner->getServer()->getPlayer($args[0]);
         if ($target === null) {
             $sender->sendMessage(mc::_("%1% can not be found.", $args[0]));
             return true;
         }
         $other = true;
     }
     switch ($cmd->getName()) {
         case "clearinv":
             $target->getInventory()->clearAll();
             if ($other) {
                 $target->sendMessage(mc::_("Your inventory has been cleared by %1%", $sender->getName()));
             }
             $sender->sendMessage(mc::_("%1%'s inventory cleared", $target->getName()));
             return true;
         case "clearhotbar":
             $inv = $target->getInventory();
             for ($i = 0; $i < $inv->getHotbarSize(); $i++) {
                 $inv->setHotbarSlotIndex($i, -1);
             }
             if ($other) {
                 $target->sendMessage(mc::_("Your hotbar has been cleared by %1%", $sender->getName()));
             }
             $sender->sendMessage(mc::_("%1%'s hotbar cleared", $target->getName()));
             // Make sure inventory is updated...
             $inv->sendContents($target);
             return true;
     }
     return false;
 }
开发者ID:jigibbs123,项目名称:pocketmine-plugins,代码行数:48,代码来源:CmdClearInv.php

示例9: onCommand

 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;
                 }
             }
         }
     }
 }
开发者ID:Blubberboy333,项目名称:NotifySounds,代码行数:34,代码来源:Main.php

示例10: onCommand

 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;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:28,代码来源:WpMotdMgr.php

示例11: onCommand

 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;
             }
         }
     }
 }
开发者ID:applqpak,项目名称:WarnPlayer,代码行数:26,代码来源:Main.php

示例12: onCommand

 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;
 }
开发者ID:edwinyoo44,项目名称:pocketmine-plugins,代码行数:32,代码来源:CmdNear.php

示例13: onCommand

 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);
 }
开发者ID:Gabriel865,项目名称:pocketmine-plugins,代码行数:25,代码来源:CmdPlayers.php

示例14: onCommand

 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;
             }
     }
 }
开发者ID:sarhatabaot,项目名称:ChatCensor,代码行数:29,代码来源:Mute.php

示例15: onCommand

 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;
     }
 }
开发者ID:brandon15811,项目名称:PocketDockConsole,代码行数:31,代码来源:Main.php


注:本文中的pocketmine\command\Command::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。