Support 1.19.1

This commit is contained in:
Derek Lee 2022-07-31 17:26:17 -07:00
parent 2a7599f04b
commit 51d32ce765

View File

@ -430,7 +430,11 @@ public class Format {
public static PacketContainer createPacketPlayOutChat(String json) { public static PacketContainer createPacketPlayOutChat(String json) {
final PacketContainer container; final PacketContainer container;
if (VersionHandler.isUnder_1_19()) { if (VersionHandler.isAbove_1_19()) {
container = new PacketContainer(PacketType.Play.Server.SYSTEM_CHAT);
container.getStrings().write(0, json);
container.getBooleans().write(0, false);
} else if (VersionHandler.isUnder_1_19()) {
WrappedChatComponent component = WrappedChatComponent.fromJson(json); WrappedChatComponent component = WrappedChatComponent.fromJson(json);
container = new PacketContainer(PacketType.Play.Server.CHAT); container = new PacketContainer(PacketType.Play.Server.CHAT);
container.getModifier().writeDefaults(); container.getModifier().writeDefaults();
@ -445,7 +449,11 @@ public class Format {
public static PacketContainer createPacketPlayOutChat(WrappedChatComponent component) { public static PacketContainer createPacketPlayOutChat(WrappedChatComponent component) {
final PacketContainer container; final PacketContainer container;
if (VersionHandler.isUnder_1_19()) { if (VersionHandler.isAbove_1_19()) {
container = new PacketContainer(PacketType.Play.Server.SYSTEM_CHAT);
container.getStrings().write(0, component.getJson());
container.getBooleans().write(0, false);
} else if (VersionHandler.isUnder_1_19()) {
container = new PacketContainer(PacketType.Play.Server.CHAT); container = new PacketContainer(PacketType.Play.Server.CHAT);
container.getModifier().writeDefaults(); container.getModifier().writeDefaults();
container.getChatComponents().write(0, component); container.getChatComponents().write(0, component);