From 05f54a54084b1f6994baa969fef1643f75c8f036 Mon Sep 17 00:00:00 2001 From: alexcrea Date: Sun, 13 Jul 2025 23:07:10 +0200 Subject: [PATCH] fix item group update issue --- .../cuanvil/gui/config/MainConfigGui.java | 4 +-- .../elements/GroupConfigSubSettingGui.java | 29 +++++++++++++------ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/main/java/xyz/alexcrea/cuanvil/gui/config/MainConfigGui.java b/src/main/java/xyz/alexcrea/cuanvil/gui/config/MainConfigGui.java index e2224f7..cc4fddc 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/gui/config/MainConfigGui.java +++ b/src/main/java/xyz/alexcrea/cuanvil/gui/config/MainConfigGui.java @@ -103,8 +103,8 @@ public class MainConfigGui extends ChestGui { ItemMeta groupMeta = groupItemstack.getItemMeta(); assert groupMeta != null; - groupMeta.setDisplayName("§aGroups"); - groupMeta.setLore(Collections.singletonList("§7Click here to open material group menu")); + groupMeta.setDisplayName("§aItem Groups"); + groupMeta.setLore(Collections.singletonList("§7Click here to open item group menu")); groupItemstack.setItemMeta(groupMeta); GuiItem groupConfigItem = GuiGlobalItems.goToGuiItem(groupItemstack, GroupConfigGui.getInstance()); diff --git a/src/main/java/xyz/alexcrea/cuanvil/gui/config/list/elements/GroupConfigSubSettingGui.java b/src/main/java/xyz/alexcrea/cuanvil/gui/config/list/elements/GroupConfigSubSettingGui.java index efa1117..c49fec7 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/gui/config/list/elements/GroupConfigSubSettingGui.java +++ b/src/main/java/xyz/alexcrea/cuanvil/gui/config/list/elements/GroupConfigSubSettingGui.java @@ -39,7 +39,7 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen @NotNull GroupConfigGui parent, @NotNull IncludeGroup group) { super(3, - CasedStringUtil.snakeToUpperSpacedCase(group.getName()) + " Config"); + "§e" + CasedStringUtil.snakeToUpperSpacedCase(group.getName()) + " §rConfig"); this.parent = parent; this.group = group; @@ -71,20 +71,31 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen this.pane.bindItem('D', new GuiItem(deleteItem, openGuiAndCheckAction(), CustomAnvil.instance)); // Displayed item will be updated later - this.materialSelection = new GuiItem(new ItemStack(Material.DIAMOND_SWORD), (event) -> { - event.setCancelled(true); + String materialSelectionName = "§e" + CasedStringUtil.snakeToUpperSpacedCase(group.getName()) + " §rMaterials"; + ItemStack selectItem = new ItemStack(Material.DIAMOND_SWORD); + ItemMeta selectItemMeta = selectItem.getItemMeta(); + selectItemMeta.setDisplayName(materialSelectionName); + selectItem.setItemMeta(selectItemMeta); + this.materialSelection = new GuiItem(selectItem, (event) -> { + event.setCancelled(true); MaterialSelectSettingGui selectGui = new MaterialSelectSettingGui(this, - CasedStringUtil.snakeToUpperSpacedCase(group.getName()) + " Materials" + materialSelectionName , this); selectGui.show(event.getWhoClicked()); }, CustomAnvil.instance); - this.groupSelection = new GuiItem(new ItemStack(Material.CHEST), (event) -> { + String selectGroupName = "§e" + CasedStringUtil.snakeToUpperSpacedCase(this.group.getName()) + " §rGroups"; + ItemStack selectGroup = new ItemStack(Material.CHEST); + ItemMeta selectGroupMeta = selectGroup.getItemMeta(); + selectGroupMeta.setDisplayName(selectGroupName); + + selectGroup.setItemMeta(selectGroupMeta); + this.groupSelection = new GuiItem(selectGroup, (event) -> { event.setCancelled(true); GroupSelectSettingGui enchantGui = new GroupSelectSettingGui( - CasedStringUtil.snakeToUpperSpacedCase(this.group.getName()) + " Groups", + selectGroupName, this, this, 0); enchantGui.show(event.getWhoClicked()); }, CustomAnvil.instance); @@ -310,7 +321,7 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen // ---------------------------- // End of SelectGroupContainer related methods // ---------------------------- - // SelectGroupContainer related methods + // SelectMaterialContainer related methods // ---------------------------- @Override @@ -347,7 +358,7 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen } // ---------------------------- - // End of SelectGroupContainer related methods + // End of SelectMaterialContainer related methods // ---------------------------- private void updateDirectReferencingGroups(AbstractMaterialGroup referenceTo){ @@ -370,7 +381,7 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen for (AbstractMaterialGroup otherGroup : everyStoredGroups) { if(otherGroup.getGroups().contains(testGroup)){ otherGroup.updateMaterials(); - toUpdate.add(otherGroup); + updateFuture.add(otherGroup); } }