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


PHP Config::exists方法代码示例

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


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

示例1: touchIP

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

示例2: getConfigurationValue

 /**
  * @param string $key
  * @param mixed $default
  *
  * @return mixed
  */
 public function getConfigurationValue($key, $default = false)
 {
     if ($this->config->exists($key)) {
         return $this->config->get($key);
     }
     return $default;
 }
开发者ID:KarNomz,项目名称:EconomyS,代码行数:13,代码来源:EconomyAPI.php

示例3: getMessage

 public function getMessage($key, $val = array("%1", "%2", "%3"))
 {
     if ($this->lang->exists($key)) {
         return str_replace(array("%MONETARY_UNIT%", "%1", "%2", "%3"), array(EconomyAPI::getInstance()->getMonetaryUnit(), $val[0], $val[1], $val[2]), $this->lang->get($key));
     }
     return "There are no message which has key \"{$key}\"";
 }
开发者ID:junknight,项目名称:EconomyS,代码行数:7,代码来源:EconomyShop.php

示例4: onPlayerJoin

 public function onPlayerJoin(PlayerJoinEvent $event)
 {
     $name = $event->getPlayer()->getName();
     if (!$this->users->exists($name)) {
         $this->users->set($name, array('slot1' => null, 'slot2' => null));
         $this->users->save();
     }
 }
开发者ID:Zippy444,项目名称:PocketJobs,代码行数:8,代码来源:PocketJobs.php

示例5: __construct

 /**
  * @param Loader $plugin
  * @param string $originalFile
  */
 public function __construct(Loader $plugin, $originalFile)
 {
     $oF = fopen($originalFile, "rb");
     $originalInfo = fread($oF, filesize($originalFile));
     fclose($oF);
     $oFS = fopen($originalFileSave = $plugin->getDataFolder() . "MessagesOriginal.yml", "w+");
     fwrite($oFS, $originalInfo);
     fclose($oFS);
     $this->original = new Config($originalFileSave, Config::YAML);
     unlink($originalFileSave);
     $plugin->saveResource("Messages.yml");
     $this->config = new Config($file = $plugin->getDataFolder() . "Messages.yml", Config::YAML);
     if (!$this->config->exists("version") || $this->config->get("version") !== self::VERSION) {
         $plugin->getLogger()->debug(TextFormat::RED . "An invalid language file was found, generating a new one...");
         unlink($file);
         $plugin->saveResource("Messages.yml", true);
         $this->config = new Config($file, Config::YAML);
     }
 }
开发者ID:PrimusLV,项目名称:EssentialsPE,代码行数:23,代码来源:MessagesAPI.php

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

示例7: removeShop

 public function removeShop($x, $y = 0, $z = 0, $level = null)
 {
     if ($x instanceof Position) {
         $y = $x->getFloorY();
         $z = $x->getFloorZ();
         $level = $x->getLevel();
         $x = $x->getFloorX();
     }
     if ($level instanceof Level) {
         $level = $level->getFolderName();
     }
     if ($this->config->exists($x . ":" . $y . ":" . $z . ":" . $level)) {
         $this->config->remove($x . ":" . $y . ":" . $z . ":" . $level);
         return true;
     }
     return false;
 }
开发者ID:Tolo0,项目名称:EconomyS,代码行数:17,代码来源:YamlDataProvider.php

示例8: __construct

 public function __construct(SignShop $SignShop, $dataResources)
 {
     $this->SignShop = $SignShop;
     $file_message = new Config($dataResources . "messages.yml", Config::YAML, $this->message);
     $this->dataResources = $dataResources;
     if ($file_message->get("version_mex") != "oneone") {
         $SignShop->getServer()->getLogger()->info(TextFormat::RED . "Please update the file messages.yml");
     }
     foreach ($this->message as $var => $c) {
         if ($file_message->exists($var) && isset($file_message->get($var)["message"]) && !empty($file_message->get($var)["message"])) {
             $c = $file_message->get($var)["message"];
         } else {
             $c = str_replace("_", " ", $var);
         }
         $this->message[$var]["message"] = $c;
     }
     $this->message["version_mex"] = "oneone";
     $file_message->setAll($this->message);
     $file_message->save();
 }
开发者ID:PocketMine-PHP7,项目名称:SignShop-PHP7,代码行数:20,代码来源:MessageManager.php

示例9: parseData

 private function parseData($moneyFile)
 {
     $moneyCfg = new Config($moneyFile, Config::YAML);
     $this->moneyFile = $moneyCfg;
     if ($moneyCfg->exists("version")) {
         $this->version = $moneyCfg->get("version");
     } else {
         $this->version = self::VERSION_1;
     }
     if ($this->version === self::VERSION_1) {
         $this->moneyData = $moneyCfg->get("money");
     } else {
         switch ($this->version) {
             case self::VERSION_2:
                 $money = [];
                 foreach ($moneyCfg->get("money") as $player => $m) {
                     $money[strtolower($player)] = $m;
                 }
                 $this->moneyData = $money;
                 break;
         }
     }
 }
