From 6f1b12b021ab4cc6d5eee6c44d0d559e4f79db66 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 11 Mar 2017 19:54:03 +0000 Subject: [PATCH] Added new 1.0.5 packets --- src/pocketmine/Player.php | 25 +++++ src/pocketmine/network/Network.php | 10 ++ .../network/mcpe/NetworkSession.php | 15 +++ .../mcpe/protocol/BlockPickRequestPacket.php | 52 +++++++++++ .../protocol/CommandBlockUpdatePacket.php | 92 +++++++++++++++++++ .../network/mcpe/protocol/DataPacket.php | 42 ++++++--- .../network/mcpe/protocol/PlaySoundPacket.php | 58 ++++++++++++ .../network/mcpe/protocol/SetTitlePacket.php | 66 +++++++++++++ .../network/mcpe/protocol/StopSoundPacket.php | 50 ++++++++++ 9 files changed, 399 insertions(+), 11 deletions(-) create mode 100644 src/pocketmine/network/mcpe/protocol/BlockPickRequestPacket.php create mode 100644 src/pocketmine/network/mcpe/protocol/CommandBlockUpdatePacket.php create mode 100644 src/pocketmine/network/mcpe/protocol/PlaySoundPacket.php create mode 100644 src/pocketmine/network/mcpe/protocol/SetTitlePacket.php create mode 100644 src/pocketmine/network/mcpe/protocol/StopSoundPacket.php diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 28d0b8317..ef44d72e6 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -115,10 +115,12 @@ use pocketmine\network\mcpe\protocol\AvailableCommandsPacket; use pocketmine\network\mcpe\protocol\BatchPacket; use pocketmine\network\mcpe\protocol\BlockEntityDataPacket; use pocketmine\network\mcpe\protocol\BlockEventPacket; +use pocketmine\network\mcpe\protocol\BlockPickRequestPacket; use pocketmine\network\mcpe\protocol\ChangeDimensionPacket; use pocketmine\network\mcpe\protocol\ChunkRadiusUpdatedPacket; use pocketmine\network\mcpe\protocol\ClientboundMapItemDataPacket; use pocketmine\network\mcpe\protocol\ClientToServerHandshakePacket; +use pocketmine\network\mcpe\protocol\CommandBlockUpdatePacket; use pocketmine\network\mcpe\protocol\CommandStepPacket; use pocketmine\network\mcpe\protocol\ContainerClosePacket; use pocketmine\network\mcpe\protocol\ContainerOpenPacket; @@ -150,6 +152,7 @@ use pocketmine\network\mcpe\protocol\PlayerActionPacket; use pocketmine\network\mcpe\protocol\PlayerFallPacket; use pocketmine\network\mcpe\protocol\PlayerInputPacket; use pocketmine\network\mcpe\protocol\PlayerListPacket; +use pocketmine\network\mcpe\protocol\PlaySoundPacket; use pocketmine\network\mcpe\protocol\PlayStatusPacket; use pocketmine\network\mcpe\protocol\ProtocolInfo; use pocketmine\network\mcpe\protocol\RemoveBlockPacket; @@ -174,9 +177,11 @@ use pocketmine\network\mcpe\protocol\SetHealthPacket; use pocketmine\network\mcpe\protocol\SetPlayerGameTypePacket; use pocketmine\network\mcpe\protocol\SetSpawnPositionPacket; use pocketmine\network\mcpe\protocol\SetTimePacket; +use pocketmine\network\mcpe\protocol\SetTitlePacket; use pocketmine\network\mcpe\protocol\ShowCreditsPacket; use pocketmine\network\mcpe\protocol\SpawnExperienceOrbPacket; use pocketmine\network\mcpe\protocol\StartGamePacket; +use pocketmine\network\mcpe\protocol\StopSoundPacket; use pocketmine\network\mcpe\protocol\TakeItemEntityPacket; use pocketmine\network\mcpe\protocol\TextPacket; use pocketmine\network\mcpe\protocol\TransferPacket; @@ -2452,6 +2457,10 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade return true; } + public function handleBlockPickRequest(BlockPickRequestPacket $packet) : bool{ + return false; //TODO + } + public function handleUseItem(UseItemPacket $packet) : bool{ if($this->spawned === false or !$this->isAlive()){ return true; @@ -3304,6 +3313,10 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade return true; } + public function handleCommandBlockUpdate(CommandBlockUpdatePacket $packet) : bool{ + return false; //TODO + } + public function handleUpdateTrade(UpdateTradePacket $packet) : bool{ return false; } @@ -3339,6 +3352,18 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade return false; } + public function handlePlaySound(PlaySoundPacket $packet) : bool{ + return false; + } + + public function handleStopSound(StopSoundPacket $packet) : bool{ + return false; + } + + public function handleSetTitle(SetTitlePacket $packet) : bool{ + return false; + } + public function handleUnknown(UnknownPacket $packet) : bool{ $this->server->getLogger()->debug("Received unknown packet from " . $this->getName() . ": 0x" . bin2hex($packet->payload)); return true; diff --git a/src/pocketmine/network/Network.php b/src/pocketmine/network/Network.php index 49e00b370..abe41caba 100644 --- a/src/pocketmine/network/Network.php +++ b/src/pocketmine/network/Network.php @@ -36,10 +36,12 @@ use pocketmine\network\mcpe\protocol\AvailableCommandsPacket; use pocketmine\network\mcpe\protocol\BatchPacket; use pocketmine\network\mcpe\protocol\BlockEntityDataPacket; use pocketmine\network\mcpe\protocol\BlockEventPacket; +use pocketmine\network\mcpe\protocol\BlockPickRequestPacket; use pocketmine\network\mcpe\protocol\ChangeDimensionPacket; use pocketmine\network\mcpe\protocol\ChunkRadiusUpdatedPacket; use pocketmine\network\mcpe\protocol\ClientboundMapItemDataPacket; use pocketmine\network\mcpe\protocol\ClientToServerHandshakePacket; +use pocketmine\network\mcpe\protocol\CommandBlockUpdatePacket; use pocketmine\network\mcpe\protocol\CommandStepPacket; use pocketmine\network\mcpe\protocol\ContainerClosePacket; use pocketmine\network\mcpe\protocol\ContainerOpenPacket; @@ -56,6 +58,7 @@ use pocketmine\network\mcpe\protocol\ExplodePacket; use pocketmine\network\mcpe\protocol\FullChunkDataPacket; use pocketmine\network\mcpe\protocol\HurtArmorPacket; use pocketmine\network\mcpe\protocol\MapInfoRequestPacket; +use pocketmine\network\mcpe\protocol\PlaySoundPacket; use pocketmine\network\mcpe\protocol\ProtocolInfo; use pocketmine\network\mcpe\protocol\InteractPacket; use pocketmine\network\mcpe\protocol\InventoryActionPacket; @@ -93,9 +96,11 @@ use pocketmine\network\mcpe\protocol\SetHealthPacket; use pocketmine\network\mcpe\protocol\SetPlayerGameTypePacket; use pocketmine\network\mcpe\protocol\SetSpawnPositionPacket; use pocketmine\network\mcpe\protocol\SetTimePacket; +use pocketmine\network\mcpe\protocol\SetTitlePacket; use pocketmine\network\mcpe\protocol\ShowCreditsPacket; use pocketmine\network\mcpe\protocol\SpawnExperienceOrbPacket; use pocketmine\network\mcpe\protocol\StartGamePacket; +use pocketmine\network\mcpe\protocol\StopSoundPacket; use pocketmine\network\mcpe\protocol\TakeItemEntityPacket; use pocketmine\network\mcpe\protocol\TextPacket; use pocketmine\network\mcpe\protocol\TransferPacket; @@ -320,10 +325,12 @@ class Network{ $this->registerPacket(ProtocolInfo::BATCH_PACKET, BatchPacket::class); $this->registerPacket(ProtocolInfo::BLOCK_ENTITY_DATA_PACKET, BlockEntityDataPacket::class); $this->registerPacket(ProtocolInfo::BLOCK_EVENT_PACKET, BlockEventPacket::class); + $this->registerPacket(ProtocolInfo::BLOCK_PICK_REQUEST_PACKET, BlockPickRequestPacket::class); $this->registerPacket(ProtocolInfo::CHANGE_DIMENSION_PACKET, ChangeDimensionPacket::class); $this->registerPacket(ProtocolInfo::CHUNK_RADIUS_UPDATED_PACKET, ChunkRadiusUpdatedPacket::class); $this->registerPacket(ProtocolInfo::CLIENTBOUND_MAP_ITEM_DATA_PACKET, ClientboundMapItemDataPacket::class); $this->registerPacket(ProtocolInfo::CLIENT_TO_SERVER_HANDSHAKE_PACKET, ClientToServerHandshakePacket::class); + $this->registerPacket(ProtocolInfo::COMMAND_BLOCK_UPDATE_PACKET, CommandBlockUpdatePacket::class); $this->registerPacket(ProtocolInfo::COMMAND_STEP_PACKET, CommandStepPacket::class); $this->registerPacket(ProtocolInfo::CONTAINER_CLOSE_PACKET, ContainerClosePacket::class); $this->registerPacket(ProtocolInfo::CONTAINER_OPEN_PACKET, ContainerOpenPacket::class); @@ -353,6 +360,7 @@ class Network{ $this->registerPacket(ProtocolInfo::PLAYER_FALL_PACKET, PlayerFallPacket::class); $this->registerPacket(ProtocolInfo::PLAYER_INPUT_PACKET, PlayerInputPacket::class); $this->registerPacket(ProtocolInfo::PLAYER_LIST_PACKET, PlayerListPacket::class); + $this->registerPacket(ProtocolInfo::PLAY_SOUND_PACKET, PlaySoundPacket::class); $this->registerPacket(ProtocolInfo::PLAY_STATUS_PACKET, PlayStatusPacket::class); $this->registerPacket(ProtocolInfo::REMOVE_BLOCK_PACKET, RemoveBlockPacket::class); $this->registerPacket(ProtocolInfo::REMOVE_ENTITY_PACKET, RemoveEntityPacket::class); @@ -375,9 +383,11 @@ class Network{ $this->registerPacket(ProtocolInfo::SET_PLAYER_GAME_TYPE_PACKET, SetPlayerGameTypePacket::class); $this->registerPacket(ProtocolInfo::SET_SPAWN_POSITION_PACKET, SetSpawnPositionPacket::class); $this->registerPacket(ProtocolInfo::SET_TIME_PACKET, SetTimePacket::class); + $this->registerPacket(ProtocolInfo::SET_TITLE_PACKET, SetTitlePacket::class); $this->registerPacket(ProtocolInfo::SHOW_CREDITS_PACKET, ShowCreditsPacket::class); $this->registerPacket(ProtocolInfo::SPAWN_EXPERIENCE_ORB_PACKET, SpawnExperienceOrbPacket::class); $this->registerPacket(ProtocolInfo::START_GAME_PACKET, StartGamePacket::class); + $this->registerPacket(ProtocolInfo::STOP_SOUND_PACKET, StopSoundPacket::class); $this->registerPacket(ProtocolInfo::TAKE_ITEM_ENTITY_PACKET, TakeItemEntityPacket::class); $this->registerPacket(ProtocolInfo::TEXT_PACKET, TextPacket::class); $this->registerPacket(ProtocolInfo::TRANSFER_PACKET, TransferPacket::class); diff --git a/src/pocketmine/network/mcpe/NetworkSession.php b/src/pocketmine/network/mcpe/NetworkSession.php index ae790ae9e..a0c0ecfc3 100644 --- a/src/pocketmine/network/mcpe/NetworkSession.php +++ b/src/pocketmine/network/mcpe/NetworkSession.php @@ -35,10 +35,12 @@ use pocketmine\network\mcpe\protocol\AvailableCommandsPacket; use pocketmine\network\mcpe\protocol\BatchPacket; use pocketmine\network\mcpe\protocol\BlockEntityDataPacket; use pocketmine\network\mcpe\protocol\BlockEventPacket; +use pocketmine\network\mcpe\protocol\BlockPickRequestPacket; use pocketmine\network\mcpe\protocol\ChangeDimensionPacket; use pocketmine\network\mcpe\protocol\ChunkRadiusUpdatedPacket; use pocketmine\network\mcpe\protocol\ClientboundMapItemDataPacket; use pocketmine\network\mcpe\protocol\ClientToServerHandshakePacket; +use pocketmine\network\mcpe\protocol\CommandBlockUpdatePacket; use pocketmine\network\mcpe\protocol\CommandStepPacket; use pocketmine\network\mcpe\protocol\ContainerClosePacket; use pocketmine\network\mcpe\protocol\ContainerOpenPacket; @@ -69,6 +71,7 @@ use pocketmine\network\mcpe\protocol\PlayerActionPacket; use pocketmine\network\mcpe\protocol\PlayerFallPacket; use pocketmine\network\mcpe\protocol\PlayerInputPacket; use pocketmine\network\mcpe\protocol\PlayerListPacket; +use pocketmine\network\mcpe\protocol\PlaySoundPacket; use pocketmine\network\mcpe\protocol\PlayStatusPacket; use pocketmine\network\mcpe\protocol\RemoveBlockPacket; use pocketmine\network\mcpe\protocol\RemoveEntityPacket; @@ -92,9 +95,11 @@ use pocketmine\network\mcpe\protocol\SetHealthPacket; use pocketmine\network\mcpe\protocol\SetPlayerGameTypePacket; use pocketmine\network\mcpe\protocol\SetSpawnPositionPacket; use pocketmine\network\mcpe\protocol\SetTimePacket; +use pocketmine\network\mcpe\protocol\SetTitlePacket; use pocketmine\network\mcpe\protocol\ShowCreditsPacket; use pocketmine\network\mcpe\protocol\SpawnExperienceOrbPacket; use pocketmine\network\mcpe\protocol\StartGamePacket; +use pocketmine\network\mcpe\protocol\StopSoundPacket; use pocketmine\network\mcpe\protocol\TakeItemEntityPacket; use pocketmine\network\mcpe\protocol\TextPacket; use pocketmine\network\mcpe\protocol\TransferPacket; @@ -174,6 +179,8 @@ interface NetworkSession{ public function handleInteract(InteractPacket $packet) : bool; + public function handleBlockPickRequest(BlockPickRequestPacket $packet) : bool; + public function handleUseItem(UseItemPacket $packet) : bool; public function handlePlayerAction(PlayerActionPacket $packet) : bool; @@ -262,6 +269,8 @@ interface NetworkSession{ public function handleCommandStep(CommandStepPacket $packet) : bool; + public function handleCommandBlockUpdate(CommandBlockUpdatePacket $packet) : bool; + public function handleUpdateTrade(UpdateTradePacket $packet) : bool; public function handleResourcePackDataInfo(ResourcePackDataInfoPacket $packet) : bool; @@ -272,5 +281,11 @@ interface NetworkSession{ public function handleTransfer(TransferPacket $packet) : bool; + public function handlePlaySound(PlaySoundPacket $packet) : bool; + + public function handleStopSound(StopSoundPacket $packet) : bool; + + public function handleSetTitle(SetTitlePacket $packet) : bool; + public function handleUnknown(UnknownPacket $packet) : bool; } \ No newline at end of file diff --git a/src/pocketmine/network/mcpe/protocol/BlockPickRequestPacket.php b/src/pocketmine/network/mcpe/protocol/BlockPickRequestPacket.php new file mode 100644 index 000000000..89ff5180f --- /dev/null +++ b/src/pocketmine/network/mcpe/protocol/BlockPickRequestPacket.php @@ -0,0 +1,52 @@ + + + +use pocketmine\network\mcpe\NetworkSession; + +class BlockPickRequestPacket extends DataPacket{ + const NETWORK_ID = ProtocolInfo::BLOCK_PICK_REQUEST_PACKET; + + public $tileX; + public $tileY; + public $tileZ; + public $hotbarSlot; + + public function decode(){ + $this->getSignedBlockPosition($this->tileX, $this->tileY, $this->tileZ); + $this->hotbarSlot = $this->getByte(); + } + + public function encode(){ + $this->reset(); + $this->putSignedBlockPosition($this->tileX, $this->tileY, $this->tileZ); + $this->putByte($this->hotbarSlot); + } + + public function handle(NetworkSession $session) : bool{ + return $session->handleBlockPickRequest($this); + } +} \ No newline at end of file diff --git a/src/pocketmine/network/mcpe/protocol/CommandBlockUpdatePacket.php b/src/pocketmine/network/mcpe/protocol/CommandBlockUpdatePacket.php new file mode 100644 index 000000000..f99720e5f --- /dev/null +++ b/src/pocketmine/network/mcpe/protocol/CommandBlockUpdatePacket.php @@ -0,0 +1,92 @@ + + + +use pocketmine\network\mcpe\NetworkSession; + +class CommandBlockUpdatePacket extends DataPacket{ + const NETWORK_ID = ProtocolInfo::COMMAND_BLOCK_UPDATE_PACKET; + + public $isCommandBlockUpdate; + + public $x; + public $y; + public $z; + public $commandBlockMode; + public $isRedstoneMode; + public $isConditional; + + public $eid; + + public $command; + public $lastOutput; + public $name; + + public $shouldTrackOutput; + + public function decode(){ + $this->isCommandBlockUpdate = $this->getBool(); + + if($this->isCommandBlockUpdate){ + $this->getBlockPosition($this->x, $this->y, $this->z); + $this->commandBlockMode = $this->getUnsignedVarInt(); + $this->isRedstoneMode = $this->getBool(); + $this->isConditional = $this->getBool(); + }else{ + $this->eid = $this->getEntityRuntimeId(); + } + + $this->command = $this->getString(); + $this->lastOutput = $this->getString(); + $this->name = $this->getString(); + + $this->shouldTrackOutput = $this->getBool(); + } + + public function encode(){ + $this->reset(); + $this->putBool($this->isCommandBlockUpdate); + + if($this->isCommandBlockUpdate){ + $this->putBlockPosition($this->x, $this->y, $this->z); + $this->putUnsignedVarInt($this->commandBlockMode); + $this->putBool($this->isRedstoneMode); + $this->putBool($this->isConditional); + }else{ + $this->putEntityRuntimeId($this->eid); + } + + $this->putString($this->command); + $this->putString($this->lastOutput); + $this->putString($this->name); + + $this->putBool($this->shouldTrackOutput); + } + + public function handle(NetworkSession $session) : bool{ + return $session->handleCommandBlockUpdate($this); + } +} \ No newline at end of file diff --git a/src/pocketmine/network/mcpe/protocol/DataPacket.php b/src/pocketmine/network/mcpe/protocol/DataPacket.php index d08193289..18f006290 100644 --- a/src/pocketmine/network/mcpe/protocol/DataPacket.php +++ b/src/pocketmine/network/mcpe/protocol/DataPacket.php @@ -116,17 +116,15 @@ abstract class DataPacket extends BinaryStream{ $value[2] = $item->getDamage(); break; case Entity::DATA_TYPE_POS: - $value = []; - $value[0] = $this->getVarInt(); //x - $value[1] = $this->getVarInt(); //y (SIGNED) - $value[2] = $this->getVarInt(); //z + $value = [0, 0, 0]; + $this->getSignedBlockPosition(...$value); break; case Entity::DATA_TYPE_LONG: $value = $this->getVarLong(); break; case Entity::DATA_TYPE_VECTOR3F: $value = [0.0, 0.0, 0.0]; - $this->getVector3f($value[0], $value[1], $value[2]); + $this->getVector3f(...$value); break; default: $value = []; @@ -173,16 +171,14 @@ abstract class DataPacket extends BinaryStream{ break; case Entity::DATA_TYPE_POS: //TODO: change this implementation (use objects) - $this->putVarInt($d[1][0]); //x - $this->putVarInt($d[1][1]); //y (SIGNED) - $this->putVarInt($d[1][2]); //z + $this->putSignedBlockPosition(...$d[1]); break; case Entity::DATA_TYPE_LONG: $this->putVarLong($d[1]); break; case Entity::DATA_TYPE_VECTOR3F: //TODO: change this implementation (use objects) - $this->putVector3f($d[1][0], $d[1][1], $d[1][2]); //x, y, z + $this->putVector3f(...$d[1]); //x, y, z } } } @@ -220,7 +216,7 @@ abstract class DataPacket extends BinaryStream{ } /** - * Writes an block position with unsigned Y coordinate. + * Reads an block position with unsigned Y coordinate. * @param int $x * @param int $y 0-255 * @param int $z @@ -232,7 +228,7 @@ abstract class DataPacket extends BinaryStream{ } /** - * Reads a block position with unsigned Y coordinate. + * Writes a block position with unsigned Y coordinate. * @param int &$x * @param int &$y * @param int &$z @@ -243,6 +239,30 @@ abstract class DataPacket extends BinaryStream{ $this->putVarInt($z); } + /** + * Reads a block position with a signed Y coordinate. + * @param int &$x + * @param int &$y + * @param int &$z + */ + public function getSignedBlockPosition(&$x, &$y, &$z){ + $x = $this->getVarInt(); + $y = $this->getVarInt(); + $z = $this->getVarInt(); + } + + /** + * Writes a block position with a signed Y coordinate. + * @param int $x + * @param int $y + * @param int $z + */ + public function putSignedBlockPosition($x, $y, $z){ + $this->putVarInt($x); + $this->putVarInt($y); + $this->putVarInt($z); + } + /** * Reads a floating-point vector3 rounded to 4dp. * @param float $x diff --git a/src/pocketmine/network/mcpe/protocol/PlaySoundPacket.php b/src/pocketmine/network/mcpe/protocol/PlaySoundPacket.php new file mode 100644 index 000000000..ba40a6a82 --- /dev/null +++ b/src/pocketmine/network/mcpe/protocol/PlaySoundPacket.php @@ -0,0 +1,58 @@ + + + +use pocketmine\network\mcpe\NetworkSession; + +class PlaySoundPacket extends DataPacket{ + const NETWORK_ID = ProtocolInfo::PLAY_SOUND_PACKET; + + public $string1; + public $x; + public $y; + public $z; + public $float1; + public $float2; + + public function decode(){ + $this->string1 = $this->getString(); + $this->getBlockPosition($this->x, $this->y, $this->z); + $this->float1 = $this->getLFloat(); + $this->float2 = $this->getLFloat(); + } + + public function encode(){ + $this->reset(); + $this->putString($this->string1); + $this->putBlockPosition($this->x, $this->y, $this->z); + $this->putLFloat($this->float1); + $this->putLFloat($this->float2); + } + + public function handle(NetworkSession $session) : bool{ + return $session->handlePlaySound($this); + } +} \ No newline at end of file diff --git a/src/pocketmine/network/mcpe/protocol/SetTitlePacket.php b/src/pocketmine/network/mcpe/protocol/SetTitlePacket.php new file mode 100644 index 000000000..3ecf312d4 --- /dev/null +++ b/src/pocketmine/network/mcpe/protocol/SetTitlePacket.php @@ -0,0 +1,66 @@ + + + +use pocketmine\network\mcpe\NetworkSession; + +class SetTitlePacket extends DataPacket{ + const NETWORK_ID = ProtocolInfo::SET_TITLE_PACKET; + + const TYPE_CLEAR_TITLE = 0; + const TYPE_RESET_TITLE = 1; + const TYPE_SET_TITLE = 2; + const TYPE_SET_SUBTITLE = 3; + const TYPE_SET_ACTIONBAR_MESSAGE = 4; + const TYPE_SET_ANIMATION_TIMES = 5; + + public $type; + public $text; + public $fadeInTime; + public $stayTime; + public $fadeOutTime; + + public function decode(){ + $this->type = $this->getVarInt(); + $this->text = $this->getString(); + $this->fadeInTime = $this->getVarInt(); + $this->stayTime = $this->getVarInt(); + $this->fadeOutTime = $this->getVarInt(); + } + + public function encode(){ + $this->reset(); + $this->putVarInt($this->type); + $this->putString($this->text); + $this->putVarInt($this->fadeInTime); + $this->putVarInt($this->stayTime); + $this->putVarInt($this->fadeOutTime); + } + + public function handle(NetworkSession $session) : bool{ + return $session->handleSetTitle($this); + } +} \ No newline at end of file diff --git a/src/pocketmine/network/mcpe/protocol/StopSoundPacket.php b/src/pocketmine/network/mcpe/protocol/StopSoundPacket.php new file mode 100644 index 000000000..a339f9121 --- /dev/null +++ b/src/pocketmine/network/mcpe/protocol/StopSoundPacket.php @@ -0,0 +1,50 @@ + + + +use pocketmine\network\mcpe\NetworkSession; + +class StopSoundPacket extends DataPacket{ + const NETWORK_ID = ProtocolInfo::STOP_SOUND_PACKET; + + public $string1; + public $stopAll; + + public function decode(){ + $this->string1 = $this->getString(); + $this->stopAll = $this->getBool(); + } + + public function encode(){ + $this->reset(); + $this->putString($this->string1); + $this->putBool($this->stopAll); + } + + public function handle(NetworkSession $session) : bool{ + return $session->handleStopSound($this); + } +} \ No newline at end of file