use pocketmine\network\mcpe\NetworkSession; class PhotoTransferPacket extends DataPacket{ public const NETWORK_ID = ProtocolInfo::PHOTO_TRANSFER_PACKET; /** @var string */ public $photoName; /** @var string */ public $photoData; /** @var string */ public $bookId; //photos are stored in a sibling directory to the games folder (screenshots/(some UUID)/bookID/example.png) protected function decodePayload(){ $this->photoName = $this->getString(); $this->photoData = $this->getString(); $this->bookId = $this->getString(); } protected function encodePayload(){ $this->putString($this->photoName); $this->putString($this->photoData); $this->putString($this->bookId); } public function handle(NetworkSession $session) : bool{ return $session->handlePhotoTransfer($this); } }