本文整理汇总了PHP中pocketmine\Server::isLevelGenerated方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::isLevelGenerated方法的具体用法?PHP Server::isLevelGenerated怎么用?PHP Server::isLevelGenerated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\Server
的用法示例。
在下文中一共展示了Server::isLevelGenerated方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(array $args, Main $main)
{
$this->name = $args["name"];
$this->motto = $args["motto"];
$this->id = $args["id"];
$this->founder = $args["founder"];
$this->ranks = $args["ranks"];
$this->defaultRank = $args["default-rank"];
$this->allyRank = $args["ally-rank"];
$this->truceRank = $args["truce-rank"];
$this->stdRank = $args["std-rank"];
$this->members = $args["members"];
$this->lastActive = $args["last-active"];
$this->chunks = $args["chunks"];
$this->homes = $args["homes"];
$this->main = $main;
$this->whitelist = $args["whitelist"];
$this->reputation = isset($args["reputation"]) ? $args["reputation"] : 0;
$this->server = $this->main->getServer();
$levels = [];
foreach ($this->chunks as $chunk) {
$level = $chunk->getLevel();
if (!isset($levels[$level])) {
$levels[] = $level;
if (!$this->server->isLevelLoaded($level)) {
if (!$this->server->isLevelGenerated($this->server->loadLevel($level))) {
$this->server->generateLevel($level, $this->main->getLevelGenerationSeed());
}
$this->server->loadLevel($level);
}
}
}
$this->initializeXEconEntity($main->getXEcon($this->server));
}
示例2: getLevelByName
/**
* Get a world name and return a level object. Loads levels as needed
*
* @param Server $server
* @param str $world
* @return Level|null
*/
public static function getLevelByName(Server $server, $world)
{
if (!$server->isLevelGenerated($world)) {
return null;
}
if (!$server->isLevelLoaded($world)) {
$server->loadLevel($world);
}
return $server->getLevelByName($world);
}