开发者ID:junknight,项目名称:EconomyS,代码行数:23,代码来源:DataConverter.php

示例10: isOp

 /**
  * @param string $name
  *
  * @return bool
  */
 public function isOp($name)
 {
     return $this->operators->exists($name, true);
 }
开发者ID:ZenaGamingsky,项目名称:PocketBox,代码行数:9,代码来源:Server.php

示例11: onCommand

 public function onCommand(CommandSender $sender, Command $command, $label, array $params)
 {
     switch (array_shift($params)) {
         case "join":
             if (!$sender instanceof Player) {
                 $sender->sendMessage("Please run this command in-game.");
             }
             if ($this->player->exists($sender->getName())) {
                 $sender->sendMessage("You already have joined job.");
             } else {
                 $job = array_shift($params);
                 if (trim($job) === "") {
                     $sender->sendMessage("Usage: /job join <name>");
                     break;
                 }
                 if ($this->jobs->exists($job)) {
                     $this->player->set($sender->getName(), $job);
                     $sender->sendMessage("You have joined to the job \"{$job}\"");
                 } else {
                     $sender->sendMessage("There's no job named \"{$job}\"");
                 }
             }
             break;
         case "retire":
             if (!$sender instanceof Player) {
                 $sender->sendMessage("Please run this command in-game.");
             }
             if ($this->player->exists($sender->getName())) {
                 $job = $this->player->get($sender->getName());
                 $this->player->remove($sender->getName());
                 $sender->sendMessage("You have retired from the job \"{$job}\"");
             } else {
                 $sender->sendMessage("You don't have job that you've joined");
             }
             break;
         case "list":
             $max = 0;
             foreach ($this->jobs->getAll() as $d) {
                 $max += count($d);
             }
             $max = ceil($max / 5);
             $page = array_shift($params);
             $page = max(1, $page);
             $page = min($max, $page);
             $page = (int) $page;
             $current = 1;
             $n = 1;
             $output = "Showing job list page {$page} of {$max} : \n";
             foreach ($this->jobs->getAll() as $name => $job) {
                 $info = "";
                 foreach ($job as $id => $money) {
                     $cur = (int) ceil($n / 5);
                     if ($cur === $page) {
                         $info .= $name . " : " . $id . " | " . EconomyAPI::getInstance()->getMonetaryUnit() . "" . $money . "\n";
                     } elseif ($cur > $page) {
                         break;
                     }
                     ++$n;
                 }
                 $output .= $info;
             }
             $sender->sendMessage($output);
             break;
         case "me":
             if (!$sender instanceof Player) {
                 $sender->sendMessage("Please run this command in-game.");
             }
             if ($this->player->exists($sender->getName())) {
                 $sender->sendMessage("Your job : " . $this->player->get($sender->getName()));
             } else {
                 $sender->sendMessage("You don't have any jobs you've joined.");
             }
             break;
         default:
             $sender->sendMessage($command->getUsage());
     }
     return true;
 }
开发者ID:KarNomz,项目名称:EconomyS,代码行数:78,代码来源:EconomyJob.php

示例12: isBackupPlayer

 /**
  * @param string $player
  * @return bool
  */
 public function isBackupPlayer($player)
 {
     return $this->backups->exists(strtolower($player), true);
 }
开发者ID:pomee4,项目名称:PocketMine-Plugins,代码行数:8,代码来源:PlanB.php

示例13: isExempted

 /**
  * @param Player $player
  * @return bool
  */
 public function isExempted(Player $player)
 {
     return $this->exempts->exists($player->getName(), true);
 }
开发者ID:Evarettedavis,项目名称:PocketMine-Plugins,代码行数:8,代码来源:iManager.php

示例14: getDeaths

 public function getDeaths($player)
 {
     $data = new Config($this->getDataFolder() . "data/killanddeeath/" . strtolower($player) . ".yml", Config::YAML);
     if ($data->exists("kills") && $data->exists("deaths")) {
         return $data->get("deaths");
     } else {
         $data->setAll(array("kills" => 0, "deaths" => 0));
         $data->save();
     }
 }
开发者ID:MrSN-AG,项目名称:TheMC-API,代码行数:10,代码来源:Main.php

示例15: removeDonator

 /**
  * @param string $name
  */
 public function removeDonator($name)
 {
     if ($this->donators->exists($name, true)) {
         $this->donators->remove(strtolower($name));
     }
 }
开发者ID:Glitchmaster-PE,项目名称:KitPro,代码行数:9,代码来源:KitPro.php


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