From 1e3b025916ad2c1ce5f33dbdca5bf1d6e013b44a Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 17 Feb 2023 16:36:32 +0000 Subject: [PATCH] 1.19.62 --- composer.json | 2 +- composer.lock | 14 ++++++------- .../mcpe/handler/LoginPacketHandler.php | 21 +++++++++++++++++++ 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 04ec45376..159e007be 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "fgrosse/phpasn1": "^2.3", "netresearch/jsonmapper": "^4.0", "pocketmine/bedrock-data": "~1.14.0+bedrock-1.19.60", - "pocketmine/bedrock-protocol": "~19.1.0+bedrock-1.19.60", + "pocketmine/bedrock-protocol": "~19.2.0+bedrock-1.19.62", "pocketmine/binaryutils": "^0.2.1", "pocketmine/callback-validator": "^1.0.2", "pocketmine/classloader": "^0.2.0", diff --git a/composer.lock b/composer.lock index f87d2be11..9bd452dca 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": "2121c9df1e7a2193339f5a4fc9f70f52", + "content-hash": "56a1e8facd8fd7d56d6c7d2eb390e842", "packages": [ { "name": "adhocore/json-comment", @@ -276,16 +276,16 @@ }, { "name": "pocketmine/bedrock-protocol", - "version": "19.1.0+bedrock-1.19.60", + "version": "19.2.0+bedrock-1.19.62", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockProtocol.git", - "reference": "b57d8145cb765110d599dd68241f2ebe68c80933" + "reference": "a156db582d0b1a6c20c9d9cc9b1df7ef907efd0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/b57d8145cb765110d599dd68241f2ebe68c80933", - "reference": "b57d8145cb765110d599dd68241f2ebe68c80933", + "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/a156db582d0b1a6c20c9d9cc9b1df7ef907efd0b", + "reference": "a156db582d0b1a6c20c9d9cc9b1df7ef907efd0b", "shasum": "" }, "require": { @@ -317,9 +317,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/19.1.0+bedrock-1.19.60" + "source": "https://github.com/pmmp/BedrockProtocol/tree/19.2.0+bedrock-1.19.62" }, - "time": "2023-02-15T12:35:51+00:00" + "time": "2023-02-17T16:32:49+00:00" }, { "name": "pocketmine/binaryutils", diff --git a/src/network/mcpe/handler/LoginPacketHandler.php b/src/network/mcpe/handler/LoginPacketHandler.php index 80f162697..6d896aba9 100644 --- a/src/network/mcpe/handler/LoginPacketHandler.php +++ b/src/network/mcpe/handler/LoginPacketHandler.php @@ -84,6 +84,27 @@ class LoginPacketHandler extends PacketHandler{ } $clientData = $this->parseClientData($packet->clientDataJwt); + + //TODO: REMOVE THIS + //Mojang forgot to bump the protocol version when they changed protocol in 1.19.62. Check the game version instead. + if(preg_match('/^(\d+)\.(\d+)\.(\d+)/', $clientData->GameVersion, $matches) !== 1){ + throw new PacketHandlingException("Invalid game version format, expected at least 3 digits"); + } + $major = (int) $matches[1]; + $minor = (int) $matches[2]; + $patch = (int) $matches[3]; + if($major === 1 && $minor === 19 && $patch < 62){ + $this->session->sendDataPacket(PlayStatusPacket::create(PlayStatusPacket::LOGIN_FAILED_CLIENT), true); + + //This pocketmine disconnect message will only be seen by the console (PlayStatusPacket causes the messages to be shown for the client) + $this->session->disconnect( + $this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_disconnect_incompatibleProtocol("$packet->protocol (< v1.19.62)")), + false + ); + + return true; + } + try{ $skin = SkinAdapterSingleton::get()->fromSkinData(ClientDataToSkinDataHelper::fromClientData($clientData)); }catch(\InvalidArgumentException | InvalidSkinException $e){