From 795c97401c8a424d12a8c759f457c939d695a143 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 10 Apr 2024 14:24:55 +0100 Subject: [PATCH] add more data to the java server pinger --- .../model/mojang/JavaServerStatusToken.java | 19 +++++++++++ .../model/server/JavaMinecraftServer.java | 32 +++++++++++++++++-- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/main/java/cc.fascinated/model/mojang/JavaServerStatusToken.java b/src/main/java/cc.fascinated/model/mojang/JavaServerStatusToken.java index 0b5c9b8..57f7f22 100644 --- a/src/main/java/cc.fascinated/model/mojang/JavaServerStatusToken.java +++ b/src/main/java/cc.fascinated/model/mojang/JavaServerStatusToken.java @@ -47,4 +47,23 @@ public final class JavaServerStatusToken { * The favicon of the server. */ private final String favicon; + + /** + * Whether the server prevents chat reports. + */ + private boolean preventsChatReports; + + /** + * Whether the server enforces secure chat. + */ + private boolean enforcesSecureChat; + + /** + * Whether the server has previews chat enabled. + *

+ * Chat Preview sends chat messages to the server as they are typed, even before they're sent. + * More information + *

+ */ + private boolean previewsChat; } diff --git a/src/main/java/cc.fascinated/model/server/JavaMinecraftServer.java b/src/main/java/cc.fascinated/model/server/JavaMinecraftServer.java index d827701..d0057cb 100644 --- a/src/main/java/cc.fascinated/model/server/JavaMinecraftServer.java +++ b/src/main/java/cc.fascinated/model/server/JavaMinecraftServer.java @@ -40,18 +40,41 @@ public final class JavaMinecraftServer extends MinecraftServer { */ private ForgeData forgeData; + /** + * Whether the server prevents chat reports. + */ + private boolean preventsChatReports; + + /** + * Whether the server enforces secure chat. + */ + private boolean enforcesSecureChat; + + /** + * Whether the server has previews chat enabled. + *

+ * Chat Preview sends chat messages to the server as they are typed, even before they're sent. + * More information + *

+ */ + private boolean previewsChat; + /** * The mojang banned status of the server. */ private boolean mojangBanned; - public JavaMinecraftServer(String hostname, String ip, int port, MOTD motd, Players players, - @NonNull Version version, Favicon favicon, ForgeModInfo modInfo, ForgeData forgeData) { + public JavaMinecraftServer(String hostname, String ip, int port, MOTD motd, Players players, @NonNull Version version, + Favicon favicon, ForgeModInfo modInfo, ForgeData forgeData, boolean preventsChatReports, + boolean enforcesSecureChat, boolean previewsChat) { super(hostname, ip, port, motd, players); this.version = version; this.favicon = favicon; this.modInfo = modInfo; this.forgeData = forgeData; + this.preventsChatReports = preventsChatReports; + this.enforcesSecureChat = enforcesSecureChat; + this.previewsChat = previewsChat; } /** @@ -78,7 +101,10 @@ public final class JavaMinecraftServer extends MinecraftServer { token.getVersion().detailedCopy(), JavaMinecraftServer.Favicon.create(token.getFavicon(), ServerUtils.getAddress(hostname, port)), token.getModInfo(), - token.getForgeData() + token.getForgeData(), + token.isPreventsChatReports(), + token.isEnforcesSecureChat(), + token.isPreviewsChat() ); }