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


PHP PluginCommand::setPermissionMessage方法代码示例

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


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

示例1: enableCmd

 /**
  * Register this class as a command.
  *
  * @param str $cmd - command to register
  * @param mixed[] $yaml - options for command
  */
 public function enableCmd($cmd, $yaml)
 {
     $newCmd = new PluginCommand($cmd, $this->owner);
     if (isset($yaml["description"])) {
         $newCmd->setDescription($yaml["description"]);
     }
     if (isset($yaml["usage"])) {
         $newCmd->setUsage($yaml["usage"]);
     }
     if (isset($yaml["aliases"]) and is_array($yaml["aliases"])) {
         $aliasList = [];
         foreach ($yaml["aliases"] as $alias) {
             if (strpos($alias, ":") !== false) {
                 $this->owner->getLogger()->info("Unable to load alias {$alias}");
                 continue;
             }
             $aliasList[] = $alias;
         }
         $newCmd->setAliases($aliasList);
     }
     if (isset($yaml["permission"])) {
         $newCmd->setPermission($yaml["permission"]);
     }
     if (isset($yaml["permission-message"])) {
         $newCmd->setPermissionMessage($yaml["permission-message"]);
     }
     $newCmd->setExecutor($this);
     $cmdMap = $this->owner->getServer()->getCommandMap();
     $cmdMap->register($this->owner->getDescription()->getName(), $newCmd);
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:36,代码来源:BasicCli.php

示例2: parseYamlCommands

 /**
  * @param Plugin $plugin
  *
  * @return PluginCommand[]
  */
 protected function parseYamlCommands(Plugin $plugin)
 {
     $pluginCmds = [];
     foreach ($plugin->getDescription()->getCommands() as $key => $data) {
         if (strpos($key, ":") !== false) {
             $this->server->getLogger()->critical($this->server->getLanguage()->translateString("pocketmine.plugin.commandError", [$key, $plugin->getDescription()->getFullName()]));
             continue;
         }
         if (is_array($data)) {
             $newCmd = new PluginCommand($key, $plugin);
             if (isset($data["description"])) {
                 $newCmd->setDescription($data["description"]);
             }
             if (isset($data["usage"])) {
                 $newCmd->setUsage($data["usage"]);
             }
             if (isset($data["aliases"]) and is_array($data["aliases"])) {
                 $aliasList = [];
                 foreach ($data["aliases"] as $alias) {
                     if (strpos($alias, ":") !== false) {
                         $this->server->getLogger()->critical($this->server->getLanguage()->translateString("pocketmine.plugin.aliasError", [$alias, $plugin->getDescription()->getFullName()]));
                         continue;
                     }
                     $aliasList[] = $alias;
                 }
                 $newCmd->setAliases($aliasList);
             }
             if (isset($data["permission"])) {
                 $newCmd->setPermission($data["permission"]);
             }
             if (isset($data["permission-message"])) {
                 $newCmd->setPermissionMessage($data["permission-message"]);
             }
             $pluginCmds[] = $newCmd;
         }
     }
     return $pluginCmds;
 }
开发者ID:TylerGames,项目名称:PocketMine-MP,代码行数:43,代码来源:PluginManager.php

示例3: parseYamlCommands

 /**
  * @param Plugin $plugin
  *
  * @return PluginCommand[]
  */
 protected function parseYamlCommands(Plugin $plugin)
 {
     $pluginCmds = [];
     foreach ($plugin->getDescription()->getCommands() as $key => $data) {
         if (strpos($key, ":") !== false) {
             $this->server->getLogger()->critical("Could not load command " . $key . " for plugin " . $plugin->getDescription()->getName());
             continue;
         }
         if (is_array($data)) {
             $newCmd = new PluginCommand($key, $plugin);
             if (isset($data["description"])) {
                 $newCmd->setDescription($data["description"]);
             }
             if (isset($data["usage"])) {
                 $newCmd->setUsage($data["usage"]);
             }
             if (isset($data["aliases"]) and is_array($data["aliases"])) {
                 $aliasList = [];
                 foreach ($data["aliases"] as $alias) {
                     if (strpos($alias, ":") !== false) {
                         $this->server->getLogger()->critical("Could not load alias " . $alias . " for plugin " . $plugin->getDescription()->getName());
                         continue;
                     }
                     $aliasList[] = $alias;
                 }
                 $newCmd->setAliases($aliasList);
             }
             if (isset($data["permission"])) {
                 $newCmd->setPermission($data["permission"]);
             }
             if (isset($data["permission-message"])) {
                 $newCmd->setPermissionMessage($data["permission-message"]);
             }
             $pluginCmds[] = $newCmd;
         }
     }
     return $pluginCmds;
 }
开发者ID:hlogeon,项目名称:PocketMineJs-MP,代码行数:43,代码来源:PluginManager.php


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