From 9e38aec129715e0c1df4f85545abb8bb6fcef091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Dean=20K=C3=BCpper?= Date: Wed, 1 Sep 2021 13:42:44 +0200 Subject: [PATCH] fix the order of title packages (#572) --- .../connection/client/ConnectedPlayer.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index 24d203b13..6006bfc36 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -370,18 +370,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { GsonComponentSerializer serializer = ProtocolUtils.getJsonChatSerializer(this .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.ActionType.SET_TIMES, this.getProtocolVersion()); + GenericTitlePacket.ActionType.SET_TIMES, this.getProtocolVersion()); net.kyori.adventure.title.Title.Times times = title.times(); if (times != null) { timesPkt.setFadeIn((int) DurationUtils.toTicks(times.fadeIn())); @@ -390,6 +380,16 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { } 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(); } }