Skip to content

Commit 68a5921

Browse files
author
TheProgramSrc
committed
v4.2.7 Changelog:
+ Added more checks to the SkinTexture to avoid errors
1 parent 2df6a77 commit 68a5921

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## v4.2.7 Changelog:
2+
```
3+
+ Added more checks to the SkinTexture to avoid errors
4+
```
5+
16
## v4.2.6 Changelog:
27
```
38
* Fixed version in SuperCoreAPI Update Checker

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>xyz.theprogramsrc</groupId>
88
<artifactId>SuperCoreAPI</artifactId>
9-
<version>4.2.6</version>
9+
<version>4.2.7</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SuperCoreAPI</name>

src/main/java/xyz/theprogramsrc/supercoreapi/Base.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void onCheckFail() {
2424

2525
@Override
2626
public void onCheckSuccess(String lastVersion) {
27-
String currentVersion = "4.2.6";
27+
String currentVersion = "4.2.7";
2828
int latest = Integer.parseInt(lastVersion.split(" ")[0].replaceAll("\\.", ""));
2929
int current = Integer.parseInt(currentVersion.split(" ")[0].replaceAll("\\.", ""));
3030
if(latest > current){

src/main/java/xyz/theprogramsrc/supercoreapi/spigot/utils/skintexture/SkinTexture.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ public static SkinTexture fromMojang(String playerName) {
6464
String response = Utils.readWithInputStream("https://api.mojang.com/users/profiles/minecraft/" + playerName);
6565
if(response == null)
6666
return null;
67-
String uuid = (new JsonParser()).parse(response).getAsJsonObject().get("id").getAsString();
67+
JsonElement el = (new JsonParser()).parse(response);
68+
if(el.isJsonNull())
69+
return null;
70+
String uuid = el.getAsJsonObject().get("id").getAsString();
6871
String fullUUID = Utils.uuidToFullUUID(uuid);
6972
return fromMojang(UUID.fromString(fullUUID));
7073
}
@@ -79,7 +82,10 @@ public static SkinTexture fromMojang(UUID uuid) {
7982
String response = Utils.readWithInputStream("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid.toString().replace("-", "") + "?unsigned=false");
8083
if(response == null)
8184
return null;
82-
JsonObject properties = (new JsonParser()).parse(response).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
85+
JsonElement el = (new JsonParser()).parse(response);
86+
if(el.isJsonNull())
87+
return null;
88+
JsonObject properties = el.getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
8389
String value = properties.get("value").getAsString();
8490
return new SkinTexture(base64ToUrl(value));
8591
}

0 commit comments

Comments
 (0)