mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Added tps into query
This commit is contained in:
parent
d18d30920f
commit
44d992dc45
2 changed files with 6 additions and 1 deletions
|
|
@ -113,7 +113,11 @@ class PocketMinecraftServer{
|
|||
*/
|
||||
public function getTPS(){
|
||||
$v = array_values($this->tickMeasure);
|
||||
$tps = 40 / ($v[39] - $v[0]);
|
||||
$divval = ($v[39] - $v[0]);
|
||||
if($divval === 0){
|
||||
return 0;
|
||||
}
|
||||
$tps = 40 / $divval;
|
||||
return round($tps, 4);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ class QueryHandler{
|
|||
"whitelist" => $this->server->api->getProperty("white-list") === true ? "on":"off",
|
||||
"hostport" => $this->server->api->getProperty("server-port"),
|
||||
//"hostip" => $this->server->api->getProperty("server-ip", "0.0.0.0")
|
||||
"tps" => $this->server->debugInfo()["tps"],
|
||||
);
|
||||
foreach($KVdata as $key => $value){
|
||||
$str .= $key."\x00".$value."\x00";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue