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


PHP Config::save方法代码示例

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


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

示例1: setExempt

 /**
  * @param Player $player
  * @param bool $value
  */
 public function setExempt(Player $player, $value = true)
 {
     if ($value) {
         $this->exempts->set(strtolower($player->getName()));
         $this->exempts->save();
     } else {
         $this->exempts->remove(strtolower($player->getName()));
         $this->exempts->save();
     }
 }
开发者ID:happyexceed,项目名称:PocketMine-Plugins-1,代码行数:14,代码来源:iManager.php

示例2: onCommand

 public function onCommand(CommandSender $sender, Command $cmd, $label, array $sub)
 {
     @mkdir($this->getServer()->getDataPath() . "/plugins/! DeBePlugins/");
     $korean = new Config($this->getServer()->getDataPath() . "/plugins/! DeBePlugins/" . "! Korean.yml", Config::YAML, ["Korean" => false]);
     if ($korean->get("Korean")) {
         $korean->set("Korean", false);
         $m = "설정";
     } else {
         $korean->set("Korean", true);
         $m = "해제";
     }
     $sender->sendMessage("[Korean] 한국말 {$m}");
     $korean->save();
     return true;
 }
开发者ID:stoastye85,项目名称:Plugins,代码行数:15,代码来源:Korean.php

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

示例4: saveChests

 public function saveChests()
 {
     $save = [];
     foreach ($this->chests as $chest) {
         /** @var ChestPattern $pattern */
         $pattern = $chest->getPattern();
         $save[] = ["x" => $chest->getPosition()->x, "y" => $chest->getPosition()->y, "z" => $chest->getPosition()->z, "levelName" => $chest->getPosition()->getLevel()->getName(), "patternName" => $pattern::getName(), "patternArgs" => $pattern->getPatternData()];
     }
     $this->config->setAll($save);
     $this->config->save();
 }
开发者ID:KidPlaysMCPE,项目名称:ChestRefill,代码行数:11,代码来源:FlatFileStore.php

示例5: saveSession

 private function saveSession()
 {
     $values = [];
     foreach (self::$configDefaults as $k => $v) {
         if ($k !== "mutedUntil") {
             $values[$k] = $this->{$k};
         } else {
             // Use '$this->{$k}' so we can later implement more time handlers without problems...
             $values[$k] = $this->{$k} instanceof \DateTime ? $this->{$k}->getTimestamp() : $v;
         }
     }
     $this->config->setAll($values);
     $this->config->save();
 }
开发者ID:ZencraftYouTube,项目名称:EssentialsPE,代码行数:14,代码来源:BaseSession.php

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

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

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

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

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

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

示例12: onJoin

 public function onJoin(PlayerJoinEvent $event)
 {
     $name = $event->getPlayer()->getDisplayName();
     $ip = $event->getPlayer()->getAddress();
     if (is_file($this->getDataFolder() . "players/lastip/" . $name[0] . "/" . $name . ".yml")) {
         unlink($this->getDataFolder() . "players/lastip/" . $name[0] . "/" . $name . ".yml");
         $name = $event->getPlayer()->getDisplayName();
         $ip = $event->getPlayer()->getAddress();
         @mkdir($this->getDataFolder() . "players/lastip/" . $name[0] . "", 0777, true);
         $lastip = new Config($this->getDataFolder() . "players/lastip/" . $name[0] . "/" . $name . ".yml", CONFIG::YAML, array("lastip" => "" . $ip . ""));
         $lastip->save();
         @mkdir($this->getDataFolder() . "players/ip/" . $ip[0] . "", 0777, true);
         $ipfile = new Config($this->getDataFolder() . "players/ip/" . $ip[0] . "/" . $ip . ".txt", CONFIG::ENUM);
         $ipfile->set($name);
         $ipfile->save();
     } else {
         $name = $event->getPlayer()->getDisplayName();
         $ip = $event->getPlayer()->getAddress();
         @mkdir($this->getDataFolder() . "players/lastip/" . $name[0] . "", 0777, true);
         $lastip = new Config($this->getDataFolder() . "players/lastip/" . $name[0] . "/" . $name . ".yml", CONFIG::YAML, array("lastip" => "" . $ip . ""));
         $lastip->save();
         @mkdir($this->getDataFolder() . "players/ip/" . $ip[0] . "", 0777, true);
         $ipfile = new Config($this->getDataFolder() . "players/ip/" . $ip[0] . "/" . $ip . ".txt", CONFIG::ENUM);
         $ipfile->set($name);
         $ipfile->save();
     }
 }
开发者ID:youvento,项目名称:Alias,代码行数:27,代码来源:MainClass.php

示例13: save

 public function save($path)
 {
     $name = $this->name;
     $data = new Config($path . "{$name}.yml", Config::YAML);
     $data->set("name", $name);
     $data->set("eid", $this->eid);
     $data->set("type", $this->type);
     $data->set("networkId", $this->networkId);
     $data->set("levelName", $this->levelName);
     $data->set("itemOnHand", $this->itemOnHand);
     $data->set("armorHelmet", $this->armorHelmet);
     $data->set("armorChestplate", $this->armorChestplate);
     $data->set("armorLegging", $this->armorLegging);
     $data->set("armorBoots", $this->armorBoots);
     if ($this->position != null && $this->position != false) {
         $data->set("positionX", round($this->position->x));
         $data->set("positionY", round($this->position->y));
         $data->set("positionZ", round($this->position->z));
     }
     $data->set("kitBlock", $this->kitBlock);
     $data->set("particles", $this->particles);
     $data->set("destinationLevelName", $this->destinationLevelName);
     if ($this->destinationPos != null && $this->destinationPos != false) {
         $data->set("destinationPosX", round($this->destinationPos->x));
         $data->set("destinationPosY", round($this->destinationPos->y));
         $data->set("destinationPosZ", round($this->destinationPos->z));
     }
     $data->set("cost", $this->cost);
     $data->set("message", $this->message);
     $data->set("category", $this->category);
     $data->save();
 }
开发者ID:robozeri,项目名称:SG,代码行数:32,代码来源:StatueModel.php

示例14: saveInventory

 public function saveInventory(Player $player, Inventory $inv)
 {
     $n = trim(strtolower($player->getName()));
     if ($n === "") {
         return false;
     }
     $d = substr($n, 0, 1);
     if (!is_dir($this->getDataFolder() . $d)) {
         mkdir($this->getDataFolder() . $d);
     }
     $path = $this->getDataFolder() . $d . "/" . $n . ".yml";
     $cfg = new Config($path, Config::YAML);
     $yaml = $cfg->getAll();
     if ($this->isGlobal) {
         $ln = "*";
     } else {
         $ln = trim(strtolower($player->getLevel()->getName()));
     }
     $yaml[$ln] = [];
     foreach ($inv->getContents() as $slot => &$item) {
         $yaml[$ln][$slot] = implode(":", [$item->getId(), $item->getDamage(), $item->getCount()]);
     }
     $inv->clearAll();
     $cfg->setAll($yaml);
     $cfg->save();
     return true;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:27,代码来源:YamlMgr.php

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


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