From 7ec27bfb046151c8fe15351fb705b09c666477d1 Mon Sep 17 00:00:00 2001 From: RainBowSheepx Date: Fri, 17 Jun 2022 19:45:40 +0300 Subject: [PATCH] Chat fixed, Negative fixed --- src/API/ChatAPI.php | 4 ++-- src/Player.php | 1 + src/pmf/Level.php | 1 + src/utils/Utils.php | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/API/ChatAPI.php b/src/API/ChatAPI.php index 539ae018..3589361f 100644 --- a/src/API/ChatAPI.php +++ b/src/API/ChatAPI.php @@ -148,7 +148,7 @@ class ChatAPI{ } $message["player"] = ""; } - - $this->server->handle("server.chat", new Container($message, $whitelist, $blacklist)); + $container = new Container($message, $whitelist, $blacklist); + $this->server->handle("server.chat", $container); } } diff --git a/src/Player.php b/src/Player.php index 8af5a81b..af908761 100755 --- a/src/Player.php +++ b/src/Player.php @@ -1192,6 +1192,7 @@ class Player{ $cnt = $this->send($data); if(isset($this->chunkCount[$count])){ unset($this->chunkCount[$count]); + if(!is_null($cnt) and !is_null($cnt[0])) $this->chunkCount[$cnt[0]] = true; } } diff --git a/src/pmf/Level.php b/src/pmf/Level.php index a78e31f6..53189ac7 100644 --- a/src/pmf/Level.php +++ b/src/pmf/Level.php @@ -420,6 +420,7 @@ class PMFLevel extends PMF{ $aX = $x - ($X << 4); $aZ = $z - ($Z << 4); $aY = $y - ($Y << 4); + #Need to fix. But idk how. $b = ord($this->chunks[$index][$Y][(int) ($aY + ($aX << 5) + ($aZ << 9))]); $m = ord($this->chunks[$index][$Y][(int) (($aY >> 1) + 16 + ($aX << 5) + ($aZ << 9))]); if(($y & 1) === 0){ diff --git a/src/utils/Utils.php b/src/utils/Utils.php index 83cebcc1..fde308f8 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -602,10 +602,10 @@ class Utils{ public static function writeLong($value){ $x = ""; - if($value[0] === "-"){ + if(strval($value)[0] === "-"){ $negative = true; $value = bcadd($value, "1"); - if($value[0] === "-"){ + if(strval($value)[0] === "-"){ $value = substr($value, 1); } }else{