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


PHP Server::getAutoSave方法代码示例

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


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

示例1: __construct

 /**
  * Init the default level data
  *
  * @param Server $server
  * @param string $name
  * @param string $path
  * @param string $provider Class that extends LevelProvider
  *
  * @throws \Exception
  */
 public function __construct(Server $server, $name, $path, $provider)
 {
     $this->blockStates = Block::$fullList;
     $this->levelId = static::$levelIdCounter++;
     $this->blockMetadata = new BlockMetadataStore($this);
     $this->server = $server;
     $this->autoSave = $server->getAutoSave();
     /** @var LevelProvider $provider */
     if (is_subclass_of($provider, LevelProvider::class, true)) {
         $this->provider = new $provider($this, $path);
     } else {
         throw new LevelException("Provider is not a subclass of LevelProvider");
     }
     $this->server->getLogger()->info("Preparing level \"" . $this->provider->getName() . "\"");
     $this->blockOrder = $provider::getProviderOrder();
     $this->useSections = $provider::usesChunkSection();
     $this->folderName = $name;
     $this->updateQueue = new ReversePriorityQueue();
     $this->updateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->time = (int) $this->provider->getTime();
     $this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 4)));
     $this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 0);
     $this->chunkTickList = [];
     $this->clearChunksOnTick = (bool) $this->server->getProperty("chunk-ticking.clear-tick-list", false);
     $this->timings = new LevelTimings($this);
     $this->temporalPosition = new Position(0, 0, 0, $this);
     $this->temporalVector = new Vector3(0, 0, 0);
 }
开发者ID:RedstoneAlmeida,项目名称:Steadfast2,代码行数:38,代码来源:Level.php

示例2: __construct

 /**
  * Init the default level data
  *
  * @param Server $server
  * @param string $name
  * @param string $path
  * @param string $provider Class that extends LevelProvider
  *
  * @throws \Exception
  */
 public function __construct(Server $server, $name, $path, $provider)
 {
     $this->blockStates = Block::$fullList;
     $this->levelId = static::$levelIdCounter++;
     $this->blockMetadata = new BlockMetadataStore($this);
     $this->server = $server;
     $this->autoSave = $server->getAutoSave();
     /** @var LevelProvider $provider */
     if (is_subclass_of($provider, LevelProvider::class, true)) {
         $this->provider = new $provider($this, $path);
     } else {
         throw new LevelException("Provider is not a subclass of LevelProvider");
     }
     $this->server->getLogger()->info($this->server->getLanguage()->translateString("pocketmine.level.preparing", [$this->provider->getName()]));
     $this->generator = Generator::getGenerator($this->provider->getGenerator());
     $this->blockOrder = $provider::getProviderOrder();
     $this->useSections = $provider::usesChunkSection();
     $this->folderName = $name;
     $this->updateQueue = new ReversePriorityQueue();
     $this->updateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->time = (int) $this->provider->getTime();
     $this->weatherEnabled = $this->getServer()->getProperty("weather.enable", true);
     if ($this->weatherEnabled === true) {
         $this->raining = $this->provider->isRaining();
         $this->rainTime = $this->provider->getRainTime();
         if ($this->rainTime <= 0) {
             $this->setRainTime(mt_rand(4, 7) * 20 * 60);
         }
         $this->randomWeather = mt_rand(0, 150);
         $this->thundering = $this->provider->isThundering();
         $this->thunderTime = $this->provider->getThunderTime();
         if ($this->thunderTime <= 0) {
             $this->setThunderTime(mt_rand(4, 7) * 20 * 60);
         }
     }
     foreach ($this->getServer()->getProperty("disable-block-ticking", []) as $id) {
         $ticked = isset($this->randomTickBlocks[$id]);
         if ($ticked === true) {
             unset($this->randomTickBlocks[$id]);
         }
     }
     $this->updateRedstoneQueue = new ReversePriorityQueue();
     $this->updateRedstoneQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 4)));
     $this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 40);
     $this->chunkGenerationQueueSize = (int) $this->server->getProperty("chunk-generation.queue-size", 8);
     $this->chunkPopulationQueueSize = (int) $this->server->getProperty("chunk-generation.population-queue-size", 2);
     $this->chunkTickList = [];
     $this->clearChunksOnTick = (bool) $this->server->getProperty("chunk-ticking.clear-tick-list", true);
     $this->cacheChunks = (bool) $this->server->getProperty("chunk-sending.cache-chunks", false);
     $this->timings = new LevelTimings($this);
     $this->temporalPosition = new Position(0, 0, 0, $this);
     $this->temporalVector = new Vector3(0, 0, 0);
     $this->tickRate = 1;
 }
