100 $usage = round(($u[0] / 1024) / 1024, 2) .
"/" . round(($d[0] / 1024) / 1024, 2) .
"/" . round(($u[1] / 1024) / 1024, 2) .
"/" . round(($u[2] / 1024) / 1024, 2) .
" MB @ " .
Utils::getThreadCount() .
" threads";
101 $serverStatus = serialize([
102 "online" => count($this->server->getOnlinePlayers()),
103 "max" => $this->server->getMaxPlayers(),
104 "upload" => round($this->server->getNetwork()->getUpload() / 1024, 2),
105 "download" => round($this->server->getNetwork()->getDownload() / 1024, 2),
106 "tps" => $this->server->getTicksPerSecondAverage(),
107 "load" => $this->server->getTickUsageAverage(),
110 for($n = 0; $n < $this->threads; ++$n){
111 if(!$this->workers[$n]->isTerminated()){
112 $this->workers[$n]->serverStatus = $serverStatus;
114 if($this->workers[$n]->isTerminated() ===
true){
115 $this->workers[$n] =
new RCONInstance($this->socket, $this->password, $this->clientsPerThread);
116 }elseif($this->workers[$n]->isWaiting()){
117 if($this->workers[$n]->response !==
""){
118 $this->server->getLogger()->info($this->workers[$n]->response);
119 $this->workers[$n]->synchronized(
function(RCONInstance $thread){
121 }, $this->workers[$n]);
124 $response =
new RemoteConsoleCommandSender();
125 $command = $this->workers[$n]->cmd;
127 $this->server->getPluginManager()->callEvent($ev =
new RemoteServerCommandEvent($response, $command));
129 if(!$ev->isCancelled()){
130 $this->server->dispatchCommand($ev->getSender(), $ev->getCommand());
133 $this->workers[$n]->response = $response->getMessage();
134 $this->workers[$n]->synchronized(
function(RCONInstance $thread){
136 }, $this->workers[$n]);