very serious bug fixed(almost as important as readme.md update in roadrunner)

This commit is contained in:
GameHerobrine 2025-05-14 03:08:05 +03:00
parent fe07ec81ee
commit 87d2fbf884
2 changed files with 7 additions and 10 deletions

View file

@ -202,24 +202,21 @@ class ConsoleAPI{
"v" => VIEW, "v" => VIEW,
]; ];
if(!isset($params[0]) or !isset($gms[strtolower($params[0])])){ if(!isset($params[0]) or !isset($gms[strtolower($params[0])])){
$output .= "Usage: /$cmd <mode>\n"; return "Usage: /$cmd <mode>";
break;
} }
$this->server->api->setProperty("gamemode", $gms[strtolower($params[0])]); $this->server->api->setProperty("gamemode", $gms[strtolower($params[0])]);
$output .= "Default Gamemode is now " . strtoupper($this->server->getGamemode()) . ".\n"; $output .= "Default Gamemode is now " . strtoupper($this->server->getGamemode()) . ".\n";
break; break;
case "status": case "status":
if(!($issuer instanceof Player) and $issuer === "console"){ $info = $this->server->debugInfo();
$info = $this->server->debugInfo(true); if(!($issuer instanceof Player) && $issuer === "console"){
}else{ return "TPS: {$info["tps"]}, Memory usage: {$info["memory_usage"]} (Peak {$info["memory_peak_usage"]}), Entities: {$info["entities"]}, Events: {$info["events"]}, Handlers: {$info["handlers"]}, Actions: {$info["actions"]}, Garbage: {$info["garbage"]}";
$info = $this->server->debugInfo();
} }
return "TPS: " . $info["tps"] . ", Memory usage: " . $info["memory_usage"] . " (Peak " . $info["memory_peak_usage"] . ")"; return "TPS: {$info["tps"]}, Memory usage: {$info["memory_usage"]} (Peak {$info["memory_peak_usage"]})";
case "stop": case "stop":
self::$loop->stop = true; self::$loop->stop = true;
$output .= "Stopping the server\n";
$this->server->close(); $this->server->close();
break; return "Stopping the server\n";
case "difficulty": case "difficulty":
$s = trim(array_shift($params)); $s = trim(array_shift($params));
if($s === "" or (((int) $s) > 3 and ((int) $s) < 0)){ if($s === "" or (((int) $s) > 3 and ((int) $s) < 0)){

View file

@ -774,7 +774,7 @@ class PocketMinecraftServer{
$info["garbage"] = gc_collect_cycles(); $info["garbage"] = gc_collect_cycles();
$this->handle("server.debug", $info); $this->handle("server.debug", $info);
if($console === true){ if($console === true){
console("[INFO] TPS: " . $info["tps"] . ", Memory usage: " . $info["memory_usage"] . " (Peak " . $info["memory_peak_usage"] . "), Entities: " . $info["entities"] . ", Events: " . $info["events"] . ", Handlers: " . $info["handlers"] . ", Actions: " . $info["actions"] . ", Garbage: " . $info["garbage"], true, true); console("[INFO] TPS: {$info["tps"]}, Memory usage: {$info["memory_usage"]} (Peak {$info["memory_peak_usage"]}), Entities: {$info["entities"]}, Events: {$info["events"]}, Handlers: {$info["handlers"]}, Actions: {$info["actions"]}, Garbage: {$info["garbage"]}", true, true);
} }
return $info; return $info;
} }