开发者ID:orlando092,项目名称:ImagicalMine,代码行数:65,代码来源:Level.php

示例3: __construct

 /**
  * Init the default level data
  *
  * @param Server $server
  * @param string $name
  * @param string $path
  * @param string $provider Class that extends LevelProvider
  *
  * @throws \Exception
  */
 public function __construct(Server $server, $name, $path, $provider)
 {
     $this->blockStates = Block::$fullList;
     $this->levelId = static::$levelIdCounter++;
     $this->blockMetadata = new BlockMetadataStore($this);
     $this->server = $server;
     $this->autoSave = $server->getAutoSave();
     /** @var LevelProvider $provider */
     if (is_subclass_of($provider, LevelProvider::class, true)) {
         $this->provider = new $provider($this, $path);
     } else {
         throw new LevelException("Provider is not a subclass of LevelProvider");
     }
     $this->server->getKatana()->console->system("Preparing level " . Terminal::$COLOR_WHITE . $this->getName());
     $this->blockOrder = $provider::getProviderOrder();
     $this->useSections = $provider::usesChunkSection();
     $this->folderName = $name;
     $this->updateQueue = new ReversePriorityQueue();
     $this->updateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->time = (int) $this->provider->getTime();
     $this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 4)));
     $this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 40);
     $this->chunkPopulationQueueSize = (int) $this->server->getProperty("chunk-generation.population-queue-size", 2);
     $this->chunkTickList = [];
     $this->timings = new LevelTimings($this);
     $this->temporalPosition = new Position(0, 0, 0, $this);
     $this->temporalVector = new Vector3(0, 0, 0);
     $this->tickRate = 1;
     // Initialize chunk cache folder
     if ($this->server->getKatana()->getProperty("cache.save-to-disk", true) && !file_exists("chunk_cache/" . $this->getName() . "/")) {
         mkdir("chunk_cache/" . $this->getName() . "/", 0777);
     }
 }
开发者ID:AbelGamerC,项目名称:Katana,代码行数:43,代码来源:Level.php

示例4: __construct

 /**
  * Init the default level data
  *
  * @param Server $server
  * @param string $name
  * @param string $path
  * @param string $provider Class that extends LevelProvider
  *
  * @throws \Exception
  */
 public function __construct(Server $server, $name, $path, $provider)
 {
     $this->blockStates = Block::$fullList;
     $this->levelId = static::$levelIdCounter++;
     $this->blockMetadata = new BlockMetadataStore($this);
     $this->server = $server;
     $this->autoSave = $server->getAutoSave();
     /** @var LevelProvider $provider */
     if (\is_subclass_of($provider, LevelProvider::class, \true)) {
         $this->provider = new $provider($this, $path);
     } else {
         throw new LevelException("Provider is not a subclass of LevelProvider");
     }
     $this->server->getLogger()->info($this->server->getLanguage()->translateString("pocketmine.level.preparing", [$this->provider->getName()]));
     $this->generator = Generator::getGenerator($this->provider->getGenerator());
     $this->blockOrder = $provider::getProviderOrder();
     $this->useSections = $provider::usesChunkSection();
     $this->folderName = $name;
     $this->updateQueue = new ReversePriorityQueue();
     $this->updateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->time = (int) $this->provider->getTime();
     $this->chunkTickRadius = \min($this->server->getViewDistance(), \max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 4)));
     $this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 40);
     $this->chunkGenerationQueueSize = (int) $this->server->getProperty("chunk-generation.queue-size", 8);
     $this->chunkPopulationQueueSize = (int) $this->server->getProperty("chunk-generation.population-queue-size", 2);
     $this->chunkTickList = [];
     $this->clearChunksOnTick = (bool) $this->server->getProperty("chunk-ticking.clear-tick-list", \true);
     $this->cacheChunks = (bool) $this->server->getProperty("chunk-sending.cache-chunks", \false);
     $this->timings = new LevelTimings($this);
     $this->temporalPosition = new Position(0, 0, 0, $this);
     $this->temporalVector = new Vector3(0, 0, 0);
     $this->tickRate = 1;
 }
