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


PHP Level::getName方法代码示例

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


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

示例1: getShield

 /**
  * @param Level $level
  * @return Shield|null
  */
 public function getShield(Level $level)
 {
     if (isset($this->shields[strtolower($level->getName())])) {
         return $this->shields[strtolower($level->getName())];
     }
     return null;
 }
开发者ID:NameNoOne100,项目名称:PocketMine-Plugins,代码行数:11,代码来源:ShieldStorage.php

示例2: getWorldLoadedData

 public function getWorldLoadedData(Level $level)
 {
     $temp_config = $this->getUserData();
     if (!isset($temp_config["worlds"][$level->getName()])) {
         $temp_config["worlds"][$level->getName()] = array("group" => $this->plugin->getDefaultGroup()->getName(), "permissions" => array());
         $this->setUserData($temp_config);
     }
     return $this->getUserData();
 }
开发者ID:BoysElCrack,项目名称:xPermissions,代码行数:9,代码来源:User.php

示例3: getWorldLoadedData

 public function getWorldLoadedData(Level $level)
 {
     $temp_config = $this->plugin->getGroupsData();
     if (!isset($temp_config[$this->groupName]["worlds"][$level->getName()])) {
         $this->plugin->getLogger()->warning("Permissions not set in " . $this->groupName . " in level: " . $level->getName() . ".");
         $temp_config[$this->groupName]["worlds"][$level->getName()] = array("permissions" => array());
         $this->plugin->setGroupsData($temp_config);
     }
     return $this->plugin->getGroupsData();
 }
开发者ID:BoysElCrack,项目名称:xPermissions,代码行数:10,代码来源:Group.php

示例4: setMetadata

 public function setMetadata($block, $metadataKey, MetadataValue $newMetadatavalue)
 {
     if (!$block instanceof Block) {
         throw new \InvalidArgumentException("Object must be a Block");
     }
     if ($block->getLevel() === $this->owningLevel) {
         parent::setMetadata($block, $metadataKey, $newMetadatavalue);
     } else {
         throw new \InvalidStateException("Block does not belong to world " . $this->owningLevel->getName());
     }
 }
开发者ID:TexusDark,项目名称:Ananas-MP,代码行数:11,代码来源:BlockMetadataStore.php

