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


PHP utils\Config类代码示例

本文整理汇总了PHP中pocketmine\utils\Config的典型用法代码示例。如果您正苦于以下问题:PHP Config类的具体用法?PHP Config怎么用?PHP Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: saveYml

 public function saveYml()
 {
     ksort($this->nn);
     $nn = new Config($this->getServer()->getDataPath() . "/plugins/! MineBlock/" . "NickName.yml", Config::YAML, []);
     $nn->setAll($this->nn);
     $nn->save();
 }
开发者ID:Skull3x,项目名称:MineBlock,代码行数:7,代码来源:NickName.php

示例2: savePlayer

 public function savePlayer(IPlayer $player, array $config)
 {
     $name = trim(strtolower($player->getName()));
     $data = new Config($this->plugin->getDataFolder() . "players/" . $name[0] . "/{$name}.yml", Config::YAML);
     $data->setAll($config);
     $data->save();
 }
开发者ID:JungHyun3459,项目名称:EmailAuth,代码行数:7,代码来源:YAMLDataProvider.php

示例3: saveYml

 public function saveYml()
 {
     $fly = new Config($this->getServer()->getDataPath() . "/plugins/! DeBePlugins/" . "Fly.yml", Config::YAML);
     $fly->setAll($this->fly);
     $fly->save();
     $this->loadYml();
 }
开发者ID:stoastye85,项目名称:Plugins,代码行数:7,代码来源:Fly.php

示例4: checkUpdate

 public function checkUpdate()
 {
     $this->getPlugin()->getServer()->getPluginManager()->callEvent($event = new UpdateCheckingEvent($this->getPlugin(), $this->channel));
     if ($event->isCancelled()) {
         return false;
     }
     if ($this->channel == "beta") {
         $address = "https://api.github.com/repos/cybercube-hk/jail/releases";
     } else {
         $this->plugin->getLogger()->alert("[UPDATER] INVALID CHANNEL!");
         return false;
     }
     $i = json_decode(Utils::getURL($address), true);
     if ($this->channel == "beta") {
         $i = $i[0];
         $this->newversion = substr($i["name"], 6);
         $this->dlurl = $i["assets"][0]["browser_download_url"];
     }
     $plugin = $this->getPlugin();
     if ($plugin::VERSION_STRING !== $this->newversion) {
         $path = $this->plugin->getDataFolder() . "newest-version-download-link.txt";
         echo "\n";
         $this->plugin->getLogger()->info("Your version is too old or too new!  The latest " . $this->channel . " version is: (version: " . $this->newversion . ")");
         $this->plugin->getLogger()->info("Download url for the latest version: §e" . $this->dlurl . "");
         $this->plugin->getLogger()->info("The link is being saved into: §bnewest-version-download-link.txt\n");
         $txt = new Config($path, Config::ENUM);
         $txt->set("Version " . $this->newversion . " -> " . $this->dlurl, true);
         $txt->save();
         return true;
     }
     echo "\n";
     $this->plugin->getLogger()->info("No updates found!  Your Jail version is up-to-date!\n");
     return true;
 }
开发者ID:HerO-0110,项目名称:Jail,代码行数:34,代码来源:UpdateChecker.php

示例5: saveYml

 public function saveYml()
 {
     asort($this->si);
     $si = new Config($this->getServer()->getDataPath() . "/plugins/! MineBlock/" . "SubInventory.yml", Config::YAML);
     $si->setAll($this->si);
     $si->save();
 }
开发者ID:Skull3x,项目名称:MineBlock,代码行数:7,代码来源:SubInventory.php

