From eef7b914dddd4cfe7aa138296dd0059fc95f5823 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Sun, 31 Jul 2022 19:00:37 +0300 Subject: [PATCH] made it work with php5 agagin --- src/Player.php | 2 +- src/utils/Utils.php | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Player.php b/src/Player.php index 9dc21de2..733b9624 100755 --- a/src/Player.php +++ b/src/Player.php @@ -457,7 +457,7 @@ class Player{ } $c = key($this->chunksOrder); - $d = $this->chunksOrder[$c] ?? null; + $d = $this->chunksOrder[$c]; //not sure why was ?? placed here if($c === null or $d === null){ $this->server->schedule(40, [$this, "getNextChunk"]); return false; diff --git a/src/utils/Utils.php b/src/utils/Utils.php index ee8fcd6f..de36f2d6 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -235,7 +235,7 @@ class Utils{ return; } - [, $unpacked] = unpack("n", $str); + list(, $unpacked) = unpack("n", $str); if($unpacked > 0x7fff and $signed === true){ $unpacked -= 0x10000; // Convert unsigned short to signed short } @@ -312,7 +312,7 @@ class Utils{ } public static function readLShort($str, $signed = true){ - [, $unpacked] = @unpack("v", $str); + list(, $unpacked) = @unpack("v", $str); if($unpacked > 0x7fff and $signed === true){ $unpacked -= 0x10000; // Convert unsigned short to signed short } @@ -320,7 +320,7 @@ class Utils{ } public static function readLInt($str){ - [, $unpacked] = @unpack("V", $str); + list(, $unpacked) = @unpack("V", $str); if($unpacked >= 2147483648){ $unpacked -= 4294967296; } @@ -328,7 +328,7 @@ class Utils{ } public static function readLFloat($str){ - [, $value] = ENDIANNESS === BIG_ENDIAN ? @unpack("f", strrev($str)) : @unpack("f", $str); + list(, $value) = ENDIANNESS === BIG_ENDIAN ? @unpack("f", strrev($str)) : @unpack("f", $str); return $value; } @@ -345,7 +345,7 @@ class Utils{ } public static function readTriad($str){ - [, $unpacked] = @unpack("N", "\x00" . $str); + list(, $unpacked) = @unpack("N", "\x00" . $str); return $unpacked; } @@ -528,7 +528,7 @@ class Utils{ return; } - [, $unpacked] = unpack("N", $str); + list(, $unpacked) = unpack("N", $str); if($unpacked >= 2147483648){ $unpacked -= 4294967296; } @@ -544,7 +544,7 @@ class Utils{ } public static function readFloat($str){ - [, $value] = ENDIANNESS === BIG_ENDIAN ? @unpack("f", $str) : @unpack("f", strrev($str)); + list(, $value) = ENDIANNESS === BIG_ENDIAN ? @unpack("f", $str) : @unpack("f", strrev($str)); return $value; } @@ -557,7 +557,7 @@ class Utils{ } public static function readDouble($str){ - [, $value] = ENDIANNESS === BIG_ENDIAN ? @unpack("d", $str) : @unpack("d", strrev($str)); + list(, $value) = ENDIANNESS === BIG_ENDIAN ? @unpack("d", $str) : @unpack("d", strrev($str)); return $value; } @@ -566,7 +566,7 @@ class Utils{ } public static function readLDouble($str){ - [, $value] = ENDIANNESS === BIG_ENDIAN ? @unpack("d", strrev($str)) : @unpack("d", $str); + list(, $value) = ENDIANNESS === BIG_ENDIAN ? @unpack("d", strrev($str)) : @unpack("d", $str); return $value; } @@ -602,7 +602,7 @@ class Utils{ public static function writeLong($value){ $x = ""; - if(strval($value[0] ?? '') === "-"){ + if(strval($value[0] == null ? '' : $value[0]) === "-"){ $negative = true; $value = bcadd($value, "1"); if(strval($value[0]) === "-"){