PocketMine-MP 5.43.2 git-a137a986d01d9af23452b2e741699a770c7ae112
Loading...
Searching...
No Matches
GatheringJoinInfo.php
1<?php
2
3/*
4 * This file is part of BedrockProtocol.
5 * Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6 *
7 * BedrockProtocol is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 */
12
13declare(strict_types=1);
14
15namespace pocketmine\network\mcpe\protocol\types;
16
17use pmmp\encoding\ByteBufferReader;
18use pmmp\encoding\ByteBufferWriter;
20use Ramsey\Uuid\UuidInterface;
21
23
24 public function __construct(
25 private UuidInterface $experienceId,
26 private string $experienceName,
27 private UuidInterface $experienceWorldId,
28 private string $experienceWorldName,
29 private string $creatorId,
30 private UuidInterface $targetId,
31 private string $scenarioId,
32 private string $serverId,
33 ){}
34
35 public function getExperienceId() : UuidInterface{ return $this->experienceId; }
36
37 public function getExperienceName() : string{ return $this->experienceName; }
38
39 public function getExperienceWorldId() : UuidInterface{ return $this->experienceWorldId; }
40
41 public function getExperienceWorldName() : string{ return $this->experienceWorldName; }
42
43 public function getCreatorId() : string{ return $this->creatorId; }
44
45 public function getTargetId() : UuidInterface{ return $this->targetId; }
46
47 public function getScenarioId() : string{ return $this->scenarioId; }
48
49 public function getServerId() : string{ return $this->serverId; }
50
51 public static function read(ByteBufferReader $in) : self{
52 $experienceId = CommonTypes::getUUID($in);
53 $experienceName = CommonTypes::getString($in);
54 $experienceWorldId = CommonTypes::getUUID($in);
55 $experienceWorldName = CommonTypes::getString($in);
56 $creatorId = CommonTypes::getString($in);
57 $targetId = CommonTypes::getUUID($in);
58 $scenarioId = CommonTypes::getString($in);
59 $serverId = CommonTypes::getString($in);
60
61 return new self(
62 $experienceId,
63 $experienceName,
64 $experienceWorldId,
65 $experienceWorldName,
66 $creatorId,
67 $targetId,
68 $scenarioId,
69 $serverId,
70 );
71 }
72
73 public function write(ByteBufferWriter $out) : void{
74 CommonTypes::putUUID($out, $this->experienceId);
75 CommonTypes::putString($out, $this->experienceName);
76 CommonTypes::putUUID($out, $this->experienceWorldId);
77 CommonTypes::putString($out, $this->experienceWorldName);
78 CommonTypes::putString($out, $this->creatorId);
79 CommonTypes::putUUID($out, $this->targetId);
80 CommonTypes::putString($out, $this->scenarioId);
81 CommonTypes::putString($out, $this->serverId);
82 }
83}