13
0
geforkt von Mirrors/Velocity

fix the order of title packages (#572)

Dieser Commit ist enthalten in:
Joshua Dean Küpper 2021-09-01 13:42:44 +02:00 committet von GitHub
Ursprung 1b390c3eff
Commit 9e38aec129
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -370,18 +370,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
GsonComponentSerializer serializer = ProtocolUtils.getJsonChatSerializer(this GsonComponentSerializer serializer = ProtocolUtils.getJsonChatSerializer(this
.getProtocolVersion()); .getProtocolVersion());
GenericTitlePacket titlePkt = GenericTitlePacket.constructTitlePacket(
GenericTitlePacket.ActionType.SET_TITLE, this.getProtocolVersion());
titlePkt.setComponent(serializer.serialize(translateMessage(title.title())));
connection.delayedWrite(titlePkt);
GenericTitlePacket subtitlePkt = GenericTitlePacket.constructTitlePacket(
GenericTitlePacket.ActionType.SET_SUBTITLE, this.getProtocolVersion());
subtitlePkt.setComponent(serializer.serialize(translateMessage(title.subtitle())));
connection.delayedWrite(subtitlePkt);
GenericTitlePacket timesPkt = GenericTitlePacket.constructTitlePacket( GenericTitlePacket timesPkt = GenericTitlePacket.constructTitlePacket(
GenericTitlePacket.ActionType.SET_TIMES, this.getProtocolVersion()); GenericTitlePacket.ActionType.SET_TIMES, this.getProtocolVersion());
net.kyori.adventure.title.Title.Times times = title.times(); net.kyori.adventure.title.Title.Times times = title.times();
if (times != null) { if (times != null) {
timesPkt.setFadeIn((int) DurationUtils.toTicks(times.fadeIn())); timesPkt.setFadeIn((int) DurationUtils.toTicks(times.fadeIn()));
@ -390,6 +380,16 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
} }
connection.delayedWrite(timesPkt); connection.delayedWrite(timesPkt);
GenericTitlePacket subtitlePkt = GenericTitlePacket.constructTitlePacket(
GenericTitlePacket.ActionType.SET_SUBTITLE, this.getProtocolVersion());
subtitlePkt.setComponent(serializer.serialize(translateMessage(title.subtitle())));
connection.delayedWrite(subtitlePkt);
GenericTitlePacket titlePkt = GenericTitlePacket.constructTitlePacket(
GenericTitlePacket.ActionType.SET_TITLE, this.getProtocolVersion());
titlePkt.setComponent(serializer.serialize(translateMessage(title.title())));
connection.delayedWrite(titlePkt);
connection.flush(); connection.flush();
} }
} }