aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/cowtipper/cowlection/util
diff options
context:
space:
mode:
authorCow <cow@volloeko.de>2022-10-03 13:24:07 +0200
committerCow <cow@volloeko.de>2022-10-03 13:24:07 +0200
commit5ff6bdf6c27b7d27dbb501b52b5a8f7eb7f87cbd (patch)
tree49f4f4475f17c32ef3a40103133fb3e47b40e5b1 /src/main/java/de/cowtipper/cowlection/util
parent4566b79b70728c1f81b4bd619f399c2bce293e32 (diff)
downloadCowlection-5ff6bdf6c27b7d27dbb501b52b5a8f7eb7f87cbd.tar.gz
Cowlection-5ff6bdf6c27b7d27dbb501b52b5a8f7eb7f87cbd.tar.bz2
Cowlection-5ff6bdf6c27b7d27dbb501b52b5a8f7eb7f87cbd.zip
Fixed completely broken API based features
- username lookup by uuid - determination of active/selected profile - also replaced 'last save' with 'last profile save'
Diffstat (limited to 'src/main/java/de/cowtipper/cowlection/util')
-rw-r--r--src/main/java/de/cowtipper/cowlection/util/ApiUtils.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/util/ApiUtils.java b/src/main/java/de/cowtipper/cowlection/util/ApiUtils.java
index 3a303e5..0695c1e 100644
--- a/src/main/java/de/cowtipper/cowlection/util/ApiUtils.java
+++ b/src/main/java/de/cowtipper/cowlection/util/ApiUtils.java
@@ -1,6 +1,6 @@
package de.cowtipper.cowlection.util;
-import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;
import com.mojang.util.UUIDTypeAdapter;
@@ -28,7 +28,7 @@ import java.util.concurrent.Executors;
public class ApiUtils {
public static final String UUID_NOT_FOUND = "UUID-NOT-FOUND";
private static final String NAME_TO_UUID_URL = "https://api.mojang.com/users/profiles/minecraft/";
- private static final String UUID_TO_NAME_URL = "https://api.mojang.com/user/profiles/%s/names";
+ private static final String UUID_TO_NAME_URL = "https://api.mojang.com/user/profile/%s";
private static final String ONLINE_STATUS_URL = "https://api.hypixel.net/status?key=%s&uuid=%s";
private static final String SKYBLOCK_STATS_URL = "https://api.hypixel.net/skyblock/profiles?key=%s&uuid=%s";
private static final String BAZAAR_URL = "https://api.hypixel.net/skyblock/bazaar";
@@ -66,9 +66,9 @@ public class ApiUtils {
if (reader == null) {
return UUID_NOT_FOUND;
} else {
- JsonArray nameHistoryData = new JsonParser().parse(reader).getAsJsonArray();
- if (nameHistoryData.size() > 0) {
- return nameHistoryData.get(nameHistoryData.size() - 1).getAsJsonObject().get("name").getAsString();
+ JsonObject profile = new JsonParser().parse(reader).getAsJsonObject();
+ if (profile.has("name")) {
+ return profile.get("name").getAsString();
}
}
} catch (IOException | JsonSyntaxException e) {