50 $server = $sender->getServer();
51 $sender->sendMessage(TextFormat::GREEN .
"---- " . TextFormat::RESET .
"Server status" . TextFormat::GREEN .
" ----");
53 $time = (int) (microtime(
true) - $server->getStartTime());
55 $seconds = $time % 60;
61 $minutes = floor(($time % 3600) / 60);
63 $hours = floor(($time % (3600 * 24)) / 3600);
64 if($time >= 3600 * 24){
65 $days = floor($time / (3600 * 24));
70 $uptime = ($minutes !==
null ?
74 :
"") .
"$hours hours "
75 :
"") .
"$minutes minutes "
76 :
"") .
"$seconds seconds";
78 $sender->sendMessage(TextFormat::GOLD .
"Uptime: " . TextFormat::RED . $uptime);
80 $tpsColor = TextFormat::GREEN;
81 if($server->getTicksPerSecond() < 12){
82 $tpsColor = TextFormat::RED;
83 }elseif($server->getTicksPerSecond() < 17){
84 $tpsColor = TextFormat::GOLD;
87 $sender->sendMessage(TextFormat::GOLD .
"Current TPS: {$tpsColor}{$server->getTicksPerSecond()} ({$server->getTickUsage()}%)");
88 $sender->sendMessage(TextFormat::GOLD .
"Average TPS: {$tpsColor}{$server->getTicksPerSecondAverage()} ({$server->getTickUsageAverage()}%)");
90 $bandwidth = $server->getNetwork()->getBandwidthTracker();
91 $sender->sendMessage(TextFormat::GOLD .
"Network upload: " . TextFormat::RED . round($bandwidth->getSend()->getAverageBytes() / 1024, 2) .
" kB/s");
92 $sender->sendMessage(TextFormat::GOLD .
"Network download: " . TextFormat::RED . round($bandwidth->getReceive()->getAverageBytes() / 1024, 2) .
" kB/s");
94 $sender->sendMessage(TextFormat::GOLD .
"Thread count: " . TextFormat::RED . Process::getThreadCount());
96 $sender->sendMessage(TextFormat::GOLD .
"Main thread memory: " . TextFormat::RED . number_format(round(($mUsage[0] / 1024) / 1024, 2), 2) .
" MB.");
97 $sender->sendMessage(TextFormat::GOLD .
"Total memory: " . TextFormat::RED . number_format(round(($mUsage[1] / 1024) / 1024, 2), 2) .
" MB.");
98 $sender->sendMessage(TextFormat::GOLD .
"Total virtual memory: " . TextFormat::RED . number_format(round(($mUsage[2] / 1024) / 1024, 2), 2) .
" MB.");
100 $globalLimit = $server->getMemoryManager()->getGlobalMemoryLimit();
101 if($globalLimit > 0){
102 $sender->sendMessage(TextFormat::GOLD .
"Maximum memory (manager): " . TextFormat::RED . number_format(round(($globalLimit / 1024) / 1024, 2), 2) .
" MB.");
105 foreach($server->getWorldManager()->getWorlds() as $world){
106 $worldName = $world->getFolderName() !== $world->getDisplayName() ?
" (" . $world->getDisplayName() .
")" :
"";
107 $timeColor = $world->getTickRateTime() > 40 ? TextFormat::RED : TextFormat::YELLOW;
108 $sender->sendMessage(TextFormat::GOLD .
"World \"{$world->getFolderName()}\"$worldName: " .
109 TextFormat::RED . number_format(count($world->getLoadedChunks())) . TextFormat::GREEN .
" loaded chunks, " .
110 TextFormat::RED . number_format(count($world->getTickingChunks())) . TextFormat::GREEN .
" ticking chunks, " .
111 TextFormat::RED . number_format(count($world->getEntities())) . TextFormat::GREEN .
" entities. " .
112 "Time $timeColor" . round($world->getTickRateTime(), 2) .
"ms"