File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
SimpleAPI/src/main/java/com/bencodez/simpleapi/skull Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public abstract class SkullCacheHandler {
2020 Queue <String > skullsToLoad = new ConcurrentLinkedQueue <>();
2121
2222 private boolean pause = false ;
23-
23+
2424 @ Getter
2525 @ Setter
2626 private String bedrockPrefix = "." ;
@@ -70,15 +70,27 @@ public void flushCache() {
7070 SkullCache .flushWeek ();
7171 }
7272
73+ @ SuppressWarnings ("deprecation" )
7374 public ItemStack getSkull (UUID uuid , String playerName ) {
75+ Material skullMaterial ;
76+ ItemStack skullItem ;
77+ // Check for legacy versions
78+ try {
79+ skullMaterial = Material .valueOf ("PLAYER_HEAD" );
80+ skullItem = new ItemStack (skullMaterial );
81+ } catch (IllegalArgumentException e ) {
82+ // Fallback
83+ skullMaterial = Material .valueOf ("SKULL_ITEM" );
84+ skullItem = new ItemStack (skullMaterial , 1 , (short ) 3 );
85+ }
7486 if (playerName .length () > 16 || (pause && !SkullCache .isLoaded (uuid )) || uuid .toString ().charAt (14 ) == '3' ) {
75- return new ItemStack ( Material . PLAYER_HEAD ) ;
87+ return skullItem ;
7688 }
7789 try {
7890 return SkullCache .getSkull (uuid , playerName );
7991 } catch (Exception e ) {
8092 pauseCaching ();
81- return new ItemStack ( Material . PLAYER_HEAD ) ;
93+ return skullItem ;
8294 }
8395 }
8496
You can’t perform that action at this time.
0 commit comments