add more data to the java server pinger

This commit is contained in:
Lee 2024-04-10 14:24:55 +01:00
parent cd3738a2b9
commit 795c97401c
2 changed files with 48 additions and 3 deletions

@ -47,4 +47,23 @@ public final class JavaServerStatusToken {
* The favicon of the server. * The favicon of the server.
*/ */
private final String favicon; 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.
* <p>
* Chat Preview sends chat messages to the server as they are typed, even before they're sent.
* <a href="https://www.minecraft.net/es-mx/article/minecraft-snapshot-22w19a">More information</a>
* </p>
*/
private boolean previewsChat;
} }

@ -40,18 +40,41 @@ public final class JavaMinecraftServer extends MinecraftServer {
*/ */
private ForgeData forgeData; 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.
* <p>
* Chat Preview sends chat messages to the server as they are typed, even before they're sent.
* <a href="https://www.minecraft.net/es-mx/article/minecraft-snapshot-22w19a">More information</a>
* </p>
*/
private boolean previewsChat;
/** /**
* The mojang banned status of the server. * The mojang banned status of the server.
*/ */
private boolean mojangBanned; private boolean mojangBanned;
public JavaMinecraftServer(String hostname, String ip, int port, MOTD motd, Players players, public JavaMinecraftServer(String hostname, String ip, int port, MOTD motd, Players players, @NonNull Version version,
@NonNull Version version, Favicon favicon, ForgeModInfo modInfo, ForgeData forgeData) { Favicon favicon, ForgeModInfo modInfo, ForgeData forgeData, boolean preventsChatReports,
boolean enforcesSecureChat, boolean previewsChat) {
super(hostname, ip, port, motd, players); super(hostname, ip, port, motd, players);
this.version = version; this.version = version;
this.favicon = favicon; this.favicon = favicon;
this.modInfo = modInfo; this.modInfo = modInfo;
this.forgeData = forgeData; 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(), token.getVersion().detailedCopy(),
JavaMinecraftServer.Favicon.create(token.getFavicon(), ServerUtils.getAddress(hostname, port)), JavaMinecraftServer.Favicon.create(token.getFavicon(), ServerUtils.getAddress(hostname, port)),
token.getModInfo(), token.getModInfo(),
token.getForgeData() token.getForgeData(),
token.isPreventsChatReports(),
token.isEnforcesSecureChat(),
token.isPreviewsChat()
); );
} }