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


PHP Config::set方法代码示例

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


在下文中一共展示了Config::set方法的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: onLoad

 public function onLoad()
 {
     $this->saveDefaultConfig();
     $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML);
     $version = $this->getDescription()->getVersion();
     if ($this->config->get("version") != $version) {
         $this->config->set("version", $version);
         $this->fixOldConfig();
     }
     $this->purePerms = $this->getServer()->getPluginManager()->getPlugin("PurePerms");
 }
开发者ID:mad-hon,项目名称:PureChat,代码行数:11,代码来源:PureChat.php

示例3: registerPlayer

 public function registerPlayer(IPlayer $player, $hash)
 {
     $name = trim(strtolower($player->getName()));
     @mkdir($this->plugin->getDataFolder() . "players/" . $name[0] . "/");
     $data = new Config($this->plugin->getDataFolder() . "players/" . $name[0] . "/{$name}.yml", Config::YAML);
     $data->set("registerdate", time());
     $data->set("logindate", time());
     $data->set("lastip", null);
     $data->set("hash", $hash);
     $data->save();
     return $data->getAll();
 }
开发者ID:JungHyun3459,项目名称:EmailAuth,代码行数:12,代码来源:YAMLDataProvider.php

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

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

示例6: add

 public function add($name, $warp)
 {
     $past = $this->config->get($name, null);
     $this->config->set($name, $warp);
     $this->config->save();
     return $past;
 }
开发者ID:TBNRFrags2468,项目名称:Economy,代码行数:7,代码来源:YAMLStore.php

示例7: touchIP

 public function touchIP($ip)
 {
     if (!$this->ipList->exists($ip)) {
         $this->ipList->set($ip);
         return false;
     }
     return true;
 }
开发者ID:MCPEGamerJPatGitHub,项目名称:xEcon,代码行数:8,代码来源:JSONDataProvider.php

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

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

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

示例11: changeMyPassword

 private function changeMyPassword($sender, $args)
 {
     if ($this->plugin->passChange) {
         if (in_array($args[1])) {
             $pass = $args[1];
             $pass = md5($pass);
             $this->plugin->chatprotection[$sender->getId()] = $pass;
             if ($this->plugin->provider === "yml") {
                 $myuser = new Config($this->plugin->getDataFolder() . "players/" . strtolower($event->getPlayer()->getName() . ".yml"), Config::YAML);
                 $myuser->set("password", $pass);
                 $myuser->set("version", $this->pluin->version);
                 $Myuser->save();
             } elseif ($this->plugin->provider === "mysql") {
             }
         }
     }
 }
开发者ID:EpicArtz08999,项目名称:xAuth,代码行数:17,代码来源:CommandManager.php

示例12: saveBlock

 /**
  * @param Block $block
  */
 public function saveBlock(Block $block)
 {
     $this->blocks[$block->getPosition()->getX() . ":" . $block->getPosition()->getY() . ":" . $block->getPosition()->getZ() . ":" . $block->getPosition()->getLevel()->getName()] = $block;
     $blocks = $this->config->get("blocks");
     $blocks[$block->id] = $block->toArray();
     $this->config->set("blocks", $blocks);
     $this->config->save();
 }
开发者ID:DWWf,项目名称:TapToDo-LEET.CC,代码行数:11,代码来源:TapToDo.php

示例13: addSign

 /**
  * Add a new 1vs1 sign
  */
 public function addSign(Sign $signTile)
 {
     $signs = $this->config->signs;
     $signs[count($this->signTiles)] = [$signTile->getX(), $signTile->getY(), $signTile->getZ(), $signTile->getLevel()->getName()];
     $this->config->set("signs", $signs);
     $this->config->save();
     array_push($this->signTiles, $signTile);
 }
开发者ID:bjorguv,项目名称:pocketmine-1vs1-plugin,代码行数:11,代码来源:ArenaManager.php

示例14: saveConfig

 public function saveConfig()
 {
     $this->mineData->setAll([]);
     foreach ($this->mines as $n => $mine) {
         $this->mineData->set($n, [$mine->getA()->getX(), $mine->getB()->getX(), $mine->getA()->getY(), $mine->getB()->getY(), $mine->getA()->getZ(), $mine->getB()->getZ(), count($mine->getData()) > 0 ? $mine->getData() : false, $mine->getLevel()->getName()]);
     }
     $this->mineData->save();
 }
开发者ID:MCPEGamerJPatGitHub,项目名称:MineReset,代码行数:8,代码来源:MineReset.php

示例15: updatePerms

 public function updatePerms()
 {
     foreach ($this->getServer()->getPluginManager()->getPermissions() as $perm) {
         if (!$this->permsConfig->exists($perm->getName(), true)) {
             $this->permsConfig->set(strtolower($perm->getName()), $this->getDefaultIndex($perm->getDefault()));
         }
     }
     $all = $this->permsConfig->getAll();
     asort($all, SORT_FLAG_CASE | SORT_NATURAL);
     $this->permsConfig->setAll($all);
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:11,代码来源:NumericRanks.php


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