public function __construct(Server $server) { $this->server = $server; $this->identifiers = []; $this->rakLib = new RakLibServer($this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp()); $this->interface = new ServerHandler($this->rakLib, $this); for ($i = 0; $i < 256; ++$i) { $this->channelCounts[$i] = 0; } }
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->getBukkitPEVersion(); $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(); }