@@ -67,7 +67,7 @@ public SkinData load(UUID uuid) throws Exception {
6767 if (profile .hasTextures ()) {
6868 return new SkinData (profile );
6969 }
70- throw new Exception ("Could not complete() PlayerProfile for " + uuid + " (rate limited or profile doesn't exist)" );
70+ throw new SkinLoadException ("Could not complete() PlayerProfile for " + uuid + " (rate limited or profile doesn't exist)" );
7171 }
7272 });
7373 this .futureCache = CacheBuilder .newBuilder ()
@@ -78,8 +78,23 @@ public CompletableFuture<SkinData> load(UUID uuid) throws Exception {
7878 return CompletableFuture .supplyAsync (() -> {
7979 try {
8080 return skinCache .get (uuid );
81- } catch (Exception e ) {
82- return new SkinData (Bukkit .createProfile (uuid ));
81+ } catch (Exception ex ) {
82+ // This was causing "issues" with nms querying
83+ // the skin server. Just going to log the
84+ // exception now I guess
85+ // return new SkinData(Bukkit.createProfile(uuid));
86+ if (ex instanceof SkinLoadException ) {
87+ plugin .getLogger ().log (Level .WARNING , "Exception loading skin: " + ex .getMessage ());
88+ } else {
89+ plugin .getLogger ().log (Level .WARNING , "Exception loading skin" , ex );
90+ }
91+ // also complete exceptionally to cancel later
92+ // CompletionStages
93+ if (ex instanceof RuntimeException ) {
94+ throw (RuntimeException ) ex ;
95+ } else {
96+ throw new RuntimeException ("Skin could not be loaded" , ex );
97+ }
8398 }
8499 }, executor );
85100 }
@@ -170,4 +185,10 @@ public SkinData(PlayerProfile profile) {
170185 }
171186
172187 }
188+
189+ public static class SkinLoadException extends RuntimeException {
190+ public SkinLoadException (String message ) {
191+ super (message );
192+ }
193+ }
173194}
0 commit comments