QueryAPI.php(forgot to add)

This commit is contained in:
GameHerobrine 2022-07-23 02:33:11 +03:00
parent 34287bb101
commit 48903689dd

38
src/API/QueryAPI.php Normal file
View file

@ -0,0 +1,38 @@
<?php
class QueryAPI{
private $queryData;
public static $NOT_FOUND_VALUE;
private $server;
public function __construct(){
$this->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{}