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


PHP PluginCommand::setPermission方法代码示例

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


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

示例1: onEnable

 public function onEnable()
 {
     $this->getServer()->getLogger()->info(Color::BLUE . "이 플러그인은 Light-EULA가 적용되있는 플러그인입니다.");
     $this->getServer()->getLogger()->info(Color::BLUE . "이 플러그인을 사용시 Light-EULA에 동의하는것으로 간주합니다.");
     $this->getServer()->getLogger()->info(Color::BLUE . "라이센스->https://raw.githubusercontent.com/LightBlue7/Light-EULA/master/LICENSE.md");
     if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") == null) {
         $this->getLogger()->error("이코노미 플러그인을 찾을 수 없습니다.EconomyAPi플러그인을 적용해주세요.");
         $this->getServer()->getPluginManager()->disablePlugin($this);
     }
     $this->LoadConfig();
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
     $commandMap = $this->getServer()->getCommandMap();
     $command = new PluginCommand("회사설정", $this);
     $command->setDescription("OP전용 회사명령어입니다.");
     $command->setPermission("companycreation.command.allow");
     $command->setUsage(Color::RED . "/회사설정 도움말|생성비|오피생성|세금비용설정|유지비설정|리셋|페쇄");
     $commandMap->register("회사설정", $command);
     $command = new PluginCommand("회사관리", $this);
     $command->setDescription("회장전용 회사관리 명령어입니다.");
     $command->setPermission("companycontrol.command.allow");
     $command->setUsage(Color::RED . "/회사관리 도움말|영입|모집|해고|페쇄");
     $commandMap->register("회사관리", $command);
     $command = new PluginCommand("회사", $this);
     $command->setDescription("회사원및회장전용 명령어입니다.");
     $command->setPermission("company.command.allow");
     $command->setUsage(Color::RED . "/회사 도움말|생성|리스트|초대수락|정보|사람|채팅|퇴사");
     $commandMap->register("회사", $command);
 }
开发者ID:LightBlue7,项目名称:OneCompany,代码行数:28,代码来源:OneCompany.php

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

示例3: registerCommand

 /**
  * Register the plug-in command
  *
  * @param string $name
  * @param string $permission
  * @param string $description
  * @param string $usage
  */
 public function registerCommand($name, $permission, $description = "", $usage = "")
 {
     $command = new PluginCommand($name, $this->plugin);
     $command->setDescription($description);
     $command->setPermission($permission);
     $command->setUsage($usage);
     Server::getInstance()->getCommandMap()->register($name, $command);
 }
开发者ID:ChalkPE,项目名称:ExamplePlugin,代码行数:16,代码来源:PluginDatabase.php

示例4: registerCommand

 public function registerCommand($name, $fallback, $permission, $description = "", $usage = "")
 {
     $commandMap = $this->getServer()->getCommandMap();
     $command = new PluginCommand($name, $this);
     $command->setDescription($description);
     $command->setPermission($permission);
     $command->setUsage($usage);
     $commandMap->register($fallback, $command);
 }
开发者ID:JungHyun3459,项目名称:PMMP-Plugins,代码行数:9,代码来源:DirectAuction.php

示例5: onEnable

 public function onEnable()
 {
     $this->getLogger()->alert("본 플러그인은 Light-EULA를 사용합니다.");
     $this->getLogger()->alert("이 플러그인을 사용시 Light-EULA라이센스에 동의하는 것으로 간주합니다.");
     $this->getLogger()->alert("라이센스->https://github.com/LightBlue7/Light-EULA/blob/master/LICENSE.md");
     $commandMap = $this->getServer()->getCommandMap();
     $command = new PluginCommand("ChatClear", $this);
     $command->setDescription("채팅을 청소합니다.");
     $command->setPermission("ChatClear.command.allow");
     $command->setUsage("/ChatClear");
     $commandMap->register("ChatClear", $command);
 }
开发者ID:LightBlue7,项目名称:ChatClear,代码行数:12,代码来源:ChatClear.php

