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()); }