diff --git a/build/php b/build/php index f51e95474..fb297eb51 160000 --- a/build/php +++ b/build/php @@ -1 +1 @@ -Subproject commit f51e954743d32aba515a91b2d8b7e6a65e4ac064 +Subproject commit fb297eb511862ef3d4ca0aff5256a8caf5513cb4 diff --git a/changelogs/4.14.md b/changelogs/4.14.md new file mode 100644 index 000000000..206e99048 --- /dev/null +++ b/changelogs/4.14.md @@ -0,0 +1,14 @@ +**For Minecraft: Bedrock Edition 1.19.60** + +### Note about API versions +Plugins which don't touch the protocol and compatible with any previous 4.x.y version will also run on these releases and do not need API bumps. +Plugin developers should **only** update their required API to this version if you need the changes in this build. + +**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do. + +# 4.14.0 +Released 8th February 2023. + +## General +- Added support for Minecraft: Bedrock Edition 1.19.60. +- Removed support for older versions. diff --git a/composer.json b/composer.json index bd1a85af9..2b6cae2e9 100644 --- a/composer.json +++ b/composer.json @@ -35,9 +35,9 @@ "fgrosse/phpasn1": "^2.3", "netresearch/jsonmapper": "^4.0", "pocketmine/bedrock-block-upgrade-schema": "^1.0.0", - "pocketmine/bedrock-data": "~1.13.0+bedrock-1.19.50", + "pocketmine/bedrock-data": "~1.14.0+bedrock-1.19.60", "pocketmine/bedrock-item-upgrade-schema": "^1.0.0", - "pocketmine/bedrock-protocol": "~18.1.0+bedrock-1.19.50", + "pocketmine/bedrock-protocol": "~19.0.0+bedrock-1.19.60", "pocketmine/binaryutils": "^0.2.1", "pocketmine/callback-validator": "^1.0.2", "pocketmine/classloader": "^0.2.0", @@ -56,7 +56,7 @@ "webmozart/path-util": "^2.3" }, "require-dev": { - "phpstan/phpstan": "1.9.14", + "phpstan/phpstan": "1.9.17", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index 17d0b31f9..b330a858e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a9e05a8358faee33178bac5279d864f4", + "content-hash": "89f31843f10576277f645b81a4bef28d", "packages": [ { "name": "adhocore/json-comment", @@ -276,16 +276,16 @@ }, { "name": "pocketmine/bedrock-data", - "version": "1.13.0+bedrock-1.19.50", + "version": "1.14.0+bedrock-1.19.60", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockData.git", - "reference": "57337ddc9433a0e245a1ce48c51af05f0573d58d" + "reference": "7b06234ec6e1f4fb06ad4b2f177e606c25df9b46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/57337ddc9433a0e245a1ce48c51af05f0573d58d", - "reference": "57337ddc9433a0e245a1ce48c51af05f0573d58d", + "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/7b06234ec6e1f4fb06ad4b2f177e606c25df9b46", + "reference": "7b06234ec6e1f4fb06ad4b2f177e606c25df9b46", "shasum": "" }, "type": "library", @@ -296,9 +296,9 @@ "description": "Blobs of data generated from Minecraft: Bedrock Edition, used by PocketMine-MP", "support": { "issues": "https://github.com/pmmp/BedrockData/issues", - "source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.19.50" + "source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.19.60" }, - "time": "2022-11-30T16:19:59+00:00" + "time": "2023-02-08T18:32:01+00:00" }, { "name": "pocketmine/bedrock-item-upgrade-schema", @@ -328,16 +328,16 @@ }, { "name": "pocketmine/bedrock-protocol", - "version": "18.1.0+bedrock-1.19.50", + "version": "19.0.0+bedrock-1.19.60", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockProtocol.git", - "reference": "c34f22847a1cc362a3f1c45698576d30d1e8392f" + "reference": "3c8cf08d09b8b3fafc209d184e66e50d2e34c06c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/c34f22847a1cc362a3f1c45698576d30d1e8392f", - "reference": "c34f22847a1cc362a3f1c45698576d30d1e8392f", + "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/3c8cf08d09b8b3fafc209d184e66e50d2e34c06c", + "reference": "3c8cf08d09b8b3fafc209d184e66e50d2e34c06c", "shasum": "" }, "require": { @@ -369,9 +369,9 @@ "description": "An implementation of the Minecraft: Bedrock Edition protocol in PHP", "support": { "issues": "https://github.com/pmmp/BedrockProtocol/issues", - "source": "https://github.com/pmmp/BedrockProtocol/tree/18.1.0+bedrock-1.19.50" + "source": "https://github.com/pmmp/BedrockProtocol/tree/19.0.0+bedrock-1.19.60" }, - "time": "2023-01-20T12:35:30+00:00" + "time": "2023-02-08T18:38:02+00:00" }, { "name": "pocketmine/binaryutils", @@ -1884,16 +1884,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.14", + "version": "1.9.17", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e5fcc96289cf737304286a9b505fbed091f02e58" + "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5fcc96289cf737304286a9b505fbed091f02e58", - "reference": "e5fcc96289cf737304286a9b505fbed091f02e58", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/204e459e7822f2c586463029f5ecec31bb45a1f2", + "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2", "shasum": "" }, "require": { @@ -1923,7 +1923,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.14" + "source": "https://github.com/phpstan/phpstan/tree/1.9.17" }, "funding": [ { @@ -1939,20 +1939,20 @@ "type": "tidelift" } ], - "time": "2023-01-19T10:47:09+00:00" + "time": "2023-02-08T12:25:00+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "1.3.3", + "version": "1.3.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "54a24bd23e9e80ee918cdc24f909d376c2e273f7" + "reference": "d77af96c1aaec28f7c0293677132eaaad079e01b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/54a24bd23e9e80ee918cdc24f909d376c2e273f7", - "reference": "54a24bd23e9e80ee918cdc24f909d376c2e273f7", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/d77af96c1aaec28f7c0293677132eaaad079e01b", + "reference": "d77af96c1aaec28f7c0293677132eaaad079e01b", "shasum": "" }, "require": { @@ -1989,9 +1989,9 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.3.3" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.3.4" }, - "time": "2022-12-21T15:25:00+00:00" + "time": "2023-02-09T08:05:29+00:00" }, { "name": "phpstan/phpstan-strict-rules", diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 253c907d3..74aeaa19c 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,7 +31,7 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "4.13.1"; + public const BASE_VERSION = "4.14.1"; public const IS_DEVELOPMENT_BUILD = true; public const BUILD_CHANNEL = "stable"; diff --git a/src/entity/Human.php b/src/entity/Human.php index 58911a07c..5ede1abf8 100644 --- a/src/entity/Human.php +++ b/src/entity/Human.php @@ -50,6 +50,8 @@ use pocketmine\network\mcpe\convert\TypeConverter; use pocketmine\network\mcpe\protocol\AddPlayerPacket; use pocketmine\network\mcpe\protocol\PlayerListPacket; use pocketmine\network\mcpe\protocol\PlayerSkinPacket; +use pocketmine\network\mcpe\protocol\types\AbilitiesData; +use pocketmine\network\mcpe\protocol\types\AbilitiesLayer; use pocketmine\network\mcpe\protocol\types\command\CommandPermissions; use pocketmine\network\mcpe\protocol\types\DeviceOS; use pocketmine\network\mcpe\protocol\types\entity\EntityIds; @@ -60,7 +62,6 @@ use pocketmine\network\mcpe\protocol\types\GameMode; use pocketmine\network\mcpe\protocol\types\inventory\ItemStackWrapper; use pocketmine\network\mcpe\protocol\types\PlayerListEntry; use pocketmine\network\mcpe\protocol\types\PlayerPermissions; -use pocketmine\network\mcpe\protocol\types\UpdateAbilitiesPacketLayer; use pocketmine\network\mcpe\protocol\UpdateAbilitiesPacket; use pocketmine\player\Player; use pocketmine\utils\Limits; @@ -507,14 +508,14 @@ class Human extends Living implements ProjectileSource, InventoryHolder{ GameMode::SURVIVAL, $this->getAllNetworkData(), new PropertySyncData([], []), - UpdateAbilitiesPacket::create(CommandPermissions::NORMAL, PlayerPermissions::VISITOR, $this->getId() /* TODO: this should be unique ID */, [ - new UpdateAbilitiesPacketLayer( - UpdateAbilitiesPacketLayer::LAYER_BASE, - array_fill(0, UpdateAbilitiesPacketLayer::NUMBER_OF_ABILITIES, false), + UpdateAbilitiesPacket::create(new AbilitiesData(CommandPermissions::NORMAL, PlayerPermissions::VISITOR, $this->getId() /* TODO: this should be unique ID */, [ + new AbilitiesLayer( + AbilitiesLayer::LAYER_BASE, + array_fill(0, AbilitiesLayer::NUMBER_OF_ABILITIES, false), 0.0, 0.0 ) - ]), + ])), [], //TODO: entity links "", //device ID (we intentionally don't send this - secvuln) DeviceOS::UNKNOWN //we intentionally don't send this (secvuln) diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index 49f87793f..0caccb53c 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -90,6 +90,8 @@ use pocketmine\network\mcpe\protocol\TakeItemActorPacket; use pocketmine\network\mcpe\protocol\TextPacket; use pocketmine\network\mcpe\protocol\ToastRequestPacket; use pocketmine\network\mcpe\protocol\TransferPacket; +use pocketmine\network\mcpe\protocol\types\AbilitiesData; +use pocketmine\network\mcpe\protocol\types\AbilitiesLayer; use pocketmine\network\mcpe\protocol\types\BlockPosition; use pocketmine\network\mcpe\protocol\types\command\CommandData; use pocketmine\network\mcpe\protocol\types\command\CommandEnum; @@ -103,7 +105,6 @@ use pocketmine\network\mcpe\protocol\types\inventory\ContainerIds; use pocketmine\network\mcpe\protocol\types\inventory\ItemStackWrapper; use pocketmine\network\mcpe\protocol\types\PlayerListEntry; use pocketmine\network\mcpe\protocol\types\PlayerPermissions; -use pocketmine\network\mcpe\protocol\types\UpdateAbilitiesPacketLayer; use pocketmine\network\mcpe\protocol\UpdateAbilitiesPacket; use pocketmine\network\mcpe\protocol\UpdateAdventureSettingsPacket; use pocketmine\network\mcpe\protocol\UpdateAttributesPacket; @@ -848,33 +849,33 @@ class NetworkSession{ //ALL of these need to be set for the base layer, otherwise the client will cry $boolAbilities = [ - UpdateAbilitiesPacketLayer::ABILITY_ALLOW_FLIGHT => $for->getAllowFlight(), - UpdateAbilitiesPacketLayer::ABILITY_FLYING => $for->isFlying(), - UpdateAbilitiesPacketLayer::ABILITY_NO_CLIP => !$for->hasBlockCollision(), - UpdateAbilitiesPacketLayer::ABILITY_OPERATOR => $isOp, - UpdateAbilitiesPacketLayer::ABILITY_TELEPORT => $for->hasPermission(DefaultPermissionNames::COMMAND_TELEPORT_SELF), - UpdateAbilitiesPacketLayer::ABILITY_INVULNERABLE => $for->isCreative(), - UpdateAbilitiesPacketLayer::ABILITY_MUTED => false, - UpdateAbilitiesPacketLayer::ABILITY_WORLD_BUILDER => false, - UpdateAbilitiesPacketLayer::ABILITY_INFINITE_RESOURCES => !$for->hasFiniteResources(), - UpdateAbilitiesPacketLayer::ABILITY_LIGHTNING => false, - UpdateAbilitiesPacketLayer::ABILITY_BUILD => !$for->isSpectator(), - UpdateAbilitiesPacketLayer::ABILITY_MINE => !$for->isSpectator(), - UpdateAbilitiesPacketLayer::ABILITY_DOORS_AND_SWITCHES => !$for->isSpectator(), - UpdateAbilitiesPacketLayer::ABILITY_OPEN_CONTAINERS => !$for->isSpectator(), - UpdateAbilitiesPacketLayer::ABILITY_ATTACK_PLAYERS => !$for->isSpectator(), - UpdateAbilitiesPacketLayer::ABILITY_ATTACK_MOBS => !$for->isSpectator(), + AbilitiesLayer::ABILITY_ALLOW_FLIGHT => $for->getAllowFlight(), + AbilitiesLayer::ABILITY_FLYING => $for->isFlying(), + AbilitiesLayer::ABILITY_NO_CLIP => !$for->hasBlockCollision(), + AbilitiesLayer::ABILITY_OPERATOR => $isOp, + AbilitiesLayer::ABILITY_TELEPORT => $for->hasPermission(DefaultPermissionNames::COMMAND_TELEPORT_SELF), + AbilitiesLayer::ABILITY_INVULNERABLE => $for->isCreative(), + AbilitiesLayer::ABILITY_MUTED => false, + AbilitiesLayer::ABILITY_WORLD_BUILDER => false, + AbilitiesLayer::ABILITY_INFINITE_RESOURCES => !$for->hasFiniteResources(), + AbilitiesLayer::ABILITY_LIGHTNING => false, + AbilitiesLayer::ABILITY_BUILD => !$for->isSpectator(), + AbilitiesLayer::ABILITY_MINE => !$for->isSpectator(), + AbilitiesLayer::ABILITY_DOORS_AND_SWITCHES => !$for->isSpectator(), + AbilitiesLayer::ABILITY_OPEN_CONTAINERS => !$for->isSpectator(), + AbilitiesLayer::ABILITY_ATTACK_PLAYERS => !$for->isSpectator(), + AbilitiesLayer::ABILITY_ATTACK_MOBS => !$for->isSpectator(), ]; - $this->sendDataPacket(UpdateAbilitiesPacket::create( + $this->sendDataPacket(UpdateAbilitiesPacket::create(new AbilitiesData( $isOp ? CommandPermissions::OPERATOR : CommandPermissions::NORMAL, $isOp ? PlayerPermissions::OPERATOR : PlayerPermissions::MEMBER, $for->getId(), [ //TODO: dynamic flying speed! FINALLY!!!!!!!!!!!!!!!!! - new UpdateAbilitiesPacketLayer(UpdateAbilitiesPacketLayer::LAYER_BASE, $boolAbilities, 0.05, 0.1), + new AbilitiesLayer(AbilitiesLayer::LAYER_BASE, $boolAbilities, 0.05, 0.1), ] - )); + ))); } public function syncAdventureSettings() : void{ diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index cc2c24776..40e77f410 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -149,6 +149,8 @@ class InGamePacketHandler extends PacketHandler{ /** @var bool */ public $forceMoveSync = false; + protected ?string $lastRequestedFullSkinId = null; + public function __construct( private Player $player, private NetworkSession $session, @@ -745,6 +747,15 @@ class InGamePacketHandler extends PacketHandler{ } public function handlePlayerSkin(PlayerSkinPacket $packet) : bool{ + if($packet->skin->getFullSkinId() === $this->lastRequestedFullSkinId){ + //TODO: HACK! In 1.19.60, the client sends its skin back to us if we sent it a skin different from the one + //it's using. We need to prevent this from causing a feedback loop. + $this->session->getLogger()->debug("Refused duplicate skin change request"); + return true; + } + $this->lastRequestedFullSkinId = $packet->skin->getFullSkinId(); + + $this->session->getLogger()->debug("Processing skin change request"); try{ $skin = SkinAdapterSingleton::get()->fromSkinData($packet->skin); }catch(InvalidSkinException $e){ diff --git a/src/network/mcpe/handler/SpawnResponsePacketHandler.php b/src/network/mcpe/handler/SpawnResponsePacketHandler.php index 554322af5..2ebb9d2b6 100644 --- a/src/network/mcpe/handler/SpawnResponsePacketHandler.php +++ b/src/network/mcpe/handler/SpawnResponsePacketHandler.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace pocketmine\network\mcpe\handler; use pocketmine\network\mcpe\protocol\PlayerAuthInputPacket; +use pocketmine\network\mcpe\protocol\PlayerSkinPacket; use pocketmine\network\mcpe\protocol\SetLocalPlayerAsInitializedPacket; final class SpawnResponsePacketHandler extends PacketHandler{ @@ -37,6 +38,13 @@ final class SpawnResponsePacketHandler extends PacketHandler{ return true; } + public function handlePlayerSkin(PlayerSkinPacket $packet) : bool{ + //TODO: REMOVE THIS + //As of 1.19.60, we receive this packet during pre-spawn for no obvious reason. The skin is still sent in the + //login packet, so we can ignore this one. If unhandled, this packet makes a huge debug spam in the log. + return true; + } + public function handlePlayerAuthInput(PlayerAuthInputPacket $packet) : bool{ //the client will send this every tick once we start sending chunks, but we don't handle it in this stage //this is very spammy so we filter it out