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


PHP mc::_方法代码示例

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


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

示例1: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     echo __METHOD__ . "," . __LINE__ . "\n";
     //##DEBUG
     if (strtolower($cmd->getName()) != "afk") {
         return false;
     }
     if (!MPMU::inGame($sender)) {
         return true;
     }
     $api = $this->owner->api;
     if ($api->isShielded($sender) && $api->isFrozen($sender) && $api->getMute($sender)) {
         // Current AFK'ed
         $msg = count($args) == 0 ? mc::_("%1% is back at keyboard", $sender->getName()) : implode(" ", $args);
         $api->freeze($sender, false);
         $api->setMute($sender, false);
         $api->setShield($sender, false);
     } else {
         $msg = count($args) == 0 ? mc::_("%1% is away from keyboard", $sender->getName()) : implode(" ", $args);
         $api->freeze($sender, true);
         $api->setMute($sender, true);
         $api->setShield($sender, true);
     }
     $this->owner->getServer()->broadcastMessage($msg);
     return true;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:26,代码来源:CmdAFK.php

示例2: 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

示例3: transferPlayer

 /**
  * This will transfer a player and also add the workaround for players
  * lingering connections...
  * @param Player $player
  * @param str $address
  * @param int $port
  * @param str $message
  * @return bool
  */
 public static function transferPlayer(Player $player, $address, $port, $message = null)
 {
     $ft = $player->getServer()->getPluginManager()->getPlugin("FastTransfer");
     if ($ft === null) {
         return false;
     }
     if ($message === null) {
         $message = mc::_("You are being transferred");
     }
     $res = $ft->transferPlayer($player, $address, $port, $message);
     // find out the RakLib interface, which is the network interface that MCPE players connect with
     foreach ($player->getServer()->getNetwork()->getInterfaces() as $interface) {
         if ($interface instanceof RakLibInterface) {
             $raklib = $interface;
             break;
         }
     }
     if (!isset($rakLib)) {
         return $res;
     }
     // calculate the identifier for the player used by RakLib
     $identifier = $player->getAddress() . ":" . $player->getPort();
     // this method call is the most important one -
     // it sends some signal to RakLib that makes it think that the client
     // has clicked the "Quit to Title" button (or timed out). Some RakLib
     // internal stuff will then tell PocketMine that the player has quitted.
     $rakLib->closeSession($identifier, "transfer");
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:37,代码来源:FastTransfer.php

示例4: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     switch (count($args)) {
         case 0:
             if (!MPMU::inGame($sender)) {
                 return true;
             }
             $target = $sender;
             break;
         case 1:
             if (($target = $this->owner->getServer()->getPlayer($args[0])) == null) {
                 $sender->sendMessage(mc::_("%1% not found", $args[0]));
                 return true;
             }
             break;
         default:
             return false;
     }
     $item = clone $target->getInventory()->getItemInHand();
     $sender->sendMesage(TextFormat::BLUE . mc::_("Item: ") . TextFormat::WHITE . ItemName::str($item));
     $sender->sendMesage(TextFormat::BLUE . mc::_("ItemId: ") . TextFormat::WHITE . $item->getId());
     $sender->sendMesage(TextFormat::BLUE . mc::_("Count: ") . TextFormat::WHITE . $item->getCount());
     $sender->sendMesage(TextFormat::BLUE . mc::_("Damage: ") . TextFormat::WHITE . $item->getDamage());
     return true;
 }
开发者ID:0-DevMatthew-0,项目名称:pocketmine-plugins,代码行数:25,代码来源:CmdItemInfo.php

示例5: onSCommand

 public function onSCommand(CommandSender $c, Command $cc, $scmd, $data, array $args)
 {
     if (count($args) != 1) {
         return false;
     }
     $pname = $args[0];
     $mgr = $this->owner->getServer()->getPluginManager();
     $plugin = $mgr->getPlugin($pname);
     if ($plugin === null) {
         $c->sendMessage(mc::_("%1%: plugin not found", $pname));
         return true;
     }
     $getini = [$plugin, "getMessagesIni"];
     if (!is_callable($getini)) {
         $c->sendMessage(mc::_("%1%: does not support dumping messages.ini", $pname));
         return true;
     }
     if (!is_dir($plugin->getDataFolder())) {
         mkdir($plugin->getDataFolder());
     }
     if (file_put_contents($plugin->getDataFolder() . "messages.ini", $getini())) {
         $c->sendMessage(mc::_("%1%: messages.ini created", $pname));
     } else {
         $c->sendMessage(mc::_("%1%: error dumping messages.ini", $pname));
     }
     return true;
 }
