From 9453e91892013f3ee20e196190e27b755b28980c Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 14 Apr 2024 17:23:33 +0100 Subject: [PATCH] fix bug with bedrock servers not being parsed properly --- .../backend/model/server/BedrockMinecraftServer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/xyz/mcutils/backend/model/server/BedrockMinecraftServer.java b/src/main/java/xyz/mcutils/backend/model/server/BedrockMinecraftServer.java index a969ac3..1a548f1 100644 --- a/src/main/java/xyz/mcutils/backend/model/server/BedrockMinecraftServer.java +++ b/src/main/java/xyz/mcutils/backend/model/server/BedrockMinecraftServer.java @@ -42,6 +42,9 @@ public final class BedrockMinecraftServer extends MinecraftServer { /** * Create a new Bedrock Minecraft server. + *

+ * Token Format + *

* * @param hostname the hostname of the server * @param ip the IP address of the server @@ -51,12 +54,13 @@ public final class BedrockMinecraftServer extends MinecraftServer { */ @NonNull public static BedrockMinecraftServer create(@NonNull String hostname, String ip, int port, DNSRecord[] records, @NonNull String token) { + System.out.println(token); String[] split = token.split(";"); // Split the token Edition edition = Edition.valueOf(split[0]); Version version = new Version(Integer.parseInt(split[2]), split[3]); Players players = new Players(Integer.parseInt(split[4]), Integer.parseInt(split[5]), null); MOTD motd = MOTD.create(split[1] + "\n" + split[7]); - GameMode gameMode = new GameMode(split[8], Integer.parseInt(split[9])); + GameMode gameMode = new GameMode(split[8], split.length > 9 ? Integer.parseInt(split[9]) : -1); return new BedrockMinecraftServer( split[6], hostname,