From 48903689ddfee9911066d6e49bda5f0f8318d14a Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Sat, 23 Jul 2022 02:33:11 +0300 Subject: [PATCH] QueryAPI.php(forgot to add) --- src/API/QueryAPI.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/API/QueryAPI.php diff --git a/src/API/QueryAPI.php b/src/API/QueryAPI.php new file mode 100644 index 00000000..ac367880 --- /dev/null +++ b/src/API/QueryAPI.php @@ -0,0 +1,38 @@ +server = ServerAPI::request(); + QueryAPI::$NOT_FOUND_VALUE = new NFV(); + $this->updateQueryData("splitnum", chr(128)); + $this->updateQueryData("hostname", $this->server->name); + $this->updateQueryData("gametype", ($this->server->gamemode & 0x01) === 0 ? "SMP":"CMP"); + $this->updateQueryData("game_id", "MINECRAFTPE"); + $this->updateQueryData("version", CURRENT_MINECRAFT_VERSION); + $this->updateQueryData("server_engine", "NostalgiaCore ".MAJOR_VERSION); + $this->addToQuery("plugins"); + $this->addToQuery("map"); + $this->addToQuery("numplayers"); + $this->updateQueryData("maxplayers", $this->server->maxClients); + $this->updateQueryData("whitelist", $this->server->api->getProperty("white-list") === true ? "on":"off"); + $this->updateQueryData("hostport", $this->server->api->getProperty("server-port")); + $this->addToQuery("tps"); + } + + public function getQueryData(){ + return $this->queryData; + } + + public function addToQuery($name){ + $this->updateQueryData($name, QueryAPI::$NOT_FOUND_VALUE); + } + + public function updateQueryData($name, $value){ + $this->queryData[$name] = $value; + } +} + +class NFV{} \ No newline at end of file