示例6: onEnable

 public function onEnable()
 {
     if (!is_dir($this->getDataFolder())) {
         mkdir($this->getDataFolder());
     }
     mc::plugin_init($this, $this->getFile());
     $wp = $this->getServer()->getPluginManager()->getPlugin("WorldProtect");
     if ($wp !== null && version_compare($wp->getDescription()->getVersion(), "2.1.0") < 0) {
         $this->getLogger()->warning(TextFormat::RED . mc::_("This version of SignWarp requires"));
         $this->getLogger()->warning(TextFormat::RED . mc::_("at least version 2.1.0 of WorldProtect"));
         $this->getLogger()->warning(TextFormat::RED . mc::_("Only version %1% available", $wp->getDescription()->getVersion()));
         throw new \RuntimeException("Runtime checks failed");
         return;
     }
     $defaults = ["version" => $this->getDescription()->getVersion(), "# settings" => "configurable variables", "settings" => ["# dynamic updates" => "Signs will be udpated with the number of players in a world", "dynamic-updates" => true, "# xyz.cmd" => "If true, the **xyz** command will be available", "xyz.cmd" => true], "# text" => "Text displayed on the different signs", "text" => ["# transfer" => "Fast transfer signs", "transfer" => ["[TRANSFER]"], "# world" => "World teleport signs", "world" => ["[WORLD]"], "# warp" => "Local world teleport signs", "warp" => ["[WARP]", "[SWARP]"], "# players" => "Text to use when displaying player counts", "players" => ["Players:"]]];
     $cfg = (new Config($this->getDataFolder() . "config.yml", Config::YAML, $defaults))->getAll();
     if ($this->getServer()->getPluginManager()->getPlugin("FastTransfer")) {
         $this->getLogger()->info(TextFormat::GREEN . mc::_("Enabling FastTransfer support"));
     } else {
         $this->getLogger()->warning(TextFormat::BLUE . mc::_("Disabling FastTransfer support"));
         $cfg["text"]["transfer"] = [];
     }
     $this->text = ["sign" => []];
     foreach (["world", "warp", "transfer"] as $n) {
         $thist->text[$n] = [];
         foreach ($cfg["text"][$n] as $m) {
             $this->text[$n][$m] = $m;
             $this->text["sign"][$m] = $m;
         }
     }
     $this->text["players"] = $cfg["text"]["players"];
     if ($cfg["settings"]["xyz.cmd"]) {
         $newCmd = new PluginCommand("xyz", $this);
         $newCmd->setDescription(mc::_("Returns x,y,z coordinates"));
         $newCmd->setUsage(mc::_("/xyz"));
         $newCmd->setPermission("signwarp.cmd.xyz");
         $cmdMap = $this->getServer()->getCommandMap();
         $cmdMap->registerAll($this->getDescription()->getName(), [$newCmd]);
         $this->getLogger()->info(TextFormat::GREEN . mc::_("enabled /xyz command"));
     }
     if ($cfg["settings"]["dynamic-updates"]) {
         $this->getLogger()->info(TextFormat::GREEN . mc::_("dynamic-updates: ON"));
         $tt = new PluginCallbackTask($this, [$this, "updateSigns"], []);
         $this->getServer()->getScheduler()->scheduleRepeatingTask($tt, 40);
     } else {
         $this->getLogger()->info(TextFormat::YELLOW . mc::_("dynamic-updates: OFF"));
     }
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:49,代码来源:Main.php

示例7: onEnable

 public function onEnable()
 {
     $this->CompanyDB = (new Config($this->getDataFolder() . "Company.json", Config::JSON))->getAll();
     if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") == null) {
         $this->getLogger()->error($this->get("cant-find-economyapi"));
         $this->getServer()->getPluginManager()->disablePlugin($this);
     }
     $this->economy = EconomyAPI::getInstance();
     $this->Loadconfig();
     $this->getServer()->getPluginManager()->registerEvent($this, $this);
     $commandmap = $this->getServer()->getCommandMap();
     $command = new PluginCommand("회사", $this);
     $command->setDescription("회사를 개설합니다.");
     $command->setUsage("사용법 : /회사 생성 | 양도 | 목록 | 회사원추가 | 회사원목록 | 폐쇠");
     $command->setPermission("Company.command.allow");
     $command->register("회사", $command);
 }
开发者ID:psh3253,项目名称:OneCompany,代码行数:17,代码来源:OneCompany.php

示例8: onEnable

 public function onEnable()
 {
     $this->getServer()->getLogger()->alert(Color::BLUE . "이 플러그인은 Light-EULA가 적용되있는 플러그인입니다.");
     $this->getServer()->getLogger()->alert(Color::BLUE . "이 플러그인을 사용시 Light-EULA에 동의하는것으로 간주합니다.");
     $this->getServer()->getLogger()->alert(Color::BLUE . "라이센스->https://raw.githubusercontent.com/LightBlue7/Light-EULA/master/LICENSE.md");
     if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") == null) {
         $this->getLogger()->error("이코노미 플러그인을 찾을 수 없습니다.EconomyAPi플러그인을 적용해주세요.");
         $this->getServer()->getPluginManager()->disablePlugin($this);
     }
     $this->LoadConfig();
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
     $commandMap = $this->getServer()->getCommandMap();
     $command = new PluginCommand("은행", $this);
     $command->setDescription("서버에서 은행을 이용할 수 있는 명령어입니다.");
     $command->setPermission("OneBank.command.allow");
     $command->setUsage("/은행 <입금|출금|대출>");
     $commandMap->register("은행", $command);
 }
开发者ID:Assistance-Team,项目名称:OneBank,代码行数:18,代码来源:OneBank.php

示例9: onEnable

 public function onEnable()
 {
     $this->initMessage();
     $this->CompanyDB = (new Config($this->getDataFolder() . "Company.json", Config::JSON))->getAll();
     if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") != null) {
         $this->economyAPI = \onebone\economyapi\EconomyAPI::getInstance();
     } else {
         $this->getLogger()->error($this->get("there-are-no-economyapi"));
         $this->getServer()->getPluginManager()->disablePlugin($this);
     }
     $commandMap = $this->getServer()->getCommandMap();
     $command = new PluginCommand("회사", $this);
     $command->setDescription("회사를 개설합니다.");
     $command->setUsage("사용법 : /회사 생성 | 양도 | 목록 | 회사원추가 | 회사원목록 | 폐쇠");
     $command->setPermission("Company.command.allow");
     $commandMap->register("회사", $command);
     $this->saveResource("config.yml", false);
     $this->CompanyPrice = (new Config($this->getDataFolder() . "Config.yml", Config::YAML))->getAll();
 }
开发者ID:wsj7178,项目名称:OneCompany,代码行数:19,代码来源:OneCompany.php

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

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