From 85521f5e7a34ea07034d3715b46e47548a570783 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 2 Dec 2019 13:57:19 +0000 Subject: [PATCH] EducationSettingsPacket: added encode & decode --- .../mcpe/protocol/EducationSettingsPacket.php | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/network/mcpe/protocol/EducationSettingsPacket.php b/src/pocketmine/network/mcpe/protocol/EducationSettingsPacket.php index 684904bb6..e8f5eea4e 100644 --- a/src/pocketmine/network/mcpe/protocol/EducationSettingsPacket.php +++ b/src/pocketmine/network/mcpe/protocol/EducationSettingsPacket.php @@ -30,12 +30,34 @@ use pocketmine\network\mcpe\NetworkSession; class EducationSettingsPacket extends DataPacket{ public const NETWORK_ID = ProtocolInfo::EDUCATION_SETTINGS_PACKET; + /** @var string */ + private $codeBuilderDefaultUri; + /** @var bool */ + private $hasQuiz; + + public static function create(string $codeBuilderDefaultUri, bool $hasQuiz) : self{ + $result = new self; + $result->codeBuilderDefaultUri = $codeBuilderDefaultUri; + $result->hasQuiz = $hasQuiz; + return $result; + } + + public function getCodeBuilderDefaultUri() : string{ + return $this->codeBuilderDefaultUri; + } + + public function getHasQuiz() : bool{ + return $this->hasQuiz; + } + protected function decodePayload() : void{ - //TODO + $this->codeBuilderDefaultUri = $this->getString(); + $this->hasQuiz = $this->getBool(); } protected function encodePayload() : void{ - //TODO + $this->putString($this->codeBuilderDefaultUri); + $this->putBool($this->hasQuiz); } public function handle(NetworkSession $handler) : bool{