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


PHP Server::getLevel方法代码示例

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


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

示例1: onCompletion

 public function onCompletion(Server $server)
 {
     $level = $server->getLevel($this->levelId);
     if ($level instanceof Level and $this->hasResult()) {
         $level->chunkRequestCallback($this->chunkX, $this->chunkZ, $this->getResult());
     }
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:7,代码来源:ChunkRequestTask.php

示例2: handlePackets

 public function handlePackets()
 {
     while (strlen($packet = $this->generationThread->readThreadToMainPacket()) > 0) {
         $pid = ord($packet[0]);
         $offset = 1;
         if ($pid === GenerationManager::PACKET_REQUEST_CHUNK) {
             $levelID = Binary::readInt(substr($packet, $offset, 4));
             $offset += 4;
             $chunkX = Binary::readInt(substr($packet, $offset, 4));
             $offset += 4;
             $chunkZ = Binary::readInt(substr($packet, $offset, 4));
             $this->handleRequest($levelID, $chunkX, $chunkZ);
         } elseif ($pid === GenerationManager::PACKET_SEND_CHUNK) {
             $levelID = Binary::readInt(substr($packet, $offset, 4));
             $offset += 4;
             $len = ord($packet[$offset++]);
             /** @var FullChunk $class */
             $class = substr($packet, $offset, $len);
             $offset += $len;
             $level = $this->server->getLevel($levelID);
             if ($level instanceof Level) {
                 $chunk = $class::fromBinary(substr($packet, $offset), $level->getProvider());
                 $this->receiveChunk($levelID, $chunk);
             }
         }
     }
 }
开发者ID:rryy,项目名称:PocketMine-MP,代码行数:27,代码来源:GenerationRequestManager.php

示例3: onCompletion

 public function onCompletion(Server $server)
 {
     $level = $server->getLevel($this->levelId);
     if ($level instanceof Level and $this->hasResult()) {
         $level->chunkRequestCallback($this->chunkX, $this->chunkZ, $this->getResult(), FullChunkDataPacket::ORDER_LAYERED);
     }
 }
开发者ID:kniffo80,项目名称:Genisys,代码行数:7,代码来源:ChunkRequestTask.php

示例4: receiveChunk

 public function receiveChunk($levelID, FullChunk $chunk)
 {
     if (($level = $this->server->getLevel($levelID)) instanceof Level) {
         $level->generateChunkCallback($chunk->getX(), $chunk->getZ(), $chunk);
     } else {
         $this->generationManager->closeLevel($levelID);
     }
 }
开发者ID:rryy,项目名称:PocketMine-MP,代码行数:8,代码来源:GenerationInstanceManager.php

示例5: onCompletion

 public function onCompletion(Server $server)
 {
     $level = $server->getLevel($this->levelId);
     if ($level !== null) {
         /** @var FullChunk $chunk */
         $chunk = $this->chunkClass;
         $chunk = $chunk::fromFastBinary($this->chunk, $level->getProvider());
         if ($chunk === null) {
             //TODO error
             return;
         }
         $level->generateChunkCallback($chunk->getX(), $chunk->getZ(), $chunk);
     }
 }
开发者ID:ecoron,项目名称:MinionsLandPE,代码行数:14,代码来源:LightPopulationTask.php

示例6: onCompletion

 public function onCompletion(Server $server)
 {
     $chunks = $this->getResult();
     $plugin = $server->getPluginManager()->getPlugin("MineReset");
     if ($plugin instanceof MineReset and $plugin->isEnabled()) {
         $level = $server->getLevel($this->levelId);
         if ($level != null) {
             foreach ($chunks as $hash => $chunk) {
                 Level::getXZ($hash, $x, $z);
                 $level->setChunk($x, $z, $chunk);
             }
         }
         $plugin->getRegionBlocker()->freeZone($this->regionId, $this->levelId);
     }
 }
开发者ID:MCPEGamerJPatGitHub,项目名称:MineReset,代码行数:15,代码来源:MineResetTask.php

示例7: onCompletion

 public function onCompletion(Server $server)
 {
     $level = $server->getLevel($this->levelId);
     if ($level instanceof Level and $this->hasResult()) {
         $level->chunkRequestCallback($this->chunkX, $this->chunkZ, $this->getResult(), FullChunkDataPacket::ORDER_LAYERED);
     }
     $this->levelId = null;
     $this->chunkX = null;
     $this->chunkZ = null;
     $this->chunk = null;
     $this->tiles = null;
     $this->setResult(null, false);
     unset($this->levelId);
     unset($this->chunk);
     unset($this->chunkX);
     unset($this->chunkZ);
     unset($this->tiles);
 }
开发者ID:zzz1999,项目名称:Genisys,代码行数:18,代码来源:ChunkRequestTask.php

示例8: onCompletion

 public function onCompletion(Server $server)
 {
     $level = $server->getLevel($this->levelId);
     if ($level !== \null) {
         if ($this->state === \false) {
             $level->registerGenerator();
             return;
         }
         /** @var FullChunk $chunkC */
         $chunkC = $this->chunkClass;
         $chunk = $chunkC::fromFastBinary($this->chunk, $level->getProvider());
         if ($chunk === \null) {
             //TODO error
             return;
         }
         for ($i = 0; $i < 9; ++$i) {
             if ($i === 4) {
                 continue;
             }
             $c = $this->{"chunk{$i}"};
             if ($c !== \null) {
                 $c = $chunkC::fromFastBinary($c, $level->getProvider());
                 $level->generateChunkCallback($c->getX(), $c->getZ(), $c);
             }
         }
         $level->generateChunkCallback($chunk->getX(), $chunk->getZ(), $chunk);
     }
 }
开发者ID:xpyctum,项目名称:PocketMinePlusPlus,代码行数:28,代码来源:PopulationTask.php

示例9: onCompletion

 public function onCompletion(Server $server)
 {
     $level = $server->getLevel($this->levelId);
     if ($level !== null) {
         if ($this->state === false) {
             $level->registerGenerator();
             return;
         }
         /** @var FullChunk[] $chunks */
         $chunks = [];
         /** @var FullChunk $chunkC */
         $chunkC = $this->chunkClass;
         $chunks[0] = $chunkC::fromFastBinary($this->chunk00, $level->getProvider());
         $chunks[1] = $chunkC::fromFastBinary($this->chunk01, $level->getProvider());
         $chunks[2] = $chunkC::fromFastBinary($this->chunk02, $level->getProvider());
         $chunks[3] = $chunkC::fromFastBinary($this->chunk10, $level->getProvider());
         $chunk = $chunkC::fromFastBinary($this->chunk, $level->getProvider());
         $chunks[5] = $chunkC::fromFastBinary($this->chunk12, $level->getProvider());
         $chunks[6] = $chunkC::fromFastBinary($this->chunk20, $level->getProvider());
         $chunks[7] = $chunkC::fromFastBinary($this->chunk21, $level->getProvider());
         $chunks[8] = $chunkC::fromFastBinary($this->chunk22, $level->getProvider());
         foreach ($chunks as $c) {
             if ($c !== null) {
                 $level->generateChunkCallback($c->getX(), $c->getZ(), $c);
             }
         }
         if ($chunk === null) {
             //TODO error
             return;
         }
         $level->generateChunkCallback($chunk->getX(), $chunk->getZ(), $chunk);
     }
 }
开发者ID:TylerGames,项目名称:PocketMine-MP,代码行数:33,代码来源:PopulationTask.php


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