开发者ID:jigibbs123,项目名称:pocketmine-plugins,代码行数:27,代码来源:DumpMsgs.php

示例6: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "blowup") {
         return false;
     }
     if (count($args) == 0) {
         return false;
     }
     $pl = $this->owner->getServer()->getPlayer($args[0]);
     if (!$pl) {
         $sender->sendMessage(mc::_("%1% not found.", $args[0]));
         return true;
     }
     array_shift($args);
     $yield = 5;
     $magic = false;
     foreach ($args as $i) {
         if (is_numeric($i)) {
             $yield = intval($i);
             if ($yield < 1) {
                 $yield = 1;
             }
         } elseif (strtolower($i) == "magic") {
             $magic = true;
         } elseif (strtolower($i) == "normal") {
             $magic = false;
         }
     }
     $this->blowPlayer($pl, $yield, $magic);
     return true;
 }
开发者ID:0-DevMatthew-0,项目名称:pocketmine-plugins,代码行数:31,代码来源:CmdBlowUp.php

示例7: dispatchSCmd

 /**
  * Dispatch commands using sub command table
  */
 public function dispatchSCmd(CommandSender $sender, Command $cmd, array $args, $data = null)
 {
     if (count($args) == 0) {
         $sender->sendMessage(mc::_("No sub-command specified"));
         return false;
     }
     $scmd = strtolower(array_shift($args));
     if (isset($this->aliases[$scmd])) {
         $scmd = $this->aliases[$scmd];
     }
     if (!isset($this->executors[$scmd])) {
         $sender->sendMessage(mc::_("Unknown sub-command %2% (try /%1% help)", $cmd->getName(), $scmd));
         return false;
     }
     if (isset($this->permission[$scmd])) {
         if (!$sender->hasPermission($this->permission[$scmd])) {
             $sender->sendMessage(mc::_("You are not allowed to do this"));
             return true;
         }
     }
     $callback = $this->executors[$scmd];
     if ($callback($sender, $cmd, $scmd, $data, $args)) {
         return true;
     }
     if (isset($this->executors["help"])) {
         $callback = $this->executors["help"];
         return $callback($sender, $cmd, $scmd, $data, ["usage"]);
     }
     return false;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:33,代码来源:SubCommandMap.php

示例8: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (strtolower($cmd->getName()) != "wall") {
         return false;
     }
     if (count($args) == 0) {
         return false;
     }
     if ($sender instanceof RemoteConsoleCommandSender && ($who = MPMU::startsWith($args[1], "--rpc=")) !== null) {
         array_shift($args);
         $msg = implode(" ", $args);
         if ($msg != "") {
             $this->owner->getServer()->broadcastMesage(mc::_("WALL:%1% %2%", $who, $msg));
         }
         return true;
     }
     $msg = implode(" ", $args);
     $who = $sender->getName();
     $this->owner->getServer()->broadcastMessage(mc::_("WALL:%1% %2%", $who, $msg));
     $lst = $this->owner->getModule("ServerList");
     foreach ($lst->getIds() as $id) {
         if ($lst->getServerAttr($id, "rcon-pw") === null) {
             continue;
         }
         $host = $lst->getServerAttr($id, "rcon-host");
         $port = $lst->getServerAttr($id, "rcon-port");
         $auth = $lst->getServerAttr($id, "rcon-pw");
         $this->owner->getServer()->getScheduler()->scheduleAsyncTask(new RconTask($this->owner, "rconDone", [$host, $port, $auth], "wall --rpc=" . $who . " " . $msg, [null]));
     }
     return true;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:31,代码来源:CmdWall.php

示例9: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "top") {
         return false;
     }
     switch (count($args)) {
         case 0:
             if (!MPMU::inGame($sender)) {
                 return true;
             }
             $pl = $sender;
             break;
         case 1:
             if (!MPMU::access($sender, "gb.cmd.top.others")) {
                 return true;
             }
             $pl = $this->owner->getServer()->getPlayer($args[0]);
             if (!$pl) {
                 $sender->sendMessage(mc::_("%1% not found", $args[0]));
                 return true;
             }
             break;
         default:
             return false;
     }
     $y = $pl->getLevel()->getHighestBlockAt($pl->getX(), $pl->getZ()) + 1;
     $pl->teleport(new Vector3($pl->getX(), $y, $pl->getZ()));
     return true;
 }
开发者ID:0-DevMatthew-0,项目名称:pocketmine-plugins,代码行数:29,代码来源:CmdTpTop.php

