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); }
/** * 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); }
/** * 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); }
public function onEnable() { $cmd = new PluginCommand("customkick", $this); $cmd->setDescription("Kick with custom message"); $cmd->setUsage("/kick <player>"); $cmd->setExecutor($this); $this->getServer()->getCommandMap()->register($this->getDescription()->getName(), $cmd); }
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); }
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); }
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); }
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); }
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); }
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(); }
/** * @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; }
/** * @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; }
/** * @param string $name */ private function registerCommand($name) { $command = new PluginCommand($this->getMessages()->getMessage($name . "-command-name"), $this); $command->setUsage($command->getName()); $command->setDescription($this->getMessages()->getMessage($name . "-command-description")); $this->getServer()->getCommandMap()->register("VIPPlus", $command); }