mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
support php8019 and some cleanup (by @D-aHTuCT)
This commit is contained in:
parent
cf0f9df267
commit
b60f0877e1
376 changed files with 6528 additions and 13472 deletions
|
|
@ -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{
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue