made it work with php5 agagin

This commit is contained in:
GameHerobrine 2022-07-31 19:00:37 +03:00
parent da78eb419e
commit eef7b914dd
2 changed files with 11 additions and 11 deletions

View file

@ -457,7 +457,7 @@ class Player{
} }
$c = key($this->chunksOrder); $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){ if($c === null or $d === null){
$this->server->schedule(40, [$this, "getNextChunk"]); $this->server->schedule(40, [$this, "getNextChunk"]);
return false; return false;

View file

@ -235,7 +235,7 @@ class Utils{
return; return;
} }
[, $unpacked] = unpack("n", $str); list(, $unpacked) = unpack("n", $str);
if($unpacked > 0x7fff and $signed === true){ if($unpacked > 0x7fff and $signed === true){
$unpacked -= 0x10000; // Convert unsigned short to signed short $unpacked -= 0x10000; // Convert unsigned short to signed short
} }
@ -312,7 +312,7 @@ class Utils{
} }
public static function readLShort($str, $signed = true){ public static function readLShort($str, $signed = true){
[, $unpacked] = @unpack("v", $str); list(, $unpacked) = @unpack("v", $str);
if($unpacked > 0x7fff and $signed === true){ if($unpacked > 0x7fff and $signed === true){
$unpacked -= 0x10000; // Convert unsigned short to signed short $unpacked -= 0x10000; // Convert unsigned short to signed short
} }
@ -320,7 +320,7 @@ class Utils{
} }
public static function readLInt($str){ public static function readLInt($str){
[, $unpacked] = @unpack("V", $str); list(, $unpacked) = @unpack("V", $str);
if($unpacked >= 2147483648){ if($unpacked >= 2147483648){
$unpacked -= 4294967296; $unpacked -= 4294967296;
} }
@ -328,7 +328,7 @@ class Utils{
} }
public static function readLFloat($str){ 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; return $value;
} }
@ -345,7 +345,7 @@ class Utils{
} }
public static function readTriad($str){ public static function readTriad($str){
[, $unpacked] = @unpack("N", "\x00" . $str); list(, $unpacked) = @unpack("N", "\x00" . $str);
return $unpacked; return $unpacked;
} }
@ -528,7 +528,7 @@ class Utils{
return; return;
} }
[, $unpacked] = unpack("N", $str); list(, $unpacked) = unpack("N", $str);
if($unpacked >= 2147483648){ if($unpacked >= 2147483648){
$unpacked -= 4294967296; $unpacked -= 4294967296;
} }
@ -544,7 +544,7 @@ class Utils{
} }
public static function readFloat($str){ 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; return $value;
} }
@ -557,7 +557,7 @@ class Utils{
} }
public static function readDouble($str){ 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; return $value;
} }
@ -566,7 +566,7 @@ class Utils{
} }
public static function readLDouble($str){ 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; return $value;
} }
@ -602,7 +602,7 @@ class Utils{
public static function writeLong($value){ public static function writeLong($value){
$x = ""; $x = "";
if(strval($value[0] ?? '') === "-"){ if(strval($value[0] == null ? '' : $value[0]) === "-"){
$negative = true; $negative = true;
$value = bcadd($value, "1"); $value = bcadd($value, "1");
if(strval($value[0]) === "-"){ if(strval($value[0]) === "-"){