mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
fix item group update issue
This commit is contained in:
parent
4c0c7a8c3b
commit
05f54a5408
2 changed files with 22 additions and 11 deletions
|
|
@ -103,8 +103,8 @@ public class MainConfigGui extends ChestGui {
|
||||||
ItemMeta groupMeta = groupItemstack.getItemMeta();
|
ItemMeta groupMeta = groupItemstack.getItemMeta();
|
||||||
assert groupMeta != null;
|
assert groupMeta != null;
|
||||||
|
|
||||||
groupMeta.setDisplayName("§aGroups");
|
groupMeta.setDisplayName("§aItem Groups");
|
||||||
groupMeta.setLore(Collections.singletonList("§7Click here to open material group menu"));
|
groupMeta.setLore(Collections.singletonList("§7Click here to open item group menu"));
|
||||||
groupItemstack.setItemMeta(groupMeta);
|
groupItemstack.setItemMeta(groupMeta);
|
||||||
|
|
||||||
GuiItem groupConfigItem = GuiGlobalItems.goToGuiItem(groupItemstack, GroupConfigGui.getInstance());
|
GuiItem groupConfigItem = GuiGlobalItems.goToGuiItem(groupItemstack, GroupConfigGui.getInstance());
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen
|
||||||
@NotNull GroupConfigGui parent,
|
@NotNull GroupConfigGui parent,
|
||||||
@NotNull IncludeGroup group) {
|
@NotNull IncludeGroup group) {
|
||||||
super(3,
|
super(3,
|
||||||
CasedStringUtil.snakeToUpperSpacedCase(group.getName()) + " Config");
|
"§e" + CasedStringUtil.snakeToUpperSpacedCase(group.getName()) + " §rConfig");
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.group = group;
|
this.group = group;
|
||||||
|
|
||||||
|
|
@ -71,20 +71,31 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen
|
||||||
this.pane.bindItem('D', new GuiItem(deleteItem, openGuiAndCheckAction(), CustomAnvil.instance));
|
this.pane.bindItem('D', new GuiItem(deleteItem, openGuiAndCheckAction(), CustomAnvil.instance));
|
||||||
|
|
||||||
// Displayed item will be updated later
|
// Displayed item will be updated later
|
||||||
this.materialSelection = new GuiItem(new ItemStack(Material.DIAMOND_SWORD), (event) -> {
|
String materialSelectionName = "§e" + CasedStringUtil.snakeToUpperSpacedCase(group.getName()) + " §rMaterials";
|
||||||
event.setCancelled(true);
|
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,
|
MaterialSelectSettingGui selectGui = new MaterialSelectSettingGui(this,
|
||||||
CasedStringUtil.snakeToUpperSpacedCase(group.getName()) + " Materials"
|
materialSelectionName
|
||||||
, this);
|
, this);
|
||||||
selectGui.show(event.getWhoClicked());
|
selectGui.show(event.getWhoClicked());
|
||||||
|
|
||||||
}, CustomAnvil.instance);
|
}, 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);
|
event.setCancelled(true);
|
||||||
GroupSelectSettingGui enchantGui = new GroupSelectSettingGui(
|
GroupSelectSettingGui enchantGui = new GroupSelectSettingGui(
|
||||||
CasedStringUtil.snakeToUpperSpacedCase(this.group.getName()) + " Groups",
|
selectGroupName,
|
||||||
this, this, 0);
|
this, this, 0);
|
||||||
enchantGui.show(event.getWhoClicked());
|
enchantGui.show(event.getWhoClicked());
|
||||||
}, CustomAnvil.instance);
|
}, CustomAnvil.instance);
|
||||||
|
|
@ -310,7 +321,7 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen
|
||||||
// ----------------------------
|
// ----------------------------
|
||||||
// End of SelectGroupContainer related methods
|
// End of SelectGroupContainer related methods
|
||||||
// ----------------------------
|
// ----------------------------
|
||||||
// SelectGroupContainer related methods
|
// SelectMaterialContainer related methods
|
||||||
// ----------------------------
|
// ----------------------------
|
||||||
|
|
||||||
@Override
|
@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){
|
private void updateDirectReferencingGroups(AbstractMaterialGroup referenceTo){
|
||||||
|
|
@ -370,7 +381,7 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen
|
||||||
for (AbstractMaterialGroup otherGroup : everyStoredGroups) {
|
for (AbstractMaterialGroup otherGroup : everyStoredGroups) {
|
||||||
if(otherGroup.getGroups().contains(testGroup)){
|
if(otherGroup.getGroups().contains(testGroup)){
|
||||||
otherGroup.updateMaterials();
|
otherGroup.updateMaterials();
|
||||||
toUpdate.add(otherGroup);
|
updateFuture.add(otherGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue