13declare(strict_types=1);
15namespace pocketmine\network\mcpe\protocol;
20 public const NETWORK_ID = ProtocolInfo::SET_TITLE_PACKET;
22 public const TYPE_CLEAR_TITLE = 0;
23 public const TYPE_RESET_TITLE = 1;
24 public const TYPE_SET_TITLE = 2;
25 public const TYPE_SET_SUBTITLE = 3;
26 public const TYPE_SET_ACTIONBAR_MESSAGE = 4;
27 public const TYPE_SET_ANIMATION_TIMES = 5;
28 public const TYPE_SET_TITLE_JSON = 6;
29 public const TYPE_SET_SUBTITLE_JSON = 7;
30 public const TYPE_SET_ACTIONBAR_MESSAGE_JSON = 8;
33 public string $text =
"";
34 public int $fadeInTime = 0;
35 public int $stayTime = 0;
36 public int $fadeOutTime = 0;
37 public string $xuid =
"";
38 public string $platformOnlineId =
"";
50 string $platformOnlineId,
53 $result->type = $type;
54 $result->text = $text;
55 $result->fadeInTime = $fadeInTime;
56 $result->stayTime = $stayTime;
57 $result->fadeOutTime = $fadeOutTime;
58 $result->xuid = $xuid;
59 $result->platformOnlineId = $platformOnlineId;
64 $this->type = $in->getVarInt();
70 $this->platformOnlineId = $in->
getString();
74 $out->putVarInt($this->type);
75 $out->putString($this->text);
79 $out->putString($this->xuid);
80 $out->putString($this->platformOnlineId);
84 return $handler->handleSetTitle($this);
87 private static function type(
int $type) : self{
89 $result->type = $type;
93 private static function text(
int $type,
string $text) : self{
94 $result = self::type($type);
95 $result->text = $text;
99 public static function title(
string $text) : self{
100 return self::text(self::TYPE_SET_TITLE, $text);
103 public static function subtitle(
string $text) : self{
104 return self::text(self::TYPE_SET_SUBTITLE, $text);
107 public static function actionBarMessage(
string $text) : self{
108 return self::text(self::TYPE_SET_ACTIONBAR_MESSAGE, $text);
111 public static function clearTitle() : self{
112 return self::type(self::TYPE_CLEAR_TITLE);
115 public static function resetTitleOptions() : self{
116 return self::type(self::TYPE_RESET_TITLE);
119 public static function setAnimationTimes(
int $fadeIn,
int $stay,
int $fadeOut) : self{
120 $result = self::type(self::TYPE_SET_ANIMATION_TIMES);
121 $result->fadeInTime = $fadeIn;
122 $result->stayTime = $stay;
123 $result->fadeOutTime = $fadeOut;
handle(PacketHandlerInterface $handler)
decodePayload(PacketSerializer $in)
static create(int $type, string $text, int $fadeInTime, int $stayTime, int $fadeOutTime, string $xuid, string $platformOnlineId,)
encodePayload(PacketSerializer $out)