From dabe2e8106067c0dc8adbd8293561e7f7f90a989 Mon Sep 17 00:00:00 2001 From: Gravita Date: Tue, 12 Oct 2021 17:34:44 +0700 Subject: [PATCH] [FIX] Ping Server --- .../java/pro/gravit/launchserver/helper/MakeProfileHelper.java | 2 +- .../src/main/java/pro/gravit/launcher/client/ServerPinger.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/helper/MakeProfileHelper.java b/LaunchServer/src/main/java/pro/gravit/launchserver/helper/MakeProfileHelper.java index bfd05f6a..4bee8597 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/helper/MakeProfileHelper.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/helper/MakeProfileHelper.java @@ -24,7 +24,7 @@ public static ClientProfile makeProfile(ClientProfile.Version version, String ti builder.setTitle(title); builder.setUuid(UUID.randomUUID()); builder.setMainClass(getMainClassByVersion(version, options)); - builder.setServers(List.of(new ClientProfile.ServerProfile(title, "localhost", 25535))); + builder.setServers(List.of(new ClientProfile.ServerProfile(title, "localhost", 25565))); // ------------ builder.setUpdateVerify(List.of("libraries", "natives", "mods", "minecraft.jar", "forge.jar", "liteloader.jar")); { diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ServerPinger.java b/Launcher/src/main/java/pro/gravit/launcher/client/ServerPinger.java index 21cb94da..09ef1511 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ServerPinger.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ServerPinger.java @@ -163,6 +163,9 @@ private Result modernPing(HInput input, HOutput output) throws IOException { // Parse JSON response JsonObject object = JsonParser.parseString(response).getAsJsonObject(); + if(object.has("error")) { + throw new IOException(object.get("error").getAsString()); + } JsonObject playersObject = object.get("players").getAsJsonObject(); int online = playersObject.get("online").getAsInt(); int max = playersObject.get("max").getAsInt();