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


PHP Config::getNested方法代码示例

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


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

示例1: getProperty

 public function getProperty($variable, $defaultValue = null)
 {
     if (!array_key_exists($variable, $this->propertyCache)) {
         $v = getopt("", ["{$variable}::"]);
         if (isset($v[$variable])) {
             $this->propertyCache[$variable] = $v[$variable];
         } else {
             $this->propertyCache[$variable] = $this->properties->getNested($variable);
         }
     }
     return $this->propertyCache[$variable] === null ? $defaultValue : $this->propertyCache[$variable];
 }
开发者ID:TexusDark,项目名称:Katana,代码行数:12,代码来源:Katana.php

示例2: getMessage

 public function getMessage($key, $args = [])
 {
     $message = $this->messages->getNested($key, false);
     if (!$message) {
         $this->tntRun->getServer()->getLogger()->warning($this->tntRun->getTag() . "Translation for " . $key . " not found in messages.yml!");
         return "";
     }
     foreach ($args as $k => $str) {
         $message = str_replace("%" . $k, $str, $message);
     }
     return $this->tntRun->getTag() . trim($this->translateColors($message));
 }
开发者ID:100henrik100,项目名称:TNTRun,代码行数:12,代码来源:MessageManager.php

示例3: translateAndFormat

 public function translateAndFormat($key, ...$args)
 {
     $message = $this->messages->getNested($key, false);
     if (!$message) {
         $this->tntRun->getServer()->getLogger()->warning("TntRun translation for " . $key . " not found in messages.yml");
         return "";
     }
     foreach ($args as $k => $str) {
         $message = str_replace("%" . $k, $str, $message);
     }
     return $this->translateColors($this->tag . $message);
 }
开发者ID:EmreTr1,项目名称:TNTRun,代码行数:12,代码来源:MessageManager.php

示例4: getMessage

 /**
  * @param $node
  * @param ...$vars
  * @return mixed|null
  */
 public function getMessage($node, ...$vars)
 {
     $msg = $this->messages->getNested($node);
     if ($msg != null) {
         $number = 0;
         foreach ($vars as $v) {
             $msg = str_replace("%var{$number}%", $v, $msg);
             $number++;
         }
         return $msg;
     }
     return null;
 }
开发者ID:blah123454321,项目名称:PurePerms,代码行数:18,代码来源:PPMessages.php

示例5: getMessage

 /**
  * @param $identifier
  * @return bool|string
  */
 public function getMessage($identifier)
 {
     if (trim($identifier) === "") {
         return false;
     }
     if (($c = $this->config->getNested($identifier)) !== null) {
         return $c;
     } elseif (($o = $this->original->getNested($identifier)) !== null) {
         return $o;
     } else {
         return false;
     }
 }
开发者ID:PrimusLV,项目名称:EssentialsPE,代码行数:17,代码来源:MessagesAPI.php

示例6: fromConfig

 public static function fromConfig(Config $config)
 {
     $cred = new MySQLCredentials();
     $cred->host = $config->getNested("Database.MySQL.Connection.Address", "example.com");
     $cred->port = $config->getNested("Database.MySQL.Connection.Port", 3306);
     $cred->username = $config->getNested("Database.MySQL.Connection.Username", "root");
     $cred->password = $config->getNested("Database.MySQL.Connection.Password", "");
     $cred->schema = $config->getNested("Database.MySQL.Connection.Schema", "hereauth");
     $cred->socket = $config->getNested("Database.MySQL.Connection.Socket", "");
     return $cred;
 }
开发者ID:PEMapModder,项目名称:HereAuth,代码行数:11,代码来源:MySQLCredentials.php

示例7: getOriginalNametag

 public function getOriginalNametag(PPGroup $group, $levelName = null)
 {
     if ($levelName === null) {
         if ($this->config->getNested("groups." . $group->getName() . ".nametag") === null) {
             $this->getLogger()->critical("Invalid nametag found in config.yml (Group: " . $group->getName() . ") / Setting it to default value.");
             $this->config->setNested("groups." . $group->getName() . ".nametag", "&8&l[" . $group->getName() . "]&f&r {display_name}");
             $this->config->save();
             $this->config->reload();
         }
         return $this->config->getNested("groups." . $group->getName() . ".nametag");
     } else {
         if ($this->config->getNested("groups." . $group->getName() . "worlds.{$levelName}.nametag") === null) {
             $this->getLogger()->critical("Invalid nametag found in config.yml (Group: " . $group->getName() . ", WorldName = {$levelName}) / Setting it to default value.");
             $this->config->setNested("groups." . $group->getName() . "worlds.{$levelName}.nametag", "&8&l[" . $group->getName() . "]&f&r {display_name}");
             $this->config->save();
             $this->config->reload();
         }
         return $this->config->getNested("groups." . $group->getName() . "worlds.{$levelName}.nametag");
     }
 }
