diff --git a/src/API/ConsoleAPI.php b/src/API/ConsoleAPI.php index 47433f65..c8ac2212 100644 --- a/src/API/ConsoleAPI.php +++ b/src/API/ConsoleAPI.php @@ -1,7 +1,7 @@ server->schedule(2, [$this, "handle"], [], true); if(!defined("NO_THREADS")){ - self::$loop = new ConsoleLoop(); + $this->loop = new ConsoleLoop(); } $this->register("help", "[page|command name]", [$this, "defaultCommands"]); $this->register("status", "", [$this, "defaultCommands"]); @@ -51,8 +51,8 @@ class ConsoleAPI{ function __destruct(){ $this->server->deleteEvent($this->event); if(!defined("NO_THREADS")){ - self::$loop->stop(); - self::$loop->notify(); + $this->loop->stop(); + $this->loop->notify(); usleep(50000); } } @@ -66,10 +66,10 @@ class ConsoleAPI{ if(defined("NO_THREADS")){ return; } - $line = self::$loop->line; + $line = $this->loop->line; if($line !== false){ $line = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", trim($line)); - self::$loop->line = false; + $this->loop->line = false; $output = $this->run($line, "console"); if($output != ""){ $mes = explode("\n", trim($output)); @@ -78,7 +78,7 @@ class ConsoleAPI{ } } }else{ - self::$loop->notify(); + $this->loop->notify(); } } @@ -214,7 +214,7 @@ class ConsoleAPI{ } return "TPS: {$info["tps"]}, Memory usage: {$info["memory_usage"]} (Peak {$info["memory_peak_usage"]})"; case "stop": - self::$loop->stop = true; + $this->loop->stop = true; $this->server->close(); return "Stopping the server\n"; case "difficulty": diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index 0f1bc7d3..8abf26d7 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -610,7 +610,6 @@ class PocketMinecraftServer{ public static function clientID($ip, $port){ return crc32($ip . $port) ^ crc32($port . $ip . BOOTUP_RANDOM); - //return $ip . ":" . $port; } public function send(Packet $packet){