mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 04:00:29 +00:00
Merge branch 'stable'
This commit is contained in:
@@ -108,8 +108,8 @@ namespace pocketmine {
|
||||
if(substr_count($pthreads_version, ".") < 2){
|
||||
$pthreads_version = "0.$pthreads_version";
|
||||
}
|
||||
if(version_compare($pthreads_version, "3.1.7dev") < 0){
|
||||
$messages[] = "pthreads >= 3.1.7dev is required, while you have $pthreads_version.";
|
||||
if(version_compare($pthreads_version, "3.2.0") < 0){
|
||||
$messages[] = "pthreads >= 3.2.0 is required, while you have $pthreads_version.";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -74,14 +74,14 @@ class FormattedCommandAlias extends Command{
|
||||
$index = strpos($formatString, '$');
|
||||
while($index !== false){
|
||||
$start = $index;
|
||||
if($index > 0 and $formatString{$start - 1} === "\\"){
|
||||
if($index > 0 and $formatString[$start - 1] === "\\"){
|
||||
$formatString = substr($formatString, 0, $start - 1) . substr($formatString, $start);
|
||||
$index = strpos($formatString, '$', $index);
|
||||
continue;
|
||||
}
|
||||
|
||||
$required = false;
|
||||
if($formatString{$index + 1} == '$'){
|
||||
if($formatString[$index + 1] == '$'){
|
||||
$required = true;
|
||||
|
||||
++$index;
|
||||
@@ -91,7 +91,7 @@ class FormattedCommandAlias extends Command{
|
||||
|
||||
$argStart = $index;
|
||||
|
||||
while($index < strlen($formatString) and self::inRange(ord($formatString{$index}) - 48, 0, 9)){
|
||||
while($index < strlen($formatString) and self::inRange(ord($formatString[$index]) - 48, 0, 9)){
|
||||
++$index;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class FormattedCommandAlias extends Command{
|
||||
|
||||
$rest = false;
|
||||
|
||||
if($index < strlen($formatString) and $formatString{$index} === "-"){
|
||||
if($index < strlen($formatString) and $formatString[$index] === "-"){
|
||||
$rest = true;
|
||||
++$index;
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ abstract class VanillaCommand extends Command{
|
||||
* @return float
|
||||
*/
|
||||
protected function getRelativeDouble(float $original, CommandSender $sender, string $input, float $min = self::MIN_COORD, float $max = self::MAX_COORD) : float{
|
||||
if($input{0} === "~"){
|
||||
if($input[0] === "~"){
|
||||
$value = $this->getDouble($sender, substr($input, 1));
|
||||
|
||||
return $original + $value;
|
||||
|
@@ -79,8 +79,8 @@ class ShapedRecipe implements CraftingRecipe{
|
||||
}
|
||||
|
||||
for($x = 0; $x < $this->width; ++$x){
|
||||
if($row{$x} !== ' ' and !isset($ingredients[$row{$x}])){
|
||||
throw new \InvalidArgumentException("No item specified for symbol '" . $row{$x} . "'");
|
||||
if($row[$x] !== ' ' and !isset($ingredients[$row[$x]])){
|
||||
throw new \InvalidArgumentException("No item specified for symbol '" . $row[$x] . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ class LiquidBucket extends Item{
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$player->getWorld()->setBlock($blockReplace, $resultBlock->getFlowingForm());
|
||||
$player->getWorld()->addSound($blockClicked->add(0.5, 0.5, 0.5), $resultBlock->getBucketEmptySound());
|
||||
$player->getWorld()->addSound($blockReplace->add(0.5, 0.5, 0.5), $resultBlock->getBucketEmptySound());
|
||||
|
||||
if($player->hasFiniteResources()){
|
||||
$player->getInventory()->setItemInHand($ev->getItem());
|
||||
|
@@ -186,7 +186,7 @@ class Language{
|
||||
|
||||
$len = strlen($text);
|
||||
for($i = 0; $i < $len; ++$i){
|
||||
$c = $text{$i};
|
||||
$c = $text[$i];
|
||||
if($replaceString !== null){
|
||||
$ord = ord($c);
|
||||
if(
|
||||
|
@@ -37,7 +37,7 @@ class UnknownPacket extends DataPacket{
|
||||
|
||||
public function pid() : int{
|
||||
if(strlen($this->payload ?? "") > 0){
|
||||
return ord($this->payload{0});
|
||||
return ord($this->payload[0]);
|
||||
}
|
||||
return self::NETWORK_ID;
|
||||
}
|
||||
|
@@ -151,7 +151,7 @@ class BanList{
|
||||
$fp = @fopen($this->file, "r");
|
||||
if(is_resource($fp)){
|
||||
while(($line = fgets($fp)) !== false){
|
||||
if($line{0} !== "#"){
|
||||
if($line[0] !== "#"){
|
||||
try{
|
||||
$entry = BanEntry::fromString($line);
|
||||
if($entry !== null){
|
||||
|
@@ -351,7 +351,7 @@ class Utils{
|
||||
public static function javaStringHash(string $string) : int{
|
||||
$hash = 0;
|
||||
for($i = 0, $len = strlen($string); $i < $len; $i++){
|
||||
$ord = ord($string{$i});
|
||||
$ord = ord($string[$i]);
|
||||
if($ord & 0x80){
|
||||
$ord -= 0x100;
|
||||
}
|
||||
|
@@ -385,7 +385,7 @@ class Chunk{
|
||||
* @return int 0-255
|
||||
*/
|
||||
public function getBiomeId(int $x, int $z) : int{
|
||||
return ord($this->biomeIds{($z << 4) | $x});
|
||||
return ord($this->biomeIds[($z << 4) | $x]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -397,7 +397,7 @@ class Chunk{
|
||||
*/
|
||||
public function setBiomeId(int $x, int $z, int $biomeId) : void{
|
||||
$this->hasChanged = true;
|
||||
$this->biomeIds{($z << 4) | $x} = chr($biomeId & 0xff);
|
||||
$this->biomeIds[($z << 4) | $x] = chr($biomeId & 0xff);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -65,15 +65,15 @@ final class LightArray{
|
||||
}
|
||||
|
||||
public function get(int $x, int $y, int $z) : int{
|
||||
return (ord($this->data{($x << 7) | ($z << 3) | ($y >> 1)}) >> (($y & 1) << 2)) & 0xf;
|
||||
return (ord($this->data[($x << 7) | ($z << 3) | ($y >> 1)]) >> (($y & 1) << 2)) & 0xf;
|
||||
}
|
||||
|
||||
public function set(int $x, int $y, int $z, int $level) : void{
|
||||
$i = ($x << 7) | ($z << 3) | ($y >> 1);
|
||||
|
||||
$shift = ($y & 1) << 2;
|
||||
$byte = ord($this->data{$i});
|
||||
$this->data{$i} = chr(($byte & ~(0xf << $shift)) | (($level & 0xf) << $shift));
|
||||
$byte = ord($this->data[$i]);
|
||||
$this->data[$i] = chr(($byte & ~(0xf << $shift)) | (($level & 0xf) << $shift));
|
||||
}
|
||||
|
||||
public function collectGarbage() : void{
|
||||
|
@@ -38,7 +38,7 @@ class ChunkUtils{
|
||||
public static function convertBiomeColors(array $array) : string{
|
||||
$result = str_repeat("\x00", 256);
|
||||
foreach($array as $i => $color){
|
||||
$result{$i} = chr(($color >> 24) & 0xff);
|
||||
$result[$i] = chr(($color >> 24) & 0xff);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user