diff --git a/pom.xml b/pom.xml index a055bb2..6e3ca1d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.dpkgsoft mojang - 1.3 + 1.4 diff --git a/src/main/java/com/dpkgsoft/mojang/MojangAPI.java b/src/main/java/com/dpkgsoft/mojang/MojangAPI.java index 3142c98..11771d5 100644 --- a/src/main/java/com/dpkgsoft/mojang/MojangAPI.java +++ b/src/main/java/com/dpkgsoft/mojang/MojangAPI.java @@ -112,6 +112,19 @@ public static Profile[] getProfiles(String[] playerNames) throws APIException { } } + public static Profile getProfileByUuid(String uuid) throws APIException { + try { + String data = Utils.get(SESSION_ENDPOINT + "session/minecraft/profile/" + uuid); + if (new JSONObject(data).has("error")) { + throw new APIException(400); + } + JSONObject json = new JSONObject(data); + return new Profile(json.getString("id"), json.getString("name")); + } catch (IOException e) { + throw new APIException(e.getMessage(), 1); + } + } + public static TexturesRequest getTextures(String uuid) throws APIException { try { String data = Utils.get(SESSION_ENDPOINT + "session/minecraft/profile/" + uuid + "?unsigned=false");