开发者ID:mad-hon,项目名称:PureChat,代码行数:20,代码来源:PureChat.php

示例8: getProperty

 /**
  * @param string $variable
  * @param mixed  $defaultValue
  *
  * @return mixed
  */
 public function getProperty($variable, $defaultValue = null)
 {
     $value = $this->config->getNested($variable);
     return $value === null ? $defaultValue : $value;
 }
开发者ID:ZenaGamingsky,项目名称:Steadfast2,代码行数:11,代码来源:Server.php

示例9: getopt

 $opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-profiler"]);
 define("pocketmine\\DATA", isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
 define("pocketmine\\PLUGIN_PATH", isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
 Terminal::init();
 define("pocketmine\\ANSI", Terminal::hasFormattingCodes());
 if (!file_exists(\pocketmine\DATA)) {
     mkdir(\pocketmine\DATA, 0777, true);
 }
 //Logger has a dependency on timezone, so we'll set it to UTC until we can get the actual timezone.
 date_default_timezone_set("UTC");
 if (!file_exists("katana.yml")) {
     $content = file_get_contents("src/pocketmine/resources/katana.yml");
     @file_put_contents("katana.yml", $content);
 }
 $tmpKatanaProperties = new Config("katana.yml", Config::YAML, []);
 $saveLog = $tmpKatanaProperties->getNested("console.save-console", true);
 $logger = new MainLogger(\pocketmine\DATA . "server.log", \pocketmine\ANSI, $saveLog);
 if ($saveLog) {
     $logger->info("Writing logs to server.log");
 } else {
     $logger->info("Server logging disabled");
 }
 if (!ini_get("date.timezone")) {
     if ($timezone = detect_system_timezone() and date_default_timezone_set($timezone)) {
         //Success! Timezone has already been set and validated in the if statement.
         //This here is just for redundancy just in case some program wants to read timezone data from the ini.
         ini_set("date.timezone", $timezone);
     } else {
         //If system timezone detection fails or timezone is an invalid value.
         if ($response = Utils::getURL("http://ip-api.com/json") and $ip_geolocation_data = json_decode($response, true) and $ip_geolocation_data['status'] != 'fail' and date_default_timezone_set($ip_geolocation_data['timezone'])) {
             //Again, for redundancy.
开发者ID:TexusDark,项目名称:Katana,代码行数:31,代码来源:PocketMine.php

示例10: initConfig

 public function initConfig()
 {
     if (!file_exists($this->getDataFolder())) {
         @mkdir($this->getDataFolder());
     }
     $this->saveResource("config.yml");
     $cfg = new Config($this->getDataFolder() . "config.yml", Config::YAML);
     SurvivalGames::$cfg["language"] = $cfg->get("language", "English");
     SurvivalGames::$cfg["auto_start_players"] = $cfg->get("auto_start_players", "");
     SurvivalGames::$cfg["auto_start_time"] = $cfg->get("auto_start_time", "");
     SurvivalGames::$cfg["auto_start_vote"] = $cfg->get("auto_start_vote", "");
     SurvivalGames::$cfg["enable_player_queue"] = $cfg->get("enable_player_queue", true);
     SurvivalGames::$cfg["grace_period"] = $cfg->get("grace_period", 20);
     SurvivalGames::$cfg["lobby_position"]["x"] = $cfg->getNested("lobby_position.x", $this->getServer()->getDefaultLevel()->getSpawnLocation()->x);
     SurvivalGames::$cfg["lobby_position"]["y"] = $cfg->getNested("lobby_position.y", $this->getServer()->getDefaultLevel()->getSpawnLocation()->y);
     SurvivalGames::$cfg["lobby_position"]["z"] = $cfg->getNested("lobby_position.z", $this->getServer()->getDefaultLevel()->getSpawnLocation()->z);
     SurvivalGames::$cfg["lobby_position"]["world"] = $cfg->getNested("lobby_position.world", $this->getServer()->getDefaultLevel()->getName());
     if (!$this->getServer()->isLevelLoaded(SurvivalGames::$cfg["lobby_position"]["world"])) {
         $this->getServer()->loadLevel(SurvivalGames::$cfg["lobby_position"]["world"]);
     }
     SurvivalGames::$cfg["block"]["place"]["whitelist"] = $cfg->getNested("block.place.whitelist", [18, 105, 31, 37, 38, 50, 103, 43]);
     SurvivalGames::$cfg["block"]["break"]["whitelist"] = $cfg->getNested("block.break.whitelist", [18, 105, 31, 37, 38, 50, 103, 43]);
     SurvivalGames::$cfg["endgame"]["players"] = $cfg->getNested("endgame.players", 3);
     SurvivalGames::$cfg["endgame"]["fire_lightning"]["enabled"] = $cfg->getNested("endgame.fire_lightning.enabled", true);
     SurvivalGames::$cfg["endgame"]["fire_lightning"]["interval"] = $cfg->getNested("endgame.fire_lightning.interval", 20);
     SurvivalGames::$cfg["deathmatch"]["enabled"] = $cfg->getNested("deathmatch.enabled", false);
     SurvivalGames::$cfg["deathmatch"]["time"] = $cfg->getNested("deathmatch.time", 30);
     SurvivalGames::$cfg["deathmatch"]["killtime"] = $cfg->getNested("deathmatch.killtime", 5);
     SurvivalGames::$cfg["stats"] = $cfg->get("stats", true);
     SurvivalGames::$cfg["stats_provider"] = $cfg->get("stats_provider", "yaml");
     if (!file_exists($this->getDataFolder() . "arenas/")) {
         @mkdir($this->getDataFolder() . "arenas/");
         $this->saveResource("arenas/default.yml");
     }
     if (!file_exists($this->getDataFolder() . "languages/")) {
         @mkdir($this->getDataFolder() . "languages/");
     }
     $this->saveResource("languages/English.yml");
     $this->saveResource("languages/Czech.yml");
     if (!file_exists($this->getDataFolder() . "languages/" . SurvivalGames::$cfg['language'] . ".yml")) {
         $this->msg = new Config($this->getDataFolder() . "languages/English.yml", Config::YAML);
         $this->getServer()->getLogger()->info("Selected language English");
         return;
     }
     $this->msg = new Config($this->getDataFolder() . "languages/" . SurvivalGames::$cfg['Language'] . ".yml", Config::YAML);
     $this->getServer()->getLogger()->info("Selected language " . SurvivalGames::$cfg['Language']);
 }
开发者ID:ChiefArtz,项目名称:SurvivalGames,代码行数:47,代码来源:SurvivalGames.php

示例11: isLocalChat

    {
        if (($rank & self::RANK_IMPORTANCE_VIP) === self::RANK_IMPORTANCE_VIP) {
            return 129600;
        }
        if (($rank & self::RANK_IMPORTANCE_DONATOR) === self::RANK_IMPORTANCE_DONATOR) {
            return 216000;
        }
        return PHP_INT_MAX;
    }
    /**
     * @param Vector3 $from
     * @param Vector3 $to
     * @return mixed
     */
    public static function isLocalChat($from, $to)
    {
        return $from->distanceSquared($to) <= 1600;
    }
}
$config = new Config("legionpe.yml", Config::YAML, ["localize" => ["id" => 0, "ip" => "pe.legionpvp.eu", "port" => 19132, "class" => "hub"], "system" => ["isTest" => false, "maxPlayers" => 60]]);
Settings::$SYSTEM_MAX_PLAYERS = $config->getNested("system.maxPlayers");
Settings::$SYSTEM_IS_TEST = $config->getNested("system.isTest");
Settings::$PROCESS_ID = getmypid();
Settings::$LOCALIZE_ID = $config->getNested("localize.id");
Settings::$LOCALIZE_IP = $config->getNested("localize.ip");
Settings::$LOCALIZE_PORT = $config->getNested("localize.port");
$array = ["hub" => Settings::CLASS_HUB, "pvp" => Settings::CLASS_KITPVP, "kitpvp" => Settings::CLASS_KITPVP, "parkour" => Settings::CLASS_PARKOUR, "spleef" => Settings::CLASS_SPLEEF, "infected" => Settings::CLASS_INFECTED, "classic" => Settings::CLASS_CLASSICAL, "classical" => Settings::CLASS_CLASSICAL];
if (!isset($array[$config->getNested("localize.class")])) {
    throw new \RuntimeException("Invalid class: " . var_export($config->getNested("localize.class"), true));
}
Settings::$LOCALIZE_CLASS = $array[$config->getNested("localize.class")];
开发者ID:Addison118,项目名称:LegionPE-Theta-Base,代码行数:31,代码来源:Settings.php

示例12: getItemWorth

 /**
  * Get the worth of an item
  *
  * @param $itemId
  * @return bool|int
  */
 public function getItemWorth($itemId)
 {
     return $this->economy->getNested("worth." . (int) $itemId, false);
 }
开发者ID:mwvent,项目名称:WattzEssentialsPE,代码行数:10,代码来源:Loader.php

示例13: onRespawn

 public function onRespawn(PlayerRespawnEvent $event)
 {
     $player = $event->getPlayer();
     $name = $player->getName();
     if ($this->inArena($player)) {
         $arena = $this->getArena($player);
         $config = new Config($this->getDataFolder() . "Arenas/" . $arena . ".yml", Config::YAML);
         $team = $this->getTeam($player->getNameTag());
         if ($config->getNested("Bed." . $team . ".Alive") == true) {
             $welt = $config->getNested("Spawn." . $team . ".Welt");
             $x = $config->getNested("Spawn." . $team . ".X");
             $y = $config->getNested("Spawn." . $team . ".Y");
             $z = $config->getNested("Spawn." . $team . ".Z");
             $level = $this->getServer()->getLevelByName($welt);
             $event->setRespawnPosition(new Position($x, $y, $z, $level));
         } else {
             $event->setRespawnPosition($this->getServer()->getDefaultLevel()->getSafeSpawn());
             $player->sendMessage($this->prefix . TextFormat::RED . "Dein Bett wurde zerstört, du kannst nicht mehr respawnen!");
             $this->removePlayerFromArena($arena, $name);
             $this->lasthit[$player->getName()] = "no";
             $player->setNameTag($player->getName());
         }
     }
 }
开发者ID:Bluplayz,项目名称:BedwarsPE,代码行数:24,代码来源:Bedwars.php

示例14: checkFile

 public function checkFile(Config $arena)
 {
     if (!(is_numeric($arena->getNested("signs.join_sign_x")) && is_numeric($arena->getNested("signs.join_sign_y")) && is_numeric($arena->getNested("signs.join_sign_z")) && is_string($arena->getNested("signs.join_sign_world")) && is_string($arena->getNested("signs.status_line_1")) && is_string($arena->getNested("signs.status_line_2")) && is_string($arena->getNested("signs.status_line_3")) && is_string($arena->getNested("signs.status_line_4")) && is_numeric($arena->getNested("signs.return_sign_x")) && is_numeric($arena->getNested("signs.return_sign_y")) && is_numeric($arena->getNested("signs.return_sign_z")) && is_string($arena->getNested("arena.arena_world")) && is_numeric($arena->getNested("arena.join_position_x")) && is_numeric($arena->getNested("arena.join_position_y")) && is_numeric($arena->getNested("arena.join_position_z")) && is_numeric($arena->getNested("arena.lobby_position_x")) && is_numeric($arena->getNested("arena.lobby_position_y")) && is_numeric($arena->getNested("arena.lobby_position_z")) && is_numeric($arena->getNested("arena.first_corner_x")) && is_numeric($arena->getNested("arena.first_corner_z")) && is_numeric($arena->getNested("arena.second_corner_x")) && is_numeric($arena->getNested("arena.second_corner_z")) && is_numeric($arena->getNested("arena.spec_spawn_x")) && is_numeric($arena->getNested("arena.spec_spawn_y")) && is_numeric($arena->getNested("arena.spec_spawn_z")) && is_numeric($arena->getNested("arena.leave_position_x")) && is_numeric($arena->getNested("arena.leave_position_y")) && is_numeric($arena->getNested("arena.leave_position_z")) && is_string($arena->getNested("arena.leave_position_world")) && is_numeric($arena->getNested("arena.max_game_time")) && is_numeric($arena->getNested("arena.max_players")) && is_numeric($arena->getNested("arena.min_players")) && is_numeric($arena->getNested("arena.starting_time")) && is_numeric($arena->getNested("arena.color_wait_time")) && is_numeric($arena->getNested("arena.floor_y")) && is_string($arena->getNested("arena.finish_msg_levels")) && !is_string($arena->getNested("arena.money_reward")))) {
         return false;
     }
     if (!((strtolower($arena->get("type")) == "furious" || strtolower($arena->get("type")) == "stoned" || strtolower($arena->get("type")) == "classic") && (strtolower($arena->get("material")) == "wool" || strtolower($arena->get("material")) == "clay") && (strtolower($arena->getNested("signs.enable_status")) == "true" || strtolower($arena->getNested("signs.enable_status")) == "false") && (strtolower($arena->getNested("arena.spectator_mode")) == "true" || strtolower($arena->getNested("arena.spectator_mode")) == "false") && (strtolower($arena->getNested("arena.time")) == "true" || strtolower($arena->getNested("arena.time")) == "day" || strtolower($arena->getNested("arena.time")) == "night" || is_numeric(strtolower($arena->getNested("arena.time")))) && (strtolower($arena->get("enabled")) == "true" || strtolower($arena->get("enabled")) == "false"))) {
         return false;
     }
     return true;
 }
开发者ID:Creeperface01,项目名称:ColorMatch,代码行数:10,代码来源:ColorMatch.php

示例15: isWhitelisted

 public function isWhitelisted(Player $player)
 {
     $cfg = new Config($this->getDataFolder() . "players.yml", Config::YAML);
     if ($cfg->getNested("Players." . strtolower($player->getName())) == "true") {
         return true;
     }
     return false;
 }
开发者ID:kinect3000,项目名称:ReasonWL,代码行数:8,代码来源:Main.php


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