@@ -35,7 +35,11 @@ public class SkullModifier implements ItemMetaModifier {
3535 /**
3636 * <a href="https://github.com/CryptoMorin/XSeries/blob/b633d00608435701f1045a566b98a81edd5f923c/src/main/java/com/cryptomorin/xseries/profiles/objects/ProfileInputType.java#L29C35-L29C50">...</a>
3737 */
38- private static final Pattern MOJANG_SHA256_APPROX = Pattern .compile ("[0-9a-z]{55,70}" );
38+ private static final Pattern MOJANG_SHA256_APPROX_PATTERN = Pattern .compile ("[0-9a-z]{55,70}" );
39+ /**
40+ * <a href="https://github.com/CryptoMorin/XSeries/blob/b11b176deca55da6d465e67a3d4be548c3ef06c6/src/main/java/com/cryptomorin/xseries/profiles/objects/ProfileInputType.java#L55C12-L55C57">...</a>
41+ */
42+ private static final Pattern BASE64_PATTERN = Pattern .compile ("[-A-Za-z0-9+/]{100,}={0,3}" );
3943 private static final SkullMeta delegateSkullMeta ;
4044 private static final SkullHandler skullHandler = getSkullHandler ();
4145
@@ -62,23 +66,23 @@ private static SkullHandler getSkullHandler() {
6266 }
6367
6468 private static void setSkull (SkullMeta meta , String skull ) {
65- Optional <byte []> base64 = Validate .getBase64 (skull );
66- if (base64 .isPresent ()) {
67- skullHandler .setSkullByBase64 (meta , base64 .get ());
68- return ;
69- }
70-
7169 Optional <URL > url = Validate .getURL (skull );
7270 if (url .isPresent ()) {
7371 skullHandler .setSkullByURL (meta , url .get ());
7472 return ;
7573 }
7674
77- if (MOJANG_SHA256_APPROX .matcher (skull ).matches ()) {
75+ if (MOJANG_SHA256_APPROX_PATTERN .matcher (skull ).matches ()) {
7876 skullHandler .setSkullByURL (meta , "https://textures.minecraft.net/texture/" + skull );
7977 return ;
8078 }
8179
80+ if (BASE64_PATTERN .matcher (skull ).matches ()) {
81+ Optional <byte []> base64 = Validate .getBase64 (skull );
82+ base64 .ifPresent (bytes -> skullHandler .setSkullByBase64 (meta , bytes ));
83+ return ;
84+ }
85+
8286 Optional <UUID > uuid = Validate .getUUID (skull );
8387 if (uuid .isPresent ()) {
8488 skullHandler .setSkullByUUID (meta , uuid .get ());
0 commit comments