Skip to content

Commit

Permalink
[6.0.11][publish] Experimental > fix skull
Browse files Browse the repository at this point in the history
  • Loading branch information
Bkm016 committed Jun 22, 2023
1 parent 1542567 commit 65d1649
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,24 +277,18 @@ private static boolean isBase64(@NotNull String base64) {

@Nullable
public static ItemBuilder.SkullTexture getSkinValue(@NotNull ItemMeta skull) {
Objects.requireNonNull(skull, "Skull ItemStack cannot be null");
SkullMeta meta = (SkullMeta) skull;
GameProfile profile = null;

try {
profile = (GameProfile) CRAFT_META_SKULL_PROFILE_GETTER.invoke(meta);
} catch (Throwable ex) {
ex.printStackTrace();
profile = Reflex.Companion.getProperty(skull, "profile", false, true, true);
} catch (Exception ignored) {
}

if (profile != null && !profile.getProperties().get("textures").isEmpty()) {
for (Property property : profile.getProperties().get("textures")) {
if (!property.getValue().isEmpty()) {
return new ItemBuilder.SkullTexture(property.getValue(), null);
return new ItemBuilder.SkullTexture(property.getValue(), profile.getId());
}
}
}

return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fun buildItem(material: Material, builder: ItemBuilder.() -> Unit = {}): ItemSta
@Isolated
open class ItemBuilder {

class SkullTexture(val textures: String, val uuid: UUID? = UUID.randomUUID())
class SkullTexture(val textures: String, val uuid: UUID)

/**
* 物品材质
Expand Down

0 comments on commit 65d1649

Please sign in to comment.