private function cmdListAll(CommandSender $c, $pageNumber) { $all = []; $dat = ["Players" => count($this->owner->getServer()->getOnlinePlayers()), "MaxPlayers" => $this->owner->getServer()->getMaxPlayers(), "List" => []]; foreach ($this->owner->getServer()->getOnlinePlayers() as $p) { $dat["List"][] = $p->getName(); } $totals = ["Players" => $dat["Players"], "MaxPlayers" => $dat["MaxPlayers"]]; $all[mc::_("**this-server**")] = $dat; foreach ($this->servers as $id => $ln) { $dat = preg_split('/\\s+/', $ln, 3); $host = array_shift($dat); $port = array_shift($dat); $Query = new MinecraftQuery(); try { $Query->Connect($host, $port, 1); } catch (MinecraftQueryException $e) { $this->owner->getLogger()->warning(mc::_("Query %1% failed: %2%", $host, $e->getMessage())); continue; } if (($info = $Query->GetInfo()) === false) { continue; } foreach (["Players", "MaxPlayers"] as $i) { if (isset($info[$i])) { $totals[$i] += $info[$i]; } } $all[$id] = ["Players" => $info["Players"], "MaxPlayers" => $info["MaxPlayers"], "List" => $Query->getPlayers()]; } $txt = [mc::_("Totals: %1%/%2%", $totals["Players"], $totals["MaxPlayers"])]; foreach ($all as $id => $dat) { $txt[] = TextFormat::YELLOW . mc::_("%1% (%2%/%3%):", $id, $dat["Players"], $dat["MaxPlayers"]); if (!is_array($dat["List"])) { continue; } $cols = 8; $i = 0; foreach ($dat["List"] as $n) { if ($i++ % $cols == 0) { $txt[] = $n; } else { $txt[count($txt) - 1] .= ", " . $n; } } } return $this->paginateText($c, $pageNumber, $txt); }
?> </tbody> </table> </div> <div class="col-sm-6"> <table class="table table-bordered table-striped"> <thead> <tr> <th> Players </th> </tr> </thead> <tbody> <?php if (($players = $query->getPlayers()) !== false) { foreach ($players as $player) { ?> <tr> <td> <?php echo htmlspecialchars($player); ?> </td> </tr> <?php } } else { ?> <tr> <td>