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


PHP Config::setNested方法代码示例

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


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

示例1: setOriginalNametag

 /**
  * @param PPGroup $group
  * @param $nameTag
  * @param null $levelName
  * @return bool
  */
 public function setOriginalNametag(PPGroup $group, $nameTag, $levelName = null)
 {
     if ($levelName === null) {
         $this->config->setNested("groups." . $group->getName() . ".nametag", $nameTag);
     } else {
         $this->config->setNested("groups." . $group->getName() . "worlds.{$levelName}.nametag", $nameTag);
     }
     $this->config->save();
     $this->config->reload();
     return true;
 }
开发者ID:mad-hon,项目名称:PureChat,代码行数:17,代码来源:PureChat.php

示例2: setItemWorth

 /**
  * Sets the worth of an item
  *
  * @param $itemId
  * @param $worth
  */
 public function setItemWorth($itemId, $worth)
 {
     $this->economy->setNested("worth." . (int) $itemId, (int) $worth);
     $this->economy->save();
 }
开发者ID:mwvent,项目名称:WattzEssentialsPE,代码行数:11,代码来源:Loader.php

示例3: onInteract

 public function onInteract(PlayerInteractEvent $event)
 {
     $player = $event->getPlayer();
     $name = $player->getName();
     $block = $event->getBlock();
     $tile = $player->getLevel()->getTile($block);
     if ($this->registerBed == true && $this->registerBedWHO == $name) {
         $arena = $this->registerBedArena;
         $team = $this->registerBedTeam;
         $this->registerBed = false;
         $config = new Config($this->getDataFolder() . "Arenas/" . $arena . ".yml", Config::YAML);
         $block2 = new Block(26);
         if ($player->getLevel()->getBlock(new Vector3($block->getX() + 1, $block->getY(), $block->getZ()))->getId() == 26) {
             $block2 = $player->getLevel()->getBlock(new Vector3($block->getX() + 1, $block->getY(), $block->getZ()));
         }
         if ($player->getLevel()->getBlock(new Vector3($block->getX() - 1, $block->getY(), $block->getZ()))->getId() == 26) {
             $block2 = $player->getLevel()->getBlock(new Vector3($block->getX() - 1, $block->getY(), $block->getZ()));
         }
         if ($player->getLevel()->getBlock(new Vector3($block->getX(), $block->getY(), $block->getZ() + 1))->getId() == 26) {
             $block2 = $player->getLevel()->getBlock(new Vector3($block->getX(), $block->getY(), $block->getZ() + 1));
         }
         if ($player->getLevel()->getBlock(new Vector3($block->getX(), $block->getY(), $block->getZ() - 1))->getId() == 26) {
             $block2 = $player->getLevel()->getBlock(new Vector3($block->getX(), $block->getY(), $block->getZ() - 1));
         }
         $config->setNested("Bed." . $team . ".Welt", $block->getLevel()->getName());
         $config->setNested("Bed." . $team . ".X", $block->getX());
         $config->setNested("Bed." . $team . ".Y", $block->getY());
         $config->setNested("Bed." . $team . ".Z", $block->getZ());
         $config->setNested("Bed." . $team . ".X2", $block2->getX());
         $config->setNested("Bed." . $team . ".Y2", $block2->getY());
         $config->setNested("Bed." . $team . ".Z2", $block2->getZ());
         $config->setNested("Bed." . $team . ".Alive", true);
         $config->save();
         $player->sendMessage(TextFormat::GREEN . "Du hast Erfolgreich das Bett von Team " . TextFormat::AQUA . $team . TextFormat::GREEN . " für die Arena " . TextFormat::AQUA . $arena . TextFormat::GREEN . " registriert!");
         $player->sendMessage(TextFormat::GREEN . "Setup -> /bw help");
     }
     if ($tile instanceof Sign) {
         $text = $tile->getText();
         if ($this->registerSign == true && $this->registerSignWHO == $name) {
             $arena = $this->registerSignArena;
             $config = new Config($this->getDataFolder() . "Arenas/" . $arena . ".yml", Config::YAML);
             $teams = (int) $config->get("Teams");
             $ppt = (int) $config->get("PlayersPerTeam");
             $maxplayers = $teams * $ppt;
             $tile->setText($this->prefix, $arena . " " . $teams . "x" . $ppt, TextFormat::GREEN . "Loading...", TextFormat::YELLOW . "0 / " . $maxplayers);
             $this->registerSign = false;
             $player->sendMessage(TextFormat::GREEN . "Du hast Erfolgreich das Schild für die Arena " . TextFormat::AQUA . $arena . TextFormat::GREEN . " registriert!");
             $player->sendMessage(TextFormat::GREEN . "Setup -> /bw help");
         } elseif ($text[0] == $this->prefix) {
             if ($text[2] == TextFormat::GREEN . "Betreten") {
                 $arena = substr($text[1], 0, -4);
                 $config = new Config($this->getDataFolder() . "Arenas/" . $arena . ".yml", Config::YAML);
                 $status = $config->get("Status");
                 $maxplayers = $config->get("PlayersPerTeam") * $config->get("Teams");
                 $players = count($config->get("Players"));
                 if ($status == "Lobby") {
                     if ($players < $maxplayers) {
                         $this->TeleportToWaitingLobby($arena, $player);
                         $this->setTeamSelectionItems($player, $arena);
                         $this->addPlayerToArena($arena, $name);
                     } else {
                         $player->sendMessage($this->prefix . TextFormat::RED . "Du kannst dieses Match nicht betreten!");
                     }
                 } else {
                     $player->sendMessage($this->prefix . TextFormat::RED . "Du kannst dieses Match nicht betreten!");
                 }
             } else {
                 $player->sendMessage($this->prefix . TextFormat::RED . "Du kannst dieses Match nicht betreten!");
             }
         }
     }
 }
开发者ID:Bluplayz,项目名称:BedwarsPE,代码行数:72,代码来源:Bedwars.php

示例4: removePlayer

 public function removePlayer($player)
 {
     $cfg = new Config($this->getDataFolder() . "players.yml", Config::YAML);
     if ($cfg->getNested("Players." . strtolower($player)) != "false") {
         $cfg->setNested("Players." . strtolower($player), "false");
     }
     $cfg->save();
     $cfg->reload();
 }
开发者ID:kinect3000,项目名称:ReasonWL,代码行数:9,代码来源:Main.php


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