示例10: 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

示例11: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (count($args) !== 0) {
         return false;
     }
     if ($cmd->getName() != "back") {
         return false;
     }
     if (!MPMU::inGame($sender)) {
         return true;
     }
     $pos = $this->getState($sender, null);
     if ($pos == null) {
         $sender->sendMessage(mc::_("No recorded death position to return to"));
         return true;
     }
     list($x, $y, $z, $world) = $pos;
     $level = TPUtils::getLevelByName($this->owner->getServer(), $world);
     if ($level === null) {
         $sender->sendMessage(mc::_("Can not return to your death location"));
         $this->unsetState($sender);
         return true;
     }
     $sender->sendMessage(mc::_("Teleporting to the place of your demise"));
     TPUtils::tpNearBy($sender, new Position($x, $y, $z, $level));
     $this->unsetState($sender);
     return true;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:28,代码来源:CmdTpBack.php

示例12: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if (!MPMU::inGame($sender)) {
         return true;
     }
     switch ($cmd->getName()) {
         case "gmc":
             $mode = 1;
             break;
         case "gms":
             $mode = 0;
             break;
         case "gma":
             $mode = 2;
             break;
         case "gmspc":
             $mode = 3;
             break;
         default:
             return false;
     }
     if ($mode !== $sender->getGamemode()) {
         $sender->setGamemode($mode);
         if ($mode !== $sender->getGamemode()) {
             $sender->sendMessage(TextFormat::RED . mc::_("Unable to change gamemode"));
         } else {
             $this->owner->getServer()->broadcastMessage(mc::_("%1% changed gamemode to %2% mode", $sender->getName(), MPMU::gamemodeStr($mode)));
         }
     } else {
         $sender->sendMessage(mc::_("You are already in %1% mode", MPMU::gamemodeStr($mode)));
     }
     return true;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:33,代码来源:CmdGmx.php

示例13: __construct

 public function __construct($owner)
 {
     parent::__construct($owner);
     PermUtils::add($this->owner, "gb.cmd.top", "top commnad", "op");
     PermUtils::add($this->owner, "gb.cmd.top.others", "top others commnad", "op");
     $this->enableCmd("top", ["description" => mc::_("Teleport player to top most block"), "usage" => mc::_("/top [player]"), "permission" => "gb.cmd.top"]);
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:7,代码来源:CmdTpTop.php

示例14: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     switch (count($args)) {
         case 0:
             if (!MPMU::inGame($sender)) {
                 return true;
             }
             $target = $sender;
             $other = false;
             break;
         case 1:
             if (($target = MPMU::getPlayer($sender, $args[0])) === null) {
                 return true;
             }
             $other = true;
             break;
         default:
             return false;
     }
     $item = clone $target->getInventory()->getItemInHand();
     if ($item->getId() == Item::AIR) {
         if ($other) {
             $sender->sendMessage(mc::_("%1% is holding nothing!", $target->getDisplayName()));
         } else {
             $sender->sendMessage(mc::_("You are holding nothing!"));
         }
         return true;
     }
     $sender->sendMessage(TextFormat::BLUE . mc::_("Item: ") . TextFormat::WHITE . ItemName::str($item));
     $sender->sendMessage(TextFormat::BLUE . mc::_("ItemId: ") . TextFormat::WHITE . $item->getId());
     $sender->sendMessage(TextFormat::BLUE . mc::_("Count: ") . TextFormat::WHITE . $item->getCount());
     $sender->sendMessage(TextFormat::BLUE . mc::_("Damage: ") . TextFormat::WHITE . $item->getDamage());
     return true;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:34,代码来源:CmdItemInfo.php

示例15: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     if ($cmd->getName() != "heal") {
         return false;
     }
     if (count($args) == 0) {
         if (!MPMU::inGame($sender)) {
             return true;
         }
         $sender->setHealth($sender->getMaxHealth());
         $sender->sendMessage(mc::_("You have been healed"));
         return true;
     }
     if (($patient = MPMU::getPlayer($sender, $args[0])) === null) {
         return true;
     }
     if (isset($args[1]) && is_numeric($args[1])) {
         $health = $patient->getHealth() + intval($args[1]);
         if ($health > $patient->getMaxHealth()) {
             $health = $patient->getMaxHealth();
         }
     } else {
         $health = $patient->getMaxHealth();
     }
     $patient->setHealth($health);
     $sender->sendMessage(mc::_("%1% was healed.", $args[0]));
     return true;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:28,代码来源:CmdHeal.php


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