File tree Expand file tree Collapse file tree
src/main/java/org/matrixnetwork/stats2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,10 +35,6 @@ public static Economy getEcon() {
3535 return econ ;
3636 }
3737
38- public static SkinsRestorerAPI getSkinsRestorerAPI () {
39- return SkinsRestorerAPI .getApi ();
40- }
41-
4238 @ Override
4339 public void onLoad () {
4440 plugin = this ;
Original file line number Diff line number Diff line change 11package org .matrixnetwork .stats2 .rest ;
22
3+ import net .skinsrestorer .api .SkinsRestorerAPI ;
34import org .json .simple .JSONObject ;
45import org .json .simple .parser .JSONParser ;
56import org .matrixnetwork .stats2 .MatrixStats ;
@@ -25,12 +26,16 @@ public Response getSkin(@HeaderParam("Authorization") String tokenStr) {
2526 String username = Auth .getInstance ().verifyToken (tokenStr );
2627
2728 if (username != null ) {
28- MatrixStats .getPlugin ().getLogger ().info ("Username: " + username );
29- JSONObject retObj = new JSONObject ();
30- String skinName = MatrixStats .getSkinsRestorerAPI ().getSkinName (username );
31- MatrixStats .getPlugin ().getLogger ().info ("Skin: " + skinName );
32- retObj .put ("skin" , skinName == null ? username : skinName );
33- return Response .ok (retObj .toJSONString ()).build ();
29+ try {
30+ JSONObject retObj = new JSONObject ();
31+ String skinName = SkinsRestorerAPI .getApi ().getSkinName (username );
32+ retObj .put ("skin" , skinName == null ? username : skinName );
33+ return Response .ok (retObj .toJSONString ()).build ();
34+ } catch (Exception ex ) {
35+ MatrixStats .getPlugin ().getLogger ().info (ex .toString ());
36+ MatrixStats .getPlugin ().getLogger ().info (ex .getMessage ());
37+ return Response .noContent ().build ();
38+ }
3439 }
3540 else {
3641 return Response .status (403 ).build ();
You can’t perform that action at this time.
0 commit comments