From 1607b0f773545f703f4ca8282f43ffc520356783 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Wed, 6 Sep 2023 15:17:28 +0100 Subject: [PATCH] Fix for subclass select UI --- .../src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java index 7943a6dc..3fce6040 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java @@ -50,7 +50,7 @@ public class SubclassSelect extends EditableInventory { private final PlayerClass playerClass; public ClassItem(ConfigurationSection config) { - super(Material.BARRIER, config); + super(config.contains("item") ? Material.valueOf(UtilityMethods.enumName(config.getString("item"))) : Material.BARRIER, config); Validate.isTrue(config.getString("function").length() > 10, "Couldn't find the class associated to: " + config.getString("function")); String classId = UtilityMethods.enumName(config.getString("function").substring(10)); this.playerClass = Objects.requireNonNull(MMOCore.plugin.classManager.get(classId), classId + " does not correspond to any classId."); @@ -64,7 +64,7 @@ public class SubclassSelect extends EditableInventory { @Override public ItemStack display(SubclassSelectionInventory inv, int n) { - ItemStack item = playerClass.getIcon(); + ItemStack item = n == 0 ? playerClass.getIcon() : super.display(inv, n); ItemMeta meta = item.getItemMeta(); if (hideFlags()) meta.addItemFlags(ItemFlag.values());