From 4250e99e3aaf783c4e04c5cf9251964b7fd7ea93 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 22 Aug 2017 11:35:56 +0100 Subject: [PATCH] Updated for 1.2.0.22 --- src/pocketmine/Player.php | 11 +++++-- .../mcpe/protocol/PlayerActionPacket.php | 29 ++++++++++--------- .../network/mcpe/protocol/ProtocolInfo.php | 6 ++-- .../mcpe/protocol/ShowStoreOfferPacket.php | 4 --- .../network/mcpe/protocol/TextPacket.php | 16 +++++++--- 5 files changed, 39 insertions(+), 27 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index e3be7a376..92adcab74 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -3403,11 +3403,18 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->dataPacket($pk); } + /** + * Sends a popup message to the player + * + * TODO: add translation type popups + * + * @param string $message + * @param string $subtitle @deprecated + */ public function sendPopup(string $message, string $subtitle = ""){ $pk = new TextPacket(); $pk->type = TextPacket::TYPE_POPUP; - $pk->source = $message; - $pk->message = $subtitle; + $pk->message = $message; $this->dataPacket($pk); } diff --git a/src/pocketmine/network/mcpe/protocol/PlayerActionPacket.php b/src/pocketmine/network/mcpe/protocol/PlayerActionPacket.php index cb6b54d4e..15c137de9 100644 --- a/src/pocketmine/network/mcpe/protocol/PlayerActionPacket.php +++ b/src/pocketmine/network/mcpe/protocol/PlayerActionPacket.php @@ -36,21 +36,22 @@ class PlayerActionPacket extends DataPacket{ const ACTION_STOP_BREAK = 2; const ACTION_GET_UPDATED_BLOCK = 3; const ACTION_DROP_ITEM = 4; - const ACTION_STOP_SLEEPING = 5; - const ACTION_RESPAWN = 6; - const ACTION_JUMP = 7; - const ACTION_START_SPRINT = 8; - const ACTION_STOP_SPRINT = 9; - const ACTION_START_SNEAK = 10; - const ACTION_STOP_SNEAK = 11; - const ACTION_DIMENSION_CHANGE_REQUEST = 12; //sent when dying in different dimension - const ACTION_DIMENSION_CHANGE_ACK = 13; //sent when spawning in a different dimension to tell the server we spawned - const ACTION_START_GLIDE = 14; - const ACTION_STOP_GLIDE = 15; - const ACTION_BUILD_DENIED = 16; - const ACTION_CONTINUE_BREAK = 17; + const ACTION_START_SLEEPING = 5; + const ACTION_STOP_SLEEPING = 6; + const ACTION_RESPAWN = 7; + const ACTION_JUMP = 8; + const ACTION_START_SPRINT = 9; + const ACTION_STOP_SPRINT = 10; + const ACTION_START_SNEAK = 11; + const ACTION_STOP_SNEAK = 12; + const ACTION_DIMENSION_CHANGE_REQUEST = 13; //sent when dying in different dimension + const ACTION_DIMENSION_CHANGE_ACK = 14; //sent when spawning in a different dimension to tell the server we spawned + const ACTION_START_GLIDE = 15; + const ACTION_STOP_GLIDE = 16; + const ACTION_BUILD_DENIED = 17; + const ACTION_CONTINUE_BREAK = 18; - const ACTION_SET_ENCHANTMENT_SEED = 19; + const ACTION_SET_ENCHANTMENT_SEED = 20; /** @var int */ public $entityRuntimeId; diff --git a/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php b/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php index 41cf2672d..4d51d668f 100644 --- a/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php +++ b/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php @@ -39,15 +39,15 @@ interface ProtocolInfo{ /** * Actual Minecraft: PE protocol version */ - const CURRENT_PROTOCOL = 133; + const CURRENT_PROTOCOL = 134; /** * Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */ - const MINECRAFT_VERSION = 'v1.2.0.18 beta'; + const MINECRAFT_VERSION = 'v1.2.0.22 beta'; /** * Version number sent to clients in ping responses. */ - const MINECRAFT_VERSION_NETWORK = '1.2.0.18'; + const MINECRAFT_VERSION_NETWORK = '1.2.0.22'; const LOGIN_PACKET = 0x01; const PLAY_STATUS_PACKET = 0x02; diff --git a/src/pocketmine/network/mcpe/protocol/ShowStoreOfferPacket.php b/src/pocketmine/network/mcpe/protocol/ShowStoreOfferPacket.php index 6892e5a68..f2cfe334d 100644 --- a/src/pocketmine/network/mcpe/protocol/ShowStoreOfferPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ShowStoreOfferPacket.php @@ -34,19 +34,15 @@ class ShowStoreOfferPacket extends DataPacket{ public $offerId; /** @var bool */ public $unknownBool; - /** @var string */ - public $unknownString; protected function decodePayload(){ $this->offerId = $this->getString(); $this->unknownBool = $this->getBool(); - $this->unknownString = $this->getString(); } protected function encodePayload(){ $this->putString($this->offerId); $this->putBool($this->unknownBool); - $this->putString($this->unknownString); } public function handle(NetworkSession $session) : bool{ diff --git a/src/pocketmine/network/mcpe/protocol/TextPacket.php b/src/pocketmine/network/mcpe/protocol/TextPacket.php index 2f5923129..7c090c240 100644 --- a/src/pocketmine/network/mcpe/protocol/TextPacket.php +++ b/src/pocketmine/network/mcpe/protocol/TextPacket.php @@ -51,12 +51,13 @@ class TextPacket extends DataPacket{ public $message; /** @var string[] */ public $parameters = []; + /** @var string */ + public $xboxUserId = ""; protected function decodePayload(){ $this->type = $this->getByte(); $this->needsTranslation = $this->getBool(); switch($this->type){ - case self::TYPE_POPUP: case self::TYPE_CHAT: case self::TYPE_WHISPER: /** @noinspection PhpMissingBreakStatementInspection */ @@ -68,21 +69,24 @@ class TextPacket extends DataPacket{ $this->message = $this->getString(); break; - case self::TYPE_JUKEBOX_POPUP: case self::TYPE_TRANSLATION: + case self::TYPE_POPUP: + case self::TYPE_JUKEBOX_POPUP: $this->message = $this->getString(); $count = $this->getUnsignedVarInt(); for($i = 0; $i < $count; ++$i){ $this->parameters[] = $this->getString(); } + break; } + + $this->xboxUserId = $this->getString(); } protected function encodePayload(){ $this->putByte($this->type); $this->putBool($this->needsTranslation); switch($this->type){ - case self::TYPE_POPUP: case self::TYPE_CHAT: case self::TYPE_WHISPER: /** @noinspection PhpMissingBreakStatementInspection */ @@ -94,14 +98,18 @@ class TextPacket extends DataPacket{ $this->putString($this->message); break; - case self::TYPE_JUKEBOX_POPUP: case self::TYPE_TRANSLATION: + case self::TYPE_POPUP: + case self::TYPE_JUKEBOX_POPUP: $this->putString($this->message); $this->putUnsignedVarInt(count($this->parameters)); foreach($this->parameters as $p){ $this->putString($p); } + break; } + + $this->putString($this->xboxUserId); } public function handle(NetworkSession $session) : bool{