mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] Ping Server
This commit is contained in:
parent
58dfc472ac
commit
dabe2e8106
2 changed files with 4 additions and 1 deletions
|
@ -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"));
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue