mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Ticks per Second info
This commit is contained in:
@ -31,6 +31,7 @@ class ConsoleAPI{
|
||||
$this->help = array();
|
||||
$this->server = $server;
|
||||
$this->input = fopen(FILE_PATH."console.in", "w+b");
|
||||
$this->last = microtime(true);
|
||||
}
|
||||
|
||||
public function init(){
|
||||
@ -44,6 +45,11 @@ class ConsoleAPI{
|
||||
|
||||
public function defaultCommands($cmd, $params){
|
||||
switch($cmd){
|
||||
case "status":
|
||||
case "lag":
|
||||
$info = $this->server->debugInfo();
|
||||
console("[INFO] TPS: ".$info["tps"].", Memory usage: ".$info["memory_usage"]." (Peak ".$info["memory_peak_usage"].")");
|
||||
break;
|
||||
case "update-done":
|
||||
$this->server->api->setProperty("last-update", time());
|
||||
break;
|
||||
@ -175,6 +181,7 @@ class ConsoleAPI{
|
||||
case "help":
|
||||
case "?":
|
||||
console("[INFO] /help: Show available commands");
|
||||
console("[INFO] /status: Show server TPS and memory usage");
|
||||
console("[INFO] /gamemode: Changes default gamemode");
|
||||
console("[INFO] /difficulty: Changes difficulty");
|
||||
console("[INFO] /say: Broadcasts mesages");
|
||||
@ -197,7 +204,7 @@ class ConsoleAPI{
|
||||
$this->help[strtolower(trim($cmd))] = array($help, $callback);
|
||||
}
|
||||
|
||||
public function handle(){
|
||||
public function handle($time){
|
||||
while(($line = fgets($this->input)) !== false){
|
||||
$line = trim($line);
|
||||
if($line === ""){
|
||||
|
@ -66,7 +66,7 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run
|
||||
console("[NOTICE] Pocket-PHP-Minecraft has been updated at ".date("Y-m-d H:i:s", $last));
|
||||
console("[NOTICE] If you want to update, get the latest version at https://github.com/shoghicp/Pocket-Minecraft-PHP/archive/master.zip");
|
||||
console("[NOTICE] This message will dissapear when you issue the command \"/update-done\"");
|
||||
sleep(5);
|
||||
sleep(3);
|
||||
}else{
|
||||
$last = time();
|
||||
$this->setProperty("last-update", $last);
|
||||
|
Reference in New Issue
Block a user