Exemplo n.º 1
0
 public function registerDefaults()
 {
     $commands = $this->getPlugin()->getConfig()->get("commands");
     if (is_array($commands)) {
         $count = 0;
         foreach ($commands as $command) {
             if (!$this->isCommandStored($command["name"])) {
                 $rcmd = new RCMD(strtolower($command["name"]));
                 $rcmd->setDescription($command["description"]);
                 $rcmd->setPermNode(strtolower($command["permission"]));
                 $rcmd->setPermValue(strtolower($command["value"]));
                 $rcmd->setActions($command["actions"]);
                 $this->addCommand($rcmd);
                 $permission = new Permission($rcmd->getPermNode(), $rcmd->getDescription(), $rcmd->getPermValue());
                 $this->getPlugin()->getServer()->getPluginManager()->addPermission($permission);
                 $count++;
             }
         }
         $this->getPlugin()->getServer()->getLogger()->info("Loaded " . $count . "/" . count($commands) . " RCMD(s).");
     } else {
         $this->getPlugin()->getServer()->getLogger()->critical("Failed to load RCMD(s), please make sure the config file is properly set up.");
     }
 }