示例5: isRegistered

 public static function isRegistered(Level $level)
 {
     if (isset(self::$registeredLevel[$level->getName()])) {
         return true;
     }
     return false;
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:7,代码来源:WeatherManager.php

示例6: isLevelCorrect

 public function isLevelCorrect(Level $level)
 {
     if ($this->world === "*") {
         return true;
     }
     return strtolower($level->getName()) === $this->world;
 }
开发者ID:gitter-badger,项目名称:DynamicHub,代码行数:7,代码来源:JoinMethod.php

示例7: delHome

 public function delHome(IPlayer $player, Level $level)
 {
     $n = strtolower($player->getName());
     $l = "l-" . strtolower($level->getName());
     if (!isset($this->homes[$l]) || !isset($this->homes[$l][$n])) {
         return;
     }
     unset($this->homes[$l][$n]);
     if (count($this->homes[$l]) == 0) {
         unset($this->homes[$l]);
     }
     $this->saveHomes();
 }
开发者ID:0-DevMatthew-0,项目名称:pocketmine-plugins,代码行数:13,代码来源:CmdHomes.php

示例8: loadInventory

 private function loadInventory(Player $player, Level $level)
 {
     $n = trim(strtolower($player->getName()));
     if ($n === "") {
         return false;
     }
     $d = substr($n, 0, 1);
     $path = $this->getDataFolder() . $d . "/" . $n . ".yml";
     if (!is_file($path)) {
         return false;
     }
     $cfg = new Config($path, Config::YAML);
     $yaml = $cfg->getAll();
     $ln = trim(strtolower($level->getName()));
     if (!isset($yaml[$ln])) {
         return false;
     }
     foreach ($yaml[$ln] as $slot => $t) {
         list($id, $dam, $cnt) = explode(":", $t);
         $item = Item::get($id, $dam, $cnt);
         $player->getInventory()->setItem($slot, $item);
     }
     return true;
 }
开发者ID:AvivShopen,项目名称:bad-plugins,代码行数:24,代码来源:Main.php

示例9: loadCfg

 private function loadCfg(Level $lv)
 {
     $world = $lv->getName();
     $f = $lv->getProvider()->getPath() . "itemcasepe.txt";
     $this->cases[$world] = [];
     if (!file_exists($f)) {
         return;
     }
     foreach (explode("\n", file_get_contents($f)) as $ln) {
         if (preg_match('/^\\s*#/', $ln)) {
             continue;
         }
         if (($ln = trim($ln)) == "") {
             continue;
         }
         $v = explode(",", $ln);
         if (count($v) < 3) {
             continue;
         }
         $this->cases[$world][$v[0]] = ["item" => $v[1], "count" => $v[2]];
     }
 }
开发者ID:flaxues,项目名称:pocketmine-plugins,代码行数:22,代码来源:Main.php

示例10: isActiveIn

 public function isActiveIn(Level $level)
 {
     if ($this->activeIn === false) {
         return true;
     } else {
         return in_array($level->getName(), $this->activeIn);
     }
 }
开发者ID:haruajsuru,项目名称:BattleKits,代码行数:8,代码来源:Kit.php

示例11: switchLevelVanish

 /**
  * Allow to switch between levels Vanished!
  * You need to teleport the player to a different level in order to call this event
  *
  * @param Player $player
  * @param Level $origin
  * @param Level $target
  */
 public function switchLevelVanish(Player $player, Level $origin, Level $target)
 {
     if ($origin->getName() !== $target->getName() && $this->isVanished($player)) {
         // This will be used if the specified player has "noPacket" enabled.
         // A temporal check will be used for "the other players".
         $noPacket = $this->hasNoPacket($player);
         // Just as prevention if any player has "noPacket" disabled...
         $pk = new MobEffectPacket();
         $pk->effectId = $this->invisibilityEffect->getId();
         $pk->amplifier = $this->invisibilityEffect->getAmplifier();
         $pk->particles = $this->invisibilityEffect->isVisible();
         $pk->duration = $this->invisibilityEffect->getDuration();
         // Show to origin's players
         $pk->eventId = MobEffectPacket::EVENT_REMOVE;
         foreach ($origin->getPlayers() as $p) {
             if ($p !== $player) {
                 if ($this->isVanished($player)) {
                     if (!$noPacket) {
                         $pk->eid = $player->getId();
                         $p->dataPacket($pk);
                     } else {
                         $p->showPlayer($player);
                     }
                 }
                 if ($this->isVanished($p)) {
                     if (!$this->hasNoPacket($p)) {
                         $pk->eid = $p->getId();
                         $player->dataPacket($pk);
                     } else {
                         $player->showPlayer($p);
                     }
                 }
             }
         }
         // Hide to target's players
         $pk->eventId = MobEffectPacket::EVENT_ADD;
         foreach ($target->getPlayers() as $p) {
             if ($p !== $player) {
                 if ($this->isVanished($player)) {
                     if (!$noPacket) {
                         $pk->eid = $player->getId();
                         $p->dataPacket($pk);
                     } else {
                         $p->hidePlayer($player);
                     }
                 }
                 if ($this->isVanished($p)) {
                     if (!$this->hasNoPacket($p)) {
                         $pk->eid = $p->getId();
                         $player->dataPacket($pk);
                     } else {
                         $player->hidePlayer($p);
                     }
                 }
             }
         }
     }
 }
开发者ID:mwvent,项目名称:WattzEssentialsPE,代码行数:66,代码来源:Loader.php

示例12: sendLevelInfo

 /**
  * @param CommandSender $sender
  * @param Level $level
  */
 public function sendLevelInfo(CommandSender $sender, Level $level)
 {
     $sender->sendMessage("Name: " . $level->getName());
     $sender->sendMessage("Id: " . $level->getId());
     $sender->sendMessage("Entities: " . count($level->getEntities()));
     $sender->sendMessage("Players: " . count($level->getPlayers()));
     $sender->sendMessage("Tiles: " . count($level->getTiles()));
     $sender->sendMessage("Chunks: " . count($level->getChunks()));
     $sender->sendMessage("Loaders: " . count($level->getLoaders()));
     $sender->sendMessage("Spawn: " . $level->getSafeSpawn()->getFloorX() . ":" . $level->getSafeSpawn()->getFloorY() . ":" . $level->getSafeSpawn()->getFloorZ());
     $sender->sendMessage("Time: " . $level->getTime());
     $sender->sendMessage("Tick-rate: " . $level->getTickRate());
     $sender->sendMessage("Tick-rate-time: " . $level->getTickRateTime());
     $sender->sendMessage("Seed: " . $level->getSeed());
     $sender->sendMessage("Is-auto-saving: " . ($level->getAutoSave() ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
     $sender->sendMessage("Is-generated: " . ($level->getServer()->isLevelGenerated($level->getName()) ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
     $sender->sendMessage("Is-loaded: " . ($level->getServer()->isLevelLoaded($level->getName()) ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
 }
开发者ID:happyexceed,项目名称:PocketMine-Plugins-1,代码行数:22,代码来源:InfoFetcher.php

示例13: teleportToSpawn_2

 public function teleportToSpawn_2(Player $player, Level $level)
 {
     $temp = $this->getConfig()->getAll();
     $spawns = new Config($this->getDataFolder() . "spawns.yml", Config::YAML, array());
     $spawns = $spawns->getAll();
     if (isset($spawns[$level->getName()])) {
         $player->teleport(new Position($spawns[$level->getName()]["X"], $spawns[$level->getName()]["Y"], $spawns[$level->getName()]["Z"]), $spawns[$level->getName()]["Yaw"], $spawns[$level->getName()]["Pitch"]);
         if ($temp["enable-spawn-message"] == true) {
             $player->sendMessage($this->translateColors("&", $this->getSpawnMessage_2($player, $level)));
         }
     } else {
         $player->sendMessage($this->translateColors("&", $this->getNoSpawnMessage()));
     }
     return true;
 }
开发者ID:xHFx,项目名称:MSpawns,代码行数:15,代码来源:Main.php

示例14: createForWrite

 /**
  * Creates a new clip for writing
  *
  * @param Level   $level
  * @param Vector3 $anchor
  * @param string  $owner
  * @param string  $name
  *
  * @return Clip
  */
 public static function createForWrite(Level $level, Vector3 $anchor, $owner, $name = "default")
 {
     $clip = new Clip($name, true);
     $clip->levelName = $level->getName();
     $clip->anchor = new Vector3($anchor->x, $anchor->y, $anchor->z);
     // prevent memory leak
     $clip->creationTime = time();
     $clip->owner = $owner;
     return $clip;
 }
开发者ID:Ad5001,项目名称:WorldEditArt,代码行数:20,代码来源:Clip.php

示例15: claimingIsDisabled

 public function claimingIsDisabled(Level $level)
 {
     $disabledWorlds = explode(":", file_get_contents($this->getDataFolder() . "NoClaimWorlds.txt"));
     return in_array($level->getName(), $disabledWorlds);
 }
开发者ID:GamerXzavier,项目名称:Party-remake,代码行数:5,代码来源:FactionMain.php


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