23 public const NETWORK_ID = ProtocolInfo::SET_TITLE_PACKET;
25 public const TYPE_CLEAR_TITLE = 0;
26 public const TYPE_RESET_TITLE = 1;
27 public const TYPE_SET_TITLE = 2;
28 public const TYPE_SET_SUBTITLE = 3;
29 public const TYPE_SET_ACTIONBAR_MESSAGE = 4;
30 public const TYPE_SET_ANIMATION_TIMES = 5;
31 public const TYPE_SET_TITLE_JSON = 6;
32 public const TYPE_SET_SUBTITLE_JSON = 7;
33 public const TYPE_SET_ACTIONBAR_MESSAGE_JSON = 8;
36 public string $text =
"";
37 public int $fadeInTime = 0;
38 public int $stayTime = 0;
39 public int $fadeOutTime = 0;
40 public string $xuid =
"";
41 public string $platformOnlineId =
"";
42 public string $filteredTitleText =
"";
54 string $platformOnlineId,
55 string $filteredTitleText,
58 $result->type = $type;
59 $result->text = $text;
60 $result->fadeInTime = $fadeInTime;
61 $result->stayTime = $stayTime;
62 $result->fadeOutTime = $fadeOutTime;
63 $result->xuid = $xuid;
64 $result->platformOnlineId = $platformOnlineId;
65 $result->filteredTitleText = $filteredTitleText;
70 $this->type = VarInt::readSignedInt($in);
71 $this->text = CommonTypes::getString($in);
72 $this->fadeInTime = VarInt::readSignedInt($in);
73 $this->stayTime = VarInt::readSignedInt($in);
74 $this->fadeOutTime = VarInt::readSignedInt($in);
75 $this->xuid = CommonTypes::getString($in);
76 $this->platformOnlineId = CommonTypes::getString($in);
77 $this->filteredTitleText = CommonTypes::getString($in);
81 VarInt::writeSignedInt($out, $this->type);
82 CommonTypes::putString($out, $this->text);
83 VarInt::writeSignedInt($out, $this->fadeInTime);
84 VarInt::writeSignedInt($out, $this->stayTime);
85 VarInt::writeSignedInt($out, $this->fadeOutTime);
86 CommonTypes::putString($out, $this->xuid);
87 CommonTypes::putString($out, $this->platformOnlineId);
88 CommonTypes::putString($out, $this->filteredTitleText);
92 return $handler->handleSetTitle($this);
95 private static function type(
int $type) : self{
97 $result->type = $type;
101 private static function text(
int $type,
string $text) : self{
102 $result = self::type($type);
103 $result->text = $text;
107 public static function title(
string $text) : self{
108 return self::text(self::TYPE_SET_TITLE, $text);
111 public static function subtitle(
string $text) : self{
112 return self::text(self::TYPE_SET_SUBTITLE, $text);
115 public static function actionBarMessage(
string $text) : self{
116 return self::text(self::TYPE_SET_ACTIONBAR_MESSAGE, $text);
119 public static function clearTitle() : self{
120 return self::type(self::TYPE_CLEAR_TITLE);
123 public static function resetTitleOptions() : self{
124 return self::type(self::TYPE_RESET_TITLE);
127 public static function setAnimationTimes(
int $fadeIn,
int $stay,
int $fadeOut) : self{
128 $result = self::type(self::TYPE_SET_ANIMATION_TIMES);
129 $result->fadeInTime = $fadeIn;
130 $result->stayTime = $stay;
131 $result->fadeOutTime = $fadeOut;
static create(int $type, string $text, int $fadeInTime, int $stayTime, int $fadeOutTime, string $xuid, string $platformOnlineId, string $filteredTitleText,)