File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
src/main/java/xyz/theprogramsrc/supercoreapi/spigot/utils/skintexture Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 66
77 <groupId >xyz.theprogramsrc</groupId >
88 <artifactId >SuperCoreAPI</artifactId >
9- <version >4.1.2 </version >
9+ <version >4.1.3 </version >
1010 <packaging >jar</packaging >
1111
1212 <name >SuperCoreAPI</name >
Original file line number Diff line number Diff line change @@ -62,7 +62,10 @@ public static SkinTexture fromPlayer(Player player) {
6262 * @return the skin
6363 */
6464 public static SkinTexture fromMojang (String playerName ) {
65- String uuid = (new JsonParser ()).parse (getResponse ("https://api.mojang.com/users/profiles/minecraft/" + playerName )).getAsJsonObject ().get ("id" ).getAsString ();
65+ String response = getResponse ("https://api.mojang.com/users/profiles/minecraft/" + playerName );
66+ if (response == null )
67+ return null ;
68+ String uuid = (new JsonParser ()).parse (getResponse (response )).getAsJsonObject ().get ("id" ).getAsString ();
6669 String fullUUID = Utils .uuidToFullUUID (uuid );
6770 return fromMojang (UUID .fromString (fullUUID ));
6871 }
@@ -73,7 +76,10 @@ public static SkinTexture fromMojang(String playerName) {
7376 * @return the skin
7477 */
7578 public static SkinTexture fromMojang (UUID uuid ) {
76- 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 ();
79+ String response = getResponse ("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid .toString ().replace ("-" , "" ) + "?unsigned=false" );
80+ if (response == null )
81+ return null ;
82+ JsonObject properties = (new JsonParser ()).parse (response ).getAsJsonObject ().get ("properties" ).getAsJsonArray ().get (0 ).getAsJsonObject ();
7783 String value = properties .get ("value" ).getAsString ();
7884 return new SkinTexture (base64ToUrl (value ));
7985 }
You can’t perform that action at this time.
0 commit comments