console should work on android now

This commit is contained in:
GameHerobrine 2022-11-09 11:13:31 +03:00
parent bdf7a88999
commit 6bc20a0a02

View file

@ -57,8 +57,9 @@ class ConsoleAPI{
if(defined("NO_THREADS")){ if(defined("NO_THREADS")){
return; return;
} }
if($this->loop->line !== false){ $line = $this->loop->line;
$line = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", trim($this->loop->line)); if($line !== false){
$line = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", trim($line));
$this->loop->line = false; $this->loop->line = false;
$output = $this->run($line, "console"); $output = $this->run($line, "console");
if($output != ""){ if($output != ""){
@ -290,8 +291,10 @@ class ConsoleLoop extends Thread{
} }
while(!$this->stop){ while(!$this->stop){
$this->line = $this->readLine(); $this->synchronized(function($t){
$this->wait(); $t->line = $t->readLine();
$t->wait();
}, $this);
$this->line = false; $this->line = false;
} }