From a0cd1e1cef2e4ef3987381376ddaaacc8e20cab8 Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Thu, 23 Nov 2023 18:32:05 -0500 Subject: [PATCH] Bump to release `1.20.2-1` (#766) * Better take on the previous commit * Bump to release --- pom.xml | 2 +- .../mc/protocol/data/status/ServerStatusInfo.java | 3 +-- .../clientbound/ClientboundStatusResponsePacket.java | 10 ++++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 35412744d..5e8322f73 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.steveice10 mcprotocollib - 1.20.2-1-SNAPSHOT + 1.20.2-1 jar MCProtocolLib diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/status/ServerStatusInfo.java b/src/main/java/com/github/steveice10/mc/protocol/data/status/ServerStatusInfo.java index 5ded28bfd..17efd43a1 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/status/ServerStatusInfo.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/status/ServerStatusInfo.java @@ -6,7 +6,6 @@ import lombok.NonNull; import lombok.Setter; import net.kyori.adventure.text.Component; -import org.jetbrains.annotations.Nullable; @Data @Setter(AccessLevel.NONE) @@ -16,5 +15,5 @@ public class ServerStatusInfo { private @NonNull PlayerInfo playerInfo; private @NonNull Component description; private byte[] iconPng; - private @Nullable Boolean enforcesSecureChat; + private boolean enforcesSecureChat; } diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/status/clientbound/ClientboundStatusResponsePacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/status/clientbound/ClientboundStatusResponsePacket.java index 70fced4a0..6a501ecf1 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/status/clientbound/ClientboundStatusResponsePacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/status/clientbound/ClientboundStatusResponsePacket.java @@ -28,6 +28,10 @@ @With @AllArgsConstructor public class ClientboundStatusResponsePacket implements MinecraftPacket { + + // vanilla behavior falls back to false if the field was not sent + private static final boolean ENFORCES_SECURE_CHAT_DEFAULT = false; + private final @NonNull ServerStatusInfo info; public ClientboundStatusResponsePacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException { @@ -54,7 +58,7 @@ public ClientboundStatusResponsePacket(ByteBuf in, MinecraftCodecHelper helper) icon = this.stringToIcon(obj.get("favicon").getAsString()); } - Boolean enforcesSecureChat = null; + boolean enforcesSecureChat = ENFORCES_SECURE_CHAT_DEFAULT; if (obj.has("enforcesSecureChat")) { enforcesSecureChat = obj.get("enforcesSecureChat").getAsBoolean(); } @@ -88,9 +92,7 @@ public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOExcepti if (this.info.getIconPng() != null) { obj.addProperty("favicon", this.iconToString(this.info.getIconPng())); } - if (this.info.getEnforcesSecureChat() != null) { - obj.addProperty("enforcesSecureChat", this.info.getEnforcesSecureChat()); - } + obj.addProperty("enforcesSecureChat", this.info.isEnforcesSecureChat()); helper.writeString(out, obj.toString()); }