diff --git a/src/CrashDump.php b/src/CrashDump.php index 1e22ba99a..6758ba884 100644 --- a/src/CrashDump.php +++ b/src/CrashDump.php @@ -191,7 +191,7 @@ class CrashDump{ private function extraData() : void{ global $argv; - if($this->server->getConfigGroup()->getProperty("auto-report.send-settings", true) !== false){ + if($this->server->getConfigGroup()->getPropertyBool("auto-report.send-settings", true)){ $this->data["parameters"] = (array) $argv; if(($serverDotProperties = @file_get_contents($this->server->getDataPath() . "server.properties")) !== false){ $this->data["server.properties"] = preg_replace("#^rcon\\.password=(.*)$#m", "rcon.password=******", $serverDotProperties); @@ -214,7 +214,7 @@ class CrashDump{ } $this->data["extensions"] = $extensions; - if($this->server->getConfigGroup()->getProperty("auto-report.send-phpinfo", true) !== false){ + if($this->server->getConfigGroup()->getPropertyBool("auto-report.send-phpinfo", true)){ ob_start(); phpinfo(); $this->data["phpinfo"] = ob_get_contents(); @@ -276,7 +276,7 @@ class CrashDump{ $this->addLine("Code:"); $this->data["code"] = []; - if($this->server->getConfigGroup()->getProperty("auto-report.send-code", true) !== false and file_exists($error["fullFile"])){ + if($this->server->getConfigGroup()->getPropertyBool("auto-report.send-code", true) and file_exists($error["fullFile"])){ $file = @file($error["fullFile"], FILE_IGNORE_NEW_LINES); if($file !== false){ for($l = max(0, $error["line"] - 10); $l < $error["line"] + 10 and isset($file[$l]); ++$l){ diff --git a/src/MemoryManager.php b/src/MemoryManager.php index 0097c8832..b54eed878 100644 --- a/src/MemoryManager.php +++ b/src/MemoryManager.php @@ -123,7 +123,7 @@ class MemoryManager{ } private function init(ServerConfigGroup $config) : void{ - $this->memoryLimit = ((int) $config->getProperty("memory.main-limit", 0)) * 1024 * 1024; + $this->memoryLimit = $config->getPropertyInt("memory.main-limit", 0) * 1024 * 1024; $defaultMemory = 1024; @@ -149,7 +149,7 @@ class MemoryManager{ } } - $hardLimit = ((int) $config->getProperty("memory.main-hard-limit", $defaultMemory)); + $hardLimit = $config->getPropertyInt("memory.main-hard-limit", $defaultMemory); if($hardLimit <= 0){ ini_set("memory_limit", '-1'); @@ -157,22 +157,22 @@ class MemoryManager{ ini_set("memory_limit", $hardLimit . "M"); } - $this->globalMemoryLimit = ((int) $config->getProperty("memory.global-limit", 0)) * 1024 * 1024; - $this->checkRate = (int) $config->getProperty("memory.check-rate", 20); - $this->continuousTrigger = (bool) $config->getProperty("memory.continuous-trigger", true); - $this->continuousTriggerRate = (int) $config->getProperty("memory.continuous-trigger-rate", 30); + $this->globalMemoryLimit = $config->getPropertyInt("memory.global-limit", 0) * 1024 * 1024; + $this->checkRate = $config->getPropertyInt("memory.check-rate", 20); + $this->continuousTrigger = $config->getPropertyBool("memory.continuous-trigger", true); + $this->continuousTriggerRate = $config->getPropertyInt("memory.continuous-trigger-rate", 30); - $this->garbageCollectionPeriod = (int) $config->getProperty("memory.garbage-collection.period", 36000); - $this->garbageCollectionTrigger = (bool) $config->getProperty("memory.garbage-collection.low-memory-trigger", true); - $this->garbageCollectionAsync = (bool) $config->getProperty("memory.garbage-collection.collect-async-worker", true); + $this->garbageCollectionPeriod = $config->getPropertyInt("memory.garbage-collection.period", 36000); + $this->garbageCollectionTrigger = $config->getPropertyBool("memory.garbage-collection.low-memory-trigger", true); + $this->garbageCollectionAsync = $config->getPropertyBool("memory.garbage-collection.collect-async-worker", true); - $this->lowMemChunkRadiusOverride = (int) $config->getProperty("memory.max-chunks.chunk-radius", 4); - $this->lowMemChunkGC = (bool) $config->getProperty("memory.max-chunks.trigger-chunk-collect", true); + $this->lowMemChunkRadiusOverride = $config->getPropertyInt("memory.max-chunks.chunk-radius", 4); + $this->lowMemChunkGC = $config->getPropertyBool("memory.max-chunks.trigger-chunk-collect", true); - $this->lowMemDisableChunkCache = (bool) $config->getProperty("memory.world-caches.disable-chunk-cache", true); - $this->lowMemClearWorldCache = (bool) $config->getProperty("memory.world-caches.low-memory-trigger", true); + $this->lowMemDisableChunkCache = $config->getPropertyBool("memory.world-caches.disable-chunk-cache", true); + $this->lowMemClearWorldCache = $config->getPropertyBool("memory.world-caches.low-memory-trigger", true); - $this->dumpWorkers = (bool) $config->getProperty("memory.memory-dump.dump-async-worker", true); + $this->dumpWorkers = $config->getPropertyBool("memory.memory-dump.dump-async-worker", true); gc_enable(); } diff --git a/src/Server.php b/src/Server.php index 0ebbc6e07..512354548 100644 --- a/src/Server.php +++ b/src/Server.php @@ -496,7 +496,7 @@ class Server{ } public function shouldSavePlayerData() : bool{ - return (bool) $this->configGroup->getProperty("player.save-player-data", true); + return $this->configGroup->getPropertyBool("player.save-player-data", true); } /** @@ -858,13 +858,13 @@ class Server{ ]) ); - $debugLogLevel = (int) $this->configGroup->getProperty("debug.level", 1); + $debugLogLevel = $this->configGroup->getPropertyInt("debug.level", 1); if($this->logger instanceof MainLogger){ $this->logger->setLogDebug($debugLogLevel > 1); } - $this->forceLanguage = (bool) $this->configGroup->getProperty("settings.force-language", false); - $selectedLang = $this->configGroup->getConfigString("language", $this->configGroup->getProperty("settings.language", Language::FALLBACK_LANGUAGE)); + $this->forceLanguage = $this->configGroup->getPropertyBool("settings.force-language", false); + $selectedLang = $this->configGroup->getConfigString("language", $this->configGroup->getPropertyString("settings.language", Language::FALLBACK_LANGUAGE)); try{ $this->language = new Language($selectedLang); }catch(LanguageNotFoundException $e){ @@ -880,7 +880,7 @@ class Server{ $this->logger->info($this->getLanguage()->translateString("language.selected", [$this->getLanguage()->getName(), $this->getLanguage()->getLang()])); if(VersionInfo::IS_DEVELOPMENT_BUILD){ - if(!((bool) $this->configGroup->getProperty("settings.enable-dev-builds", false))){ + if(!$this->configGroup->getPropertyBool("settings.enable-dev-builds", false)){ $this->logger->emergency($this->language->translateString("pocketmine.server.devBuild.error1", [VersionInfo::NAME])); $this->logger->emergency($this->language->translateString("pocketmine.server.devBuild.error2")); $this->logger->emergency($this->language->translateString("pocketmine.server.devBuild.error3")); @@ -902,7 +902,7 @@ class Server{ $this->logger->info($this->getLanguage()->translateString("pocketmine.server.start", [TextFormat::AQUA . $this->getVersion() . TextFormat::RESET])); - if(($poolSize = $this->configGroup->getProperty("settings.async-workers", "auto")) === "auto"){ + if(($poolSize = $this->configGroup->getPropertyString("settings.async-workers", "auto")) === "auto"){ $poolSize = 2; $processors = Utils::getCoreCount() - 2; @@ -913,25 +913,25 @@ class Server{ $poolSize = max(1, (int) $poolSize); } - $this->asyncPool = new AsyncPool($poolSize, max(-1, (int) $this->configGroup->getProperty("memory.async-worker-hard-limit", 256)), $this->autoloader, $this->logger, $this->tickSleeper); + $this->asyncPool = new AsyncPool($poolSize, max(-1, $this->configGroup->getPropertyInt("memory.async-worker-hard-limit", 256)), $this->autoloader, $this->logger, $this->tickSleeper); $netCompressionThreshold = -1; - if($this->configGroup->getProperty("network.batch-threshold", 256) >= 0){ - $netCompressionThreshold = (int) $this->configGroup->getProperty("network.batch-threshold", 256); + if($this->configGroup->getPropertyInt("network.batch-threshold", 256) >= 0){ + $netCompressionThreshold = $this->configGroup->getPropertyInt("network.batch-threshold", 256); } - $netCompressionLevel = (int) $this->configGroup->getProperty("network.compression-level", 6); + $netCompressionLevel = $this->configGroup->getPropertyInt("network.compression-level", 6); if($netCompressionLevel < 1 or $netCompressionLevel > 9){ $this->logger->warning("Invalid network compression level $netCompressionLevel set, setting to default 6"); $netCompressionLevel = 6; } ZlibCompressor::setInstance(new ZlibCompressor($netCompressionLevel, $netCompressionThreshold, ZlibCompressor::DEFAULT_MAX_DECOMPRESSION_SIZE)); - $this->networkCompressionAsync = (bool) $this->configGroup->getProperty("network.async-compression", true); + $this->networkCompressionAsync = $this->configGroup->getPropertyBool("network.async-compression", true); - EncryptionContext::$ENABLED = (bool) $this->configGroup->getProperty("network.enable-encryption", true); + EncryptionContext::$ENABLED = $this->configGroup->getPropertyBool("network.enable-encryption", true); - $this->doTitleTick = ((bool) $this->configGroup->getProperty("console.title-tick", true)) && Terminal::hasFormattingCodes(); + $this->doTitleTick = $this->configGroup->getPropertyBool("console.title-tick", true) && Terminal::hasFormattingCodes(); $this->operators = new Config($this->dataPath . "ops.txt", Config::ENUM); $this->whitelist = new Config($this->dataPath . "white-list.txt", Config::ENUM); @@ -977,8 +977,8 @@ class Server{ $this->logger->info($this->getLanguage()->translateString("pocketmine.server.license", [$this->getName()])); Timings::init(); - TimingsHandler::setEnabled((bool) $this->configGroup->getProperty("settings.enable-profiling", false)); - $this->profilingTickRate = (float) $this->configGroup->getProperty("settings.profile-report-trigger", 20); + TimingsHandler::setEnabled($this->configGroup->getPropertyBool("settings.enable-profiling", false)); + $this->profilingTickRate = $this->configGroup->getPropertyInt("settings.profile-report-trigger", 20); DefaultPermissions::registerCorePermissions(); @@ -1000,13 +1000,13 @@ class Server{ $this->forceShutdown(); return; } - $this->pluginManager = new PluginManager($this, ((bool) $this->configGroup->getProperty("plugins.legacy-data-dir", true)) ? null : $this->getDataPath() . "plugin_data" . DIRECTORY_SEPARATOR, $pluginGraylist); + $this->pluginManager = new PluginManager($this, $this->configGroup->getPropertyBool("plugins.legacy-data-dir", true) ? null : $this->getDataPath() . "plugin_data" . DIRECTORY_SEPARATOR, $pluginGraylist); $this->pluginManager->registerInterface(new PharPluginLoader($this->autoloader)); $this->pluginManager->registerInterface(new ScriptPluginLoader()); $providerManager = new WorldProviderManager(); if( - ($format = $providerManager->getProviderByName($formatName = (string) $this->configGroup->getProperty("level-settings.default-format"))) !== null and + ($format = $providerManager->getProviderByName($formatName = $this->configGroup->getPropertyString("level-settings.default-format", ""))) !== null and is_a($format, WritableWorldProvider::class, true) ){ $providerManager->setDefault($format); @@ -1016,9 +1016,9 @@ class Server{ $this->worldManager = new WorldManager($this, $this->dataPath . "/worlds", $providerManager); $this->worldManager->setAutoSave($this->configGroup->getConfigBool("auto-save", $this->worldManager->getAutoSave())); - $this->worldManager->setAutoSaveInterval((int) $this->configGroup->getProperty("ticks-per.autosave", 6000)); + $this->worldManager->setAutoSaveInterval($this->configGroup->getPropertyInt("ticks-per.autosave", 6000)); - $this->updater = new AutoUpdater($this, $this->configGroup->getProperty("auto-updater.host", "update.pmmp.io")); + $this->updater = new AutoUpdater($this, $this->configGroup->getPropertyString("auto-updater.host", "update.pmmp.io")); $this->queryInfo = new QueryInfo($this); @@ -1107,11 +1107,11 @@ class Server{ $this->network->blockAddress($entry->getName(), -1); } - if((bool) $this->configGroup->getProperty("network.upnp-forwarding", false)){ + if($this->configGroup->getPropertyBool("network.upnp-forwarding", false)){ $this->network->registerInterface(new UPnPNetworkInterface($this->logger, Internet::getInternalIP(), $this->getPort())); } - if((bool) $this->configGroup->getProperty("settings.send-usage", true)){ + if($this->configGroup->getPropertyBool("settings.send-usage", true)){ $this->sendUsageTicker = 6000; $this->sendUsage(SendUsageTask::TYPE_OPEN); } @@ -1396,7 +1396,7 @@ class Server{ } if($this->network instanceof Network){ - $this->network->getSessionManager()->close($this->configGroup->getProperty("settings.shutdown-message", "Server closed")); + $this->network->getSessionManager()->close($this->configGroup->getPropertyString("settings.shutdown-message", "Server closed")); } if($this->worldManager instanceof WorldManager){ @@ -1501,7 +1501,7 @@ class Server{ $this->logger->emergency($this->getLanguage()->translateString("pocketmine.crash.submit", [$dump->getPath()])); - if($this->configGroup->getProperty("auto-report.enabled", true) !== false){ + if($this->configGroup->getPropertyBool("auto-report.enabled", true)){ $report = true; $stamp = $this->getDataPath() . "crashdumps/.last_crash"; @@ -1530,7 +1530,7 @@ class Server{ } if($report){ - $url = ((bool) $this->configGroup->getProperty("auto-report.use-https", true) ? "https" : "http") . "://" . $this->configGroup->getProperty("auto-report.host", "crash.pmmp.io") . "/submit/api"; + $url = ($this->configGroup->getPropertyBool("auto-report.use-https", true) ? "https" : "http") . "://" . $this->configGroup->getPropertyString("auto-report.host", "crash.pmmp.io") . "/submit/api"; $postUrlError = "Unknown error"; $reply = Internet::postURL($url, [ "report" => "yes", @@ -1616,7 +1616,7 @@ class Server{ } public function sendUsage(int $type = SendUsageTask::TYPE_STATUS) : void{ - if((bool) $this->configGroup->getProperty("anonymous-statistics.enabled", true)){ + if($this->configGroup->getPropertyBool("anonymous-statistics.enabled", true)){ $this->asyncPool->submitTask(new SendUsageTask($this, $type, $this->uniquePlayers)); } $this->uniquePlayers = []; diff --git a/src/ServerConfigGroup.php b/src/ServerConfigGroup.php index 88d2bc441..1965e0d7f 100644 --- a/src/ServerConfigGroup.php +++ b/src/ServerConfigGroup.php @@ -65,6 +65,18 @@ final class ServerConfigGroup{ return $this->propertyCache[$variable] ?? $defaultValue; } + public function getPropertyBool(string $variable, bool $defaultValue) : bool{ + return (bool) $this->getProperty($variable, $defaultValue); + } + + public function getPropertyInt(string $variable, int $defaultValue) : int{ + return (int) $this->getProperty($variable, $defaultValue); + } + + public function getPropertyString(string $variable, string $defaultValue) : string{ + return (string) $this->getProperty($variable, $defaultValue); + } + public function getConfigString(string $variable, string $defaultValue = "") : string{ $v = getopt("", ["$variable::"]); if(isset($v[$variable])){ diff --git a/src/command/defaults/TimingsCommand.php b/src/command/defaults/TimingsCommand.php index 3c3fbf670..bcdd3ea10 100644 --- a/src/command/defaults/TimingsCommand.php +++ b/src/command/defaults/TimingsCommand.php @@ -131,7 +131,7 @@ class TimingsCommand extends VanillaCommand{ ]; fclose($fileTimings); - $host = $sender->getServer()->getConfigGroup()->getProperty("timings.host", "timings.pmmp.io"); + $host = $sender->getServer()->getConfigGroup()->getPropertyString("timings.host", "timings.pmmp.io"); $sender->getServer()->getAsyncPool()->submitTask(new BulkCurlTask( [new BulkCurlTaskOperation( diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index cea24cb9c..9ba761abd 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -595,7 +595,7 @@ class NetworkSession{ } $this->logger->debug("Xbox Live authenticated: " . ($this->authenticated ? "YES" : "NO")); - $checkXUID = (bool) $this->server->getConfigGroup()->getProperty("player.verify-xuid", true); + $checkXUID = $this->server->getConfigGroup()->getPropertyBool("player.verify-xuid", true); $myXUID = $this->info instanceof XboxLivePlayerInfo ? $this->info->getXuid() : ""; $kickForXUIDMismatch = function(string $xuid) use ($checkXUID, $myXUID) : bool{ if($checkXUID && $myXUID !== $xuid){ diff --git a/src/network/mcpe/raklib/RakLibInterface.php b/src/network/mcpe/raklib/RakLibInterface.php index 5eb5d40dd..9a5b38ceb 100644 --- a/src/network/mcpe/raklib/RakLibInterface.php +++ b/src/network/mcpe/raklib/RakLibInterface.php @@ -103,7 +103,7 @@ class RakLibInterface implements ServerEventListener, AdvancedNetworkInterface{ $threadToMainBuffer, new InternetAddress($this->server->getIp(), $this->server->getPort(), 4), $this->rakServerId, - (int) $this->server->getConfigGroup()->getProperty("network.max-mtu-size", 1492), + $this->server->getConfigGroup()->getPropertyInt("network.max-mtu-size", 1492), self::MCPE_RAKNET_PROTOCOL_VERSION, $this->sleeper ); diff --git a/src/network/query/QueryInfo.php b/src/network/query/QueryInfo.php index 47e95eeda..25d07f549 100644 --- a/src/network/query/QueryInfo.php +++ b/src/network/query/QueryInfo.php @@ -77,7 +77,7 @@ final class QueryInfo{ public function __construct(Server $server){ $this->serverName = $server->getMotd(); - $this->listPlugins = (bool) $server->getConfigGroup()->getProperty("settings.query-plugins", true); + $this->listPlugins = $server->getConfigGroup()->getPropertyBool("settings.query-plugins", true); $this->plugins = $server->getPluginManager()->getPlugins(); $this->players = $server->getOnlinePlayers(); diff --git a/src/player/Player.php b/src/player/Player.php index 9cf9ba72d..983c86010 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -281,8 +281,8 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ $rootPermissions[DefaultPermissions::ROOT_OPERATOR] = true; } $this->perm = new PermissibleBase($rootPermissions); - $this->chunksPerTick = (int) $this->server->getConfigGroup()->getProperty("chunk-sending.per-tick", 4); - $this->spawnThreshold = (int) (($this->server->getConfigGroup()->getProperty("chunk-sending.spawn-radius", 4) ** 2) * M_PI); + $this->chunksPerTick = $this->server->getConfigGroup()->getPropertyInt("chunk-sending.per-tick", 4); + $this->spawnThreshold = (int) (($this->server->getConfigGroup()->getPropertyInt("chunk-sending.spawn-radius", 4) ** 2) * M_PI); $this->chunkSelector = new ChunkSelector(); $this->chunkLoader = new PlayerChunkLoader($spawnLocation); @@ -502,7 +502,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ public function setViewDistance(int $distance) : void{ $this->viewDistance = $this->server->getAllowedViewDistance($distance); - $this->spawnThreshold = (int) (min($this->viewDistance, $this->server->getConfigGroup()->getProperty("chunk-sending.spawn-radius", 4)) ** 2 * M_PI); + $this->spawnThreshold = (int) (min($this->viewDistance, $this->server->getConfigGroup()->getPropertyInt("chunk-sending.spawn-radius", 4)) ** 2 * M_PI); $this->nextChunkOrderRun = 0; @@ -806,7 +806,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ $this->spawnToAll(); - if($this->server->getUpdater()->hasUpdate() and $this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE) and $this->server->getConfigGroup()->getProperty("auto-updater.on-update.warn-ops", true)){ + if($this->server->getUpdater()->hasUpdate() and $this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE) and $this->server->getConfigGroup()->getPropertyBool("auto-updater.on-update.warn-ops", true)){ $this->server->getUpdater()->showPlayerUpdate($this); } diff --git a/src/stats/SendUsageTask.php b/src/stats/SendUsageTask.php index c29eb60bc..751679732 100644 --- a/src/stats/SendUsageTask.php +++ b/src/stats/SendUsageTask.php @@ -60,7 +60,7 @@ class SendUsageTask extends AsyncTask{ * @phpstan-param array $playerList */ public function __construct(Server $server, int $type, array $playerList = []){ - $endpoint = "http://" . $server->getConfigGroup()->getProperty("anonymous-statistics.host", "stats.pocketmine.net") . "/"; + $endpoint = "http://" . $server->getConfigGroup()->getPropertyString("anonymous-statistics.host", "stats.pocketmine.net") . "/"; $data = []; $data["uniqueServerId"] = $server->getServerUniqueId()->toString(); diff --git a/src/updater/AutoUpdater.php b/src/updater/AutoUpdater.php index 9ca12b85e..34ed5b7c1 100644 --- a/src/updater/AutoUpdater.php +++ b/src/updater/AutoUpdater.php @@ -55,7 +55,7 @@ class AutoUpdater{ $this->logger = new \PrefixedLogger($server->getLogger(), "Auto Updater"); $this->endpoint = "http://$endpoint/api/"; - if((bool) $server->getConfigGroup()->getProperty("auto-updater.enabled", true)){ + if($server->getConfigGroup()->getPropertyBool("auto-updater.enabled", true)){ $this->doCheck(); } } @@ -72,7 +72,7 @@ class AutoUpdater{ $this->checkUpdate(); if($this->hasUpdate()){ (new UpdateNotifyEvent($this))->call(); - if((bool) $this->server->getConfigGroup()->getProperty("auto-updater.on-update.warn-console", true)){ + if($this->server->getConfigGroup()->getPropertyBool("auto-updater.on-update.warn-console", true)){ $this->showConsoleUpdate(); } }else{ @@ -178,7 +178,7 @@ class AutoUpdater{ * Returns the channel used for update checking (stable, beta, dev) */ public function getChannel() : string{ - $channel = strtolower($this->server->getConfigGroup()->getProperty("auto-updater.preferred-channel", "stable")); + $channel = strtolower($this->server->getConfigGroup()->getPropertyString("auto-updater.preferred-channel", "stable")); if($channel !== "stable" and $channel !== "beta" and $channel !== "alpha" and $channel !== "development"){ $channel = "stable"; } diff --git a/src/world/World.php b/src/world/World.php index 9abea832e..06acb4871 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -428,10 +428,10 @@ class World implements ChunkManager{ $this->time = $this->provider->getWorldData()->getTime(); $cfg = $this->server->getConfigGroup(); - $this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $cfg->getProperty("chunk-ticking.tick-radius", 4))); - $this->chunksPerTick = (int) $cfg->getProperty("chunk-ticking.per-tick", 40); - $this->tickedBlocksPerSubchunkPerTick = (int) $cfg->getProperty("chunk-ticking.blocks-per-subchunk-per-tick", self::DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK); - $this->maxConcurrentChunkPopulationTasks = (int) $cfg->getProperty("chunk-generation.population-queue-size", 2); + $this->chunkTickRadius = min($this->server->getViewDistance(), max(1, $cfg->getPropertyInt("chunk-ticking.tick-radius", 4))); + $this->chunksPerTick = $cfg->getPropertyInt("chunk-ticking.per-tick", 40); + $this->tickedBlocksPerSubchunkPerTick = $cfg->getPropertyInt("chunk-ticking.blocks-per-subchunk-per-tick", self::DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK); + $this->maxConcurrentChunkPopulationTasks = $cfg->getPropertyInt("chunk-generation.population-queue-size", 2); $dontTickBlocks = array_fill_keys($cfg->getProperty("chunk-ticking.disable-block-ticking", []), true); diff --git a/tests/phpstan/configs/check-explicit-mixed-baseline.neon b/tests/phpstan/configs/check-explicit-mixed-baseline.neon index 5f1245f45..f43930171 100644 --- a/tests/phpstan/configs/check-explicit-mixed-baseline.neon +++ b/tests/phpstan/configs/check-explicit-mixed-baseline.neon @@ -15,29 +15,14 @@ parameters: count: 1 path: ../../../src/CrashDump.php - - - message: "#^Cannot cast mixed to int\\.$#" - count: 7 - path: ../../../src/MemoryManager.php - - message: "#^Cannot access offset 'type' on mixed\\.$#" count: 1 path: ../../../src/Server.php - - - message: "#^Cannot cast mixed to float\\.$#" - count: 1 - path: ../../../src/Server.php - - - - message: "#^Cannot cast mixed to int\\.$#" - count: 6 - path: ../../../src/Server.php - - message: "#^Cannot cast mixed to string\\.$#" - count: 2 + count: 1 path: ../../../src/Server.php - @@ -45,29 +30,14 @@ parameters: count: 1 path: ../../../src/Server.php - - - message: "#^Parameter \\#1 \\$reason of method pocketmine\\\\network\\\\NetworkSessionManager\\:\\:close\\(\\) expects string, mixed given\\.$#" - count: 1 - path: ../../../src/Server.php - - - - message: "#^Parameter \\#2 \\$defaultValue of method pocketmine\\\\ServerConfigGroup\\:\\:getConfigString\\(\\) expects string, mixed given\\.$#" - count: 1 - path: ../../../src/Server.php - - - - message: "#^Parameter \\#2 \\$endpoint of class pocketmine\\\\updater\\\\AutoUpdater constructor expects string, mixed given\\.$#" - count: 1 - path: ../../../src/Server.php - - message: "#^Cannot cast mixed to int\\.$#" - count: 1 + count: 2 path: ../../../src/ServerConfigGroup.php - message: "#^Cannot cast mixed to string\\.$#" - count: 1 + count: 2 path: ../../../src/ServerConfigGroup.php - @@ -80,11 +50,6 @@ parameters: count: 2 path: ../../../src/VersionInfo.php - - - message: "#^Part \\$host \\(mixed\\) of encapsed string cannot be cast to string\\.$#" - count: 1 - path: ../../../src/command/defaults/TimingsCommand.php - - message: "#^Cannot cast mixed to float\\.$#" count: 1 @@ -115,11 +80,6 @@ parameters: count: 1 path: ../../../src/network/mcpe/raklib/PthreadsChannelReader.php - - - message: "#^Cannot cast mixed to int\\.$#" - count: 1 - path: ../../../src/network/mcpe/raklib/RakLibInterface.php - - message: "#^Parameter \\#1 \\$value of static method pocketmine\\\\permission\\\\PermissionParser\\:\\:defaultFromString\\(\\) expects bool\\|string, mixed given\\.$#" count: 1 @@ -130,11 +90,6 @@ parameters: count: 1 path: ../../../src/permission/PermissionParser.php - - - message: "#^Cannot cast mixed to int\\.$#" - count: 1 - path: ../../../src/player/Player.php - - message: "#^Parameter \\#1 \\$description of method pocketmine\\\\command\\\\Command\\:\\:setDescription\\(\\) expects string, mixed given\\.$#" count: 1 @@ -240,11 +195,6 @@ parameters: count: 1 path: ../../../src/timings/TimingsHandler.php - - - message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#" - count: 1 - path: ../../../src/updater/AutoUpdater.php - - message: "#^Parameter \\#2 \\$start of function substr expects int, mixed given\\.$#" count: 1 @@ -285,11 +235,6 @@ parameters: count: 1 path: ../../../src/utils/Utils.php - - - message: "#^Cannot cast mixed to int\\.$#" - count: 4 - path: ../../../src/world/World.php - - message: "#^Parameter \\#1 \\$keys of function array_fill_keys expects array, mixed given\\.$#" count: 1