diff --git a/src/main/java/net/minestom/server/network/packet/server/play/AdvancementsPacket.java b/src/main/java/net/minestom/server/network/packet/server/play/AdvancementsPacket.java index 0eee0aa48..6ed240577 100644 --- a/src/main/java/net/minestom/server/network/packet/server/play/AdvancementsPacket.java +++ b/src/main/java/net/minestom/server/network/packet/server/play/AdvancementsPacket.java @@ -1,5 +1,6 @@ package net.minestom.server.network.packet.server.play; +import net.minestom.server.chat.Chat; import net.minestom.server.item.ItemStack; import net.minestom.server.network.packet.PacketWriter; import net.minestom.server.network.packet.server.ServerPacket; @@ -91,8 +92,8 @@ public class AdvancementsPacket implements ServerPacket { public float y; private void write(PacketWriter writer) { - writer.writeSizedString(title); - writer.writeSizedString(description); + writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(title))); + writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(title))); writer.writeItemStack(icon); writer.writeVarInt(frameType.ordinal()); writer.writeInt(flags); diff --git a/src/main/java/net/minestom/server/network/packet/server/play/BossBarPacket.java b/src/main/java/net/minestom/server/network/packet/server/play/BossBarPacket.java index 173f4c508..b3be2424d 100644 --- a/src/main/java/net/minestom/server/network/packet/server/play/BossBarPacket.java +++ b/src/main/java/net/minestom/server/network/packet/server/play/BossBarPacket.java @@ -2,6 +2,7 @@ package net.minestom.server.network.packet.server.play; import net.minestom.server.bossbar.BarColor; import net.minestom.server.bossbar.BarDivision; +import net.minestom.server.chat.Chat; import net.minestom.server.network.packet.PacketWriter; import net.minestom.server.network.packet.server.ServerPacket; import net.minestom.server.network.packet.server.ServerPacketIdentifier; @@ -27,7 +28,7 @@ public class BossBarPacket implements ServerPacket { switch (action) { case ADD: - writer.writeSizedString(title); + writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(title))); writer.writeFloat(health); writer.writeVarInt(color.ordinal()); writer.writeVarInt(division.ordinal()); @@ -40,7 +41,7 @@ public class BossBarPacket implements ServerPacket { writer.writeFloat(health); break; case UPDATE_TITLE: - writer.writeSizedString(title); + writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(title))); break; case UPDATE_STYLE: writer.writeVarInt(color.ordinal()); diff --git a/src/main/java/net/minestom/server/network/packet/server/play/DisconnectPacket.java b/src/main/java/net/minestom/server/network/packet/server/play/DisconnectPacket.java index 4eaffd5f8..034f19d7d 100644 --- a/src/main/java/net/minestom/server/network/packet/server/play/DisconnectPacket.java +++ b/src/main/java/net/minestom/server/network/packet/server/play/DisconnectPacket.java @@ -1,5 +1,6 @@ package net.minestom.server.network.packet.server.play; +import net.minestom.server.chat.Chat; import net.minestom.server.network.packet.PacketWriter; import net.minestom.server.network.packet.server.ServerPacket; import net.minestom.server.network.packet.server.ServerPacketIdentifier; @@ -10,7 +11,7 @@ public class DisconnectPacket implements ServerPacket { @Override public void write(PacketWriter writer) { - writer.writeSizedString(message); + writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(message))); } @Override diff --git a/src/main/java/net/minestom/server/network/packet/server/play/ScoreboardObjectivePacket.java b/src/main/java/net/minestom/server/network/packet/server/play/ScoreboardObjectivePacket.java index ba23eb20d..ebf4e586a 100644 --- a/src/main/java/net/minestom/server/network/packet/server/play/ScoreboardObjectivePacket.java +++ b/src/main/java/net/minestom/server/network/packet/server/play/ScoreboardObjectivePacket.java @@ -1,5 +1,6 @@ package net.minestom.server.network.packet.server.play; +import net.minestom.server.chat.Chat; import net.minestom.server.network.packet.PacketWriter; import net.minestom.server.network.packet.server.ServerPacket; import net.minestom.server.network.packet.server.ServerPacketIdentifier; @@ -17,7 +18,7 @@ public class ScoreboardObjectivePacket implements ServerPacket { writer.writeByte(mode); if (mode == 0 || mode == 2) { - writer.writeSizedString(objectiveValue); + writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(objectiveValue))); writer.writeVarInt(type); } } diff --git a/src/main/java/net/minestom/server/network/packet/server/play/TeamsPacket.java b/src/main/java/net/minestom/server/network/packet/server/play/TeamsPacket.java index b48e91de4..33584cc32 100644 --- a/src/main/java/net/minestom/server/network/packet/server/play/TeamsPacket.java +++ b/src/main/java/net/minestom/server/network/packet/server/play/TeamsPacket.java @@ -27,13 +27,13 @@ public class TeamsPacket implements ServerPacket { switch (action) { case CREATE_TEAM: case UPDATE_TEAM_INFO: - writer.writeSizedString(teamDisplayName); + writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(teamDisplayName))); writer.writeByte(friendlyFlags); writer.writeSizedString(nameTagVisibility.getIdentifier()); writer.writeSizedString(collisionRule.getIdentifier()); writer.writeVarInt(teamColor); - writer.writeSizedString(teamPrefix); - writer.writeSizedString(teamSuffix); + writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(teamPrefix))); + writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(teamSuffix))); break; case REMOVE_TEAM: diff --git a/src/main/java/net/minestom/server/network/packet/server/play/TitlePacket.java b/src/main/java/net/minestom/server/network/packet/server/play/TitlePacket.java index 77aef0c10..e7d2d0b0b 100644 --- a/src/main/java/net/minestom/server/network/packet/server/play/TitlePacket.java +++ b/src/main/java/net/minestom/server/network/packet/server/play/TitlePacket.java @@ -25,13 +25,13 @@ public class TitlePacket implements ServerPacket { switch (action) { case SET_TITLE: - writer.writeSizedString(titleText); + writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(titleText))); break; case SET_SUBTITLE: - writer.writeSizedString(subtitleText); + writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(subtitleText))); break; case SET_ACTION_BAR: - writer.writeSizedString(actionBarText); + writer.writeSizedString(Chat.toJsonString(Chat.fromLegacyText(actionBarText))); break; case SET_TIMES_AND_DISPLAY: writer.writeInt(fadeIn);