Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /* __________________________________________________ | Aquamarine 1.0..
Decoded Output download
<?php
/* __________________________________________________
| Aquamarine 1.0.8-private release |
| Author's VK: https://vk.com/maruselplay |
| VK Group: https://vk.com/aquamarine.team |
|__________________________________________________|
*/
namespace pocketmine;
use pocketmine\command\{CommandReader, CommandSender, ConsoleCommandSender, PluginIdentifiableCommand, SimpleCommandMap, Command};
use pocketmine\event\{HandlerList, level\LevelInitEvent, level\LevelLoadEvent, server\QueryRegenerateEvent, server\ServerCommandEvent, Timings, TimingsHandler, TranslationContainer};
use pocketmine\level\{format\io\LevelProviderManager, format\io\leveldb\LevelDB, format\io\region\Anvil, format\io\region\McRegion, format\io\region\PMAnvil, generator\biome\Biome, generator\ender\Ender, generator\Flat, generator\Generator, generator\hell\Nether, generator\normal\Normal, generator\VoidGenerator, Level, LevelException};
use pocketmine\metadata\{EntityMetadataStore, LevelMetadataStore, PlayerMetadataStore};
use pocketmine\nbt\{NBT, tag\ByteTag, tag\CompoundTag, tag\DoubleTag, tag\FloatTag, tag\IntTag, tag\ListTag, tag\LongTag, tag\ShortTag, tag\StringTag};
use pocketmine\network\{AdvancedSourceInterface, CompressBatchedTask, Network, mcpe\protocol\BatchPacket, mcpe\protocol\DataPacket, mcpe\protocol\ProtocolInfo, mcpe\protocol\PlayerListPacket, query\QueryHandler, mcpe\RakLibInterface, rcon\RCON, upnp\UPnP};
use pocketmine\plugin\{PharPluginLoader, FolderPluginLoader, Plugin, PluginLoadOrder, PluginManager, ScriptPluginLoader};
use pocketmine\utils\{Binary, Color, Config, Internet, MainLogger, ServerException, Terminal, TextFormat, Utils, UUID, VersionString};
use pocketmine\block\Block;
use pocketmine\entity\Entity;
use pocketmine\entity\ThrownPotion;
use pocketmine\entity\ThrownExpBottle;
use pocketmine\inventory\{CraftingManager, InventoryType, Recipe};
use pocketmine\item\{Item, enchantment\Enchantment, enchantment\EnchantmentLevelTable};
use pocketmine\lang\BaseLang;
use pocketmine\permission\{BanList, DefaultPermissions};
use pocketmine\resourcepacks\ResourcePackManager;
use pocketmine\scheduler\{CallbackTask, DServerTask, ServerScheduler};
use pocketmine\snooze\{SleeperHandler, SleeperNotifier};
use pocketmine\tile\Tile;
class Server
{
const BROADCAST_CHANNEL_ADMINISTRATIVE = "pocketmine.broadcast.admin";
const BROADCAST_CHANNEL_USERS = "pocketmine.broadcast.user";
const PLAYER_MSG_TYPE_MESSAGE = 0;
const PLAYER_MSG_TYPE_TIP = 1;
const PLAYER_MSG_TYPE_POPUP = 2;
private static $instance = null;
private static $sleeper = null;
public $loginPlayers = [];
private $banByName = null;
private $banByIP = null;
private $banByCID = \null;
private $operators = null;
private $whitelist = null;
private $isRunning = true;
private $hasStopped = false;
private $pluginManager = null;
private $profilingTickRate = 20;
private $scheduler = null;
public $commandList = null;
private $tickCounter = 0;
private $nextTick = 0;
private $tickAverage = [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20];
private $useAverage = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
private $currentTPS = 20;
private $currentUse = 0;
private $doTitleTick = true;
private $dispatchSignals = false;
private $logger;
private $memoryManager;
private $console = null;
private $commandMap = null;
private $craftingManager;
private $resourceManager;
private $consoleSender;
private $maxPlayers;
private $autoSave;
private $rcon = null;
private $entityMetadata;
private $expCache;
private $playerMetadata;
private $levelMetadata;
private $network;
private $networkCompressionAsync = true;
public $networkCompressionLevel = 7;
private $autoSaveTicker = 0;
private $autoSaveTicks = 6000;
private $baseLang;
private $forceLanguage = false;
private $serverID;
private $autoloader;
private $dataPath;
private $pluginPath;
private $queryHandler;
private $queryRegenerateTask = null;
private $properties;
private $propertyCache = [];
private $config;
private $players = [];
private $playerList = [];
private $levels = [];
private $levelDefault = null;
public $advancedConfig = null;
public $weatherEnabled = true;
public $foodEnabled = true;
public $expEnabled = true;
public $keepInventory = false;
public $netherEnabled = false;
public $netherName = "nether";
public $netherLevel = null;
public $weatherRandomDurationMin = 6000;
public $weatherRandomDurationMax = 12000;
public $lightningTime = 200;
public $lightningFire = false;
public $version;
public $allowSnowGolem;
public $allowIronGolem;
public $allowWither;
public $autoClearInv = true;
public $dserverConfig = [];
public $dserverPlayers = 0;
public $dserverAllPlayers = 0;
public $redstoneEnabled = false;
public $allowFrequencyPulse = true;
public $anvilEnabled = false;
public $pulseFrequency = 20;
public $playerMsgType = self::PLAYER_MSG_TYPE_MESSAGE;
public $playerLoginMsg = '';
public $playerLogoutMsg = '';
public $toolboxAllowed = false;
public $keepExperience = false;
public $limitedCreative = true;
public $chunkRadius = -1;
public $destroyBlockParticle = true;
public $allowSplashPotion = true;
public $fireSpread = false;
public $advancedCommandSelector = false;
public $enchantingTableEnabled = true;
public $countBookshelf = false;
public $allowInventoryCheats = false;
public $folderpluginloader = true;
public $loadIncompatibleAPI = true;
public $enderEnabled = true;
public $enderName = "ender";
public $enderLevel = null;
public $absorbWater = false;
public $mobConfig = null;
private $tickSleeper;
public function getName() : string
{
return \pocketmine\NAME;
}
public function isRunning()
{
return $this->isRunning;
}
public function getUptime()
{
$O2443194464429585319 = microtime(true) - \pocketmine\START_TIME;
$O9341030443986593567 = floor($O2443194464429585319 % 60);
$O9094843649069554908 = null;
$O6918382190265139924 = null;
$O4073484623576673913 = null;
if ($O2443194464429585319 >= 60) {
$O9094843649069554908 = floor($O2443194464429585319 % 3600 / 60);
if ($O2443194464429585319 >= 3600) {
$O6918382190265139924 = floor($O2443194464429585319 % (3600 * 24) / 3600);
if ($O2443194464429585319 >= 3600 * 24) {
$O4073484623576673913 = floor($O2443194464429585319 / (3600 * 24));
}
}
}
$O9653277240791867984 = ($O9094843649069554908 !== null ? ($O6918382190265139924 !== null ? ($O4073484623576673913 !== null ? "{$O4073484623576673913} " . $this->getLanguage()->translateString("%pocketmine.command.status.days") . " " : '') . "{$O6918382190265139924} " . $this->getLanguage()->translateString("%pocketmine.command.status.hours") . " " : '') . "{$O9094843649069554908} " . $this->getLanguage()->translateString("%pocketmine.command.status.minutes") . " " : '') . "{$O9341030443986593567} " . $this->getLanguage()->translateString("%pocketmine.command.status.seconds");
return $O9653277240791867984;
}
public function getPocketMineVersion()
{
return \pocketmine\VERSION;
}
public function getFormattedVersion($O4468622385813754109 = '')
{
return \pocketmine\VERSION !== '' ? $O4468622385813754109 . \pocketmine\VERSION : '';
}
public function getGitCommit()
{
return \pocketmine\GIT_COMMIT;
}
public function getShortGitCommit()
{
return substr(\pocketmine\GIT_COMMIT, 0, 7);
}
public function getCodename()
{
return \pocketmine\CODENAME;
}
public function getVersion()
{
$O9862494584748528374 = implode(", ", ProtocolInfo::MINECRAFT_VERSION);
return $O9862494584748528374;
}
public function getApiVersion()
{
return \pocketmine\API_VERSION;
}
public function getGeniApiVersion()
{
return \pocketmine\GENISYS_API_VERSION;
}
public function getFilePath()
{
return \pocketmine\PATH;
}
public function getResourcePath() : string
{
return \pocketmine\RESOURCE_PATH;
}
public function getDataPath()
{
return $this->dataPath;
}
public function getPluginPath()
{
return $this->pluginPath;
}
public function getMaxPlayers()
{
return $this->maxPlayers;
}
public function getPort()
{
return $this->getConfigInt("server-port", 19132);
}
public function getViewDistance() : int
{
return max(2, $this->getConfigInt("view-distance", 8));
}
public function getAllowedViewDistance(int $O8433540969984747347) : int
{
return max(2, min($O8433540969984747347, $this->memoryManager->getViewDistance($this->getViewDistance())));
}
public function getIp() : string
{
$O0975452763598009383 = $this->getConfigString("server-ip");
return $O0975452763598009383 !== '' ? $O0975452763598009383 : "0.0.0.0";
}
public function getServerUniqueId()
{
return $this->serverID;
}
public function getAutoSave()
{
return $this->autoSave;
}
public function setAutoSave($O9021849237811156087)
{
$this->autoSave = (bool) $O9021849237811156087;
foreach ($this->getLevels() as $O8990405184547542856) {
$O8990405184547542856->setAutoSave($this->autoSave);
}
}
public function getLevelType()
{
return $this->getConfigString("level-type", "DEFAULT");
}
public function getGenerateStructures()
{
return $this->getConfigBoolean("generate-structures", true);
}
public function getGamemode()
{
return $this->getConfigInt("gamemode", 0) & 0b11;
}
public function getForceGamemode()
{
return $this->getConfigBoolean("force-gamemode", false);
}
public static function getGamemodeString($O0168140512795630311)
{
switch ((int) $O0168140512795630311) {
case Player::SURVIVAL:
return "%gameMode.survival";
case Player::CREATIVE:
return "%gameMode.creative";
case Player::ADVENTURE:
return "%gameMode.adventure";
case Player::SPECTATOR:
return "%gameMode.spectator";
}
return "UNKNOWN";
}
public static function getGamemodeName(int $O0168140512795630311) : string
{
switch ($O0168140512795630311) {
case Player::SURVIVAL:
return "Survival";
case Player::CREATIVE:
return "Creative";
case Player::ADVENTURE:
return "Adventure";
case Player::SPECTATOR:
return "Spectator";
default:
throw new \InvalidArgumentException("Invalid gamemode {$O0168140512795630311}");
}
}
public static function getGamemodeFromString($O0975452763598009383)
{
switch (strtolower(trim($O0975452763598009383))) {
case (string) Player::SURVIVAL:
case "survival":
case "s":
return Player::SURVIVAL;
case (string) Player::CREATIVE:
case "creative":
case "c":
return Player::CREATIVE;
case (string) Player::ADVENTURE:
case "adventure":
case "a":
return Player::ADVENTURE;
case (string) Player::SPECTATOR:
case "spectator":
case "view":
case "v":
return Player::SPECTATOR;
}
return -1;
}
public static function getDifficultyFromString($O0975452763598009383)
{
switch (strtolower(trim($O0975452763598009383))) {
case "0":
case "peaceful":
case "p":
return 0;
case "1":
case "easy":
case "e":
return 1;
case "2":
case "normal":
case "n":
return 2;
case "3":
case "hard":
case "h":
return 3;
}
return -1;
}
public function getDifficulty()
{
return $this->getConfigInt("difficulty", 1);
}
public function hasWhitelist()
{
return $this->getConfigBoolean("white-list", false);
}
public function getSpawnRadius()
{
return $this->getConfigInt("spawn-protection", 16);
}
public function getAllowFlight() : bool
{
return true;
}
public function isHardcore()
{
return $this->getConfigBoolean("hardcore", false);
}
public function getDefaultGamemode()
{
return $this->getConfigInt("gamemode", 0) & 0b11;
}
public function getMotd()
{
return $this->getConfigString("motd", "Minecraft: PE Server");
}
public function getLoader()
{
return $this->autoloader;
}
public function getLogger()
{
return $this->logger;
}
public function getEntityMetadata()
{
return $this->entityMetadata;
}
public function getPlayerMetadata()
{
return $this->playerMetadata;
}
public function getLevelMetadata()
{
return $this->levelMetadata;
}
public function getPluginManager()
{
return $this->pluginManager;
}
public function getCraftingManager()
{
return $this->craftingManager;
}
public function getResourceManager() : ResourcePackManager
{
return $this->resourceManager;
}
public function getResourcePackManager() : ResourcePackManager
{
return $this->resourceManager;
}
public function getScheduler()
{
return $this->scheduler;
}
public function getTick() : int
{
return $this->tickCounter;
}
public function getTicksPerSecond()
{
return round($this->currentTPS, 2);
}
public function getTicksPerSecondAverage()
{
return round(array_sum($this->tickAverage) / count($this->tickAverage), 2);
}
public function getTickUsage()
{
return round($this->currentUse * 100, 2);
}
public function getTickUsageAverage()
{
return round(array_sum($this->useAverage) / count($this->useAverage) * 100, 2);
}
public function getCommandMap()
{
return $this->commandMap;
}
public function getOnlinePlayers()
{
return $this->playerList;
}
public function addRecipe(Recipe $O7631291917453267167)
{
$this->craftingManager->registerRecipe($O7631291917453267167);
}
public function shouldSavePlayerData() : bool
{
return (bool) $this->getProperty("player.save-player-data", true);
}
public function getOfflinePlayer(string $O3599798456741367439)
{
$O3599798456741367439 = strtolower($O3599798456741367439);
$O1720501386514426509 = $this->getPlayerExact($O3599798456741367439);
if ($O1720501386514426509 === null) {
$O1720501386514426509 = new OfflinePlayer($this, $O3599798456741367439);
}
return $O1720501386514426509;
}
private function getPlayerDataPath(string $O5911788118614605079) : string
{
return $this->getDataPath() . "/players/" . strtolower($O5911788118614605079) . ".dat";
}
public function hasOfflinePlayerData(string $O3599798456741367439) : bool
{
return file_exists($this->getPlayerDataPath($O3599798456741367439));
}
public function getOfflinePlayerData(string $O3599798456741367439)
{
$O3599798456741367439 = strtolower($O3599798456741367439);
$O3050887916085603833 = $this->getDataPath() . "players/";
if ($this->shouldSavePlayerData()) {
if (file_exists($O3050887916085603833 . "{$O3599798456741367439}.dat")) {
try {
$O6119036173800608151 = new NBT(NBT::BIG_ENDIAN);
$O6119036173800608151->readCompressed(file_get_contents($O3050887916085603833 . "{$O3599798456741367439}.dat"));
return $O6119036173800608151->getData();
} catch (\Throwable $O7980738059105788111) {
rename($O3050887916085603833 . "{$O3599798456741367439}.dat", $O3050887916085603833 . "{$O3599798456741367439}.dat.bak");
$this->logger->notice($this->getLanguage()->translateString("pocketmine.data.playerCorrupted", [$O3599798456741367439]));
}
} else {
$this->logger->notice($this->getLanguage()->translateString("pocketmine.data.playerNotFound", [$O3599798456741367439]));
}
}
$O0312716190911024736 = $this->getDefaultLevel()->getSafeSpawn();
$O3349255190547088167 = (int) (microtime(true) * 1000);
$O6119036173800608151 = new CompoundTag('', [new LongTag("firstPlayed", $O3349255190547088167), new LongTag("lastPlayed", $O3349255190547088167), new ListTag("Pos", [new DoubleTag(0, $O0312716190911024736->x), new DoubleTag(1, $O0312716190911024736->y), new DoubleTag(2, $O0312716190911024736->z)]), new StringTag("Level", $this->getDefaultLevel()->getName()), new ListTag("Inventory", []), new ListTag("EnderChestInventory", []), new CompoundTag("Achievements", []), new IntTag("playerGameType", $this->getGamemode()), new ListTag("Motion", [new DoubleTag(0, 0.0), new DoubleTag(1, 0.0), new DoubleTag(2, 0.0)]), new ListTag("Rotation", [new FloatTag(0, 0.0), new FloatTag(1, 0.0)]), new FloatTag("FallDistance", 0.0), new ShortTag("Fire", 0), new ShortTag("Air", 300), new ByteTag("OnGround", 1), new ByteTag("Invulnerable", 0), new StringTag("NameTag", $O3599798456741367439), new ShortTag("Health", 20), new ShortTag("MaxHealth", 20)]);
$O6119036173800608151->Pos->setTagType(NBT::TAG_Double);
$O6119036173800608151->Inventory->setTagType(NBT::TAG_Compound);
$O6119036173800608151->EnderChestInventory->setTagType(NBT::TAG_Compound);
$O6119036173800608151->Motion->setTagType(NBT::TAG_Double);
$O6119036173800608151->Rotation->setTagType(NBT::TAG_Float);
$this->saveOfflinePlayerData($O3599798456741367439, $O6119036173800608151);
return $O6119036173800608151;
}
public function saveOfflinePlayerData(string $O3599798456741367439, CompoundTag $O0105286391214512151)
{
if ($this->shouldSavePlayerData()) {
$O6119036173800608151 = new NBT(NBT::BIG_ENDIAN);
try {
$O6119036173800608151->setData($O0105286391214512151);
file_put_contents($this->getDataPath() . "players/" . strtolower($O3599798456741367439) . ".dat", $O6119036173800608151->writeCompressed());
} catch (\Throwable $O7980738059105788111) {
$this->logger->critical($this->getLanguage()->translateString("pocketmine.data.saveError", [$O3599798456741367439, $O7980738059105788111->getMessage()]));
$this->logger->logException($O7980738059105788111);
}
}
}
public function getPlayer(string $O3599798456741367439)
{
$O2047861407786862059 = null;
$O3599798456741367439 = strtolower($O3599798456741367439);
$O8946152267816428737 = PHP_INT_MAX;
foreach ($this->getOnlinePlayers() as $O6725082928939594459) {
if (stripos($O6725082928939594459->getName(), $O3599798456741367439) === 0) {
$O0492273000808735053 = strlen($O6725082928939594459->getName()) - strlen($O3599798456741367439);
if ($O0492273000808735053 < $O8946152267816428737) {
$O2047861407786862059 = $O6725082928939594459;
$O8946152267816428737 = $O0492273000808735053;
}
if ($O0492273000808735053 === 0) {
break;
}
}
}
return $O2047861407786862059;
}
public function getPlayerExact(string $O3599798456741367439)
{
$O3599798456741367439 = strtolower($O3599798456741367439);
foreach ($this->getOnlinePlayers() as $O6725082928939594459) {
if (strtolower($O6725082928939594459->getName()) === $O3599798456741367439) {
return $O6725082928939594459;
}
}
return null;
}
public function matchPlayer($O1467530431298244211)
{
$O1467530431298244211 = strtolower($O1467530431298244211);
$O3437239058632284834 = [];
foreach ($this->getOnlinePlayers() as $O6725082928939594459) {
if (strtolower($O6725082928939594459->getName()) === $O1467530431298244211) {
$O3437239058632284834 = [$O6725082928939594459];
}
if (stripos($O6725082928939594459->getName(), $O1467530431298244211) !== false) {
$O3437239058632284834[] = $O6725082928939594459;
} else {
}
}
return $O3437239058632284834;
}
public function getPlayerByRawUUID(string $O5798241888478878256) : ?Player
{
return $this->playerList[$O5798241888478878256] ?? null;
}
public function getPlayerByUUID(UUID $O9479455264228622327) : ?Player
{
return $this->getPlayerByRawUUID($O9479455264228622327->toBinary());
}
public function removePlayer(Player $O6725082928939594459)
{
unset($this->players[spl_object_hash($O6725082928939594459)]);
}
public function getLevels()
{
return $this->levels;
}
public function getDefaultLevel()
{
return $this->levelDefault;
}
public function setDefaultLevel(?Level $O8990405184547542856) : void
{
if ($O8990405184547542856 === null or $this->isLevelLoaded($O8990405184547542856->getFolderName()) and $O8990405184547542856 !== $this->levelDefault) {
$this->levelDefault = $O8990405184547542856;
}
}
public function isLevelLoaded($O3599798456741367439)
{
return $this->getLevelByName($O3599798456741367439) instanceof Level;
}
public function getLevel($O7670272462308816267)
{
return $this->levels[$O7670272462308816267] ?? null;
}
public function getLevelByName($O3599798456741367439)
{
foreach ($this->getLevels() as $O8990405184547542856) {
if ($O8990405184547542856->getFolderName() === $O3599798456741367439) {
return $O8990405184547542856;
}
}
return null;
}
public function getExpectedExperience($O8990405184547542856)
{
if (isset($this->expCache[$O8990405184547542856])) {
return $this->expCache[$O8990405184547542856];
}
$O8171822444395634623 = $O8990405184547542856 ** 2;
if ($O8990405184547542856 < 16) {
$this->expCache[$O8990405184547542856] = $O8171822444395634623 + 6 * $O8990405184547542856;
} else {
if ($O8990405184547542856 < 31) {
$this->expCache[$O8990405184547542856] = 2.5 * $O8171822444395634623 - 40.5 * $O8990405184547542856 + 360;
} else {
$this->expCache[$O8990405184547542856] = 4.5 * $O8171822444395634623 - 162.5 * $O8990405184547542856 + 2220;
}
}
return $this->expCache[$O8990405184547542856];
}
public function unloadLevel(Level $O8990405184547542856, $O1859982694370446388 = false)
{
if ($O8990405184547542856 === $this->getDefaultLevel() and !$O1859982694370446388) {
throw new \InvalidStateException("The default world cannot be unloaded while running, please switch worlds.");
}
return $O8990405184547542856->unload($O1859982694370446388);
}
public function removeLevel(Level $O8990405184547542856) : void
{
unset($this->levels[$O8990405184547542856->getId()]);
}
public function loadLevel($O3599798456741367439)
{
if (trim($O3599798456741367439) === '') {
throw new LevelException("Invalid empty level name");
}
if ($this->isLevelLoaded($O3599798456741367439)) {
return true;
} else {
if (!$this->isLevelGenerated($O3599798456741367439)) {
$this->logger->notice($this->getLanguage()->translateString("pocketmine.level.notFound", [$O3599798456741367439]));
return false;
} else {
}
}
$O3050887916085603833 = $this->getDataPath() . "worlds/" . $O3599798456741367439 . "/";
$O7755050365517905803 = LevelProviderManager::getProvider($O3050887916085603833);
if ($O7755050365517905803 === null) {
$this->logger->error($this->getLanguage()->translateString("pocketmine.level.loadError", [$O3599798456741367439, "Cannot identify format of world"]));
return false;
}
try {
$O8990405184547542856 = new Level($this, $O3599798456741367439, $O3050887916085603833, $O7755050365517905803);
} catch (\Throwable $O7980738059105788111) {
goto O5063443397781911906;
O3811998597028183027:
$this->logger->logException($O7980738059105788111);
goto O6623103670022083984;
O2336751932189250758:
return false;
goto O6200657934645304063;
O6623103670022083984:
O4750440198214853292:
goto O2336751932189250758;
O5063443397781911906:
$this->logger->error($this->getLanguage()->translateString("pocketmine.level.loadError", [$O3599798456741367439, $O7980738059105788111->getMessage()]));
goto O4894909439047598507;
O4894909439047598507:
if (!$this->logger instanceof MainLogger) {
goto O4750440198214853292;
}
goto O3811998597028183027;
O6200657934645304063:
}
$this->levels[$O8990405184547542856->getId()] = $O8990405184547542856;
$O8990405184547542856->initLevel();
$this->getPluginManager()->callEvent(new LevelLoadEvent($O8990405184547542856));
return true;
}
public function generateLevel($O3599798456741367439, $O1719463550011029788 = null, $O7368252357325108075 = null, $O5599874228007848556 = [])
{
if (trim($O3599798456741367439) === '' or $this->isLevelGenerated($O3599798456741367439)) {
return false;
}
$O1719463550011029788 = $O1719463550011029788 ?? random_int(INT32_MIN, INT32_MAX);
if (!isset($O5599874228007848556["preset"])) {
$O5599874228007848556["preset"] = $this->getConfigString("generator-settings", '');
}
if (!($O7368252357325108075 !== null and class_exists($O7368252357325108075, true) and is_subclass_of($O7368252357325108075, Generator::class))) {
$O7368252357325108075 = Generator::getGenerator($this->getLevelType());
}
if (($O7755050365517905803 = LevelProviderManager::getProviderByName($O9566254652253104073 = $this->getProperty("level-settings.default-format", "pmanvil"))) === null) {
$O7755050365517905803 = LevelProviderManager::getProviderByName($O9566254652253104073 = "pmanvil");
if ($O7755050365517905803 === null) {
throw new \InvalidStateException("Default level provider has not been registered");
}
}
try {
$O3050887916085603833 = $this->getDataPath() . "worlds/" . $O3599798456741367439 . "/";
$O7755050365517905803::generate($O3050887916085603833, $O3599798456741367439, $O1719463550011029788, $O7368252357325108075, $O5599874228007848556);
$O8990405184547542856 = new Level($this, $O3599798456741367439, $O3050887916085603833, $O7755050365517905803);
$this->levels[$O8990405184547542856->getId()] = $O8990405184547542856;
$O8990405184547542856->initLevel();
} catch (\Throwable $O7980738059105788111) {
goto O7272201934504998244;
O3724506743109512065:
$this->logger->logException($O7980738059105788111);
goto O5657284288694430296;
O0605031002265512225:
return false;
goto O5065116026259878246;
O7272201934504998244:
$this->logger->error($this->getLanguage()->translateString("pocketmine.level.generationError", [$O3599798456741367439, $O7980738059105788111->getMessage()]));
goto O5814659708635473983;
O5657284288694430296:
O7672568378055596848:
goto O0605031002265512225;
O5814659708635473983:
if (!$this->logger instanceof MainLogger) {
goto O7672568378055596848;
}
goto O3724506743109512065;
O5065116026259878246:
}
$this->getPluginManager()->callEvent(new LevelInitEvent($O8990405184547542856));
$this->getPluginManager()->callEvent(new LevelLoadEvent($O8990405184547542856));
$this->getLogger()->notice($this->getLanguage()->translateString("pocketmine.level.backgroundGeneration", [$O3599798456741367439]));
$O9348000031193722165 = $O8990405184547542856->getSpawnLocation();
$O3493852102662277549 = $O9348000031193722165->getFloorX() >> 4;
$O6847426029377725661 = $O9348000031193722165->getFloorZ() >> 4;
$O5913201266650500530 = [];
$O2097610998554850603 = -3;
while ($O2097610998554850603 <= 3) {
$O4581900489425517057 = -3;
while ($O4581900489425517057 <= 3) {
$O8433540969984747347 = $O2097610998554850603 ** 2 + $O4581900489425517057 ** 2;
$O3006954518737917268 = $O2097610998554850603 + $O3493852102662277549;
$O8823528619564163764 = $O4581900489425517057 + $O6847426029377725661;
$O4220208707720250477 = Level::chunkHash($O3006954518737917268, $O8823528619564163764);
$O5913201266650500530[$O4220208707720250477] = $O8433540969984747347;
++$O4581900489425517057;
}
++$O2097610998554850603;
}
asort($O5913201266650500530);
foreach ($O5913201266650500530 as $O4220208707720250477 => $O8433540969984747347) {
Level::getXZ($O4220208707720250477, $O3006954518737917268, $O8823528619564163764);
$O8990405184547542856->populateChunk($O3006954518737917268, $O8823528619564163764, true);
}
return true;
}
public function isLevelGenerated($O3599798456741367439)
{
if (trim($O3599798456741367439) === '') {
return false;
}
$O3050887916085603833 = $this->getDataPath() . "worlds/" . $O3599798456741367439 . "/";
if (!$this->getLevelByName($O3599798456741367439) instanceof Level) {
return is_dir($O3050887916085603833) and !empty(array_filter(scandir($O3050887916085603833, SCANDIR_SORT_NONE), function ($O8385029910437788353) {
return $O8385029910437788353 !== ".." and $O8385029910437788353 !== ".";
}));
}
return true;
}
public function findEntity(int $O5840641995929062196, Level $O0023464626725984877 = null)
{
foreach ($this->levels as $O8990405184547542856) {
assert(!$O8990405184547542856->isClosed());
if (($O9518733833987900631 = $O8990405184547542856->getEntity($O5840641995929062196)) instanceof Entity) {
return $O9518733833987900631;
}
}
return null;
}
public function getConfigString($O0719866863345062028, $O0630247780966342016 = '')
{
$O8385029910437788353 = getopt('', ["{$O0719866863345062028}::"]);
if (isset($O8385029910437788353[$O0719866863345062028])) {
return (string) $O8385029910437788353[$O0719866863345062028];
}
return $this->properties->exists($O0719866863345062028) ? $this->properties->get($O0719866863345062028) : $O0630247780966342016;
}
public function getProperty($O0719866863345062028, $O0630247780966342016 = null)
{
if (!array_key_exists($O0719866863345062028, $this->propertyCache)) {
$O8385029910437788353 = getopt('', ["{$O0719866863345062028}::"]);
if (isset($O8385029910437788353[$O0719866863345062028])) {
$this->propertyCache[$O0719866863345062028] = $O8385029910437788353[$O0719866863345062028];
} else {
$this->propertyCache[$O0719866863345062028] = $this->config->getNested($O0719866863345062028);
}
}
return $this->propertyCache[$O0719866863345062028] === null ? $O0630247780966342016 : $this->propertyCache[$O0719866863345062028];
}
public function setConfigString($O0719866863345062028, $O9021849237811156087)
{
$this->properties->set($O0719866863345062028, $O9021849237811156087);
}
public function getConfigInt($O0719866863345062028, $O0630247780966342016 = 0)
{
$O8385029910437788353 = getopt('', ["{$O0719866863345062028}::"]);
if (isset($O8385029910437788353[$O0719866863345062028])) {
return (int) $O8385029910437788353[$O0719866863345062028];
}
return $this->properties->exists($O0719866863345062028) ? (int) $this->properties->get($O0719866863345062028) : (int) $O0630247780966342016;
}
public function setConfigInt($O0719866863345062028, $O9021849237811156087)
{
$this->properties->set($O0719866863345062028, (int) $O9021849237811156087);
}
public function getConfigBoolean($O0719866863345062028, $O0630247780966342016 = false)
{
$O8385029910437788353 = getopt('', ["{$O0719866863345062028}::"]);
if (isset($O8385029910437788353[$O0719866863345062028])) {
$O9021849237811156087 = $O8385029910437788353[$O0719866863345062028];
} else {
$O9021849237811156087 = $this->properties->exists($O0719866863345062028) ? $this->properties->get($O0719866863345062028) : $O0630247780966342016;
}
if (is_bool($O9021849237811156087)) {
return $O9021849237811156087;
}
switch (strtolower($O9021849237811156087)) {
case "on":
case "true":
case "1":
case "yes":
return true;
}
return false;
}
public function setConfigBool($O0719866863345062028, $O9021849237811156087)
{
$this->properties->set($O0719866863345062028, $O9021849237811156087 ? "1" : "0");
}
public function getPluginCommand($O3599798456741367439)
{
if (($O3932855126531729106 = $this->commandMap->getCommand($O3599798456741367439)) instanceof PluginIdentifiableCommand) {
return $O3932855126531729106;
} else {
return null;
}
}
public function getNameBans()
{
return $this->banByName;
}
public function getIPBans()
{
return $this->banByIP;
}
public function getCIDBans()
{
return $this->banByCID;
}
public function isMobsEnabled()
{
return (bool) $this->mobConfig->get("enable-mobs");
}
public function getMobsNotSpawnRadius()
{
return (int) $this->mobConfig->get("mobs-not-spawn-radius-from-spawn");
}
public function spawnMobsWorld()
{
return (bool) $this->mobConfig->get("spawn-mobs-in-world");
}
public function getWorldsForMobsSpawn()
{
return (array) $this->mobConfig->get("default-worlds-for-mob-spawn");
}
public function spawnMobsNether()
{
return (bool) $this->mobConfig->get("spawn-mobs-in-nether");
}
public function spawnMobsEnder()
{
return (bool) $this->mobConfig->get("spawn-mobs-in-ender");
}
public function addOp($O3599798456741367439)
{
$this->operators->set(strtolower($O3599798456741367439), true);
if (($O6725082928939594459 = $this->getPlayerExact($O3599798456741367439)) !== null) {
$O6725082928939594459->recalculatePermissions();
}
$this->operators->save();
}
public function removeOp($O3599798456741367439)
{
foreach ($this->operators->getAll() as $O8972380125066583049 => $O5803285531012688078) {
if (strtolower($O3599798456741367439) === strtolower($O8972380125066583049)) {
$this->operators->remove($O8972380125066583049);
}
}
if (($O6725082928939594459 = $this->getPlayerExact($O3599798456741367439)) !== null) {
$O6725082928939594459->recalculatePermissions();
}
$this->operators->save();
}
public function addWhitelist($O3599798456741367439)
{
$this->whitelist->set(strtolower($O3599798456741367439), true);
$this->whitelist->save();
}
public function removeWhitelist($O3599798456741367439)
{
$this->whitelist->remove(strtolower($O3599798456741367439));
$this->whitelist->save();
}
public function isWhitelisted($O3599798456741367439)
{
return !$this->hasWhitelist() or $this->whitelist->exists($O3599798456741367439, true);
}
public function isOp($O3599798456741367439)
{
return $this->operators->exists($O3599798456741367439, true);
}
public function getWhitelisted()
{
return $this->whitelist;
}
public function getOps()
{
return $this->operators;
}
public function reloadWhitelist()
{
$this->whitelist->reload();
}
public function getCommandAliases()
{
$O7278142800516290993 = $this->getProperty("aliases");
$O1720501386514426509 = [];
if (is_array($O7278142800516290993)) {
foreach ($O7278142800516290993 as $O9800422575660690625 => $O9021849237811156087) {
$O6425227135764029683 = [];
if (is_array($O9021849237811156087)) {
$O6425227135764029683 = $O9021849237811156087;
} else {
$O6425227135764029683[] = (string) $O9021849237811156087;
}
$O1720501386514426509[$O9800422575660690625] = $O6425227135764029683;
}
}
return $O1720501386514426509;
}
public function getCrashPath()
{
return $this->dataPath . "crashdumps/";
}
public static function getInstance() : Server
{
if (self::$instance === null) {
throw new \RuntimeException("Attempt to retrieve Server instance outside server thread");
}
return self::$instance;
}
public static function microSleep(int $O6478173387404500137)
{
if (self::$sleeper === null) {
self::$sleeper = new \Threaded();
}
self::$sleeper->synchronized(function (int $O1875008190707259367) : void {
Server::$sleeper->wait($O1875008190707259367);
}, $O6478173387404500137);
}
public function loadAdvancedConfig()
{
$this->playerMsgType = $this->getAdvancedProperty("server.player-msg-type", self::PLAYER_MSG_TYPE_MESSAGE);
$this->playerLoginMsg = $this->getAdvancedProperty("server.login-msg", "3@player joined the game");
$this->playerLogoutMsg = $this->getAdvancedProperty("server.logout-msg", "3@player left the game");
$this->weatherEnabled = $this->getAdvancedProperty("level.weather", true);
$this->foodEnabled = $this->getAdvancedProperty("player.hunger", true);
$this->expEnabled = $this->getAdvancedProperty("player.experience", true);
$this->keepInventory = $this->getAdvancedProperty("player.keep-inventory", false);
$this->keepExperience = $this->getAdvancedProperty("player.keep-experience", false);
$this->toolboxAllowed = $this->getAdvancedProperty("player.toolboxAllowed", false);
$this->loadIncompatibleAPI = $this->getAdvancedProperty("developer.load-incompatible-api", true);
$this->netherEnabled = $this->getAdvancedProperty("nether.allow-nether", false);
$this->netherName = $this->getAdvancedProperty("nether.level-name", "nether");
$this->enderEnabled = $this->getAdvancedProperty("ender.allow-ender", false);
$this->enderName = $this->getAdvancedProperty("ender.level-name", "ender");
$this->weatherRandomDurationMin = $this->getAdvancedProperty("level.weather-random-duration-min", 6000);
$this->weatherRandomDurationMax = $this->getAdvancedProperty("level.weather-random-duration-max", 12000);
$this->lightningTime = $this->getAdvancedProperty("level.lightning-time", 200);
$this->lightningFire = $this->getAdvancedProperty("level.lightning-fire", false);
$this->allowSnowGolem = $this->getAdvancedProperty("server.allow-snow-golem", false);
$this->allowWither = $this->getAdvancedProperty("server.allow-wither", false);
$this->allowIronGolem = $this->getAdvancedProperty("server.allow-iron-golem", false);
$this->autoClearInv = $this->getAdvancedProperty("player.auto-clear-inventory", true);
$this->dserverConfig = ["enable" => $this->getAdvancedProperty("dserver.enable", false), "queryAutoUpdate" => $this->getAdvancedProperty("dserver.query-auto-update", false), "queryTickUpdate" => $this->getAdvancedProperty("dserver.query-tick-update", true), "motdMaxPlayers" => $this->getAdvancedProperty("dserver.motd-max-players", 0), "queryMaxPlayers" => $this->getAdvancedProperty("dserver.query-max-players", 0), "motdAllPlayers" => $this->getAdvancedProperty("dserver.motd-all-players", false), "queryAllPlayers" => $this->getAdvancedProperty("dserver.query-all-players", false), "motdPlayers" => $this->getAdvancedProperty("dserver.motd-players", false), "queryPlayers" => $this->getAdvancedProperty("dserver.query-players", false), "timer" => $this->getAdvancedProperty("dserver.time", 40), "retryTimes" => $this->getAdvancedProperty("dserver.retry-times", 3), "serverList" => explode(";", $this->getAdvancedProperty("dserver.server-list", ''))];
$this->redstoneEnabled = $this->getAdvancedProperty("redstone.enable", false);
$this->allowFrequencyPulse = $this->getAdvancedProperty("redstone.allow-frequency-pulse", false);
$this->pulseFrequency = $this->getAdvancedProperty("redstone.pulse-frequency", 20);
$this->getLogger()->setWrite(!$this->getAdvancedProperty("server.disable-log", false));
$this->limitedCreative = $this->getAdvancedProperty("server.limited-creative", true);
$this->chunkRadius = $this->getAdvancedProperty("player.chunk-radius", -1);
$this->destroyBlockParticle = $this->getAdvancedProperty("server.destroy-block-particle", true);
$this->allowSplashPotion = $this->getAdvancedProperty("server.allow-splash-potion", true);
$this->fireSpread = $this->getAdvancedProperty("level.fire-spread", false);
$this->advancedCommandSelector = $this->getAdvancedProperty("server.advanced-command-selector", false);
$this->anvilEnabled = $this->getAdvancedProperty("enchantment.enable-anvil", true);
$this->enchantingTableEnabled = $this->getAdvancedProperty("enchantment.enable-enchanting-table", true);
$this->countBookshelf = $this->getAdvancedProperty("enchantment.count-bookshelf", false);
$this->allowInventoryCheats = $this->getAdvancedProperty("inventory.allow-cheats", false);
$this->folderpluginloader = $this->getAdvancedProperty("developer.folder-plugin-loader", true);
$this->absorbWater = $this->getAdvancedProperty("server.absorb-water", false);
}
public function getDServerMaxPlayers()
{
return $this->dserverAllPlayers + $this->getMaxPlayers();
}
public function getDServerOnlinePlayers()
{
return $this->dserverPlayers + count($this->getOnlinePlayers());
}
public function isDServerEnabled()
{
return $this->dserverConfig["enable"];
}
public function updateDServerInfo()
{
$this->scheduler->scheduleAsyncTask(new DServerTask($this->dserverConfig["serverList"], $this->dserverConfig["retryTimes"]));
}
public function getBuild()
{
return $this->version->getBuild();
}
public function getGameVersion()
{
return $this->version->getRelease();
}
public function about()
{
$O7339720733369221285 = "\r\n ___ _\r\n / | ____ ___ ______ _____ ___ ____ ______(_)___ ___\r\n / /| |/ __ `/ / / / __ `/ __ `__ \\/ __ `/ ___/ / __ \\/ _ \\\r\n / ___ / /_/ / /_/ / /_/ / / / / / / /_/ / / / / / / / __/\r\n/_/ |_\\__, /\\__,_/\\__,_/_/ /_/ /_/\\__,_/_/ /_/_/ /_/\\___/\r\n /_/\r\n\r\nf d{$this->getName()} {$this->getPocketMineVersion()}\r\nfMCPE : " . $this->getVersion() . "\r\nf php: e" . PHP_VERSION . "\r\nfOS: 6" . PHP_OS . "\r\nf: bvk.com/aquamarine.team f(bvk.com/maruselplayf)\r\n\r\na \r\n\r\n";
$this->getLogger()->info($O7339720733369221285);
}
public function __construct(\ClassLoader $O6299349282117743481, \ThreadedLogger $O3987232109979653813, $O2112039390593502437, $O9186808249105831828, $O1181239228042478561 = "unknown")
{
if (self::$instance !== null) {
throw new \InvalidStateException("Only one server instance can exist at once");
}
self::$instance = $this;
$this->tickSleeper = new SleeperHandler();
$this->autoloader = $O6299349282117743481;
$this->logger = $O3987232109979653813;
try {
if (!file_exists($O2112039390593502437 . "worlds/")) {
mkdir($O2112039390593502437 . "worlds/", 0777);
}
if (!file_exists($O2112039390593502437 . "players/")) {
mkdir($O2112039390593502437 . "players/", 0777);
}
if (!file_exists($O9186808249105831828)) {
mkdir($O9186808249105831828, 0777);
}
if (!file_exists($O2112039390593502437 . "crashdumps/")) {
mkdir($O2112039390593502437 . "crashdumps/", 0777);
}
$this->dataPath = realpath($O2112039390593502437) . DIRECTORY_SEPARATOR;
$this->pluginPath = realpath($O9186808249105831828) . DIRECTORY_SEPARATOR;
$O9862494584748528374 = new VersionString($this->getPocketMineVersion());
$this->version = $O9862494584748528374;
$this->about();
$this->logger->info(" ...");
if (!file_exists($this->dataPath . "pocketmine.yml")) {
if (file_exists($this->dataPath . "lang.txt")) {
$O1124447341552411758 = new Config($O6610404073512168585 = $this->dataPath . "lang.txt", Config::ENUM, []);
$O2669885393737283400 = null;
foreach ($O1124447341552411758->getAll(true) as $O5589052620185341712) {
$O2669885393737283400 = $O5589052620185341712;
}
if (file_exists(\pocketmine\PATH . "src/pocketmine/resources/pocketmine_{$O2669885393737283400}.yml")) {
$O5948151535137668804 = file_get_contents($O0329386070690272403 = \pocketmine\PATH . "src/pocketmine/resources/pocketmine_{$O2669885393737283400}.yml");
} else {
$O5948151535137668804 = file_get_contents($O0329386070690272403 = \pocketmine\PATH . "src/pocketmine/resources/pocketmine_rus.yml");
}
} else {
$O5948151535137668804 = file_get_contents($O0329386070690272403 = \pocketmine\PATH . "src/pocketmine/resources/pocketmine_rus.yml");
}
@file_put_contents($this->dataPath . "pocketmine.yml", $O5948151535137668804);
}
if (file_exists($this->dataPath . "lang.txt")) {
unlink($this->dataPath . "lang.txt");
}
$this->config = new Config($O6610404073512168585 = $this->dataPath . "pocketmine.yml", Config::YAML, []);
$O3099085871814036414 = $this->getProperty("settings.language", "rus");
if ($O1181239228042478561 != "unknown" and $O3099085871814036414 != $O1181239228042478561) {
@file_put_contents($O6610404073512168585, str_replace("language: \"" . $O3099085871814036414 . "\"", "language: \"" . $O1181239228042478561 . "\"", file_get_contents($O6610404073512168585)));
$this->config->reload();
unset($this->propertyCache["settings.language"]);
}
$O8748311623344355263 = $this->getProperty("settings.language", BaseLang::FALLBACK_LANGUAGE);
if (file_exists(\pocketmine\PATH . "src/pocketmine/resources/aquamarine_{$O8748311623344355263}.yml")) {
$O5948151535137668804 = file_get_contents($O0329386070690272403 = \pocketmine\PATH . "src/pocketmine/resources/aquamarine_{$O8748311623344355263}.yml");
} else {
$O5948151535137668804 = file_get_contents($O0329386070690272403 = \pocketmine\PATH . "src/pocketmine/resources/aquamarine_rus.yml");
}
if (!file_exists($this->dataPath . "aquamarine.yml")) {
@file_put_contents($this->dataPath . "aquamarine.yml", $O5948151535137668804);
}
$O6358018519146234483 = new Config($O0329386070690272403, Config::YAML, []);
$this->advancedConfig = new Config($this->dataPath . "aquamarine.yml", Config::YAML, []);
$O9067335590721393753 = $this->getAdvancedProperty("config.version", 0, $O6358018519146234483);
$O2398238170279201564 = $this->getAdvancedProperty("config.version", 0);
$this->loadAdvancedConfig();
$this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, ["motd" => "Minecraft: PE Server", "key-server-id" => 0, "server-port" => 19132, "white-list" => false, "announce-player-achievements" => true, "spawn-protection" => 16, "max-players" => 20, "gamemode" => 0, "force-gamemode" => false, "hardcore" => false, "pvp" => true, "difficulty" => 1, "generator-settings" => '', "level-name" => "world", "level-seed" => "defaultCid", "level-type" => "DEFAULT", "enable-query" => true, "enable-rcon" => false, "rcon.password" => substr(base64_encode(random_bytes(20)), 3, 10), "auto-save" => true, "online-mode" => false, "view-distance" => 8]);
$this->mobConfig = new Config($this->dataPath . "mobs_config.yml", Config::YAML, ["enable-mobs" => true, "mobs-not-spawn-radius-from-spawn" => 16, "spawn-mobs-in-world" => true, "default-worlds-for-mob-spawn" => ["world"], "spawn-mobs-in-nether" => true, "spawn-mobs-in-ender" => true]);
$this->mobConfig->save();
$O6009508099753634303 = $this->getConfigBoolean("online-mode", false);
if (!extension_loaded("openssl")) {
$this->logger->info("OpenSSL extension not found");
$this->logger->info("Please configure OpenSSL extension for PHP if you want to use Xbox Live authentication or global resource pack.");
$this->setConfigBool("online-mode", false);
} else {
if (!$O6009508099753634303) {
$this->logger->info("Online mode has been turned off in server.properties");
$this->logger->info("Xbox Live authentication is disabled.");
} else {
}
}
$this->forceLanguage = $this->getProperty("settings.force-language", false);
$this->baseLang = new BaseLang($this->getProperty("settings.language", BaseLang::FALLBACK_LANGUAGE));
$this->logger->info($this->getLanguage()->translateString("language.selected", [$this->getLanguage()->getName(), $this->getLanguage()->getLang()]));
$this->memoryManager = new MemoryManager($this);
if (($O1790656415063519491 = $this->getProperty("settings.async-workers", "auto")) === "auto") {
$O1790656415063519491 = ServerScheduler::$WORKERS;
$O2091176693740858129 = Utils::getCoreCount() - 2;
if ($O2091176693740858129 > 0) {
$O1790656415063519491 = max(1, $O2091176693740858129);
}
} else {
$O1790656415063519491 = max(1, (int) $O1790656415063519491);
}
ServerScheduler::$WORKERS = $O1790656415063519491;
if ($this->getProperty("network.batch-threshold", 256) >= 0) {
Network::$BATCH_THRESHOLD = (int) $this->getProperty("network.batch-threshold", 256);
} else {
Network::$BATCH_THRESHOLD = -1;
}
$this->networkCompressionLevel = (int) $this->getProperty("network.compression-level", 6);
if ($this->networkCompressionLevel < 1 or $this->networkCompressionLevel > 9) {
$this->logger->warning("Invalid network compression level {$this->networkCompressionLevel} set, setting to default 6");
$this->networkCompressionLevel = 6;
}
$this->networkCompressionAsync = (bool) $this->getProperty("network.async-compression", true);
$this->doTitleTick = (bool) $this->getProperty("console.title-tick", true) && Terminal::hasFormattingCodes();
$this->scheduler = new ServerScheduler();
$O7735275318978967276 = new SleeperNotifier();
$this->console = new CommandReader($O7735275318978967276);
$this->tickSleeper->addNotifier($O7735275318978967276, function () : void {
$this->checkConsole();
});
$this->console->start(PTHREADS_INHERIT_CONSTANTS);
if ($this->getConfigBoolean("enable-rcon", false)) {
try {
$this->rcon = new RCON($this, $this->getConfigString("rcon.password", ''), $this->getConfigInt("rcon.port", $this->getPort()), $this->getIp(), $this->getConfigInt("rcon.max-clients", 50));
} catch (\Exception $O7980738059105788111) {
$this->getLogger()->critical("RCON can't be started: " . $O7980738059105788111->getMessage());
}
}
$this->entityMetadata = new EntityMetadataStore();
$this->playerMetadata = new PlayerMetadataStore();
$this->levelMetadata = new LevelMetadataStore();
$this->operators = new Config($this->dataPath . "ops.txt", Config::ENUM);
$this->whitelist = new Config($this->dataPath . "white-list.txt", Config::ENUM);
if (file_exists($this->dataPath . "banned.txt") and !file_exists($this->dataPath . "banned-players.txt")) {
@rename($this->dataPath . "banned.txt", $this->dataPath . "banned-players.txt");
}
@touch($this->dataPath . "banned-players.txt");
$this->banByName = new BanList($this->dataPath . "banned-players.txt");
$this->banByName->load();
@touch($this->dataPath . "banned-ips.txt");
$this->banByIP = new BanList($this->dataPath . "banned-ips.txt");
$this->banByIP->load();
@touch($this->dataPath . "banned-cids.txt");
$this->banByCID = new BanList($this->dataPath . "banned-cids.txt");
$this->banByCID->load();
$this->maxPlayers = $this->getConfigInt("max-players", 20);
$this->setAutoSave($this->getConfigBoolean("auto-save", true));
if ($this->getConfigBoolean("hardcore", false) and $this->getDifficulty() < 3) {
$this->setConfigInt("difficulty", 3);
}
define("pocketmine\\DEBUG", (int) $this->getProperty("debug.level", 1));
if ((int) ini_get("zend.assertions") !== -1) {
$this->logger->warning("Debugging assertions are enabled, this may impact on performance. To disable them, set `zend.assertions = -1` in php.ini.");
}
ini_set("assert.exception", "1");
if ($this->logger instanceof MainLogger) {
$this->logger->setLogDebug(\pocketmine\DEBUG > 1);
}
if (\pocketmine\DEBUG >= 0) {
@cli_set_process_title("{$this->getName()} {$this->getPocketMineVersion()}");
}
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.networkStart", [$this->getIp() === '' ? "*" : $this->getIp(), $this->getPort()]));
$this->serverID = Utils::getMachineUniqueId($this->getIp() . $this->getPort());
$this->getLogger()->debug("Server unique id: " . $this->getServerUniqueId());
$this->getLogger()->debug("Machine unique id: " . Utils::getMachineUniqueId());
$this->network = new Network($this);
$this->network->setName($this->getMotd());
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.license", [$this->getName()]));
Timings::init();
$this->consoleSender = new ConsoleCommandSender();
$this->commandMap = new SimpleCommandMap($this);
$this->logger->info(" commands-list.yml...");
$this->registerCommandList();
Entity::init();
Tile::init();
InventoryType::init();
Block::init();
Enchantment::init();
EnchantmentLevelTable::init();
Item::init();
Biome::init();
Color::init();
LevelProviderManager::addProvider(Anvil::class);
LevelProviderManager::addProvider(McRegion::class);
LevelProviderManager::addProvider(PMAnvil::class);
if (extension_loaded("leveldb")) {
$this->logger->debug($this->getLanguage()->translateString("pocketmine.debug.enable"));
LevelProviderManager::addProvider(LevelDB::class);
}
Generator::addGenerator(Flat::class, "flat");
Generator::addGenerator(Normal::class, "normal");
Generator::addGenerator(Normal::class, "default");
Generator::addGenerator(Nether::class, "hell");
Generator::addGenerator(Nether::class, "nether");
Generator::addGenerator(VoidGenerator::class, "void");
Generator::addGenerator(Ender::class, "ender");
$this->craftingManager = new CraftingManager();
$this->resourceManager = new ResourcePackManager($this, $this->getDataPath() . "resource_packs" . DIRECTORY_SEPARATOR);
$this->pluginManager = new PluginManager($this, $this->commandMap);
$this->pluginManager->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this->consoleSender);
$this->pluginManager->setUseTimings($this->getProperty("settings.enable-profiling", false));
$this->profilingTickRate = (float) $this->getProperty("settings.profile-report-trigger", 20);
$this->pluginManager->registerInterface(PharPluginLoader::class);
if ($this->folderpluginloader) {
$this->pluginManager->registerInterface(FolderPluginLoader::class);
}
$this->pluginManager->registerInterface(ScriptPluginLoader::class);
register_shutdown_function([$this, "crashDump"]);
$this->queryRegenerateTask = new QueryRegenerateEvent($this);
$this->pluginManager->loadPlugins($this->pluginPath);
$this->enablePlugins(PluginLoadOrder::STARTUP);
$this->network->registerInterface(new RakLibInterface($this));
foreach ((array) $this->getProperty("worlds", []) as $O3599798456741367439 => $O5599874228007848556) {
if ($O5599874228007848556 === null) {
$O5599874228007848556 = [];
} else {
if (is_array($O5599874228007848556)) {
if (!$this->loadLevel($O3599798456741367439)) {
$O1719463550011029788 = $O5599874228007848556["seed"] ?? time();
if (is_string($O1719463550011029788) and !is_numeric($O1719463550011029788)) {
$O1719463550011029788 = Utils::javaStringHash($O1719463550011029788);
} else {
if (!is_int($O1719463550011029788)) {
$O1719463550011029788 = (int) $O1719463550011029788;
} else {
}
}
$O5599874228007848556 = explode(":", $this->getProperty("worlds.{$O3599798456741367439}.generator", Generator::getGenerator("default")));
$O1835061701061048219 = array_shift($O5599874228007848556);
$O7368252357325108075 = Generator::getGenerator($O1835061701061048219);
if (count($O5599874228007848556) > 0) {
$O5599874228007848556 = ["preset" => implode(":", $O5599874228007848556)];
} else {
$O5599874228007848556 = [];
}
$this->generateLevel($O3599798456741367439, $O1719463550011029788, $O7368252357325108075, $O5599874228007848556);
}
}
}
if (!$this->loadLevel($O3599798456741367439)) {
$O1719463550011029788 = $O5599874228007848556["seed"] ?? time();
if (is_string($O1719463550011029788) and !is_numeric($O1719463550011029788)) {
$O1719463550011029788 = Utils::javaStringHash($O1719463550011029788);
} else {
if (!is_int($O1719463550011029788)) {
$O1719463550011029788 = (int) $O1719463550011029788;
} else {
}
}
$O5599874228007848556 = explode(":", $this->getProperty("worlds.{$O3599798456741367439}.generator", Generator::getGenerator("default")));
$O1835061701061048219 = array_shift($O5599874228007848556);
$O7368252357325108075 = Generator::getGenerator($O1835061701061048219);
if (count($O5599874228007848556) > 0) {
$O5599874228007848556 = ["preset" => implode(":", $O5599874228007848556)];
} else {
$O5599874228007848556 = [];
}
$this->generateLevel($O3599798456741367439, $O1719463550011029788, $O7368252357325108075, $O5599874228007848556);
}
}
if ($this->getDefaultLevel() === null) {
$O3119723109399633552 = $this->getConfigString("level-name", "world");
if (trim($O3119723109399633552) == '') {
$this->getLogger()->warning("level-name cannot be null, using default");
$O3119723109399633552 = "world";
$this->setConfigString("level-name", "world");
}
if ($this->loadLevel($O3119723109399633552) === false) {
$O1719463550011029788 = $this->getConfigString("level-seed", (string) time());
if (!is_numeric($O1719463550011029788) or bccomp($O1719463550011029788, "9223372036854775807") > 0) {
$O1719463550011029788 = Utils::javaStringHash($O1719463550011029788);
} else {
$O1719463550011029788 = (int) $O1719463550011029788;
}
$this->generateLevel($O3119723109399633552, $O1719463550011029788 === 0 ? time() : $O1719463550011029788);
}
$this->setDefaultLevel($this->getLevelByName($O3119723109399633552));
}
if ($this->properties->hasChanged()) {
$this->properties->save();
}
if (!$this->getDefaultLevel() instanceof Level) {
$this->getLogger()->emergency($this->getLanguage()->translateString("pocketmine.level.defaultError"));
$this->forceShutdown();
return;
}
if ($this->netherEnabled) {
if (!$this->loadLevel($this->netherName)) {
$O1835061701061048219 = Generator::getGenerator("nether");
$this->generateLevel($this->netherName, time(), $O1835061701061048219);
}
$this->netherLevel = $this->getLevelByName($this->netherName);
}
if ($this->enderEnabled) {
if (!$this->loadLevel($this->enderName)) {
$this->generateLevel($this->enderName, time(), Generator::getGenerator("ender"));
}
$this->enderLevel = $this->getLevelByName($this->enderName);
}
if ($this->getProperty("ticks-per.autosave", 6000) > 0) {
$this->autoSaveTicks = (int) $this->getProperty("ticks-per.autosave", 6000);
}
$this->enablePlugins(PluginLoadOrder::POSTWORLD);
if ($this->dserverConfig["enable"] and $this->getAdvancedProperty("dserver.server-list", '') != '') {
$this->scheduler->scheduleRepeatingTask(new CallbackTask([$this, "updateDServerInfo"]), $this->dserverConfig["timer"]);
}
if ($O9067335590721393753 > $O2398238170279201564) {
$this->logger->notice("Your aquamarine.yml needs update");
$this->logger->notice("Current Version: {$O2398238170279201564} Latest Version: {$O9067335590721393753}");
}
$this->start();
} catch (\Throwable $O7980738059105788111) {
$this->exceptionHandler($O7980738059105788111);
}
}
public function registerCommandList()
{
$this->commandList = new Config($this->dataPath . "commands-list.yml", Config::YAML);
foreach ($this->getCommandMap()->getCommands() as $O3932855126531729106) {
if ($this->commandList->exists($O3932855126531729106->getName())) {
if ($this->commandList->get($O3932855126531729106->getName()) == false and $O3932855126531729106 instanceof Command) {
$this->getCommandMap()->unregister($O3932855126531729106);
}
} else {
$this->commandList->set($O3932855126531729106->getName(), true);
}
}
$this->commandList->save();
}
public function broadcastMessage($O2651614731792133437, $O6058751670045019838 = null) : int
{
if (!is_array($O6058751670045019838)) {
return $this->broadcast($O2651614731792133437, self::BROADCAST_CHANNEL_USERS);
}
foreach ($O6058751670045019838 as $O3187189378384733655) {
$O3187189378384733655->sendMessage($O2651614731792133437);
}
return count($O6058751670045019838);
}
public function broadcastTip(string $O9152597786137927993, $O6058751670045019838 = null) : int
{
if (!is_array($O6058751670045019838)) {
$O6058751670045019838 = [];
foreach ($this->pluginManager->getPermissionSubscriptions(self::BROADCAST_CHANNEL_USERS) as $O1307553872555114622) {
if ($O1307553872555114622 instanceof Player and $O1307553872555114622->hasPermission(self::BROADCAST_CHANNEL_USERS)) {
$O6058751670045019838[spl_object_hash($O1307553872555114622)] = $O1307553872555114622;
}
}
}
foreach ($O6058751670045019838 as $O3187189378384733655) {
$O3187189378384733655->sendTip($O9152597786137927993);
}
return count($O6058751670045019838);
}
public function broadcastPopup(string $O5736632541713175233, $O6058751670045019838 = null) : int
{
if (!is_array($O6058751670045019838)) {
$O6058751670045019838 = [];
foreach ($this->pluginManager->getPermissionSubscriptions(self::BROADCAST_CHANNEL_USERS) as $O1307553872555114622) {
if ($O1307553872555114622 instanceof Player and $O1307553872555114622->hasPermission(self::BROADCAST_CHANNEL_USERS)) {
$O6058751670045019838[spl_object_hash($O1307553872555114622)] = $O1307553872555114622;
}
}
}
foreach ($O6058751670045019838 as $O3187189378384733655) {
$O3187189378384733655->sendPopup($O5736632541713175233);
}
return count($O6058751670045019838);
}
public function broadcastTitle(string $O7339720733369221285, string $O7157498233636939317 = '', int $O4335603103026281922 = -1, int $O5193828833010661772 = -1, int $O2349772501025980444 = -1, $O6058751670045019838 = null)
{
if (!is_array($O6058751670045019838)) {
$O6058751670045019838 = [];
foreach ($this->pluginManager->getPermissionSubscriptions(self::BROADCAST_CHANNEL_USERS) as $O1307553872555114622) {
if ($O1307553872555114622 instanceof Player and $O1307553872555114622->hasPermission(self::BROADCAST_CHANNEL_USERS)) {
$O6058751670045019838[spl_object_hash($O1307553872555114622)] = $O1307553872555114622;
}
}
}
foreach ($O6058751670045019838 as $O3187189378384733655) {
$O3187189378384733655->addTitle($O7339720733369221285, $O7157498233636939317, $O4335603103026281922, $O5193828833010661772, $O2349772501025980444);
}
return count($O6058751670045019838);
}
public function broadcast($O2651614731792133437, string $O8793625458927515093) : int
{
$O6058751670045019838 = [];
foreach (explode(";", $O8793625458927515093) as $O2926893935619852763) {
foreach ($this->pluginManager->getPermissionSubscriptions($O2926893935619852763) as $O1307553872555114622) {
if ($O1307553872555114622 instanceof CommandSender and $O1307553872555114622->hasPermission($O2926893935619852763)) {
$O6058751670045019838[spl_object_hash($O1307553872555114622)] = $O1307553872555114622;
}
}
}
foreach ($O6058751670045019838 as $O3187189378384733655) {
$O3187189378384733655->sendMessage($O2651614731792133437);
}
return count($O6058751670045019838);
}
public function broadcastPacket(array $O7417318090430815732, DataPacket $O0518343382251093595)
{
$O0518343382251093595->encode();
$O0518343382251093595->isEncoded = true;
$this->batchPackets($O7417318090430815732, [$O0518343382251093595], false);
}
public function batchPackets(array $O7417318090430815732, array $O5320105429236813250, bool $O8248209920012605993 = false, bool $O9143209426050768354 = false)
{
if (count($O5320105429236813250) === 0) {
throw new \InvalidArgumentException("Cannot send empty batch");
}
Timings::$playerNetworkTimer->startTiming();
$O0361909413468483332 = array_filter($O7417318090430815732, function (Player $O6725082928939594459) : bool {
return $O6725082928939594459->isConnected();
});
if (count($O0361909413468483332) > 0) {
$O1293085103679494298 = new BatchPacket();
foreach ($O5320105429236813250 as $O5540795382017578046) {
$O1293085103679494298->addPacket($O5540795382017578046);
}
if (Network::$BATCH_THRESHOLD >= 0 and strlen($O1293085103679494298->payload) >= Network::$BATCH_THRESHOLD) {
$O1293085103679494298->setCompressionLevel($this->networkCompressionLevel);
} else {
$O1293085103679494298->setCompressionLevel(0);
$O8248209920012605993 = true;
}
if (!$O8248209920012605993 and !$O9143209426050768354 and $this->networkCompressionAsync) {
$O5198515499496837902 = new CompressBatchedTask($O1293085103679494298, $O0361909413468483332);
$this->getScheduler()->scheduleAsyncTask($O5198515499496837902);
} else {
$this->broadcastPacketsCallback($O1293085103679494298, $O0361909413468483332, $O9143209426050768354);
}
}
Timings::$playerNetworkTimer->stopTiming();
}
public function broadcastPacketsCallback(BatchPacket $O1293085103679494298, array $O7417318090430815732, bool $O9143209426050768354 = false)
{
if (!$O1293085103679494298->isEncoded) {
$O1293085103679494298->encode();
$O1293085103679494298->isEncoded = true;
}
foreach ($O7417318090430815732 as $O8236179980604662852) {
$O8236179980604662852->dataPacket($O1293085103679494298, false, $O9143209426050768354);
}
}
public function enablePlugins(int $O5537423987799744568)
{
foreach ($this->pluginManager->getPlugins() as $O8326391417475207927) {
if (!$O8326391417475207927->isEnabled() and $O8326391417475207927->getDescription()->getOrder() === $O5537423987799744568) {
$this->enablePlugin($O8326391417475207927);
}
}
if ($O5537423987799744568 === PluginLoadOrder::POSTWORLD) {
$this->commandMap->registerServerAliases();
DefaultPermissions::registerCorePermissions();
}
}
public function enablePlugin(Plugin $O8326391417475207927)
{
$this->pluginManager->enablePlugin($O8326391417475207927);
}
public function disablePlugins()
{
$this->pluginManager->disablePlugins();
}
public function checkConsole()
{
Timings::$serverCommandTimer->startTiming();
while (($O5209094978073612910 = $this->console->getLine()) !== null) {
$this->pluginManager->callEvent($O2430761032146710945 = new ServerCommandEvent($this->consoleSender, $O5209094978073612910));
if (!$O2430761032146710945->isCancelled()) {
$this->dispatchCommand($O2430761032146710945->getSender(), $O2430761032146710945->getCommand());
}
}
Timings::$serverCommandTimer->stopTiming();
}
public function dispatchCommand(CommandSender $O6321398628944314396, $O0572746342080630700)
{
if ($this->commandMap->dispatch($O6321398628944314396, $O0572746342080630700)) {
return true;
}
$O6321398628944314396->sendMessage(new TranslationContainer(TextFormat::GOLD . "%commands.generic.notFound"));
return false;
}
public function reload()
{
$this->logger->info("Saving worlds...");
foreach ($this->levels as $O8990405184547542856) {
$O8990405184547542856->save();
}
$this->pluginManager->disablePlugins();
$this->pluginManager->clearPlugins();
$this->commandMap->clearCommands();
$this->logger->info("Reloading properties...");
$this->properties->reload();
$this->advancedConfig->reload();
$this->loadAdvancedConfig();
$this->maxPlayers = $this->getConfigInt("max-players", 20);
if ($this->getConfigBoolean("hardcore", false) and $this->getDifficulty() < 3) {
$this->setConfigInt("difficulty", 3);
}
$this->banByIP->load();
$this->banByName->load();
$this->banByCID->load();
$this->reloadWhitelist();
$this->operators->reload();
$this->memoryManager->doObjectCleanup();
foreach ($this->getIPBans()->getEntries() as $O4491726257011425663) {
$this->getNetwork()->blockAddress($O4491726257011425663->getName(), -1);
}
$this->pluginManager->registerInterface(PharPluginLoader::class);
if ($this->folderpluginloader) {
$this->pluginManager->registerInterface(FolderPluginLoader::class);
}
$this->pluginManager->registerInterface(ScriptPluginLoader::class);
$this->pluginManager->loadPlugins($this->pluginPath);
$this->enablePlugins(PluginLoadOrder::STARTUP);
$this->enablePlugins(PluginLoadOrder::POSTWORLD);
TimingsHandler::reload();
}
public function shutdown(bool $O2838180798115608312 = false, string $O8475682493986910469 = '')
{
$this->isRunning = false;
if ($O8475682493986910469 != '') {
$this->propertyCache["settings.shutdown-message"] = $O8475682493986910469;
}
}
public function forceShutdown()
{
if ($this->hasStopped) {
return;
}
if ($this->doTitleTick) {
echo "\x1b]0;\x07";
}
try {
$this->hasStopped = true;
$this->shutdown();
if ($this->rcon instanceof RCON) {
$this->rcon->stop();
}
if ($this->getProperty("network.upnp-forwarding", false)) {
$this->logger->info("[UPnP] Removing port forward...");
UPnP::RemovePortForward($this->getPort());
}
if ($this->pluginManager instanceof PluginManager) {
$this->getLogger()->debug("Disabling all plugins");
$this->pluginManager->disablePlugins();
}
foreach ($this->players as $O6725082928939594459) {
$O6725082928939594459->close($O6725082928939594459->getLeaveMessage(), $this->getProperty("settings.shutdown-message", "Server closed"));
}
$this->getLogger()->debug("Unloading all worlds");
foreach ($this->getLevels() as $O8990405184547542856) {
$this->unloadLevel($O8990405184547542856, true);
}
$this->getLogger()->debug("Removing event handlers");
HandlerList::unregisterAll();
if ($this->scheduler instanceof ServerScheduler) {
$this->getLogger()->debug("Shutting down task scheduler");
}
if ($this->properties !== null and $this->properties->hasChanged()) {
$this->getLogger()->debug("Saving properties");
$this->properties->save();
}
if ($this->console instanceof CommandReader) {
$this->getLogger()->debug("Closing console");
$this->console->shutdown();
$this->console->notify();
}
if ($this->network instanceof Network) {
$this->getLogger()->debug("Stopping network interfaces");
foreach ($this->network->getInterfaces() as $O0102162491117335893) {
$this->getLogger()->debug("Stopping network interface " . get_class($O0102162491117335893));
$O0102162491117335893->shutdown();
$this->network->unregisterInterface($O0102162491117335893);
}
}
} catch (\Throwable $O7980738059105788111) {
goto O6286694412866559630;
O6286694412866559630:
$this->logger->logException($O7980738059105788111);
goto O4202869528322520230;
O4202869528322520230:
$this->logger->emergency("Crashed while crashing, killing process");
goto O6349227527028122342;
O6349227527028122342:
@Utils::kill(getmypid());
goto O7396620252407377150;
O7396620252407377150:
}
}
public function getQueryInformation()
{
return $this->queryRegenerateTask;
}
public function getConsole() : CommandReader
{
return $this->console;
}
public function start()
{
if ($this->getConfigBoolean("enable-query", true)) {
$this->queryHandler = new QueryHandler();
}
foreach ($this->getIPBans()->getEntries() as $O4491726257011425663) {
$this->network->blockAddress($O4491726257011425663->getName(), -1);
}
if ($this->getProperty("network.upnp-forwarding", false)) {
$this->logger->info("[UPnP] Trying to port forward...");
try {
UPnP::PortForward($this->getPort());
} catch (\Exception $O7980738059105788111) {
$this->logger->alert("UPnP portforward failed: " . $O7980738059105788111->getMessage());
}
}
$this->tickCounter = 0;
if (function_exists("pcntl_signal")) {
pcntl_signal(SIGTERM, [$this, "handleSignal"]);
pcntl_signal(SIGINT, [$this, "handleSignal"]);
pcntl_signal(SIGHUP, [$this, "handleSignal"]);
$this->dispatchSignals = true;
}
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.defaultGameMode", [self::getGamemodeString($this->getGamemode())]));
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.startFinished", [round(microtime(true) - \pocketmine\START_TIME, 3)]));
$this->tickProcessor();
$this->forceShutdown();
}
public function handleSignal($O5600339835366169926)
{
if ($O5600339835366169926 === SIGTERM or $O5600339835366169926 === SIGINT or $O5600339835366169926 === SIGHUP) {
$this->shutdown();
}
}
public function exceptionHandler(\Throwable $O7980738059105788111, $O0810817185273565676 = null)
{
while (@ob_end_flush()) {
return false;
}
global $O7043481179961869137;
if ($O0810817185273565676 === null) {
$O0810817185273565676 = $O7980738059105788111->getTrace();
}
$O3702396576067160224 = $O7980738059105788111->getMessage();
$O7177865700032277628 = $O7980738059105788111->getFile();
$O6176387794732754209 = $O7980738059105788111->getLine();
$O3702396576067160224 = preg_replace("/\\s+/", " ", trim($O3702396576067160224));
$O7177865700032277628 = Utils::cleanPath($O7177865700032277628);
if ($this->logger instanceof MainLogger) {
$this->logger->logException($O7980738059105788111, $O0810817185273565676);
}
$O7043481179961869137 = ["type" => get_class($O7980738059105788111), "message" => $O3702396576067160224, "fullFile" => $O7980738059105788111->getFile(), "file" => $O7177865700032277628, "line" => $O6176387794732754209, "trace" => $O0810817185273565676];
global $O4904279002443295767, $O7043481179961869137;
$O4904279002443295767 = $O7043481179961869137;
$this->crashDump();
}
public function crashDump()
{
while (@ob_end_flush()) {
return false;
}
if (!$this->isRunning) {
return;
}
$this->hasStopped = false;
ini_set("error_reporting", "0");
ini_set("memory_limit", "-1");
try {
$this->logger->emergency($this->getLanguage()->translateString("pocketmine.crash.create"));
$O9023761933076551717 = new CrashDump($this);
$this->logger->emergency($this->getLanguage()->translateString("pocketmine.crash.submit", [$O9023761933076551717->getPath()]));
if ($this->getProperty("auto-report.enabled", false) !== false) {
$O5301756661986993479 = true;
$O7511836798682526713 = $this->getDataPath() . "crashdumps/.last_crash";
$O9614267321886332545 = 120;
if (file_exists($O7511836798682526713) and !($O5301756661986993479 = filemtime($O7511836798682526713) + $O9614267321886332545 < time())) {
$this->logger->debug("Not sending crashdump due to last crash less than {$O9614267321886332545} seconds ago");
}
@touch($O7511836798682526713);
$O8326391417475207927 = $O9023761933076551717->getData()["plugin"];
if (is_string($O8326391417475207927)) {
$O5540795382017578046 = $this->pluginManager->getPlugin($O8326391417475207927);
if ($O5540795382017578046 instanceof Plugin and !$O5540795382017578046->getPluginLoader() instanceof PharPluginLoader) {
$this->logger->debug("Not sending crashdump due to caused by non-phar plugin");
$O5301756661986993479 = false;
}
}
if ($O9023761933076551717->getData()["error"]["type"] === \ParseError::class) {
$O5301756661986993479 = false;
}
if ($O5301756661986993479) {
$O6375846755245683904 = Internet::postURL("http://" . $this->getProperty("auto-report.host", "crash.pmmp.io") . "/submit/api", ["report" => "yes", "name" => $this->getName() . " " . $this->getPocketMineVersion(), "email" => "[email protected]", "reportPaste" => base64_encode($O9023761933076551717->getEncodedData())]);
if ($O6375846755245683904 !== false and ($O7207147385807490826 = json_decode($O6375846755245683904)) !== null and isset($O7207147385807490826->crashId) and isset($O7207147385807490826->crashUrl)) {
$O6130897079959903828 = $O7207147385807490826->crashId;
$O8890866629166657542 = $O7207147385807490826->crashUrl;
$this->logger->emergency($this->getLanguage()->translateString("pocketmine.crash.archive", [$O8890866629166657542, $O6130897079959903828]));
}
}
}
} catch (\Throwable $O7980738059105788111) {
$this->logger->logException($O7980738059105788111);
try {
$this->logger->critical($this->getLanguage()->translateString("pocketmine.crash.error", [$O7980738059105788111->getMessage()]));
} catch (\Throwable $O7980738059105788111) {
}
}
$this->forceShutdown();
$this->isRunning = false;
$O6575653030171960827 = (int) \pocketmine\START_TIME - time() + 120;
if ($O6575653030171960827 > 0) {
echo "--- Waiting {$O6575653030171960827} seconds to throttle automatic restart (you can kill the process safely now) ---" . PHP_EOL;
sleep($O6575653030171960827);
}
@Utils::kill(getmypid());
exit(1);
}
public function __debugInfo()
{
return [];
}
public function getTickSleeper() : SleeperHandler
{
return $this->tickSleeper;
}
private function tickProcessor()
{
$this->nextTick = microtime(true);
while ($this->isRunning) {
$this->tick();
$this->tickSleeper->sleepUntil($this->nextTick);
}
}
public function onPlayerLogin(Player $O6725082928939594459)
{
$this->sendFullPlayerListData($O6725082928939594459);
$O6725082928939594459->dataPacket($this->craftingManager->getCraftingDataPacket());
}
public function addPlayer(Player $O6725082928939594459)
{
$this->players[spl_object_hash($O6725082928939594459)] = $O6725082928939594459;
}
public function addOnlinePlayer(Player $O6725082928939594459)
{
$this->updatePlayerListData($O6725082928939594459->getUniqueId(), $O6725082928939594459->getId(), $O6725082928939594459->getDisplayName(), $O6725082928939594459->getSkinId(), $O6725082928939594459->getSkinData());
$this->playerList[$O6725082928939594459->getRawUniqueId()] = $O6725082928939594459;
}
public function removeOnlinePlayer(Player $O6725082928939594459)
{
if (isset($this->playerList[$O6725082928939594459->getRawUniqueId()])) {
unset($this->playerList[$O6725082928939594459->getRawUniqueId()]);
$this->removePlayerListData($O6725082928939594459->getUniqueId());
}
}
public function updatePlayerListData(UUID $O9479455264228622327, $O5840641995929062196, $O3599798456741367439, $O9064082743205090873, $O9983101786974651923, array $O7417318090430815732 = null)
{
$O1293085103679494298 = new PlayerListPacket();
$O1293085103679494298->type = PlayerListPacket::TYPE_ADD;
$O1293085103679494298->entries[] = [$O9479455264228622327, $O5840641995929062196, $O3599798456741367439, $O9064082743205090873, $O9983101786974651923];
$this->broadcastPacket($O7417318090430815732 ?? $this->playerList, $O1293085103679494298);
}
public function removePlayerListData(UUID $O9479455264228622327, array $O7417318090430815732 = null)
{
$O1293085103679494298 = new PlayerListPacket();
$O1293085103679494298->type = PlayerListPacket::TYPE_REMOVE;
$O1293085103679494298->entries[] = [$O9479455264228622327];
$this->broadcastPacket($O7417318090430815732 ?? $this->playerList, $O1293085103679494298);
}
public function sendFullPlayerListData(Player $O5540795382017578046)
{
$O1293085103679494298 = new PlayerListPacket();
$O1293085103679494298->type = PlayerListPacket::TYPE_ADD;
foreach ($this->playerList as $O6725082928939594459) {
$O1293085103679494298->entries[] = [$O6725082928939594459->getUniqueId(), $O6725082928939594459->getId(), $O6725082928939594459->getDisplayName(), $O6725082928939594459->getSkinId(), $O6725082928939594459->getSkinData()];
}
$O5540795382017578046->dataPacket($O1293085103679494298);
}
private function checkTickUpdates(int $O9825197035600597054, float $O0239288790116538602) : void
{
foreach ($this->players as $O5540795382017578046) {
if (!$O5540795382017578046->loggedIn and $O0239288790116538602 - $O5540795382017578046->creationTime >= 10) {
break;
}
}
foreach ($this->levels as $O2541340675156494755 => $O8990405184547542856) {
if (isset($this->levels[$O2541340675156494755])) {
$O3233472987137984512 = microtime(true);
$O8990405184547542856->doTick($O9825197035600597054);
$O8834206231165061335 = (microtime(true) - $O3233472987137984512) * 1000;
$O8990405184547542856->tickRateTime = $O8834206231165061335;
if ($O8834206231165061335 >= 50) {
$this->getLogger()->debug(sprintf("World \"%s\" took too long to tick: %gms (%g ticks)", $O8990405184547542856->getName(), $O8834206231165061335, round($O8834206231165061335 / 50, 2)));
}
} else {
}
}
}
public function doAutoSave()
{
if ($this->getAutoSave()) {
Timings::$worldSaveTimer->startTiming();
foreach ($this->players as $O4220208707720250477 => $O6725082928939594459) {
if ($O6725082928939594459->spawned) {
$O6725082928939594459->save();
} else {
if (!$O6725082928939594459->isConnected()) {
$this->removePlayer($O6725082928939594459);
} else {
}
}
}
foreach ($this->getLevels() as $O8990405184547542856) {
$O8990405184547542856->save(false);
}
Timings::$worldSaveTimer->stopTiming();
}
}
public function getLanguage()
{
return $this->baseLang;
}
public function isLanguageForced()
{
return $this->forceLanguage;
}
public function getNetwork()
{
return $this->network;
}
public function getMemoryManager()
{
return $this->memoryManager;
}
private function titleTick()
{
Timings::$titleTickTimer->startTiming();
$O2714783454708150733 = Utils::getRealMemoryUsage();
$O8917638466863729771 = Utils::getMemoryUsage(true);
$O5621682895757580000 = round($O8917638466863729771[0] / 1024 / 1024, 2) . "/" . round($O2714783454708150733[0] / 1024 / 1024, 2) . "/" . round($O8917638466863729771[1] / 1024 / 1024, 2) . "/" . round($O8917638466863729771[2] / 1024 / 1024, 2) . " MB @ " . Utils::getThreadCount() . " threads";
echo "\x1b]0;" . "{$this->getName()} {$this->getPocketMineVersion()}" . " | Online " . count($this->players) . "/" . $this->getMaxPlayers() . " | Memory " . $O5621682895757580000 . " | U " . round($this->network->getUpload() / 1024, 2) . " D " . round($this->network->getDownload() / 1024, 2) . " kB/s | TPS " . $this->getTicksPerSecondAverage() . " | Load " . $this->getTickUsageAverage() . "%\x07";
Timings::$titleTickTimer->stopTiming();
}
public function handlePacket(AdvancedSourceInterface $O0102162491117335893, string $O7820356987601609224, int $O4436036954571352316, string $O8138706858251949800)
{
Timings::$serverRawPacketTimer->startTiming();
try {
if (strlen($O8138706858251949800) > 2 and substr($O8138706858251949800, 0, 2) === "\xfe\xfd" and $this->queryHandler instanceof QueryHandler) {
$this->queryHandler->handle($O0102162491117335893, $O7820356987601609224, $O4436036954571352316, $O8138706858251949800);
} else {
$this->logger->debug("Unhandled raw packet from {$O7820356987601609224} {$O4436036954571352316}: " . base64_encode($O8138706858251949800));
}
} catch (\Throwable $O7980738059105788111) {
goto O6374449801597961997;
O1360678956224640724:
$this->logger->logException($O7980738059105788111);
goto O5257831522231554232;
O8846562813754608339:
$this->getNetwork()->blockAddress($O7820356987601609224, 600);
goto O4490020366102322141;
O6374449801597961997:
if (!$this->logger instanceof MainLogger) {
goto O9271029077843853246;
}
goto O1360678956224640724;
O5257831522231554232:
O9271029077843853246:
goto O8846562813754608339;
O4490020366102322141:
}
Timings::$serverRawPacketTimer->stopTiming();
}
public function getAdvancedProperty($O0719866863345062028, $O0630247780966342016 = null, Config $O5437694507309102301 = null)
{
$O4984916631066431911 = explode(".", $O0719866863345062028);
$O3954858738755071917 = array_shift($O4984916631066431911);
if ($O5437694507309102301 === null) {
$O5437694507309102301 = $this->advancedConfig;
}
if ($O5437694507309102301->exists($O3954858738755071917)) {
$O3954858738755071917 = $O5437694507309102301->get($O3954858738755071917);
} else {
return $O0630247780966342016;
}
while (count($O4984916631066431911) > 0) {
$O4471575772379216218 = array_shift($O4984916631066431911);
if (!(is_array($O3954858738755071917) and isset($O3954858738755071917[$O4471575772379216218]))) {
return $O0630247780966342016;
}
$O3954858738755071917 = $O3954858738755071917[$O4471575772379216218];
}
return $O3954858738755071917;
}
public function updateQuery()
{
$this->getPluginManager()->callEvent($this->queryRegenerateTask = new QueryRegenerateEvent($this));
}
private function tick() : void
{
$O0239288790116538602 = microtime(true);
if ($O0239288790116538602 - $this->nextTick < -0.025) {
return;
}
Timings::$serverTickTimer->startTiming();
++$this->tickCounter;
Timings::$connectionTimer->startTiming();
$this->network->processInterfaces();
Timings::$connectionTimer->stopTiming();
Timings::$schedulerTimer->startTiming();
$this->scheduler->mainThreadHeartbeat($this->tickCounter);
Timings::$schedulerTimer->stopTiming();
$this->checkTickUpdates($this->tickCounter, $O0239288790116538602);
foreach ($this->players as $O6725082928939594459) {
$O6725082928939594459->checkNetwork();
}
if ($this->tickCounter % 20 === 0) {
if ($this->doTitleTick) {
$this->titleTick();
}
$this->currentTPS = 20;
$this->currentUse = 0;
Timings::$queryUpdate->startTiming();
if ($this->dserverConfig["enable"] and $this->dserverConfig["queryTickUpdate"] or !$this->dserverConfig["enable"]) {
$this->updateQuery();
}
Timings::$queryUpdate->stopTiming();
$this->network->updateName();
$this->network->resetStatistics();
if ($this->dserverConfig["enable"] and $this->dserverConfig["motdPlayers"]) {
$O6146190800143785266 = $this->getDServerMaxPlayers();
$O4664132069359142763 = $this->getDServerOnlinePlayers();
$O3599798456741367439 = $this->getNetwork()->getName() . "[" . $O4664132069359142763 . "/" . $O6146190800143785266 . "]";
$this->getNetwork()->setName($O3599798456741367439);
}
}
if ($this->autoSave and ++$this->autoSaveTicker >= $this->autoSaveTicks) {
$this->autoSaveTicker = 0;
$this->getLogger()->debug("[Auto Save] Saving worlds...");
$O8299473063796305940 = microtime(true);
$this->doAutoSave();
$O2443194464429585319 = microtime(true) - $O8299473063796305940;
$this->getLogger()->debug("[Auto Save] Save completed in " . ($O2443194464429585319 >= 1 ? round($O2443194464429585319, 3) . "s" : round($O2443194464429585319 * 1000) . "ms"));
}
if ($this->tickCounter % 100 === 0) {
foreach ($this->levels as $O8990405184547542856) {
$O8990405184547542856->clearCache();
}
if ($this->getTicksPerSecondAverage() < 12) {
$this->logger->warning($this->getLanguage()->translateString("pocketmine.server.tickOverload"));
}
}
if ($this->dispatchSignals and $this->tickCounter % 5 === 0) {
pcntl_signal_dispatch();
}
$this->getMemoryManager()->check();
Timings::$serverTickTimer->stopTiming();
$O6926432596287446903 = microtime(true);
$this->currentTPS = min(20, 1 / max(0.001, $O6926432596287446903 - $O0239288790116538602));
$this->currentUse = min(1, ($O6926432596287446903 - $O0239288790116538602) / 0.05);
$O3384600925806886338 = $this->tickCounter % 20;
$this->tickAverage[$O3384600925806886338] = $this->currentTPS;
$this->useAverage[$O3384600925806886338] = $this->currentUse;
if ($this->nextTick - $O0239288790116538602 < -1) {
$this->nextTick = $O0239288790116538602;
} else {
$this->nextTick += 0.05;
}
}
} ?>
Did this file decode correctly?
Original Code
<?php
/* __________________________________________________
| Aquamarine 1.0.8-private release |
| Author's VK: https://vk.com/maruselplay |
| VK Group: https://vk.com/aquamarine.team |
|__________________________________________________|
*/
namespace pocketmine;
use pocketmine\command\{CommandReader, CommandSender, ConsoleCommandSender, PluginIdentifiableCommand, SimpleCommandMap, Command};
use pocketmine\event\{HandlerList, level\LevelInitEvent, level\LevelLoadEvent, server\QueryRegenerateEvent, server\ServerCommandEvent, Timings, TimingsHandler, TranslationContainer};
use pocketmine\level\{format\io\LevelProviderManager, format\io\leveldb\LevelDB, format\io\region\Anvil, format\io\region\McRegion, format\io\region\PMAnvil, generator\biome\Biome, generator\ender\Ender, generator\Flat, generator\Generator, generator\hell\Nether, generator\normal\Normal, generator\VoidGenerator, Level, LevelException};
use pocketmine\metadata\{EntityMetadataStore, LevelMetadataStore, PlayerMetadataStore};
use pocketmine\nbt\{NBT, tag\ByteTag, tag\CompoundTag, tag\DoubleTag, tag\FloatTag, tag\IntTag, tag\ListTag, tag\LongTag, tag\ShortTag, tag\StringTag};
use pocketmine\network\{AdvancedSourceInterface, CompressBatchedTask, Network, mcpe\protocol\BatchPacket, mcpe\protocol\DataPacket, mcpe\protocol\ProtocolInfo, mcpe\protocol\PlayerListPacket, query\QueryHandler, mcpe\RakLibInterface, rcon\RCON, upnp\UPnP};
use pocketmine\plugin\{PharPluginLoader, FolderPluginLoader, Plugin, PluginLoadOrder, PluginManager, ScriptPluginLoader};
use pocketmine\utils\{Binary, Color, Config, Internet, MainLogger, ServerException, Terminal, TextFormat, Utils, UUID, VersionString};
use pocketmine\block\Block;
use pocketmine\entity\Entity;
use pocketmine\entity\ThrownPotion;
use pocketmine\entity\ThrownExpBottle;
use pocketmine\inventory\{CraftingManager, InventoryType, Recipe};
use pocketmine\item\{Item, enchantment\Enchantment, enchantment\EnchantmentLevelTable};
use pocketmine\lang\BaseLang;
use pocketmine\permission\{BanList, DefaultPermissions};
use pocketmine\resourcepacks\ResourcePackManager;
use pocketmine\scheduler\{CallbackTask, DServerTask, ServerScheduler};
use pocketmine\snooze\{SleeperHandler, SleeperNotifier};
use pocketmine\tile\Tile;
class Server
{
const BROADCAST_CHANNEL_ADMINISTRATIVE = "pocketmine.broadcast.admin";
const BROADCAST_CHANNEL_USERS = "pocketmine.broadcast.user";
const PLAYER_MSG_TYPE_MESSAGE = 0;
const PLAYER_MSG_TYPE_TIP = 1;
const PLAYER_MSG_TYPE_POPUP = 2;
private static $instance = null;
private static $sleeper = null;
public $loginPlayers = [];
private $banByName = null;
private $banByIP = null;
private $banByCID = \null;
private $operators = null;
private $whitelist = null;
private $isRunning = true;
private $hasStopped = false;
private $pluginManager = null;
private $profilingTickRate = 20;
private $scheduler = null;
public $commandList = null;
private $tickCounter = 0;
private $nextTick = 0;
private $tickAverage = [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20];
private $useAverage = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
private $currentTPS = 20;
private $currentUse = 0;
private $doTitleTick = true;
private $dispatchSignals = false;
private $logger;
private $memoryManager;
private $console = null;
private $commandMap = null;
private $craftingManager;
private $resourceManager;
private $consoleSender;
private $maxPlayers;
private $autoSave;
private $rcon = null;
private $entityMetadata;
private $expCache;
private $playerMetadata;
private $levelMetadata;
private $network;
private $networkCompressionAsync = true;
public $networkCompressionLevel = 7;
private $autoSaveTicker = 0;
private $autoSaveTicks = 6000;
private $baseLang;
private $forceLanguage = false;
private $serverID;
private $autoloader;
private $dataPath;
private $pluginPath;
private $queryHandler;
private $queryRegenerateTask = null;
private $properties;
private $propertyCache = [];
private $config;
private $players = [];
private $playerList = [];
private $levels = [];
private $levelDefault = null;
public $advancedConfig = null;
public $weatherEnabled = true;
public $foodEnabled = true;
public $expEnabled = true;
public $keepInventory = false;
public $netherEnabled = false;
public $netherName = "nether";
public $netherLevel = null;
public $weatherRandomDurationMin = 6000;
public $weatherRandomDurationMax = 12000;
public $lightningTime = 200;
public $lightningFire = false;
public $version;
public $allowSnowGolem;
public $allowIronGolem;
public $allowWither;
public $autoClearInv = true;
public $dserverConfig = [];
public $dserverPlayers = 0;
public $dserverAllPlayers = 0;
public $redstoneEnabled = false;
public $allowFrequencyPulse = true;
public $anvilEnabled = false;
public $pulseFrequency = 20;
public $playerMsgType = self::PLAYER_MSG_TYPE_MESSAGE;
public $playerLoginMsg = '';
public $playerLogoutMsg = '';
public $toolboxAllowed = false;
public $keepExperience = false;
public $limitedCreative = true;
public $chunkRadius = -1;
public $destroyBlockParticle = true;
public $allowSplashPotion = true;
public $fireSpread = false;
public $advancedCommandSelector = false;
public $enchantingTableEnabled = true;
public $countBookshelf = false;
public $allowInventoryCheats = false;
public $folderpluginloader = true;
public $loadIncompatibleAPI = true;
public $enderEnabled = true;
public $enderName = "ender";
public $enderLevel = null;
public $absorbWater = false;
public $mobConfig = null;
private $tickSleeper;
public function getName() : string
{
return \pocketmine\NAME;
}
public function isRunning()
{
return $this->isRunning;
}
public function getUptime()
{
$O2443194464429585319 = microtime(true) - \pocketmine\START_TIME;
$O9341030443986593567 = floor($O2443194464429585319 % 60);
$O9094843649069554908 = null;
$O6918382190265139924 = null;
$O4073484623576673913 = null;
if ($O2443194464429585319 >= 60) {
$O9094843649069554908 = floor($O2443194464429585319 % 3600 / 60);
if ($O2443194464429585319 >= 3600) {
$O6918382190265139924 = floor($O2443194464429585319 % (3600 * 24) / 3600);
if ($O2443194464429585319 >= 3600 * 24) {
$O4073484623576673913 = floor($O2443194464429585319 / (3600 * 24));
}
}
}
$O9653277240791867984 = ($O9094843649069554908 !== null ? ($O6918382190265139924 !== null ? ($O4073484623576673913 !== null ? "{$O4073484623576673913} " . $this->getLanguage()->translateString("%pocketmine.command.status.days") . " " : '') . "{$O6918382190265139924} " . $this->getLanguage()->translateString("%pocketmine.command.status.hours") . " " : '') . "{$O9094843649069554908} " . $this->getLanguage()->translateString("%pocketmine.command.status.minutes") . " " : '') . "{$O9341030443986593567} " . $this->getLanguage()->translateString("%pocketmine.command.status.seconds");
return $O9653277240791867984;
}
public function getPocketMineVersion()
{
return \pocketmine\VERSION;
}
public function getFormattedVersion($O4468622385813754109 = '')
{
return \pocketmine\VERSION !== '' ? $O4468622385813754109 . \pocketmine\VERSION : '';
}
public function getGitCommit()
{
return \pocketmine\GIT_COMMIT;
}
public function getShortGitCommit()
{
return substr(\pocketmine\GIT_COMMIT, 0, 7);
}
public function getCodename()
{
return \pocketmine\CODENAME;
}
public function getVersion()
{
$O9862494584748528374 = implode(", ", ProtocolInfo::MINECRAFT_VERSION);
return $O9862494584748528374;
}
public function getApiVersion()
{
return \pocketmine\API_VERSION;
}
public function getGeniApiVersion()
{
return \pocketmine\GENISYS_API_VERSION;
}
public function getFilePath()
{
return \pocketmine\PATH;
}
public function getResourcePath() : string
{
return \pocketmine\RESOURCE_PATH;
}
public function getDataPath()
{
return $this->dataPath;
}
public function getPluginPath()
{
return $this->pluginPath;
}
public function getMaxPlayers()
{
return $this->maxPlayers;
}
public function getPort()
{
return $this->getConfigInt("server-port", 19132);
}
public function getViewDistance() : int
{
return max(2, $this->getConfigInt("view-distance", 8));
}
public function getAllowedViewDistance(int $O8433540969984747347) : int
{
return max(2, min($O8433540969984747347, $this->memoryManager->getViewDistance($this->getViewDistance())));
}
public function getIp() : string
{
$O0975452763598009383 = $this->getConfigString("server-ip");
return $O0975452763598009383 !== '' ? $O0975452763598009383 : "0.0.0.0";
}
public function getServerUniqueId()
{
return $this->serverID;
}
public function getAutoSave()
{
return $this->autoSave;
}
public function setAutoSave($O9021849237811156087)
{
$this->autoSave = (bool) $O9021849237811156087;
foreach ($this->getLevels() as $O8990405184547542856) {
$O8990405184547542856->setAutoSave($this->autoSave);
}
}
public function getLevelType()
{
return $this->getConfigString("level-type", "DEFAULT");
}
public function getGenerateStructures()
{
return $this->getConfigBoolean("generate-structures", true);
}
public function getGamemode()
{
return $this->getConfigInt("gamemode", 0) & 0b11;
}
public function getForceGamemode()
{
return $this->getConfigBoolean("force-gamemode", false);
}
public static function getGamemodeString($O0168140512795630311)
{
switch ((int) $O0168140512795630311) {
case Player::SURVIVAL:
return "%gameMode.survival";
case Player::CREATIVE:
return "%gameMode.creative";
case Player::ADVENTURE:
return "%gameMode.adventure";
case Player::SPECTATOR:
return "%gameMode.spectator";
}
return "UNKNOWN";
}
public static function getGamemodeName(int $O0168140512795630311) : string
{
switch ($O0168140512795630311) {
case Player::SURVIVAL:
return "Survival";
case Player::CREATIVE:
return "Creative";
case Player::ADVENTURE:
return "Adventure";
case Player::SPECTATOR:
return "Spectator";
default:
throw new \InvalidArgumentException("Invalid gamemode {$O0168140512795630311}");
}
}
public static function getGamemodeFromString($O0975452763598009383)
{
switch (strtolower(trim($O0975452763598009383))) {
case (string) Player::SURVIVAL:
case "survival":
case "s":
return Player::SURVIVAL;
case (string) Player::CREATIVE:
case "creative":
case "c":
return Player::CREATIVE;
case (string) Player::ADVENTURE:
case "adventure":
case "a":
return Player::ADVENTURE;
case (string) Player::SPECTATOR:
case "spectator":
case "view":
case "v":
return Player::SPECTATOR;
}
return -1;
}
public static function getDifficultyFromString($O0975452763598009383)
{
switch (strtolower(trim($O0975452763598009383))) {
case "0":
case "peaceful":
case "p":
return 0;
case "1":
case "easy":
case "e":
return 1;
case "2":
case "normal":
case "n":
return 2;
case "3":
case "hard":
case "h":
return 3;
}
return -1;
}
public function getDifficulty()
{
return $this->getConfigInt("difficulty", 1);
}
public function hasWhitelist()
{
return $this->getConfigBoolean("white-list", false);
}
public function getSpawnRadius()
{
return $this->getConfigInt("spawn-protection", 16);
}
public function getAllowFlight() : bool
{
return true;
}
public function isHardcore()
{
return $this->getConfigBoolean("hardcore", false);
}
public function getDefaultGamemode()
{
return $this->getConfigInt("gamemode", 0) & 0b11;
}
public function getMotd()
{
return $this->getConfigString("motd", "Minecraft: PE Server");
}
public function getLoader()
{
return $this->autoloader;
}
public function getLogger()
{
return $this->logger;
}
public function getEntityMetadata()
{
return $this->entityMetadata;
}
public function getPlayerMetadata()
{
return $this->playerMetadata;
}
public function getLevelMetadata()
{
return $this->levelMetadata;
}
public function getPluginManager()
{
return $this->pluginManager;
}
public function getCraftingManager()
{
return $this->craftingManager;
}
public function getResourceManager() : ResourcePackManager
{
return $this->resourceManager;
}
public function getResourcePackManager() : ResourcePackManager
{
return $this->resourceManager;
}
public function getScheduler()
{
return $this->scheduler;
}
public function getTick() : int
{
return $this->tickCounter;
}
public function getTicksPerSecond()
{
return round($this->currentTPS, 2);
}
public function getTicksPerSecondAverage()
{
return round(array_sum($this->tickAverage) / count($this->tickAverage), 2);
}
public function getTickUsage()
{
return round($this->currentUse * 100, 2);
}
public function getTickUsageAverage()
{
return round(array_sum($this->useAverage) / count($this->useAverage) * 100, 2);
}
public function getCommandMap()
{
return $this->commandMap;
}
public function getOnlinePlayers()
{
return $this->playerList;
}
public function addRecipe(Recipe $O7631291917453267167)
{
$this->craftingManager->registerRecipe($O7631291917453267167);
}
public function shouldSavePlayerData() : bool
{
return (bool) $this->getProperty("player.save-player-data", true);
}
public function getOfflinePlayer(string $O3599798456741367439)
{
$O3599798456741367439 = strtolower($O3599798456741367439);
$O1720501386514426509 = $this->getPlayerExact($O3599798456741367439);
if ($O1720501386514426509 === null) {
$O1720501386514426509 = new OfflinePlayer($this, $O3599798456741367439);
}
return $O1720501386514426509;
}
private function getPlayerDataPath(string $O5911788118614605079) : string
{
return $this->getDataPath() . "/players/" . strtolower($O5911788118614605079) . ".dat";
}
public function hasOfflinePlayerData(string $O3599798456741367439) : bool
{
return file_exists($this->getPlayerDataPath($O3599798456741367439));
}
public function getOfflinePlayerData(string $O3599798456741367439)
{
$O3599798456741367439 = strtolower($O3599798456741367439);
$O3050887916085603833 = $this->getDataPath() . "players/";
if ($this->shouldSavePlayerData()) {
if (file_exists($O3050887916085603833 . "{$O3599798456741367439}.dat")) {
try {
$O6119036173800608151 = new NBT(NBT::BIG_ENDIAN);
$O6119036173800608151->readCompressed(file_get_contents($O3050887916085603833 . "{$O3599798456741367439}.dat"));
return $O6119036173800608151->getData();
} catch (\Throwable $O7980738059105788111) {
rename($O3050887916085603833 . "{$O3599798456741367439}.dat", $O3050887916085603833 . "{$O3599798456741367439}.dat.bak");
$this->logger->notice($this->getLanguage()->translateString("pocketmine.data.playerCorrupted", [$O3599798456741367439]));
}
} else {
$this->logger->notice($this->getLanguage()->translateString("pocketmine.data.playerNotFound", [$O3599798456741367439]));
}
}
$O0312716190911024736 = $this->getDefaultLevel()->getSafeSpawn();
$O3349255190547088167 = (int) (microtime(true) * 1000);
$O6119036173800608151 = new CompoundTag('', [new LongTag("firstPlayed", $O3349255190547088167), new LongTag("lastPlayed", $O3349255190547088167), new ListTag("Pos", [new DoubleTag(0, $O0312716190911024736->x), new DoubleTag(1, $O0312716190911024736->y), new DoubleTag(2, $O0312716190911024736->z)]), new StringTag("Level", $this->getDefaultLevel()->getName()), new ListTag("Inventory", []), new ListTag("EnderChestInventory", []), new CompoundTag("Achievements", []), new IntTag("playerGameType", $this->getGamemode()), new ListTag("Motion", [new DoubleTag(0, 0.0), new DoubleTag(1, 0.0), new DoubleTag(2, 0.0)]), new ListTag("Rotation", [new FloatTag(0, 0.0), new FloatTag(1, 0.0)]), new FloatTag("FallDistance", 0.0), new ShortTag("Fire", 0), new ShortTag("Air", 300), new ByteTag("OnGround", 1), new ByteTag("Invulnerable", 0), new StringTag("NameTag", $O3599798456741367439), new ShortTag("Health", 20), new ShortTag("MaxHealth", 20)]);
$O6119036173800608151->Pos->setTagType(NBT::TAG_Double);
$O6119036173800608151->Inventory->setTagType(NBT::TAG_Compound);
$O6119036173800608151->EnderChestInventory->setTagType(NBT::TAG_Compound);
$O6119036173800608151->Motion->setTagType(NBT::TAG_Double);
$O6119036173800608151->Rotation->setTagType(NBT::TAG_Float);
$this->saveOfflinePlayerData($O3599798456741367439, $O6119036173800608151);
return $O6119036173800608151;
}
public function saveOfflinePlayerData(string $O3599798456741367439, CompoundTag $O0105286391214512151)
{
if ($this->shouldSavePlayerData()) {
$O6119036173800608151 = new NBT(NBT::BIG_ENDIAN);
try {
$O6119036173800608151->setData($O0105286391214512151);
file_put_contents($this->getDataPath() . "players/" . strtolower($O3599798456741367439) . ".dat", $O6119036173800608151->writeCompressed());
} catch (\Throwable $O7980738059105788111) {
$this->logger->critical($this->getLanguage()->translateString("pocketmine.data.saveError", [$O3599798456741367439, $O7980738059105788111->getMessage()]));
$this->logger->logException($O7980738059105788111);
}
}
}
public function getPlayer(string $O3599798456741367439)
{
$O2047861407786862059 = null;
$O3599798456741367439 = strtolower($O3599798456741367439);
$O8946152267816428737 = PHP_INT_MAX;
foreach ($this->getOnlinePlayers() as $O6725082928939594459) {
if (stripos($O6725082928939594459->getName(), $O3599798456741367439) === 0) {
$O0492273000808735053 = strlen($O6725082928939594459->getName()) - strlen($O3599798456741367439);
if ($O0492273000808735053 < $O8946152267816428737) {
$O2047861407786862059 = $O6725082928939594459;
$O8946152267816428737 = $O0492273000808735053;
}
if ($O0492273000808735053 === 0) {
break;
}
}
}
return $O2047861407786862059;
}
public function getPlayerExact(string $O3599798456741367439)
{
$O3599798456741367439 = strtolower($O3599798456741367439);
foreach ($this->getOnlinePlayers() as $O6725082928939594459) {
if (strtolower($O6725082928939594459->getName()) === $O3599798456741367439) {
return $O6725082928939594459;
}
}
return null;
}
public function matchPlayer($O1467530431298244211)
{
$O1467530431298244211 = strtolower($O1467530431298244211);
$O3437239058632284834 = [];
foreach ($this->getOnlinePlayers() as $O6725082928939594459) {
if (strtolower($O6725082928939594459->getName()) === $O1467530431298244211) {
$O3437239058632284834 = [$O6725082928939594459];
}
if (stripos($O6725082928939594459->getName(), $O1467530431298244211) !== false) {
$O3437239058632284834[] = $O6725082928939594459;
} else {
}
}
return $O3437239058632284834;
}
public function getPlayerByRawUUID(string $O5798241888478878256) : ?Player
{
return $this->playerList[$O5798241888478878256] ?? null;
}
public function getPlayerByUUID(UUID $O9479455264228622327) : ?Player
{
return $this->getPlayerByRawUUID($O9479455264228622327->toBinary());
}
public function removePlayer(Player $O6725082928939594459)
{
unset($this->players[spl_object_hash($O6725082928939594459)]);
}
public function getLevels()
{
return $this->levels;
}
public function getDefaultLevel()
{
return $this->levelDefault;
}
public function setDefaultLevel(?Level $O8990405184547542856) : void
{
if ($O8990405184547542856 === null or $this->isLevelLoaded($O8990405184547542856->getFolderName()) and $O8990405184547542856 !== $this->levelDefault) {
$this->levelDefault = $O8990405184547542856;
}
}
public function isLevelLoaded($O3599798456741367439)
{
return $this->getLevelByName($O3599798456741367439) instanceof Level;
}
public function getLevel($O7670272462308816267)
{
return $this->levels[$O7670272462308816267] ?? null;
}
public function getLevelByName($O3599798456741367439)
{
foreach ($this->getLevels() as $O8990405184547542856) {
if ($O8990405184547542856->getFolderName() === $O3599798456741367439) {
return $O8990405184547542856;
}
}
return null;
}
public function getExpectedExperience($O8990405184547542856)
{
if (isset($this->expCache[$O8990405184547542856])) {
return $this->expCache[$O8990405184547542856];
}
$O8171822444395634623 = $O8990405184547542856 ** 2;
if ($O8990405184547542856 < 16) {
$this->expCache[$O8990405184547542856] = $O8171822444395634623 + 6 * $O8990405184547542856;
} else {
if ($O8990405184547542856 < 31) {
$this->expCache[$O8990405184547542856] = 2.5 * $O8171822444395634623 - 40.5 * $O8990405184547542856 + 360;
} else {
$this->expCache[$O8990405184547542856] = 4.5 * $O8171822444395634623 - 162.5 * $O8990405184547542856 + 2220;
}
}
return $this->expCache[$O8990405184547542856];
}
public function unloadLevel(Level $O8990405184547542856, $O1859982694370446388 = false)
{
if ($O8990405184547542856 === $this->getDefaultLevel() and !$O1859982694370446388) {
throw new \InvalidStateException("The default world cannot be unloaded while running, please switch worlds.");
}
return $O8990405184547542856->unload($O1859982694370446388);
}
public function removeLevel(Level $O8990405184547542856) : void
{
unset($this->levels[$O8990405184547542856->getId()]);
}
public function loadLevel($O3599798456741367439)
{
if (trim($O3599798456741367439) === '') {
throw new LevelException("Invalid empty level name");
}
if ($this->isLevelLoaded($O3599798456741367439)) {
return true;
} else {
if (!$this->isLevelGenerated($O3599798456741367439)) {
$this->logger->notice($this->getLanguage()->translateString("pocketmine.level.notFound", [$O3599798456741367439]));
return false;
} else {
}
}
$O3050887916085603833 = $this->getDataPath() . "worlds/" . $O3599798456741367439 . "/";
$O7755050365517905803 = LevelProviderManager::getProvider($O3050887916085603833);
if ($O7755050365517905803 === null) {
$this->logger->error($this->getLanguage()->translateString("pocketmine.level.loadError", [$O3599798456741367439, "Cannot identify format of world"]));
return false;
}
try {
$O8990405184547542856 = new Level($this, $O3599798456741367439, $O3050887916085603833, $O7755050365517905803);
} catch (\Throwable $O7980738059105788111) {
goto O5063443397781911906;
O3811998597028183027:
$this->logger->logException($O7980738059105788111);
goto O6623103670022083984;
O2336751932189250758:
return false;
goto O6200657934645304063;
O6623103670022083984:
O4750440198214853292:
goto O2336751932189250758;
O5063443397781911906:
$this->logger->error($this->getLanguage()->translateString("pocketmine.level.loadError", [$O3599798456741367439, $O7980738059105788111->getMessage()]));
goto O4894909439047598507;
O4894909439047598507:
if (!$this->logger instanceof MainLogger) {
goto O4750440198214853292;
}
goto O3811998597028183027;
O6200657934645304063:
}
$this->levels[$O8990405184547542856->getId()] = $O8990405184547542856;
$O8990405184547542856->initLevel();
$this->getPluginManager()->callEvent(new LevelLoadEvent($O8990405184547542856));
return true;
}
public function generateLevel($O3599798456741367439, $O1719463550011029788 = null, $O7368252357325108075 = null, $O5599874228007848556 = [])
{
if (trim($O3599798456741367439) === '' or $this->isLevelGenerated($O3599798456741367439)) {
return false;
}
$O1719463550011029788 = $O1719463550011029788 ?? random_int(INT32_MIN, INT32_MAX);
if (!isset($O5599874228007848556["preset"])) {
$O5599874228007848556["preset"] = $this->getConfigString("generator-settings", '');
}
if (!($O7368252357325108075 !== null and class_exists($O7368252357325108075, true) and is_subclass_of($O7368252357325108075, Generator::class))) {
$O7368252357325108075 = Generator::getGenerator($this->getLevelType());
}
if (($O7755050365517905803 = LevelProviderManager::getProviderByName($O9566254652253104073 = $this->getProperty("level-settings.default-format", "pmanvil"))) === null) {
$O7755050365517905803 = LevelProviderManager::getProviderByName($O9566254652253104073 = "pmanvil");
if ($O7755050365517905803 === null) {
throw new \InvalidStateException("Default level provider has not been registered");
}
}
try {
$O3050887916085603833 = $this->getDataPath() . "worlds/" . $O3599798456741367439 . "/";
$O7755050365517905803::generate($O3050887916085603833, $O3599798456741367439, $O1719463550011029788, $O7368252357325108075, $O5599874228007848556);
$O8990405184547542856 = new Level($this, $O3599798456741367439, $O3050887916085603833, $O7755050365517905803);
$this->levels[$O8990405184547542856->getId()] = $O8990405184547542856;
$O8990405184547542856->initLevel();
} catch (\Throwable $O7980738059105788111) {
goto O7272201934504998244;
O3724506743109512065:
$this->logger->logException($O7980738059105788111);
goto O5657284288694430296;
O0605031002265512225:
return false;
goto O5065116026259878246;
O7272201934504998244:
$this->logger->error($this->getLanguage()->translateString("pocketmine.level.generationError", [$O3599798456741367439, $O7980738059105788111->getMessage()]));
goto O5814659708635473983;
O5657284288694430296:
O7672568378055596848:
goto O0605031002265512225;
O5814659708635473983:
if (!$this->logger instanceof MainLogger) {
goto O7672568378055596848;
}
goto O3724506743109512065;
O5065116026259878246:
}
$this->getPluginManager()->callEvent(new LevelInitEvent($O8990405184547542856));
$this->getPluginManager()->callEvent(new LevelLoadEvent($O8990405184547542856));
$this->getLogger()->notice($this->getLanguage()->translateString("pocketmine.level.backgroundGeneration", [$O3599798456741367439]));
$O9348000031193722165 = $O8990405184547542856->getSpawnLocation();
$O3493852102662277549 = $O9348000031193722165->getFloorX() >> 4;
$O6847426029377725661 = $O9348000031193722165->getFloorZ() >> 4;
$O5913201266650500530 = [];
$O2097610998554850603 = -3;
while ($O2097610998554850603 <= 3) {
$O4581900489425517057 = -3;
while ($O4581900489425517057 <= 3) {
$O8433540969984747347 = $O2097610998554850603 ** 2 + $O4581900489425517057 ** 2;
$O3006954518737917268 = $O2097610998554850603 + $O3493852102662277549;
$O8823528619564163764 = $O4581900489425517057 + $O6847426029377725661;
$O4220208707720250477 = Level::chunkHash($O3006954518737917268, $O8823528619564163764);
$O5913201266650500530[$O4220208707720250477] = $O8433540969984747347;
++$O4581900489425517057;
}
++$O2097610998554850603;
}
asort($O5913201266650500530);
foreach ($O5913201266650500530 as $O4220208707720250477 => $O8433540969984747347) {
Level::getXZ($O4220208707720250477, $O3006954518737917268, $O8823528619564163764);
$O8990405184547542856->populateChunk($O3006954518737917268, $O8823528619564163764, true);
}
return true;
}
public function isLevelGenerated($O3599798456741367439)
{
if (trim($O3599798456741367439) === '') {
return false;
}
$O3050887916085603833 = $this->getDataPath() . "worlds/" . $O3599798456741367439 . "/";
if (!$this->getLevelByName($O3599798456741367439) instanceof Level) {
return is_dir($O3050887916085603833) and !empty(array_filter(scandir($O3050887916085603833, SCANDIR_SORT_NONE), function ($O8385029910437788353) {
return $O8385029910437788353 !== ".." and $O8385029910437788353 !== ".";
}));
}
return true;
}
public function findEntity(int $O5840641995929062196, Level $O0023464626725984877 = null)
{
foreach ($this->levels as $O8990405184547542856) {
assert(!$O8990405184547542856->isClosed());
if (($O9518733833987900631 = $O8990405184547542856->getEntity($O5840641995929062196)) instanceof Entity) {
return $O9518733833987900631;
}
}
return null;
}
public function getConfigString($O0719866863345062028, $O0630247780966342016 = '')
{
$O8385029910437788353 = getopt('', ["{$O0719866863345062028}::"]);
if (isset($O8385029910437788353[$O0719866863345062028])) {
return (string) $O8385029910437788353[$O0719866863345062028];
}
return $this->properties->exists($O0719866863345062028) ? $this->properties->get($O0719866863345062028) : $O0630247780966342016;
}
public function getProperty($O0719866863345062028, $O0630247780966342016 = null)
{
if (!array_key_exists($O0719866863345062028, $this->propertyCache)) {
$O8385029910437788353 = getopt('', ["{$O0719866863345062028}::"]);
if (isset($O8385029910437788353[$O0719866863345062028])) {
$this->propertyCache[$O0719866863345062028] = $O8385029910437788353[$O0719866863345062028];
} else {
$this->propertyCache[$O0719866863345062028] = $this->config->getNested($O0719866863345062028);
}
}
return $this->propertyCache[$O0719866863345062028] === null ? $O0630247780966342016 : $this->propertyCache[$O0719866863345062028];
}
public function setConfigString($O0719866863345062028, $O9021849237811156087)
{
$this->properties->set($O0719866863345062028, $O9021849237811156087);
}
public function getConfigInt($O0719866863345062028, $O0630247780966342016 = 0)
{
$O8385029910437788353 = getopt('', ["{$O0719866863345062028}::"]);
if (isset($O8385029910437788353[$O0719866863345062028])) {
return (int) $O8385029910437788353[$O0719866863345062028];
}
return $this->properties->exists($O0719866863345062028) ? (int) $this->properties->get($O0719866863345062028) : (int) $O0630247780966342016;
}
public function setConfigInt($O0719866863345062028, $O9021849237811156087)
{
$this->properties->set($O0719866863345062028, (int) $O9021849237811156087);
}
public function getConfigBoolean($O0719866863345062028, $O0630247780966342016 = false)
{
$O8385029910437788353 = getopt('', ["{$O0719866863345062028}::"]);
if (isset($O8385029910437788353[$O0719866863345062028])) {
$O9021849237811156087 = $O8385029910437788353[$O0719866863345062028];
} else {
$O9021849237811156087 = $this->properties->exists($O0719866863345062028) ? $this->properties->get($O0719866863345062028) : $O0630247780966342016;
}
if (is_bool($O9021849237811156087)) {
return $O9021849237811156087;
}
switch (strtolower($O9021849237811156087)) {
case "on":
case "true":
case "1":
case "yes":
return true;
}
return false;
}
public function setConfigBool($O0719866863345062028, $O9021849237811156087)
{
$this->properties->set($O0719866863345062028, $O9021849237811156087 ? "1" : "0");
}
public function getPluginCommand($O3599798456741367439)
{
if (($O3932855126531729106 = $this->commandMap->getCommand($O3599798456741367439)) instanceof PluginIdentifiableCommand) {
return $O3932855126531729106;
} else {
return null;
}
}
public function getNameBans()
{
return $this->banByName;
}
public function getIPBans()
{
return $this->banByIP;
}
public function getCIDBans()
{
return $this->banByCID;
}
public function isMobsEnabled()
{
return (bool) $this->mobConfig->get("enable-mobs");
}
public function getMobsNotSpawnRadius()
{
return (int) $this->mobConfig->get("mobs-not-spawn-radius-from-spawn");
}
public function spawnMobsWorld()
{
return (bool) $this->mobConfig->get("spawn-mobs-in-world");
}
public function getWorldsForMobsSpawn()
{
return (array) $this->mobConfig->get("default-worlds-for-mob-spawn");
}
public function spawnMobsNether()
{
return (bool) $this->mobConfig->get("spawn-mobs-in-nether");
}
public function spawnMobsEnder()
{
return (bool) $this->mobConfig->get("spawn-mobs-in-ender");
}
public function addOp($O3599798456741367439)
{
$this->operators->set(strtolower($O3599798456741367439), true);
if (($O6725082928939594459 = $this->getPlayerExact($O3599798456741367439)) !== null) {
$O6725082928939594459->recalculatePermissions();
}
$this->operators->save();
}
public function removeOp($O3599798456741367439)
{
foreach ($this->operators->getAll() as $O8972380125066583049 => $O5803285531012688078) {
if (strtolower($O3599798456741367439) === strtolower($O8972380125066583049)) {
$this->operators->remove($O8972380125066583049);
}
}
if (($O6725082928939594459 = $this->getPlayerExact($O3599798456741367439)) !== null) {
$O6725082928939594459->recalculatePermissions();
}
$this->operators->save();
}
public function addWhitelist($O3599798456741367439)
{
$this->whitelist->set(strtolower($O3599798456741367439), true);
$this->whitelist->save();
}
public function removeWhitelist($O3599798456741367439)
{
$this->whitelist->remove(strtolower($O3599798456741367439));
$this->whitelist->save();
}
public function isWhitelisted($O3599798456741367439)
{
return !$this->hasWhitelist() or $this->whitelist->exists($O3599798456741367439, true);
}
public function isOp($O3599798456741367439)
{
return $this->operators->exists($O3599798456741367439, true);
}
public function getWhitelisted()
{
return $this->whitelist;
}
public function getOps()
{
return $this->operators;
}
public function reloadWhitelist()
{
$this->whitelist->reload();
}
public function getCommandAliases()
{
$O7278142800516290993 = $this->getProperty("aliases");
$O1720501386514426509 = [];
if (is_array($O7278142800516290993)) {
foreach ($O7278142800516290993 as $O9800422575660690625 => $O9021849237811156087) {
$O6425227135764029683 = [];
if (is_array($O9021849237811156087)) {
$O6425227135764029683 = $O9021849237811156087;
} else {
$O6425227135764029683[] = (string) $O9021849237811156087;
}
$O1720501386514426509[$O9800422575660690625] = $O6425227135764029683;
}
}
return $O1720501386514426509;
}
public function getCrashPath()
{
return $this->dataPath . "crashdumps/";
}
public static function getInstance() : Server
{
if (self::$instance === null) {
throw new \RuntimeException("Attempt to retrieve Server instance outside server thread");
}
return self::$instance;
}
public static function microSleep(int $O6478173387404500137)
{
if (self::$sleeper === null) {
self::$sleeper = new \Threaded();
}
self::$sleeper->synchronized(function (int $O1875008190707259367) : void {
Server::$sleeper->wait($O1875008190707259367);
}, $O6478173387404500137);
}
public function loadAdvancedConfig()
{
$this->playerMsgType = $this->getAdvancedProperty("server.player-msg-type", self::PLAYER_MSG_TYPE_MESSAGE);
$this->playerLoginMsg = $this->getAdvancedProperty("server.login-msg", "3@player joined the game");
$this->playerLogoutMsg = $this->getAdvancedProperty("server.logout-msg", "3@player left the game");
$this->weatherEnabled = $this->getAdvancedProperty("level.weather", true);
$this->foodEnabled = $this->getAdvancedProperty("player.hunger", true);
$this->expEnabled = $this->getAdvancedProperty("player.experience", true);
$this->keepInventory = $this->getAdvancedProperty("player.keep-inventory", false);
$this->keepExperience = $this->getAdvancedProperty("player.keep-experience", false);
$this->toolboxAllowed = $this->getAdvancedProperty("player.toolboxAllowed", false);
$this->loadIncompatibleAPI = $this->getAdvancedProperty("developer.load-incompatible-api", true);
$this->netherEnabled = $this->getAdvancedProperty("nether.allow-nether", false);
$this->netherName = $this->getAdvancedProperty("nether.level-name", "nether");
$this->enderEnabled = $this->getAdvancedProperty("ender.allow-ender", false);
$this->enderName = $this->getAdvancedProperty("ender.level-name", "ender");
$this->weatherRandomDurationMin = $this->getAdvancedProperty("level.weather-random-duration-min", 6000);
$this->weatherRandomDurationMax = $this->getAdvancedProperty("level.weather-random-duration-max", 12000);
$this->lightningTime = $this->getAdvancedProperty("level.lightning-time", 200);
$this->lightningFire = $this->getAdvancedProperty("level.lightning-fire", false);
$this->allowSnowGolem = $this->getAdvancedProperty("server.allow-snow-golem", false);
$this->allowWither = $this->getAdvancedProperty("server.allow-wither", false);
$this->allowIronGolem = $this->getAdvancedProperty("server.allow-iron-golem", false);
$this->autoClearInv = $this->getAdvancedProperty("player.auto-clear-inventory", true);
$this->dserverConfig = ["enable" => $this->getAdvancedProperty("dserver.enable", false), "queryAutoUpdate" => $this->getAdvancedProperty("dserver.query-auto-update", false), "queryTickUpdate" => $this->getAdvancedProperty("dserver.query-tick-update", true), "motdMaxPlayers" => $this->getAdvancedProperty("dserver.motd-max-players", 0), "queryMaxPlayers" => $this->getAdvancedProperty("dserver.query-max-players", 0), "motdAllPlayers" => $this->getAdvancedProperty("dserver.motd-all-players", false), "queryAllPlayers" => $this->getAdvancedProperty("dserver.query-all-players", false), "motdPlayers" => $this->getAdvancedProperty("dserver.motd-players", false), "queryPlayers" => $this->getAdvancedProperty("dserver.query-players", false), "timer" => $this->getAdvancedProperty("dserver.time", 40), "retryTimes" => $this->getAdvancedProperty("dserver.retry-times", 3), "serverList" => explode(";", $this->getAdvancedProperty("dserver.server-list", ''))];
$this->redstoneEnabled = $this->getAdvancedProperty("redstone.enable", false);
$this->allowFrequencyPulse = $this->getAdvancedProperty("redstone.allow-frequency-pulse", false);
$this->pulseFrequency = $this->getAdvancedProperty("redstone.pulse-frequency", 20);
$this->getLogger()->setWrite(!$this->getAdvancedProperty("server.disable-log", false));
$this->limitedCreative = $this->getAdvancedProperty("server.limited-creative", true);
$this->chunkRadius = $this->getAdvancedProperty("player.chunk-radius", -1);
$this->destroyBlockParticle = $this->getAdvancedProperty("server.destroy-block-particle", true);
$this->allowSplashPotion = $this->getAdvancedProperty("server.allow-splash-potion", true);
$this->fireSpread = $this->getAdvancedProperty("level.fire-spread", false);
$this->advancedCommandSelector = $this->getAdvancedProperty("server.advanced-command-selector", false);
$this->anvilEnabled = $this->getAdvancedProperty("enchantment.enable-anvil", true);
$this->enchantingTableEnabled = $this->getAdvancedProperty("enchantment.enable-enchanting-table", true);
$this->countBookshelf = $this->getAdvancedProperty("enchantment.count-bookshelf", false);
$this->allowInventoryCheats = $this->getAdvancedProperty("inventory.allow-cheats", false);
$this->folderpluginloader = $this->getAdvancedProperty("developer.folder-plugin-loader", true);
$this->absorbWater = $this->getAdvancedProperty("server.absorb-water", false);
}
public function getDServerMaxPlayers()
{
return $this->dserverAllPlayers + $this->getMaxPlayers();
}
public function getDServerOnlinePlayers()
{
return $this->dserverPlayers + count($this->getOnlinePlayers());
}
public function isDServerEnabled()
{
return $this->dserverConfig["enable"];
}
public function updateDServerInfo()
{
$this->scheduler->scheduleAsyncTask(new DServerTask($this->dserverConfig["serverList"], $this->dserverConfig["retryTimes"]));
}
public function getBuild()
{
return $this->version->getBuild();
}
public function getGameVersion()
{
return $this->version->getRelease();
}
public function about()
{
$O7339720733369221285 = "\r\n ___ _\r\n / | ____ ___ ______ _____ ___ ____ ______(_)___ ___\r\n / /| |/ __ `/ / / / __ `/ __ `__ \\/ __ `/ ___/ / __ \\/ _ \\\r\n / ___ / /_/ / /_/ / /_/ / / / / / / /_/ / / / / / / / __/\r\n/_/ |_\\__, /\\__,_/\\__,_/_/ /_/ /_/\\__,_/_/ /_/_/ /_/\\___/\r\n /_/\r\n\r\nf d{$this->getName()} {$this->getPocketMineVersion()}\r\nfMCPE : " . $this->getVersion() . "\r\nf php: e" . PHP_VERSION . "\r\nfOS: 6" . PHP_OS . "\r\nf: bvk.com/aquamarine.team f(bvk.com/maruselplayf)\r\n\r\na \r\n\r\n";
$this->getLogger()->info($O7339720733369221285);
}
public function __construct(\ClassLoader $O6299349282117743481, \ThreadedLogger $O3987232109979653813, $O2112039390593502437, $O9186808249105831828, $O1181239228042478561 = "unknown")
{
if (self::$instance !== null) {
throw new \InvalidStateException("Only one server instance can exist at once");
}
self::$instance = $this;
$this->tickSleeper = new SleeperHandler();
$this->autoloader = $O6299349282117743481;
$this->logger = $O3987232109979653813;
try {
if (!file_exists($O2112039390593502437 . "worlds/")) {
mkdir($O2112039390593502437 . "worlds/", 0777);
}
if (!file_exists($O2112039390593502437 . "players/")) {
mkdir($O2112039390593502437 . "players/", 0777);
}
if (!file_exists($O9186808249105831828)) {
mkdir($O9186808249105831828, 0777);
}
if (!file_exists($O2112039390593502437 . "crashdumps/")) {
mkdir($O2112039390593502437 . "crashdumps/", 0777);
}
$this->dataPath = realpath($O2112039390593502437) . DIRECTORY_SEPARATOR;
$this->pluginPath = realpath($O9186808249105831828) . DIRECTORY_SEPARATOR;
$O9862494584748528374 = new VersionString($this->getPocketMineVersion());
$this->version = $O9862494584748528374;
$this->about();
$this->logger->info(" ...");
if (!file_exists($this->dataPath . "pocketmine.yml")) {
if (file_exists($this->dataPath . "lang.txt")) {
$O1124447341552411758 = new Config($O6610404073512168585 = $this->dataPath . "lang.txt", Config::ENUM, []);
$O2669885393737283400 = null;
foreach ($O1124447341552411758->getAll(true) as $O5589052620185341712) {
$O2669885393737283400 = $O5589052620185341712;
}
if (file_exists(\pocketmine\PATH . "src/pocketmine/resources/pocketmine_{$O2669885393737283400}.yml")) {
$O5948151535137668804 = file_get_contents($O0329386070690272403 = \pocketmine\PATH . "src/pocketmine/resources/pocketmine_{$O2669885393737283400}.yml");
} else {
$O5948151535137668804 = file_get_contents($O0329386070690272403 = \pocketmine\PATH . "src/pocketmine/resources/pocketmine_rus.yml");
}
} else {
$O5948151535137668804 = file_get_contents($O0329386070690272403 = \pocketmine\PATH . "src/pocketmine/resources/pocketmine_rus.yml");
}
@file_put_contents($this->dataPath . "pocketmine.yml", $O5948151535137668804);
}
if (file_exists($this->dataPath . "lang.txt")) {
unlink($this->dataPath . "lang.txt");
}
$this->config = new Config($O6610404073512168585 = $this->dataPath . "pocketmine.yml", Config::YAML, []);
$O3099085871814036414 = $this->getProperty("settings.language", "rus");
if ($O1181239228042478561 != "unknown" and $O3099085871814036414 != $O1181239228042478561) {
@file_put_contents($O6610404073512168585, str_replace("language: \"" . $O3099085871814036414 . "\"", "language: \"" . $O1181239228042478561 . "\"", file_get_contents($O6610404073512168585)));
$this->config->reload();
unset($this->propertyCache["settings.language"]);
}
$O8748311623344355263 = $this->getProperty("settings.language", BaseLang::FALLBACK_LANGUAGE);
if (file_exists(\pocketmine\PATH . "src/pocketmine/resources/aquamarine_{$O8748311623344355263}.yml")) {
$O5948151535137668804 = file_get_contents($O0329386070690272403 = \pocketmine\PATH . "src/pocketmine/resources/aquamarine_{$O8748311623344355263}.yml");
} else {
$O5948151535137668804 = file_get_contents($O0329386070690272403 = \pocketmine\PATH . "src/pocketmine/resources/aquamarine_rus.yml");
}
if (!file_exists($this->dataPath . "aquamarine.yml")) {
@file_put_contents($this->dataPath . "aquamarine.yml", $O5948151535137668804);
}
$O6358018519146234483 = new Config($O0329386070690272403, Config::YAML, []);
$this->advancedConfig = new Config($this->dataPath . "aquamarine.yml", Config::YAML, []);
$O9067335590721393753 = $this->getAdvancedProperty("config.version", 0, $O6358018519146234483);
$O2398238170279201564 = $this->getAdvancedProperty("config.version", 0);
$this->loadAdvancedConfig();
$this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, ["motd" => "Minecraft: PE Server", "key-server-id" => 0, "server-port" => 19132, "white-list" => false, "announce-player-achievements" => true, "spawn-protection" => 16, "max-players" => 20, "gamemode" => 0, "force-gamemode" => false, "hardcore" => false, "pvp" => true, "difficulty" => 1, "generator-settings" => '', "level-name" => "world", "level-seed" => "defaultCid", "level-type" => "DEFAULT", "enable-query" => true, "enable-rcon" => false, "rcon.password" => substr(base64_encode(random_bytes(20)), 3, 10), "auto-save" => true, "online-mode" => false, "view-distance" => 8]);
$this->mobConfig = new Config($this->dataPath . "mobs_config.yml", Config::YAML, ["enable-mobs" => true, "mobs-not-spawn-radius-from-spawn" => 16, "spawn-mobs-in-world" => true, "default-worlds-for-mob-spawn" => ["world"], "spawn-mobs-in-nether" => true, "spawn-mobs-in-ender" => true]);
$this->mobConfig->save();
$O6009508099753634303 = $this->getConfigBoolean("online-mode", false);
if (!extension_loaded("openssl")) {
$this->logger->info("OpenSSL extension not found");
$this->logger->info("Please configure OpenSSL extension for PHP if you want to use Xbox Live authentication or global resource pack.");
$this->setConfigBool("online-mode", false);
} else {
if (!$O6009508099753634303) {
$this->logger->info("Online mode has been turned off in server.properties");
$this->logger->info("Xbox Live authentication is disabled.");
} else {
}
}
$this->forceLanguage = $this->getProperty("settings.force-language", false);
$this->baseLang = new BaseLang($this->getProperty("settings.language", BaseLang::FALLBACK_LANGUAGE));
$this->logger->info($this->getLanguage()->translateString("language.selected", [$this->getLanguage()->getName(), $this->getLanguage()->getLang()]));
$this->memoryManager = new MemoryManager($this);
if (($O1790656415063519491 = $this->getProperty("settings.async-workers", "auto")) === "auto") {
$O1790656415063519491 = ServerScheduler::$WORKERS;
$O2091176693740858129 = Utils::getCoreCount() - 2;
if ($O2091176693740858129 > 0) {
$O1790656415063519491 = max(1, $O2091176693740858129);
}
} else {
$O1790656415063519491 = max(1, (int) $O1790656415063519491);
}
ServerScheduler::$WORKERS = $O1790656415063519491;
if ($this->getProperty("network.batch-threshold", 256) >= 0) {
Network::$BATCH_THRESHOLD = (int) $this->getProperty("network.batch-threshold", 256);
} else {
Network::$BATCH_THRESHOLD = -1;
}
$this->networkCompressionLevel = (int) $this->getProperty("network.compression-level", 6);
if ($this->networkCompressionLevel < 1 or $this->networkCompressionLevel > 9) {
$this->logger->warning("Invalid network compression level {$this->networkCompressionLevel} set, setting to default 6");
$this->networkCompressionLevel = 6;
}
$this->networkCompressionAsync = (bool) $this->getProperty("network.async-compression", true);
$this->doTitleTick = (bool) $this->getProperty("console.title-tick", true) && Terminal::hasFormattingCodes();
$this->scheduler = new ServerScheduler();
$O7735275318978967276 = new SleeperNotifier();
$this->console = new CommandReader($O7735275318978967276);
$this->tickSleeper->addNotifier($O7735275318978967276, function () : void {
$this->checkConsole();
});
$this->console->start(PTHREADS_INHERIT_CONSTANTS);
if ($this->getConfigBoolean("enable-rcon", false)) {
try {
$this->rcon = new RCON($this, $this->getConfigString("rcon.password", ''), $this->getConfigInt("rcon.port", $this->getPort()), $this->getIp(), $this->getConfigInt("rcon.max-clients", 50));
} catch (\Exception $O7980738059105788111) {
$this->getLogger()->critical("RCON can't be started: " . $O7980738059105788111->getMessage());
}
}
$this->entityMetadata = new EntityMetadataStore();
$this->playerMetadata = new PlayerMetadataStore();
$this->levelMetadata = new LevelMetadataStore();
$this->operators = new Config($this->dataPath . "ops.txt", Config::ENUM);
$this->whitelist = new Config($this->dataPath . "white-list.txt", Config::ENUM);
if (file_exists($this->dataPath . "banned.txt") and !file_exists($this->dataPath . "banned-players.txt")) {
@rename($this->dataPath . "banned.txt", $this->dataPath . "banned-players.txt");
}
@touch($this->dataPath . "banned-players.txt");
$this->banByName = new BanList($this->dataPath . "banned-players.txt");
$this->banByName->load();
@touch($this->dataPath . "banned-ips.txt");
$this->banByIP = new BanList($this->dataPath . "banned-ips.txt");
$this->banByIP->load();
@touch($this->dataPath . "banned-cids.txt");
$this->banByCID = new BanList($this->dataPath . "banned-cids.txt");
$this->banByCID->load();
$this->maxPlayers = $this->getConfigInt("max-players", 20);
$this->setAutoSave($this->getConfigBoolean("auto-save", true));
if ($this->getConfigBoolean("hardcore", false) and $this->getDifficulty() < 3) {
$this->setConfigInt("difficulty", 3);
}
define("pocketmine\\DEBUG", (int) $this->getProperty("debug.level", 1));
if ((int) ini_get("zend.assertions") !== -1) {
$this->logger->warning("Debugging assertions are enabled, this may impact on performance. To disable them, set `zend.assertions = -1` in php.ini.");
}
ini_set("assert.exception", "1");
if ($this->logger instanceof MainLogger) {
$this->logger->setLogDebug(\pocketmine\DEBUG > 1);
}
if (\pocketmine\DEBUG >= 0) {
@cli_set_process_title("{$this->getName()} {$this->getPocketMineVersion()}");
}
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.networkStart", [$this->getIp() === '' ? "*" : $this->getIp(), $this->getPort()]));
$this->serverID = Utils::getMachineUniqueId($this->getIp() . $this->getPort());
$this->getLogger()->debug("Server unique id: " . $this->getServerUniqueId());
$this->getLogger()->debug("Machine unique id: " . Utils::getMachineUniqueId());
$this->network = new Network($this);
$this->network->setName($this->getMotd());
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.license", [$this->getName()]));
Timings::init();
$this->consoleSender = new ConsoleCommandSender();
$this->commandMap = new SimpleCommandMap($this);
$this->logger->info(" commands-list.yml...");
$this->registerCommandList();
Entity::init();
Tile::init();
InventoryType::init();
Block::init();
Enchantment::init();
EnchantmentLevelTable::init();
Item::init();
Biome::init();
Color::init();
LevelProviderManager::addProvider(Anvil::class);
LevelProviderManager::addProvider(McRegion::class);
LevelProviderManager::addProvider(PMAnvil::class);
if (extension_loaded("leveldb")) {
$this->logger->debug($this->getLanguage()->translateString("pocketmine.debug.enable"));
LevelProviderManager::addProvider(LevelDB::class);
}
Generator::addGenerator(Flat::class, "flat");
Generator::addGenerator(Normal::class, "normal");
Generator::addGenerator(Normal::class, "default");
Generator::addGenerator(Nether::class, "hell");
Generator::addGenerator(Nether::class, "nether");
Generator::addGenerator(VoidGenerator::class, "void");
Generator::addGenerator(Ender::class, "ender");
$this->craftingManager = new CraftingManager();
$this->resourceManager = new ResourcePackManager($this, $this->getDataPath() . "resource_packs" . DIRECTORY_SEPARATOR);
$this->pluginManager = new PluginManager($this, $this->commandMap);
$this->pluginManager->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this->consoleSender);
$this->pluginManager->setUseTimings($this->getProperty("settings.enable-profiling", false));
$this->profilingTickRate = (float) $this->getProperty("settings.profile-report-trigger", 20);
$this->pluginManager->registerInterface(PharPluginLoader::class);
if ($this->folderpluginloader) {
$this->pluginManager->registerInterface(FolderPluginLoader::class);
}
$this->pluginManager->registerInterface(ScriptPluginLoader::class);
register_shutdown_function([$this, "crashDump"]);
$this->queryRegenerateTask = new QueryRegenerateEvent($this);
$this->pluginManager->loadPlugins($this->pluginPath);
$this->enablePlugins(PluginLoadOrder::STARTUP);
$this->network->registerInterface(new RakLibInterface($this));
foreach ((array) $this->getProperty("worlds", []) as $O3599798456741367439 => $O5599874228007848556) {
if ($O5599874228007848556 === null) {
$O5599874228007848556 = [];
} else {
if (is_array($O5599874228007848556)) {
if (!$this->loadLevel($O3599798456741367439)) {
$O1719463550011029788 = $O5599874228007848556["seed"] ?? time();
if (is_string($O1719463550011029788) and !is_numeric($O1719463550011029788)) {
$O1719463550011029788 = Utils::javaStringHash($O1719463550011029788);
} else {
if (!is_int($O1719463550011029788)) {
$O1719463550011029788 = (int) $O1719463550011029788;
} else {
}
}
$O5599874228007848556 = explode(":", $this->getProperty("worlds.{$O3599798456741367439}.generator", Generator::getGenerator("default")));
$O1835061701061048219 = array_shift($O5599874228007848556);
$O7368252357325108075 = Generator::getGenerator($O1835061701061048219);
if (count($O5599874228007848556) > 0) {
$O5599874228007848556 = ["preset" => implode(":", $O5599874228007848556)];
} else {
$O5599874228007848556 = [];
}
$this->generateLevel($O3599798456741367439, $O1719463550011029788, $O7368252357325108075, $O5599874228007848556);
}
}
}
if (!$this->loadLevel($O3599798456741367439)) {
$O1719463550011029788 = $O5599874228007848556["seed"] ?? time();
if (is_string($O1719463550011029788) and !is_numeric($O1719463550011029788)) {
$O1719463550011029788 = Utils::javaStringHash($O1719463550011029788);
} else {
if (!is_int($O1719463550011029788)) {
$O1719463550011029788 = (int) $O1719463550011029788;
} else {
}
}
$O5599874228007848556 = explode(":", $this->getProperty("worlds.{$O3599798456741367439}.generator", Generator::getGenerator("default")));
$O1835061701061048219 = array_shift($O5599874228007848556);
$O7368252357325108075 = Generator::getGenerator($O1835061701061048219);
if (count($O5599874228007848556) > 0) {
$O5599874228007848556 = ["preset" => implode(":", $O5599874228007848556)];
} else {
$O5599874228007848556 = [];
}
$this->generateLevel($O3599798456741367439, $O1719463550011029788, $O7368252357325108075, $O5599874228007848556);
}
}
if ($this->getDefaultLevel() === null) {
$O3119723109399633552 = $this->getConfigString("level-name", "world");
if (trim($O3119723109399633552) == '') {
$this->getLogger()->warning("level-name cannot be null, using default");
$O3119723109399633552 = "world";
$this->setConfigString("level-name", "world");
}
if ($this->loadLevel($O3119723109399633552) === false) {
$O1719463550011029788 = $this->getConfigString("level-seed", (string) time());
if (!is_numeric($O1719463550011029788) or bccomp($O1719463550011029788, "9223372036854775807") > 0) {
$O1719463550011029788 = Utils::javaStringHash($O1719463550011029788);
} else {
$O1719463550011029788 = (int) $O1719463550011029788;
}
$this->generateLevel($O3119723109399633552, $O1719463550011029788 === 0 ? time() : $O1719463550011029788);
}
$this->setDefaultLevel($this->getLevelByName($O3119723109399633552));
}
if ($this->properties->hasChanged()) {
$this->properties->save();
}
if (!$this->getDefaultLevel() instanceof Level) {
$this->getLogger()->emergency($this->getLanguage()->translateString("pocketmine.level.defaultError"));
$this->forceShutdown();
return;
}
if ($this->netherEnabled) {
if (!$this->loadLevel($this->netherName)) {
$O1835061701061048219 = Generator::getGenerator("nether");
$this->generateLevel($this->netherName, time(), $O1835061701061048219);
}
$this->netherLevel = $this->getLevelByName($this->netherName);
}
if ($this->enderEnabled) {
if (!$this->loadLevel($this->enderName)) {
$this->generateLevel($this->enderName, time(), Generator::getGenerator("ender"));
}
$this->enderLevel = $this->getLevelByName($this->enderName);
}
if ($this->getProperty("ticks-per.autosave", 6000) > 0) {
$this->autoSaveTicks = (int) $this->getProperty("ticks-per.autosave", 6000);
}
$this->enablePlugins(PluginLoadOrder::POSTWORLD);
if ($this->dserverConfig["enable"] and $this->getAdvancedProperty("dserver.server-list", '') != '') {
$this->scheduler->scheduleRepeatingTask(new CallbackTask([$this, "updateDServerInfo"]), $this->dserverConfig["timer"]);
}
if ($O9067335590721393753 > $O2398238170279201564) {
$this->logger->notice("Your aquamarine.yml needs update");
$this->logger->notice("Current Version: {$O2398238170279201564} Latest Version: {$O9067335590721393753}");
}
$this->start();
} catch (\Throwable $O7980738059105788111) {
$this->exceptionHandler($O7980738059105788111);
}
}
public function registerCommandList()
{
$this->commandList = new Config($this->dataPath . "commands-list.yml", Config::YAML);
foreach ($this->getCommandMap()->getCommands() as $O3932855126531729106) {
if ($this->commandList->exists($O3932855126531729106->getName())) {
if ($this->commandList->get($O3932855126531729106->getName()) == false and $O3932855126531729106 instanceof Command) {
$this->getCommandMap()->unregister($O3932855126531729106);
}
} else {
$this->commandList->set($O3932855126531729106->getName(), true);
}
}
$this->commandList->save();
}
public function broadcastMessage($O2651614731792133437, $O6058751670045019838 = null) : int
{
if (!is_array($O6058751670045019838)) {
return $this->broadcast($O2651614731792133437, self::BROADCAST_CHANNEL_USERS);
}
foreach ($O6058751670045019838 as $O3187189378384733655) {
$O3187189378384733655->sendMessage($O2651614731792133437);
}
return count($O6058751670045019838);
}
public function broadcastTip(string $O9152597786137927993, $O6058751670045019838 = null) : int
{
if (!is_array($O6058751670045019838)) {
$O6058751670045019838 = [];
foreach ($this->pluginManager->getPermissionSubscriptions(self::BROADCAST_CHANNEL_USERS) as $O1307553872555114622) {
if ($O1307553872555114622 instanceof Player and $O1307553872555114622->hasPermission(self::BROADCAST_CHANNEL_USERS)) {
$O6058751670045019838[spl_object_hash($O1307553872555114622)] = $O1307553872555114622;
}
}
}
foreach ($O6058751670045019838 as $O3187189378384733655) {
$O3187189378384733655->sendTip($O9152597786137927993);
}
return count($O6058751670045019838);
}
public function broadcastPopup(string $O5736632541713175233, $O6058751670045019838 = null) : int
{
if (!is_array($O6058751670045019838)) {
$O6058751670045019838 = [];
foreach ($this->pluginManager->getPermissionSubscriptions(self::BROADCAST_CHANNEL_USERS) as $O1307553872555114622) {
if ($O1307553872555114622 instanceof Player and $O1307553872555114622->hasPermission(self::BROADCAST_CHANNEL_USERS)) {
$O6058751670045019838[spl_object_hash($O1307553872555114622)] = $O1307553872555114622;
}
}
}
foreach ($O6058751670045019838 as $O3187189378384733655) {
$O3187189378384733655->sendPopup($O5736632541713175233);
}
return count($O6058751670045019838);
}
public function broadcastTitle(string $O7339720733369221285, string $O7157498233636939317 = '', int $O4335603103026281922 = -1, int $O5193828833010661772 = -1, int $O2349772501025980444 = -1, $O6058751670045019838 = null)
{
if (!is_array($O6058751670045019838)) {
$O6058751670045019838 = [];
foreach ($this->pluginManager->getPermissionSubscriptions(self::BROADCAST_CHANNEL_USERS) as $O1307553872555114622) {
if ($O1307553872555114622 instanceof Player and $O1307553872555114622->hasPermission(self::BROADCAST_CHANNEL_USERS)) {
$O6058751670045019838[spl_object_hash($O1307553872555114622)] = $O1307553872555114622;
}
}
}
foreach ($O6058751670045019838 as $O3187189378384733655) {
$O3187189378384733655->addTitle($O7339720733369221285, $O7157498233636939317, $O4335603103026281922, $O5193828833010661772, $O2349772501025980444);
}
return count($O6058751670045019838);
}
public function broadcast($O2651614731792133437, string $O8793625458927515093) : int
{
$O6058751670045019838 = [];
foreach (explode(";", $O8793625458927515093) as $O2926893935619852763) {
foreach ($this->pluginManager->getPermissionSubscriptions($O2926893935619852763) as $O1307553872555114622) {
if ($O1307553872555114622 instanceof CommandSender and $O1307553872555114622->hasPermission($O2926893935619852763)) {
$O6058751670045019838[spl_object_hash($O1307553872555114622)] = $O1307553872555114622;
}
}
}
foreach ($O6058751670045019838 as $O3187189378384733655) {
$O3187189378384733655->sendMessage($O2651614731792133437);
}
return count($O6058751670045019838);
}
public function broadcastPacket(array $O7417318090430815732, DataPacket $O0518343382251093595)
{
$O0518343382251093595->encode();
$O0518343382251093595->isEncoded = true;
$this->batchPackets($O7417318090430815732, [$O0518343382251093595], false);
}
public function batchPackets(array $O7417318090430815732, array $O5320105429236813250, bool $O8248209920012605993 = false, bool $O9143209426050768354 = false)
{
if (count($O5320105429236813250) === 0) {
throw new \InvalidArgumentException("Cannot send empty batch");
}
Timings::$playerNetworkTimer->startTiming();
$O0361909413468483332 = array_filter($O7417318090430815732, function (Player $O6725082928939594459) : bool {
return $O6725082928939594459->isConnected();
});
if (count($O0361909413468483332) > 0) {
$O1293085103679494298 = new BatchPacket();
foreach ($O5320105429236813250 as $O5540795382017578046) {
$O1293085103679494298->addPacket($O5540795382017578046);
}
if (Network::$BATCH_THRESHOLD >= 0 and strlen($O1293085103679494298->payload) >= Network::$BATCH_THRESHOLD) {
$O1293085103679494298->setCompressionLevel($this->networkCompressionLevel);
} else {
$O1293085103679494298->setCompressionLevel(0);
$O8248209920012605993 = true;
}
if (!$O8248209920012605993 and !$O9143209426050768354 and $this->networkCompressionAsync) {
$O5198515499496837902 = new CompressBatchedTask($O1293085103679494298, $O0361909413468483332);
$this->getScheduler()->scheduleAsyncTask($O5198515499496837902);
} else {
$this->broadcastPacketsCallback($O1293085103679494298, $O0361909413468483332, $O9143209426050768354);
}
}
Timings::$playerNetworkTimer->stopTiming();
}
public function broadcastPacketsCallback(BatchPacket $O1293085103679494298, array $O7417318090430815732, bool $O9143209426050768354 = false)
{
if (!$O1293085103679494298->isEncoded) {
$O1293085103679494298->encode();
$O1293085103679494298->isEncoded = true;
}
foreach ($O7417318090430815732 as $O8236179980604662852) {
$O8236179980604662852->dataPacket($O1293085103679494298, false, $O9143209426050768354);
}
}
public function enablePlugins(int $O5537423987799744568)
{
foreach ($this->pluginManager->getPlugins() as $O8326391417475207927) {
if (!$O8326391417475207927->isEnabled() and $O8326391417475207927->getDescription()->getOrder() === $O5537423987799744568) {
$this->enablePlugin($O8326391417475207927);
}
}
if ($O5537423987799744568 === PluginLoadOrder::POSTWORLD) {
$this->commandMap->registerServerAliases();
DefaultPermissions::registerCorePermissions();
}
}
public function enablePlugin(Plugin $O8326391417475207927)
{
$this->pluginManager->enablePlugin($O8326391417475207927);
}
public function disablePlugins()
{
$this->pluginManager->disablePlugins();
}
public function checkConsole()
{
Timings::$serverCommandTimer->startTiming();
while (($O5209094978073612910 = $this->console->getLine()) !== null) {
$this->pluginManager->callEvent($O2430761032146710945 = new ServerCommandEvent($this->consoleSender, $O5209094978073612910));
if (!$O2430761032146710945->isCancelled()) {
$this->dispatchCommand($O2430761032146710945->getSender(), $O2430761032146710945->getCommand());
}
}
Timings::$serverCommandTimer->stopTiming();
}
public function dispatchCommand(CommandSender $O6321398628944314396, $O0572746342080630700)
{
if ($this->commandMap->dispatch($O6321398628944314396, $O0572746342080630700)) {
return true;
}
$O6321398628944314396->sendMessage(new TranslationContainer(TextFormat::GOLD . "%commands.generic.notFound"));
return false;
}
public function reload()
{
$this->logger->info("Saving worlds...");
foreach ($this->levels as $O8990405184547542856) {
$O8990405184547542856->save();
}
$this->pluginManager->disablePlugins();
$this->pluginManager->clearPlugins();
$this->commandMap->clearCommands();
$this->logger->info("Reloading properties...");
$this->properties->reload();
$this->advancedConfig->reload();
$this->loadAdvancedConfig();
$this->maxPlayers = $this->getConfigInt("max-players", 20);
if ($this->getConfigBoolean("hardcore", false) and $this->getDifficulty() < 3) {
$this->setConfigInt("difficulty", 3);
}
$this->banByIP->load();
$this->banByName->load();
$this->banByCID->load();
$this->reloadWhitelist();
$this->operators->reload();
$this->memoryManager->doObjectCleanup();
foreach ($this->getIPBans()->getEntries() as $O4491726257011425663) {
$this->getNetwork()->blockAddress($O4491726257011425663->getName(), -1);
}
$this->pluginManager->registerInterface(PharPluginLoader::class);
if ($this->folderpluginloader) {
$this->pluginManager->registerInterface(FolderPluginLoader::class);
}
$this->pluginManager->registerInterface(ScriptPluginLoader::class);
$this->pluginManager->loadPlugins($this->pluginPath);
$this->enablePlugins(PluginLoadOrder::STARTUP);
$this->enablePlugins(PluginLoadOrder::POSTWORLD);
TimingsHandler::reload();
}
public function shutdown(bool $O2838180798115608312 = false, string $O8475682493986910469 = '')
{
$this->isRunning = false;
if ($O8475682493986910469 != '') {
$this->propertyCache["settings.shutdown-message"] = $O8475682493986910469;
}
}
public function forceShutdown()
{
if ($this->hasStopped) {
return;
}
if ($this->doTitleTick) {
echo "\x1b]0;\x07";
}
try {
$this->hasStopped = true;
$this->shutdown();
if ($this->rcon instanceof RCON) {
$this->rcon->stop();
}
if ($this->getProperty("network.upnp-forwarding", false)) {
$this->logger->info("[UPnP] Removing port forward...");
UPnP::RemovePortForward($this->getPort());
}
if ($this->pluginManager instanceof PluginManager) {
$this->getLogger()->debug("Disabling all plugins");
$this->pluginManager->disablePlugins();
}
foreach ($this->players as $O6725082928939594459) {
$O6725082928939594459->close($O6725082928939594459->getLeaveMessage(), $this->getProperty("settings.shutdown-message", "Server closed"));
}
$this->getLogger()->debug("Unloading all worlds");
foreach ($this->getLevels() as $O8990405184547542856) {
$this->unloadLevel($O8990405184547542856, true);
}
$this->getLogger()->debug("Removing event handlers");
HandlerList::unregisterAll();
if ($this->scheduler instanceof ServerScheduler) {
$this->getLogger()->debug("Shutting down task scheduler");
}
if ($this->properties !== null and $this->properties->hasChanged()) {
$this->getLogger()->debug("Saving properties");
$this->properties->save();
}
if ($this->console instanceof CommandReader) {
$this->getLogger()->debug("Closing console");
$this->console->shutdown();
$this->console->notify();
}
if ($this->network instanceof Network) {
$this->getLogger()->debug("Stopping network interfaces");
foreach ($this->network->getInterfaces() as $O0102162491117335893) {
$this->getLogger()->debug("Stopping network interface " . get_class($O0102162491117335893));
$O0102162491117335893->shutdown();
$this->network->unregisterInterface($O0102162491117335893);
}
}
} catch (\Throwable $O7980738059105788111) {
goto O6286694412866559630;
O6286694412866559630:
$this->logger->logException($O7980738059105788111);
goto O4202869528322520230;
O4202869528322520230:
$this->logger->emergency("Crashed while crashing, killing process");
goto O6349227527028122342;
O6349227527028122342:
@Utils::kill(getmypid());
goto O7396620252407377150;
O7396620252407377150:
}
}
public function getQueryInformation()
{
return $this->queryRegenerateTask;
}
public function getConsole() : CommandReader
{
return $this->console;
}
public function start()
{
if ($this->getConfigBoolean("enable-query", true)) {
$this->queryHandler = new QueryHandler();
}
foreach ($this->getIPBans()->getEntries() as $O4491726257011425663) {
$this->network->blockAddress($O4491726257011425663->getName(), -1);
}
if ($this->getProperty("network.upnp-forwarding", false)) {
$this->logger->info("[UPnP] Trying to port forward...");
try {
UPnP::PortForward($this->getPort());
} catch (\Exception $O7980738059105788111) {
$this->logger->alert("UPnP portforward failed: " . $O7980738059105788111->getMessage());
}
}
$this->tickCounter = 0;
if (function_exists("pcntl_signal")) {
pcntl_signal(SIGTERM, [$this, "handleSignal"]);
pcntl_signal(SIGINT, [$this, "handleSignal"]);
pcntl_signal(SIGHUP, [$this, "handleSignal"]);
$this->dispatchSignals = true;
}
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.defaultGameMode", [self::getGamemodeString($this->getGamemode())]));
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.startFinished", [round(microtime(true) - \pocketmine\START_TIME, 3)]));
$this->tickProcessor();
$this->forceShutdown();
}
public function handleSignal($O5600339835366169926)
{
if ($O5600339835366169926 === SIGTERM or $O5600339835366169926 === SIGINT or $O5600339835366169926 === SIGHUP) {
$this->shutdown();
}
}
public function exceptionHandler(\Throwable $O7980738059105788111, $O0810817185273565676 = null)
{
while (@ob_end_flush()) {
return false;
}
global $O7043481179961869137;
if ($O0810817185273565676 === null) {
$O0810817185273565676 = $O7980738059105788111->getTrace();
}
$O3702396576067160224 = $O7980738059105788111->getMessage();
$O7177865700032277628 = $O7980738059105788111->getFile();
$O6176387794732754209 = $O7980738059105788111->getLine();
$O3702396576067160224 = preg_replace("/\\s+/", " ", trim($O3702396576067160224));
$O7177865700032277628 = Utils::cleanPath($O7177865700032277628);
if ($this->logger instanceof MainLogger) {
$this->logger->logException($O7980738059105788111, $O0810817185273565676);
}
$O7043481179961869137 = ["type" => get_class($O7980738059105788111), "message" => $O3702396576067160224, "fullFile" => $O7980738059105788111->getFile(), "file" => $O7177865700032277628, "line" => $O6176387794732754209, "trace" => $O0810817185273565676];
global $O4904279002443295767, $O7043481179961869137;
$O4904279002443295767 = $O7043481179961869137;
$this->crashDump();
}
public function crashDump()
{
while (@ob_end_flush()) {
return false;
}
if (!$this->isRunning) {
return;
}
$this->hasStopped = false;
ini_set("error_reporting", "0");
ini_set("memory_limit", "-1");
try {
$this->logger->emergency($this->getLanguage()->translateString("pocketmine.crash.create"));
$O9023761933076551717 = new CrashDump($this);
$this->logger->emergency($this->getLanguage()->translateString("pocketmine.crash.submit", [$O9023761933076551717->getPath()]));
if ($this->getProperty("auto-report.enabled", false) !== false) {
$O5301756661986993479 = true;
$O7511836798682526713 = $this->getDataPath() . "crashdumps/.last_crash";
$O9614267321886332545 = 120;
if (file_exists($O7511836798682526713) and !($O5301756661986993479 = filemtime($O7511836798682526713) + $O9614267321886332545 < time())) {
$this->logger->debug("Not sending crashdump due to last crash less than {$O9614267321886332545} seconds ago");
}
@touch($O7511836798682526713);
$O8326391417475207927 = $O9023761933076551717->getData()["plugin"];
if (is_string($O8326391417475207927)) {
$O5540795382017578046 = $this->pluginManager->getPlugin($O8326391417475207927);
if ($O5540795382017578046 instanceof Plugin and !$O5540795382017578046->getPluginLoader() instanceof PharPluginLoader) {
$this->logger->debug("Not sending crashdump due to caused by non-phar plugin");
$O5301756661986993479 = false;
}
}
if ($O9023761933076551717->getData()["error"]["type"] === \ParseError::class) {
$O5301756661986993479 = false;
}
if ($O5301756661986993479) {
$O6375846755245683904 = Internet::postURL("http://" . $this->getProperty("auto-report.host", "crash.pmmp.io") . "/submit/api", ["report" => "yes", "name" => $this->getName() . " " . $this->getPocketMineVersion(), "email" => "[email protected]", "reportPaste" => base64_encode($O9023761933076551717->getEncodedData())]);
if ($O6375846755245683904 !== false and ($O7207147385807490826 = json_decode($O6375846755245683904)) !== null and isset($O7207147385807490826->crashId) and isset($O7207147385807490826->crashUrl)) {
$O6130897079959903828 = $O7207147385807490826->crashId;
$O8890866629166657542 = $O7207147385807490826->crashUrl;
$this->logger->emergency($this->getLanguage()->translateString("pocketmine.crash.archive", [$O8890866629166657542, $O6130897079959903828]));
}
}
}
} catch (\Throwable $O7980738059105788111) {
$this->logger->logException($O7980738059105788111);
try {
$this->logger->critical($this->getLanguage()->translateString("pocketmine.crash.error", [$O7980738059105788111->getMessage()]));
} catch (\Throwable $O7980738059105788111) {
}
}
$this->forceShutdown();
$this->isRunning = false;
$O6575653030171960827 = (int) \pocketmine\START_TIME - time() + 120;
if ($O6575653030171960827 > 0) {
echo "--- Waiting {$O6575653030171960827} seconds to throttle automatic restart (you can kill the process safely now) ---" . PHP_EOL;
sleep($O6575653030171960827);
}
@Utils::kill(getmypid());
exit(1);
}
public function __debugInfo()
{
return [];
}
public function getTickSleeper() : SleeperHandler
{
return $this->tickSleeper;
}
private function tickProcessor()
{
$this->nextTick = microtime(true);
while ($this->isRunning) {
$this->tick();
$this->tickSleeper->sleepUntil($this->nextTick);
}
}
public function onPlayerLogin(Player $O6725082928939594459)
{
$this->sendFullPlayerListData($O6725082928939594459);
$O6725082928939594459->dataPacket($this->craftingManager->getCraftingDataPacket());
}
public function addPlayer(Player $O6725082928939594459)
{
$this->players[spl_object_hash($O6725082928939594459)] = $O6725082928939594459;
}
public function addOnlinePlayer(Player $O6725082928939594459)
{
$this->updatePlayerListData($O6725082928939594459->getUniqueId(), $O6725082928939594459->getId(), $O6725082928939594459->getDisplayName(), $O6725082928939594459->getSkinId(), $O6725082928939594459->getSkinData());
$this->playerList[$O6725082928939594459->getRawUniqueId()] = $O6725082928939594459;
}
public function removeOnlinePlayer(Player $O6725082928939594459)
{
if (isset($this->playerList[$O6725082928939594459->getRawUniqueId()])) {
unset($this->playerList[$O6725082928939594459->getRawUniqueId()]);
$this->removePlayerListData($O6725082928939594459->getUniqueId());
}
}
public function updatePlayerListData(UUID $O9479455264228622327, $O5840641995929062196, $O3599798456741367439, $O9064082743205090873, $O9983101786974651923, array $O7417318090430815732 = null)
{
$O1293085103679494298 = new PlayerListPacket();
$O1293085103679494298->type = PlayerListPacket::TYPE_ADD;
$O1293085103679494298->entries[] = [$O9479455264228622327, $O5840641995929062196, $O3599798456741367439, $O9064082743205090873, $O9983101786974651923];
$this->broadcastPacket($O7417318090430815732 ?? $this->playerList, $O1293085103679494298);
}
public function removePlayerListData(UUID $O9479455264228622327, array $O7417318090430815732 = null)
{
$O1293085103679494298 = new PlayerListPacket();
$O1293085103679494298->type = PlayerListPacket::TYPE_REMOVE;
$O1293085103679494298->entries[] = [$O9479455264228622327];
$this->broadcastPacket($O7417318090430815732 ?? $this->playerList, $O1293085103679494298);
}
public function sendFullPlayerListData(Player $O5540795382017578046)
{
$O1293085103679494298 = new PlayerListPacket();
$O1293085103679494298->type = PlayerListPacket::TYPE_ADD;
foreach ($this->playerList as $O6725082928939594459) {
$O1293085103679494298->entries[] = [$O6725082928939594459->getUniqueId(), $O6725082928939594459->getId(), $O6725082928939594459->getDisplayName(), $O6725082928939594459->getSkinId(), $O6725082928939594459->getSkinData()];
}
$O5540795382017578046->dataPacket($O1293085103679494298);
}
private function checkTickUpdates(int $O9825197035600597054, float $O0239288790116538602) : void
{
foreach ($this->players as $O5540795382017578046) {
if (!$O5540795382017578046->loggedIn and $O0239288790116538602 - $O5540795382017578046->creationTime >= 10) {
break;
}
}
foreach ($this->levels as $O2541340675156494755 => $O8990405184547542856) {
if (isset($this->levels[$O2541340675156494755])) {
$O3233472987137984512 = microtime(true);
$O8990405184547542856->doTick($O9825197035600597054);
$O8834206231165061335 = (microtime(true) - $O3233472987137984512) * 1000;
$O8990405184547542856->tickRateTime = $O8834206231165061335;
if ($O8834206231165061335 >= 50) {
$this->getLogger()->debug(sprintf("World \"%s\" took too long to tick: %gms (%g ticks)", $O8990405184547542856->getName(), $O8834206231165061335, round($O8834206231165061335 / 50, 2)));
}
} else {
}
}
}
public function doAutoSave()
{
if ($this->getAutoSave()) {
Timings::$worldSaveTimer->startTiming();
foreach ($this->players as $O4220208707720250477 => $O6725082928939594459) {
if ($O6725082928939594459->spawned) {
$O6725082928939594459->save();
} else {
if (!$O6725082928939594459->isConnected()) {
$this->removePlayer($O6725082928939594459);
} else {
}
}
}
foreach ($this->getLevels() as $O8990405184547542856) {
$O8990405184547542856->save(false);
}
Timings::$worldSaveTimer->stopTiming();
}
}
public function getLanguage()
{
return $this->baseLang;
}
public function isLanguageForced()
{
return $this->forceLanguage;
}
public function getNetwork()
{
return $this->network;
}
public function getMemoryManager()
{
return $this->memoryManager;
}
private function titleTick()
{
Timings::$titleTickTimer->startTiming();
$O2714783454708150733 = Utils::getRealMemoryUsage();
$O8917638466863729771 = Utils::getMemoryUsage(true);
$O5621682895757580000 = round($O8917638466863729771[0] / 1024 / 1024, 2) . "/" . round($O2714783454708150733[0] / 1024 / 1024, 2) . "/" . round($O8917638466863729771[1] / 1024 / 1024, 2) . "/" . round($O8917638466863729771[2] / 1024 / 1024, 2) . " MB @ " . Utils::getThreadCount() . " threads";
echo "\x1b]0;" . "{$this->getName()} {$this->getPocketMineVersion()}" . " | Online " . count($this->players) . "/" . $this->getMaxPlayers() . " | Memory " . $O5621682895757580000 . " | U " . round($this->network->getUpload() / 1024, 2) . " D " . round($this->network->getDownload() / 1024, 2) . " kB/s | TPS " . $this->getTicksPerSecondAverage() . " | Load " . $this->getTickUsageAverage() . "%\x07";
Timings::$titleTickTimer->stopTiming();
}
public function handlePacket(AdvancedSourceInterface $O0102162491117335893, string $O7820356987601609224, int $O4436036954571352316, string $O8138706858251949800)
{
Timings::$serverRawPacketTimer->startTiming();
try {
if (strlen($O8138706858251949800) > 2 and substr($O8138706858251949800, 0, 2) === "\xfe\xfd" and $this->queryHandler instanceof QueryHandler) {
$this->queryHandler->handle($O0102162491117335893, $O7820356987601609224, $O4436036954571352316, $O8138706858251949800);
} else {
$this->logger->debug("Unhandled raw packet from {$O7820356987601609224} {$O4436036954571352316}: " . base64_encode($O8138706858251949800));
}
} catch (\Throwable $O7980738059105788111) {
goto O6374449801597961997;
O1360678956224640724:
$this->logger->logException($O7980738059105788111);
goto O5257831522231554232;
O8846562813754608339:
$this->getNetwork()->blockAddress($O7820356987601609224, 600);
goto O4490020366102322141;
O6374449801597961997:
if (!$this->logger instanceof MainLogger) {
goto O9271029077843853246;
}
goto O1360678956224640724;
O5257831522231554232:
O9271029077843853246:
goto O8846562813754608339;
O4490020366102322141:
}
Timings::$serverRawPacketTimer->stopTiming();
}
public function getAdvancedProperty($O0719866863345062028, $O0630247780966342016 = null, Config $O5437694507309102301 = null)
{
$O4984916631066431911 = explode(".", $O0719866863345062028);
$O3954858738755071917 = array_shift($O4984916631066431911);
if ($O5437694507309102301 === null) {
$O5437694507309102301 = $this->advancedConfig;
}
if ($O5437694507309102301->exists($O3954858738755071917)) {
$O3954858738755071917 = $O5437694507309102301->get($O3954858738755071917);
} else {
return $O0630247780966342016;
}
while (count($O4984916631066431911) > 0) {
$O4471575772379216218 = array_shift($O4984916631066431911);
if (!(is_array($O3954858738755071917) and isset($O3954858738755071917[$O4471575772379216218]))) {
return $O0630247780966342016;
}
$O3954858738755071917 = $O3954858738755071917[$O4471575772379216218];
}
return $O3954858738755071917;
}
public function updateQuery()
{
$this->getPluginManager()->callEvent($this->queryRegenerateTask = new QueryRegenerateEvent($this));
}
private function tick() : void
{
$O0239288790116538602 = microtime(true);
if ($O0239288790116538602 - $this->nextTick < -0.025) {
return;
}
Timings::$serverTickTimer->startTiming();
++$this->tickCounter;
Timings::$connectionTimer->startTiming();
$this->network->processInterfaces();
Timings::$connectionTimer->stopTiming();
Timings::$schedulerTimer->startTiming();
$this->scheduler->mainThreadHeartbeat($this->tickCounter);
Timings::$schedulerTimer->stopTiming();
$this->checkTickUpdates($this->tickCounter, $O0239288790116538602);
foreach ($this->players as $O6725082928939594459) {
$O6725082928939594459->checkNetwork();
}
if ($this->tickCounter % 20 === 0) {
if ($this->doTitleTick) {
$this->titleTick();
}
$this->currentTPS = 20;
$this->currentUse = 0;
Timings::$queryUpdate->startTiming();
if ($this->dserverConfig["enable"] and $this->dserverConfig["queryTickUpdate"] or !$this->dserverConfig["enable"]) {
$this->updateQuery();
}
Timings::$queryUpdate->stopTiming();
$this->network->updateName();
$this->network->resetStatistics();
if ($this->dserverConfig["enable"] and $this->dserverConfig["motdPlayers"]) {
$O6146190800143785266 = $this->getDServerMaxPlayers();
$O4664132069359142763 = $this->getDServerOnlinePlayers();
$O3599798456741367439 = $this->getNetwork()->getName() . "[" . $O4664132069359142763 . "/" . $O6146190800143785266 . "]";
$this->getNetwork()->setName($O3599798456741367439);
}
}
if ($this->autoSave and ++$this->autoSaveTicker >= $this->autoSaveTicks) {
$this->autoSaveTicker = 0;
$this->getLogger()->debug("[Auto Save] Saving worlds...");
$O8299473063796305940 = microtime(true);
$this->doAutoSave();
$O2443194464429585319 = microtime(true) - $O8299473063796305940;
$this->getLogger()->debug("[Auto Save] Save completed in " . ($O2443194464429585319 >= 1 ? round($O2443194464429585319, 3) . "s" : round($O2443194464429585319 * 1000) . "ms"));
}
if ($this->tickCounter % 100 === 0) {
foreach ($this->levels as $O8990405184547542856) {
$O8990405184547542856->clearCache();
}
if ($this->getTicksPerSecondAverage() < 12) {
$this->logger->warning($this->getLanguage()->translateString("pocketmine.server.tickOverload"));
}
}
if ($this->dispatchSignals and $this->tickCounter % 5 === 0) {
pcntl_signal_dispatch();
}
$this->getMemoryManager()->check();
Timings::$serverTickTimer->stopTiming();
$O6926432596287446903 = microtime(true);
$this->currentTPS = min(20, 1 / max(0.001, $O6926432596287446903 - $O0239288790116538602));
$this->currentUse = min(1, ($O6926432596287446903 - $O0239288790116538602) / 0.05);
$O3384600925806886338 = $this->tickCounter % 20;
$this->tickAverage[$O3384600925806886338] = $this->currentTPS;
$this->useAverage[$O3384600925806886338] = $this->currentUse;
if ($this->nextTick - $O0239288790116538602 < -1) {
$this->nextTick = $O0239288790116538602;
} else {
$this->nextTick += 0.05;
}
}
}
Function Calls
None |
Stats
MD5 | 8178ccc4eb0fe827cecb7ba29e9902fa |
Eval Count | 0 |
Decode Time | 278 ms |