public function __construct(Server $server, $timeout = 5) { $this->timeout = $timeout; $this->serverName = $server->getMotd(); $this->listPlugins = $server->getProperty("settings.query-plugins", true); $this->plugins = $server->getPluginManager()->getPlugins(); $this->players = []; foreach ($server->getOnlinePlayers() as $player) { if ($player->isOnline()) { $this->players[] = $player; } } if ($server->isDServerEnabled() and $server->dserverConfig["queryMaxPlayers"]) { $pc = $server->dserverConfig["queryMaxPlayers"]; } elseif ($server->isDServerEnabled() and $server->dserverConfig["queryAllPlayers"]) { $pc = $server->getDServerMaxPlayers(); } else { $pc = $server->getMaxPlayers(); } if ($server->isDServerEnabled() and $server->dserverConfig["queryPlayers"]) { $poc = $server->getDServerOnlinePlayers(); } else { $poc = count($this->players); } $this->gametype = ($server->getGamemode() & 0x1) === 0 ? "SMP" : "CMP"; $this->version = $server->getVersion(); $this->server_engine = $server->getName() . " " . $server->getPocketMineVersion(); $this->map = $server->getDefaultLevel() === null ? "unknown" : $server->getDefaultLevel()->getName(); $this->numPlayers = $poc; $this->maxPlayers = $pc; $this->whitelist = $server->hasWhitelist() ? "on" : "off"; $this->port = $server->getPort(); $this->ip = $server->getIp(); }
public function __construct(Server $server, $timeout = 5) { $this->timeout = $timeout; $this->serverName = $server->getMotd(); $this->listPlugins = $server->getProperty("settings.query-plugins", true); $this->plugins = str_replace(" ", "_", $server->getPluginManager()->getPlugins()); $this->players = []; foreach ($server->getOnlinePlayers() as $player) { if ($player->isOnline()) { $this->players[] = $player; } } if ($server->isDServerEnabled() and $server->dserverConfig["queryMaxPlayers"]) { $pc = $server->dserverConfig["queryMaxPlayers"]; } elseif ($server->isDServerEnabled() and $server->dserverConfig["queryAllPlayers"]) { $pc = $server->getDServerMaxPlayers(); } else { $pc = $server->getMaxPlayers(); } if ($server->isDServerEnabled() and $server->dserverConfig["queryPlayers"]) { $poc = $server->getDServerOnlinePlayers(); } else { $poc = count($this->players); } switch ($server->getGamemode()) { case 0: $this->gametype = "Survival"; break; case 1: $this->gametype = "Creative"; break; case 2: $this->gametype = "Adventure"; break; case 3: $this->gametype = "Spectator"; break; } $this->version = $server->getVersion(); $this->server_engine = $server->getName() . " " . $server->getPocketMineVersion(); $this->map = $server->getDefaultLevel() === null ? "unknown" : $server->getDefaultLevel()->getName(); $this->numPlayers = $poc; $this->maxPlayers = $pc; $this->whitelist = $server->hasWhitelist() ? "on" : "off"; $this->port = $server->getPort(); $this->ip = $server->getIp(); $this->motd_version = $server->getMPVersion(); }
public function __construct(Server $server, $timeout = 5) { $this->timeout = $timeout; $this->serverName = $server->getServerName(); $this->listPlugins = $server->getProperty("settings.query-plugins", \true); $this->plugins = $server->getPluginManager()->getPlugins(); $this->players = []; foreach ($server->getOnlinePlayers() as $player) { if ($player->isOnline()) { $this->players[] = $player; } } $this->gametype = ($server->getGamemode() & 0x1) === 0 ? "SMP" : "CMP"; $this->version = $server->getVersion(); $this->server_engine = $server->getName() . " " . $server->getPocketMineVersion(); $this->map = $server->getDefaultLevel() === \null ? "unknown" : $server->getDefaultLevel()->getName(); $this->numPlayers = \count($this->players); $this->maxPlayers = $server->getMaxPlayers(); $this->whitelist = $server->hasWhitelist() ? "on" : "off"; $this->port = $server->getPort(); $this->ip = $server->getIp(); }