diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index b9fc383a7b..e6f9daa09d 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1330,6 +1330,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk->commandPermission = ($this->isOp() ? AdventureSettingsPacket::PERMISSION_OPERATOR : AdventureSettingsPacket::PERMISSION_NORMAL); $pk->playerPermission = ($this->isOp() ? PlayerPermissions::OPERATOR : PlayerPermissions::MEMBER); + $pk->entityUniqueId = $this->getId(); $this->dataPacket($pk); } @@ -3085,6 +3086,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ } public function handleAdventureSettings(AdventureSettingsPacket $packet) : bool{ + if($packet->entityUniqueId !== $this->getId()){ + return false; //TODO + } + + $handled = false; + $isFlying = $packet->getFlag(AdventureSettingsPacket::FLYING); if($isFlying and !$this->allowFlight and !$this->server->getAllowFlight()){ $this->kick($this->server->getLanguage()->translateString("kick.reason.cheat", ["%ability.flight"])); @@ -3096,6 +3103,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ }else{ $this->flying = $ev->isFlying(); } + + $handled = true; } if($packet->getFlag(AdventureSettingsPacket::NO_CLIP) and !$this->allowMovementCheats and !$this->isSpectator()){ @@ -3105,7 +3114,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ //TODO: check other changes - return true; + return $handled; } public function handleBlockEntityData(BlockEntityDataPacket $packet) : bool{ diff --git a/src/pocketmine/network/mcpe/protocol/AdventureSettingsPacket.php b/src/pocketmine/network/mcpe/protocol/AdventureSettingsPacket.php index 1a6708de61..94a98e73b1 100644 --- a/src/pocketmine/network/mcpe/protocol/AdventureSettingsPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AdventureSettingsPacket.php @@ -69,14 +69,14 @@ class AdventureSettingsPacket extends DataPacket{ public $commandPermission = self::PERMISSION_NORMAL; public $flags2 = -1; public $playerPermission = PlayerPermissions::MEMBER; - public $long1 = 0; + public $entityUniqueId; //This is a little-endian long, NOT a var-long. (WTF Mojang) protected function decodePayload(){ $this->flags = $this->getUnsignedVarInt(); $this->commandPermission = $this->getUnsignedVarInt(); $this->flags2 = $this->getUnsignedVarInt(); $this->playerPermission = $this->getUnsignedVarInt(); - $this->long1 = $this->getLLong(); + $this->entityUniqueId = $this->getLLong(); } protected function encodePayload(){ @@ -84,7 +84,7 @@ class AdventureSettingsPacket extends DataPacket{ $this->putUnsignedVarInt($this->commandPermission); $this->putUnsignedVarInt($this->flags2); $this->putUnsignedVarInt($this->playerPermission); - $this->putLLong($this->long1); + $this->putLLong($this->entityUniqueId); } public function getFlag(int $flag) : bool{