Skip to content

Commit

Permalink
fix(gui): handle weird edge case with gui
Browse files Browse the repository at this point in the history
  • Loading branch information
darbyjack committed Sep 14, 2024
1 parent 44a41e4 commit 0a108f5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/me/glaremasters/guilds/utils/GuiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -74,7 +75,16 @@ public static ItemStack createItem(String material, String name, List<String> lo
* @return the skull item
*/
public static ItemStack createSkullItem(final GuildMember member, final String name, final List<String> 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();

Expand Down

0 comments on commit 0a108f5

Please sign in to comment.