diff --git a/src/main/java/com/marcusslover/plus/lib/mojang/MojangProfileAPI.java b/src/main/java/com/marcusslover/plus/lib/mojang/MojangProfileAPI.java index dc918f6..6cc0289 100644 --- a/src/main/java/com/marcusslover/plus/lib/mojang/MojangProfileAPI.java +++ b/src/main/java/com/marcusslover/plus/lib/mojang/MojangProfileAPI.java @@ -101,9 +101,13 @@ public static void clean(@NotNull UUID uuid) { } catch (IllegalArgumentException e) { throw new RuntimeException("Could not parse UUID from Mojang API response", e); } + if (!json.has("name")) { + throw new RuntimeException("Invalid response from Mojang API"); + } + String name = json.get("name").getAsString(); // Create the profile - MojangProfile mojangProfile = new MojangProfile(uuid, username, System.currentTimeMillis()); + MojangProfile mojangProfile = new MojangProfile(uuid, name, System.currentTimeMillis()); // Cache the profile CACHED_PROFILE_MAP.put(uuid, mojangProfile);