maybe fix velocity query exception

This commit is contained in:
Draycia committed 2021-12-08 13:11:27 -08:00
1 parent 667010a924
commit 4b9556b7ab
1 file changed
+2 -3
@@ -147,7 +147,7 @@ public final class CarbonServerVelocity implements CarbonServer, ForwardingAudie
try { try {
final @Nullable JsonObject json = this.queryMojang(new URI("https://api.mojang.com/users/profiles/minecraft/" + username)); final @Nullable JsonObject json = this.queryMojang(new URI("https://api.mojang.com/users/profiles/minecraft/" + username));
return FastUuidSansHyphens.parseUuid(json.get("uuid").getAsString()); return FastUuidSansHyphens.parseUuid(json.get("id").getAsString());
} catch (final URISyntaxException exception) { } catch (final URISyntaxException exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
@@ -188,8 +188,7 @@ public final class CarbonServerVelocity implements CarbonServer, ForwardingAudie
this.client.send(request, HttpResponse.BodyHandlers.ofString()); this.client.send(request, HttpResponse.BodyHandlers.ofString());
final String mojangResponse = response.body(); final String mojangResponse = response.body();
final JsonArray jsonArray = this.gson.fromJson(mojangResponse, JsonObject.class).getAsJsonArray(); return this.gson.fromJson(mojangResponse, JsonObject.class);
return (JsonObject) jsonArray.get(1);
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;