Skip to content

Commit

Permalink
Changelog:
Browse files Browse the repository at this point in the history
* Fixed error being thrown when checking for SkinTexture from Mojang.
  • Loading branch information
TheProgramSrc committed Aug 15, 2020
1 parent 5962e4d commit fa76baa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>xyz.theprogramsrc</groupId>
<artifactId>SuperCoreAPI</artifactId>
<version>4.1.2</version>
<version>4.1.3</version>
<packaging>jar</packaging>

<name>SuperCoreAPI</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ public static SkinTexture fromPlayer(Player player) {
* @return the skin
*/
public static SkinTexture fromMojang(String playerName) {
String uuid = (new JsonParser()).parse(getResponse("https://api.mojang.com/users/profiles/minecraft/" + playerName)).getAsJsonObject().get("id").getAsString();
String response = getResponse("https://api.mojang.com/users/profiles/minecraft/" + playerName);
if(response == null)
return null;
String uuid = (new JsonParser()).parse(getResponse(response)).getAsJsonObject().get("id").getAsString();
String fullUUID = Utils.uuidToFullUUID(uuid);
return fromMojang(UUID.fromString(fullUUID));
}
Expand All @@ -73,7 +76,10 @@ public static SkinTexture fromMojang(String playerName) {
* @return the skin
*/
public static SkinTexture fromMojang(UUID uuid) {
JsonObject properties = (new JsonParser()).parse(getResponse("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid.toString().replace("-", "") + "?unsigned=false")).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
String response = getResponse("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid.toString().replace("-", "") + "?unsigned=false");
if(response == null)
return null;
JsonObject properties = (new JsonParser()).parse(response).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
String value = properties.get("value").getAsString();
return new SkinTexture(base64ToUrl(value));
}
Expand Down

0 comments on commit fa76baa

Please sign in to comment.