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 =
"";
39 public string $filteredTitleText =
"";
51 string $platformOnlineId,
52 string $filteredTitleText,
55 $result->type = $type;
56 $result->text = $text;
57 $result->fadeInTime = $fadeInTime;
58 $result->stayTime = $stayTime;
59 $result->fadeOutTime = $fadeOutTime;
60 $result->xuid = $xuid;
61 $result->platformOnlineId = $platformOnlineId;
62 $result->filteredTitleText = $filteredTitleText;
67 $this->type = $in->getVarInt();
73 $this->platformOnlineId = $in->
getString();
74 $this->filteredTitleText = $in->
getString();
78 $out->putVarInt($this->type);
79 $out->putString($this->text);
83 $out->putString($this->xuid);
84 $out->putString($this->platformOnlineId);
85 $out->putString($this->filteredTitleText);
89 return $handler->handleSetTitle($this);
92 private static function type(
int $type) : self{
94 $result->type = $type;
98 private static function text(
int $type,
string $text) : self{
99 $result = self::type($type);
100 $result->text = $text;
104 public static function title(
string $text) : self{
105 return self::text(self::TYPE_SET_TITLE, $text);
108 public static function subtitle(
string $text) : self{
109 return self::text(self::TYPE_SET_SUBTITLE, $text);
112 public static function actionBarMessage(
string $text) : self{
113 return self::text(self::TYPE_SET_ACTIONBAR_MESSAGE, $text);
116 public static function clearTitle() : self{
117 return self::type(self::TYPE_CLEAR_TITLE);
120 public static function resetTitleOptions() : self{
121 return self::type(self::TYPE_RESET_TITLE);
124 public static function setAnimationTimes(
int $fadeIn,
int $stay,
int $fadeOut) : self{
125 $result = self::type(self::TYPE_SET_ANIMATION_TIMES);
126 $result->fadeInTime = $fadeIn;
127 $result->stayTime = $stay;
128 $result->fadeOutTime = $fadeOut;
static create(int $type, string $text, int $fadeInTime, int $stayTime, int $fadeOutTime, string $xuid, string $platformOnlineId, string $filteredTitleText,)