开发者ID:xpyctum,项目名称:PocketMinePlusPlus,代码行数:43,代码来源:Level.php

示例5: __construct

 /**
  * Init the default level data
  *
  * @param Server $server
  * @param string $name
  * @param string $path
  * @param string $provider Class that extends LevelProvider
  *
  * @throws \Exception
  */
 public function __construct(Server $server, string $name, string $path, string $provider)
 {
     $this->blockStates = Block::$fullList;
     $this->levelId = static::$levelIdCounter++;
     $this->blockMetadata = new BlockMetadataStore($this);
     $this->server = $server;
     $this->autoSave = $server->getAutoSave();
     /** Weather Config Loader */
     $this->rainprob = $this->getServer()->getProperty("level-settings.weather.rain.possibility", 10);
     $this->raintime[] = $this->getServer()->getProperty("level-settings.weather.rain.time.min", 30);
     $this->raintime[] = $this->getServer()->getProperty("level-settings.weather.rain.time.max", 120);
     $this->rainfall[] = $this->getServer()->getProperty("level-settings.weather.rain.rainfall.min", 1000);
     $this->rainfall[] = $this->getServer()->getProperty("level-settings.weather.rain.rainfall.max", 100000);
     /** @var LevelProvider $provider */
     if (is_subclass_of($provider, LevelProvider::class, true)) {
         $this->provider = new $provider($this, $path);
     } else {
         throw new LevelException("Provider is not a subclass of LevelProvider");
     }
     $this->server->getLogger()->info($this->server->getLanguage()->translateString("pocketmine.level.preparing", [$this->provider->getName()]));
     $this->generator = Generator::getGenerator($this->provider->getGenerator());
     $this->blockOrder = $provider::getProviderOrder();
     $this->useSections = $provider::usesChunkSection();
     $this->folderName = $name;
     $this->updateQueue = new ReversePriorityQueue();
     $this->updateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->time = (int) $this->provider->getTime();
     /** Set dimension */
     if ($server->netherName == $this->folderName) {
         $this->setDimension(self::DIMENSION_NETHER);
     } else {
         $this->setDimension(self::DIMENSION_NORMAL);
     }
     $this->gamerules = new GameRules($this->provider->getGameRules());
     $this->getGameRule("doDaylightCycle") ? $this->startTime() : $this->stopTime();
     /** Random ticking */
     foreach ($this->getServer()->getProperty("chunk-ticking.disabled-randomly-ticking-blocks", []) as $id) {
         $ticked = isset($this->randomTickBlocks[$id]);
         if ($ticked === true) {
             unset($this->randomTickBlocks[$id]);
         }
     }
     $this->updateRedstoneQueue = new ReversePriorityQueue();
     $this->updateRedstoneQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 4)));
     $this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 40);
     $this->chunkGenerationQueueSize = (int) $this->server->getProperty("chunk-generation.queue-size", 8);
     $this->chunkPopulationQueueSize = (int) $this->server->getProperty("chunk-generation.population-queue-size", 2);
     $this->chunkTickList = [];
     $this->clearChunksOnTick = (bool) $this->server->getProperty("chunk-ticking.clear-tick-list", true);
     $this->cacheChunks = (bool) $this->server->getProperty("chunk-sending.cache-chunks", false);
     $this->timings = new LevelTimings($this);
     $this->temporalPosition = new Position(0, 0, 0, $this);
     $this->temporalVector = new Vector3(0, 0, 0);
     $this->tickRate = 1;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:66,代码来源:Level.php


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