diff --git a/changelogs/3.9.md b/changelogs/3.9.md index 9e91d7c04..0618aef71 100644 --- a/changelogs/3.9.md +++ b/changelogs/3.9.md @@ -74,3 +74,29 @@ Plugin developers should **only** update their required API to this version if y - Fixed some issues with multiple consecutive commas inside quotes in form responses. - Fixed server crash when the manifest json does not contain a json object in a resource pack. - Ender pearls no longer collide with blocks that do not have any collision boxes. + +# 3.9.6 +- Updated Composer dependencies to their latest versions. +- Prevent clients repeating the resource pack sequence. This fixes error spam with bugged 1.12 clients. +- `Internet::simpleCurl()` now includes the PocketMine-MP version in the user-agent string. +- Spawn protection is now disabled by default in the setup wizard. +- Default difficulty is now NORMAL(2) instead of EASY(1). +- Fixed crashing on corrupted world manifest and unsupported world formats. +- Fixed `/transferserver` being usable without appropriate permissions. +- `RegionLoader->removeChunk()` now writes the region header as appropriate. +- Fixed performance issue when loading large regions (bug in header validation). +- Fixed skin geometry being removed when the JSON contained comments. +- Added new constants to `EventPacket`. +- Added encode/decode for `StructureTemplateDataExportRequestPacket` and `StructureTemplateDataExportResponsePacket`. +- Fixed broken type asserts in `LevelChunkPacket::withCache()` and `ClientCacheMissResponsePacket::create()`. +- `types\CommandParameter` field `byte1` has been renamed to `flags`. +- Cleaned up public interface of `AvailableCommandsPacket`, removing fields which exposed details of the encoding scheme. +- Improved documentation for the following API methods: + - `pocketmine\item\Item`: + - `addCreativeItem()` + - `removeCreativeItem()` + - `clearCreativeItems()` + - `pocketmine\level\Explosion`: + - `explodeA()` + - `explodeB()` +- Fixed various cosmetic documentation inconsistencies in the core and dependencies. \ No newline at end of file diff --git a/src/block/tile/Chest.php b/src/block/tile/Chest.php index f05f189e7..04bfc4213 100644 --- a/src/block/tile/Chest.php +++ b/src/block/tile/Chest.php @@ -45,7 +45,7 @@ class Chest extends Spawnable implements Container, Nameable{ /** @var ChestInventory */ protected $inventory; - /** @var DoubleChestInventory */ + /** @var DoubleChestInventory|null */ protected $doubleInventory = null; /** @var int|null */ diff --git a/src/entity/Human.php b/src/entity/Human.php index 955db74c7..40e7f27aa 100644 --- a/src/entity/Human.php +++ b/src/entity/Human.php @@ -199,6 +199,9 @@ class Human extends Living implements ProjectileSource, InventoryHolder{ return (int) min(100, 7 * $this->xpManager->getXpLevel()); } + /** + * @return PlayerInventory + */ public function getInventory(){ return $this->inventory; } diff --git a/src/entity/Skin.php b/src/entity/Skin.php index 76e7884df..af26dbbac 100644 --- a/src/entity/Skin.php +++ b/src/entity/Skin.php @@ -23,9 +23,9 @@ declare(strict_types=1); namespace pocketmine\entity; +use Ahc\Json\Comment as CommentedJsonDecoder; use function implode; use function in_array; -use function json_decode; use function json_encode; use function json_last_error_msg; use function strlen; @@ -61,7 +61,7 @@ final class Skin{ } if($geometryData !== ""){ - $decodedGeometry = json_decode($geometryData); + $decodedGeometry = (new CommentedJsonDecoder())->decode($geometryData); if($decodedGeometry === false){ throw new \InvalidArgumentException("Invalid geometry data (" . json_last_error_msg() . ")"); } diff --git a/src/network/mcpe/protocol/AvailableCommandsPacket.php b/src/network/mcpe/protocol/AvailableCommandsPacket.php index 03c62ee11..c54461b23 100644 --- a/src/network/mcpe/protocol/AvailableCommandsPacket.php +++ b/src/network/mcpe/protocol/AvailableCommandsPacket.php @@ -164,7 +164,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{ /** * @param CommandEnum $enum - * @param string[] $enumValueMap + * @param int[] $enumValueMap */ protected function putEnum(CommandEnum $enum, array $enumValueMap) : void{ $this->putString($enum->getName()); diff --git a/src/network/mcpe/protocol/ClientCacheMissResponsePacket.php b/src/network/mcpe/protocol/ClientCacheMissResponsePacket.php index 11defadd6..d973aa59f 100644 --- a/src/network/mcpe/protocol/ClientCacheMissResponsePacket.php +++ b/src/network/mcpe/protocol/ClientCacheMissResponsePacket.php @@ -42,7 +42,7 @@ class ClientCacheMissResponsePacket extends DataPacket implements ClientboundPac */ public static function create(array $blobs) : self{ //type check - (static function(ChunkCacheBlob ...$blobs){})($blobs); + (static function(ChunkCacheBlob ...$blobs){})(...$blobs); $result = new self; $result->blobs = $blobs; diff --git a/src/network/mcpe/protocol/LevelChunkPacket.php b/src/network/mcpe/protocol/LevelChunkPacket.php index fe4818287..5689dff69 100644 --- a/src/network/mcpe/protocol/LevelChunkPacket.php +++ b/src/network/mcpe/protocol/LevelChunkPacket.php @@ -57,7 +57,7 @@ class LevelChunkPacket extends DataPacket implements ClientboundPacket{ } public static function withCache(int $chunkX, int $chunkZ, int $subChunkCount, array $usedBlobHashes, string $extraPayload) : self{ - (static function(int ...$hashes){})($usedBlobHashes); + (static function(int ...$hashes){})(...$usedBlobHashes); $result = new self; $result->chunkX = $chunkX; $result->chunkZ = $chunkZ; diff --git a/src/permission/PermissionParser.php b/src/permission/PermissionParser.php index dd625d2e7..7c64d37f0 100644 --- a/src/permission/PermissionParser.php +++ b/src/permission/PermissionParser.php @@ -95,12 +95,7 @@ class PermissionParser{ $desc = null; $children = []; if(isset($data["default"])){ - $value = PermissionParser::defaultFromString($data["default"]); - if($value !== null){ - $default = $value; - }else{ - throw new \InvalidStateException("'default' key contained unknown value"); - } + $default = PermissionParser::defaultFromString($data["default"]); } if(isset($data["children"])){ diff --git a/src/scheduler/Task.php b/src/scheduler/Task.php index 0da2b2346..9fd170c83 100644 --- a/src/scheduler/Task.php +++ b/src/scheduler/Task.php @@ -27,7 +27,7 @@ use pocketmine\utils\Utils; abstract class Task{ - /** @var TaskHandler */ + /** @var TaskHandler|null */ private $taskHandler = null; /** diff --git a/src/utils/MainLogger.php b/src/utils/MainLogger.php index e33af84f5..892486f7f 100644 --- a/src/utils/MainLogger.php +++ b/src/utils/MainLogger.php @@ -45,7 +45,7 @@ class MainLogger extends \AttachableThreadedLogger{ /** @var \Threaded */ protected $logStream; /** @var bool */ - protected $shutdown; + protected $shutdown = false; /** @var bool */ protected $logDebug; /** @var bool */ @@ -272,7 +272,6 @@ class MainLogger extends \AttachableThreadedLogger{ } public function run() : void{ - $this->shutdown = false; $logResource = fopen($this->logFile, "ab"); if(!is_resource($logResource)){ throw new \RuntimeException("Couldn't open log file"); diff --git a/src/world/light/LightUpdate.php b/src/world/light/LightUpdate.php index 26b0e8669..b608f475a 100644 --- a/src/world/light/LightUpdate.php +++ b/src/world/light/LightUpdate.php @@ -36,7 +36,7 @@ abstract class LightUpdate{ /** @var ChunkManager */ protected $world; - /** @var int[] blockhash => new light level */ + /** @var int[][] blockhash => [x, y, z, new light level] */ protected $updateNodes = []; /** @var \SplQueue */