示例6: setPlayer

 public function setPlayer(IPlayer $player, $rank)
 {
     $fileName = $this->plugin->getDataFolder() . "players/" . strtolower($player->getName()) . ".yml";
     $config = new Config($fileName, Config::YAML, ["name" => $player->getName(), "rank" => $rank]);
     $config->set("rank", $rank);
     $config->save(true);
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:7,代码来源:YamlProvider.php

示例7: onRun

 public function onRun($currentTick)
 {
     $config = new Config($this->getOwner()->getDataFolder() . "dispensers.yml", Config::YAML);
     $config->setAll($this->getOwner()->getDispenserList());
     $config->save();
     $this->getOwner()->getLogger()->info(TextFormat::AQUA . "Auto-saved!");
 }
开发者ID:sJimin,项目名称:EconomyPotionShop,代码行数:7,代码来源:TaskAutoSave.php

示例8: process

 public function process()
 {
     $path = $this->getServer()->getPluginManager()->getPlugin("SimpleAuth")->getDataFolder() . "/players/";
     foreach (glob($path . "*/*.yml") as $file) {
         $data = new Config($file, Config::YAML);
         $pname = trim(strtolower(basename($file, ".yml")));
         $regdate = $data->get("registerdate");
         $logindate = $data->get("logindate");
         $ip = $data->get("lastip");
         $hash = $data->get("hash");
         /*$this->db->query("UPDATE simpleauth_players SET name = 
         		'" . $pname . "', hash = '" . $hash . "', registerdate = '"
         		. $regdate ."', logindate = '" . $logindate . "', lastip = '"
         		. $ip . "' WHERE ");*/
         $result = $this->db->query("INSERT INTO simpleauth_players (name, hash, registerdate, logindate, lastip)\n\t\t\t\t\t\t\t\t\t\tVALUES ('{$pname}', '{$hash}', '{$regdate}', '{$logindate}', '{$ip}')");
         if ($result) {
             $this->users++;
         } else {
             $this->getServer()->getPluginManager()->disablePlugin($this);
             $this->getLogger()->critical("Unable to sumbit user to MySQL Database: Unknown Error. Disabling Plugin...");
         }
         if ($this->users % 100 === 0) {
             $this->getLogger()->notice((string) $this->users . " processed.");
         }
     }
 }
开发者ID:flaxues,项目名称:AuthDataTransfer,代码行数:26,代码来源:Loader.php

示例9: checkConfig

 public function checkConfig()
 {
     if ($this->version > ConfigUpdater::CONFIG_VERSION) {
         $this->tapToDo->getLogger()->warning("The config loaded is not supported. It may not function correctly. ");
     }
     while ($this->version < ConfigUpdater::CONFIG_VERSION) {
         switch ($this->version) {
             case 0:
                 $this->tapToDo->getLogger()->info("Updating config from version 0 to 1...");
                 $blocks = $this->config->getAll();
                 foreach ($blocks as $id => $block) {
                     foreach ($block["commands"] as $i => $command) {
                         if (strpos($command, "%safe") === false && strpos($command, "%op") === false) {
                             $command .= "%pow";
                         }
                         $block["commands"][$i] = str_replace("%safe", "", $command);
                     }
                     $blocks[$id] = $block;
                 }
                 unlink($this->tapToDo->getDataFolder() . "blocks.yml");
                 $this->tapToDo->saveResource("blocks.yml");
                 $this->config = new Config($this->tapToDo->getDataFolder() . "blocks.yml", Config::YAML);
                 $this->config->set("version", 1);
                 $this->config->set("blocks", $blocks);
                 $this->config->save();
                 $this->version = 1;
                 break;
         }
     }
     return $this->config;
 }
开发者ID:CaptainRalph,项目名称:TapToDo,代码行数:31,代码来源:ConfigUpdater.php

示例10: cfgSave

 /**
  * Save a config section to the plugins' config.yml
  *
  * @param str $key - section to save
  * @param mixed $settings - settings to save
  */
 public function cfgSave($key, $settings)
 {
     $cfg = new Config($this->getDataFolder() . "config.yml", Config::YAML);
     $dat = $cfg->getAll();
     $dat[$key] = $settings;
     $cfg->setAll($dat);
     $cfg->save();
 }
开发者ID:Gabriel865,项目名称:pocketmine-plugins,代码行数:14,代码来源:BasicPlugin.php

示例11: save

 public function save()
 {
     $config = new Config($this->path . "protects.yml", Config::YAML);
     $config->setAll($this->yml);
     $config->save();
     $config = new Config($this->path . "options.yml", Config::YAML);
     $config->setAll($this->option);
     $config->save();
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:9,代码来源:SimpleArea_Database.php

示例12: onDisable

 public function onDisable()
 {
     $save = new Config($this->getDataFolder() . "GambleDB.yml", Config::YAML);
     $save->setAll($this->db);
     $save->save();
     $save = new Config($this->getDataFolder() . "lotto.yml", Config::YAML);
     $save->setAll($this->lotto);
     $save->save();
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:9,代码来源:EconomyGamble.php

示例13: onDisable

 public function onDisable()
 {
     $config = new Config($this->getDataFolder() . "donators.yml", Config::YAML, array());
     $config->setAll($this->donators);
     $config->save();
     $kits = new Config($this->getDataFolder() . "kits.yml", Config::YAML, array());
     $kits->setAll($this->kits);
     $kits->save();
 }
开发者ID:RedstoneAlmeida,项目名称:KitSexy,代码行数:9,代码来源:KitSexy.php

示例14: init

 public static function init()
 {
     if (!file_exists($this->plugin->dataDir . $this->filename . ".yml")) {
         $this->plugin->getLogger()->info(TextFormat::RED . "Can't find " . $this->filename . " creating new one !");
         $d = new Config($this->plugin->dataDir . $this->filename . ".yml", Config::YAML, array());
         $d->save();
         return $d;
     }
     return new Config($this->plugin->dataDir . $this->filename . ".yml", Config::YAML, array());
 }
开发者ID:survicraft,项目名称:pocketmine-BlockHunt,代码行数:10,代码来源:ConfigX.php

示例15: onDisable

 public function onDisable()
 {
     $save = new Config($this->getDataFolder() . "database.yml", Config::YAML);
     $save->setAll($this->db);
     $save->save();
     if ($this->interlocker->dummyPlayer instanceof DummyPlayer) {
         $this->interlocker->dummyPlayer->loggedIn = false;
         $this->interlocker->dummyPlayer->close();
     }
 }
开发者ID:n15001,项目名称:Chatty,代码行数:10,代码来源:Chatty.php


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