support php8019 and some cleanup (by @D-aHTuCT)

This commit is contained in:
kotyara 2022-07-26 16:06:34 +05:00
parent cf0f9df267
commit b60f0877e1
376 changed files with 6528 additions and 13472 deletions

View file

@ -1,38 +1,42 @@
<?php
class QueryAPI{
private $queryData;
public static $NOT_FOUND_VALUE;
private $queryData;
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("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->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("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;
}
public function addToQuery($name){
$this->updateQueryData($name, QueryAPI::$NOT_FOUND_VALUE);
}
public function getQueryData(){
return $this->queryData;
}
}
class NFV{}
class NFV{
}