From 0a108f59f2a177540acafcb19130f06f3e5f2579 Mon Sep 17 00:00:00 2001 From: Glare Date: Sat, 14 Sep 2024 09:42:39 -0500 Subject: [PATCH] fix(gui): handle weird edge case with gui --- .../java/me/glaremasters/guilds/utils/GuiUtils.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/glaremasters/guilds/utils/GuiUtils.java b/src/main/java/me/glaremasters/guilds/utils/GuiUtils.java index dc72ddda0..a5c52b050 100644 --- a/src/main/java/me/glaremasters/guilds/utils/GuiUtils.java +++ b/src/main/java/me/glaremasters/guilds/utils/GuiUtils.java @@ -25,6 +25,7 @@ import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.profiles.builder.XSkull; +import com.cryptomorin.xseries.profiles.objects.ProfileInputType; import com.cryptomorin.xseries.profiles.objects.Profileable; import me.glaremasters.guilds.guild.GuildMember; import org.bukkit.Material; @@ -74,7 +75,16 @@ public static ItemStack createItem(String material, String name, List lo * @return the skull item */ public static ItemStack createSkullItem(final GuildMember member, final String name, final List lore) { - final Profileable playerProfile = Profileable.of(member.getUuid()); + if (member.getUuid() == null) { + throw new IllegalArgumentException("Member UUID cannot be null"); + } + + Profileable playerProfile = Profileable.of(member.getUuid()); + if (playerProfile == null) { + final ProfileInputType backupType = ProfileInputType.typeOf("c10591e6909e6a281b371836e462d67a2c78fa0952e910f32b41a26c48c1757c"); + playerProfile = Profileable.of(backupType, "c10591e6909e6a281b371836e462d67a2c78fa0952e910f32b41a26c48c1757c"); + } + final ItemStack itemStack = XSkull.createItem().profile(playerProfile).apply(); final ItemMeta meta = itemStack.getItemMeta();