diff --git a/src/main/java/xyz/alexcrea/cuanvil/gui/config/AbstractEnchantConfigGui.java b/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/AbstractEnchantConfigGui.java similarity index 98% rename from src/main/java/xyz/alexcrea/cuanvil/gui/config/AbstractEnchantConfigGui.java rename to src/main/java/xyz/alexcrea/cuanvil/gui/config/global/AbstractEnchantConfigGui.java index da8e34d..7c6d31e 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/gui/config/AbstractEnchantConfigGui.java +++ b/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/AbstractEnchantConfigGui.java @@ -1,4 +1,4 @@ -package xyz.alexcrea.cuanvil.gui.config; +package xyz.alexcrea.cuanvil.gui.config.global; import com.github.stefvanschie.inventoryframework.gui.GuiItem; import com.github.stefvanschie.inventoryframework.pane.Orientable; diff --git a/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/ElementListGlobalConfigGui.java b/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/ElementListGlobalConfigGui.java new file mode 100644 index 0000000..2f8a6c6 --- /dev/null +++ b/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/ElementListGlobalConfigGui.java @@ -0,0 +1,292 @@ +package xyz.alexcrea.cuanvil.gui.config.global; + +import com.github.stefvanschie.inventoryframework.gui.GuiItem; +import com.github.stefvanschie.inventoryframework.pane.Orientable; +import com.github.stefvanschie.inventoryframework.pane.OutlinePane; +import com.github.stefvanschie.inventoryframework.pane.Pane; +import com.github.stefvanschie.inventoryframework.pane.PatternPane; +import com.github.stefvanschie.inventoryframework.pane.util.Pattern; +import io.delilaheve.CustomAnvil; +import org.bukkit.Material; +import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.jetbrains.annotations.NotNull; +import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui; +import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems; +import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; + +public abstract class ElementListGlobalConfigGui< T > extends ValueUpdatableGui { + + + public ElementListGlobalConfigGui(int rows, @NotNull String title) { + super(rows, title, CustomAnvil.instance); + } + + + protected OutlinePane firstPage; + protected ArrayList pages; + protected HashMap pageMap; + protected PatternPane backgroundPane; + + public void init() { + // Back item panel + Pattern pattern = new Pattern( + GuiSharedConstant.EMPTY_GUI_FULL_LINE, + GuiSharedConstant.EMPTY_GUI_FULL_LINE, + GuiSharedConstant.EMPTY_GUI_FULL_LINE, + GuiSharedConstant.EMPTY_GUI_FULL_LINE, + GuiSharedConstant.EMPTY_GUI_FULL_LINE, + "B11L1R11C" + ); + this.backgroundPane = new PatternPane(0, 0, 9, 6, Pane.Priority.LOW, pattern); + + GuiGlobalItems.addBackItem(this.backgroundPane, MainConfigGui.INSTANCE); + + GuiGlobalItems.addBackgroundItem(this.backgroundPane); + this.backgroundPane.bindItem('1', GuiSharedConstant.SECONDARY_BACKGROUND_ITEM); + addPane(this.backgroundPane); + + // Page init + this.pages = new ArrayList<>(); + this.pageMap = new HashMap<>(); + + // enchant item panel + this.firstPage = createEmptyPage(); + this.pages.add(this.firstPage); + + prepareStaticValues(); + reloadValues(); + } + + protected GuiItem goLeftItem; + protected GuiItem goRightItem; + + protected void prepareStaticValues(){ + // Left item creation for consumer & bind + this.goLeftItem = new GuiItem(new ItemStack(Material.RED_TERRACOTTA), event -> { + HumanEntity viewer = event.getWhoClicked(); + UUID playerUUID = viewer.getUniqueId(); + int page = this.pageMap.getOrDefault(playerUUID, 0); + this.pageMap.put(playerUUID, page - 1); + + ItemStack cursor = viewer.getItemOnCursor(); + viewer.setItemOnCursor(new ItemStack(Material.AIR)); + + show(viewer); + + viewer.setItemOnCursor(cursor); + }, CustomAnvil.instance); + + // Right item creation for consumer & bind + this.goRightItem = new GuiItem(new ItemStack(Material.GREEN_TERRACOTTA), event -> { + HumanEntity viewer = event.getWhoClicked(); + UUID playerUUID = viewer.getUniqueId(); + int page = pageMap.getOrDefault(playerUUID, 0); + this.pageMap.put(playerUUID, page + 1); + + ItemStack cursor = viewer.getItemOnCursor(); + viewer.setItemOnCursor(new ItemStack(Material.AIR)); + + show(viewer); + + viewer.setItemOnCursor(cursor); + }, CustomAnvil.instance); + + this.backgroundPane.bindItem('C', prepareCreateNewItem()); + } + protected void reloadValues(){ + this.firstPage.clear(); + this.pages.clear(); + this.pages.add(this.firstPage); + + for (T conflict : getEveryDisplayableInstanceOfGeneric()) { + updateValueForGeneric(conflict, false); + } + + update(); + } + + protected abstract GuiItem prepareCreateNewItem(); + + protected OutlinePane createEmptyPage() { + OutlinePane page = new OutlinePane(0, 0, 9, 5); + page.align(OutlinePane.Alignment.BEGIN); + page.setOrientation(Orientable.Orientation.HORIZONTAL); + + return page; + } + + public int getPlayerPageID(UUID uuid) { + int pageId = this.pageMap.getOrDefault(uuid, 0); + if (pageId >= this.pages.size()) { + pageId = this.pages.size() - 1; + } + return pageId; + } + + protected void addToPage(GuiItem guiItem) { + // Get first available page or create one + OutlinePane page = this.pages.get(this.pages.size() - 1); + if (page.getItems().size() >= 5 * 9) { + page = createEmptyPage(); + this.pages.add(page); + } + + page.addItem(guiItem); + } + + private void removeFromPage(GuiItem guiItem) { + // get item page + OutlinePane page = null; + int pageID = 0; + while (pageID < this.pages.size()) { + OutlinePane tempPage = this.pages.get(pageID); + if (tempPage.getItems().contains(guiItem)) { + page = tempPage; + break; + } + pageID++; + } + + if (page == null) {// Why... + return; + } + removeFromPage(page, pageID, guiItem); + } + + private void removeFromPage(OutlinePane page, int pageID, GuiItem guiItem) { + page.removeItem(guiItem); + + // There is now a slot available, let fill it if possible + if (pageID < (this.pages.size() - 1)) { + OutlinePane newPage = this.pages.get(pageID + 1); + GuiItem nextPageItem = newPage.getItems().get(0); + + removeFromPage(newPage, pageID + 1, nextPageItem); + + OutlinePane thisPage = this.pages.get(pageID); + thisPage.addItem(nextPageItem); + } else if (pageID > 0 && page.getItems().isEmpty()) { + this.pages.remove(pageID); + } + } + + public void placeArrow(int page, boolean customise) { + + // Place left arrow + addPane(this.backgroundPane); + if (page > 0) { + if (customise) { + ItemStack leftItem = this.goLeftItem.getItem(); + ItemMeta leftMeta = leftItem.getItemMeta(); + + leftMeta.setDisplayName("\u00A7eReturn to page " + (page)); + + leftItem.setItemMeta(leftMeta); + this.goLeftItem.setItem(leftItem); + } + + this.backgroundPane.bindItem('L', this.goLeftItem); + } else { + this.backgroundPane.bindItem('L', GuiSharedConstant.SECONDARY_BACKGROUND_ITEM); + } + + // Place right arrow + if (page < pages.size() - 1) { + if (customise) { + ItemStack rightItem = this.goRightItem.getItem(); + ItemMeta rightMeta = rightItem.getItemMeta(); + + rightMeta.setDisplayName("\u00A7eGo to page " + (page + 2)); + + rightItem.setItemMeta(rightMeta); + this.goRightItem.setItem(rightItem); + } + + this.backgroundPane.bindItem('R', this.goRightItem); + } else { + this.backgroundPane.bindItem('R', GuiSharedConstant.SECONDARY_BACKGROUND_ITEM); + } + } + + @Override // assume will not be called in multiple thread + public void show(@NotNull HumanEntity humanEntity) { + int pageID = getPlayerPageID(humanEntity.getUniqueId()); + OutlinePane page = this.pages.get(pageID); + + getPanes().clear(); + + // display the page arrow pane + placeArrow(pageID, true); + // and add actual page + addPane(page); + + // set title + setTitle("Conflict Config (" + (pageID + 1) + "/" + (pages.size()) + ")"); + + super.show(humanEntity); + + } + + @Override // assume will not be called in multiple thread + public void click(@NotNull InventoryClickEvent event) { + int pageID = getPlayerPageID(event.getWhoClicked().getUniqueId()); + OutlinePane page = this.pages.get(pageID); + + getPanes().clear(); + + // set the page arrow pane + placeArrow(pageID, false); + // and add actual page + addPane(page); + + super.click(event); + } + + // ------------------------- + // Methods using generic T + // ------------------------- + + public void updateValueForGeneric(T generic, boolean shouldUpdate) { + ItemStack item = createItemForGeneric(generic); + + updateGeneric(generic, item); + + if (shouldUpdate) { + update(); + } + + } + + public void removeConflict(T generic) { + GuiItem item = findGuiItemForRemoval(generic); + if(item == null) return; + removeFromPage(item); + + update(); + } + + protected abstract GuiItem findGuiItemForRemoval(T generic); + + protected abstract ItemStack createItemForGeneric(T generic); + + protected abstract void updateGeneric(T generic, ItemStack usedItem); + + protected abstract List getEveryDisplayableInstanceOfGeneric(); + + @Override + public void updateGuiValues() { + // Not the optimised way to update this gui + // TODO maybe rework ValueUpdatableGui and it's dependency to allow a 1 item reload every time. + + reloadValues(); + } + +} diff --git a/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantConflictGui.java b/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantConflictGui.java index 49f4302..e713e36 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantConflictGui.java +++ b/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantConflictGui.java @@ -1,34 +1,28 @@ package xyz.alexcrea.cuanvil.gui.config.global; import com.github.stefvanschie.inventoryframework.gui.GuiItem; -import com.github.stefvanschie.inventoryframework.gui.type.ChestGui; -import com.github.stefvanschie.inventoryframework.pane.Orientable; -import com.github.stefvanschie.inventoryframework.pane.OutlinePane; -import com.github.stefvanschie.inventoryframework.pane.Pane; -import com.github.stefvanschie.inventoryframework.pane.PatternPane; -import com.github.stefvanschie.inventoryframework.pane.util.Pattern; import io.delilaheve.CustomAnvil; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.HumanEntity; -import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; import xyz.alexcrea.cuanvil.config.ConfigHolder; import xyz.alexcrea.cuanvil.group.EnchantConflictGroup; import xyz.alexcrea.cuanvil.group.IncludeGroup; import xyz.alexcrea.cuanvil.gui.config.settings.subsetting.EnchantConflictSubSettingGui; import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions; -import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems; import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant; import xyz.alexcrea.cuanvil.util.CasedStringUtil; -import java.util.*; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; -public class EnchantConflictGui extends ChestGui { +public class EnchantConflictGui extends ElementListGlobalConfigGui { public final static EnchantConflictGui INSTANCE = new EnchantConflictGui(); @@ -39,80 +33,12 @@ public class EnchantConflictGui extends ChestGui { private final HashMap conflictGuiMap; private EnchantConflictGui() { - super(6, "Conflict Config", CustomAnvil.instance); + super(6, "Conflict Config"); this.conflictGuiMap = new HashMap<>(); } - private OutlinePane firstPage; - private ArrayList pages; - private HashMap pageMap; - private PatternPane backgroundPane; - - private void init() { - // Back item panel - Pattern pattern = new Pattern( - GuiSharedConstant.EMPTY_GUI_FULL_LINE, - GuiSharedConstant.EMPTY_GUI_FULL_LINE, - GuiSharedConstant.EMPTY_GUI_FULL_LINE, - GuiSharedConstant.EMPTY_GUI_FULL_LINE, - GuiSharedConstant.EMPTY_GUI_FULL_LINE, - "B11L1R11C" - ); - this.backgroundPane = new PatternPane(0, 0, 9, 6, Pane.Priority.LOW, pattern); - - GuiGlobalItems.addBackItem(this.backgroundPane, MainConfigGui.INSTANCE); - - GuiGlobalItems.addBackgroundItem(this.backgroundPane); - this.backgroundPane.bindItem('1', GuiSharedConstant.SECONDARY_BACKGROUND_ITEM); - addPane(this.backgroundPane); - - // Page init - this.pages = new ArrayList<>(); - this.pageMap = new HashMap<>(); - - // enchant item panel - this.firstPage = createEmptyPage(); - this.pages.add(this.firstPage); - - prepareOtherValues(); - reloadValues(); - } - - - private GuiItem goLeftItem; - private GuiItem goRightItem; - - private void prepareOtherValues() { - // Left item creation for consumer & bind - this.goLeftItem = new GuiItem(new ItemStack(Material.RED_TERRACOTTA), event -> { - HumanEntity viewer = event.getWhoClicked(); - UUID playerUUID = viewer.getUniqueId(); - int page = this.pageMap.getOrDefault(playerUUID, 0); - this.pageMap.put(playerUUID, page - 1); - - ItemStack cursor = viewer.getItemOnCursor(); - viewer.setItemOnCursor(new ItemStack(Material.AIR)); - - show(viewer); - - viewer.setItemOnCursor(cursor); - }, CustomAnvil.instance); - - // Right item creation for consumer & bind - this.goRightItem = new GuiItem(new ItemStack(Material.GREEN_TERRACOTTA), event -> { - HumanEntity viewer = event.getWhoClicked(); - UUID playerUUID = viewer.getUniqueId(); - int page = pageMap.getOrDefault(playerUUID, 0); - this.pageMap.put(playerUUID, page + 1); - - ItemStack cursor = viewer.getItemOnCursor(); - viewer.setItemOnCursor(new ItemStack(Material.AIR)); - - show(viewer); - - viewer.setItemOnCursor(cursor); - }, CustomAnvil.instance); - + @Override + protected GuiItem prepareCreateNewItem(){ // Create new conflict item ItemStack createItem = new ItemStack(Material.PAPER); ItemMeta createMeta = createItem.getItemMeta(); @@ -126,7 +52,7 @@ public class EnchantConflictGui extends ChestGui { createItem.setItemMeta(createMeta); - this.backgroundPane.bindItem('C', new GuiItem(createItem, (clickEvent) -> { + return new GuiItem(createItem, (clickEvent) -> { clickEvent.setCancelled(true); HumanEntity player = clickEvent.getWhoClicked(); @@ -143,7 +69,7 @@ public class EnchantConflictGui extends ChestGui { CustomAnvil.Companion.getChatListener().setListenedCallback(player, prepareCreateItemConsumer(player)); - }, CustomAnvil.instance)); + }, CustomAnvil.instance); } private Consumer prepareCreateItemConsumer(HumanEntity player) { @@ -184,7 +110,7 @@ public class EnchantConflictGui extends ChestGui { 0); ConfigHolder.CONFLICT_HOLDER.getConflictManager().getConflictList().add(conflict); - updateValueForConflict(conflict, true); + updateValueForGeneric(conflict, true); // save empty conflict in config String[] emptyStringArray = new String[0]; @@ -207,29 +133,16 @@ public class EnchantConflictGui extends ChestGui { return selfCallback; } - private OutlinePane createEmptyPage() { - OutlinePane page = new OutlinePane(0, 0, 9, 5); - page.align(OutlinePane.Alignment.BEGIN); - page.setOrientation(Orientable.Orientation.HORIZONTAL); - - return page; - } - + @Override public void reloadValues() { this.conflictGuiMap.forEach((conflict, gui) -> gui.cleanUnused()); this.conflictGuiMap.clear(); - this.firstPage.clear(); - this.pages.clear(); - this.pages.add(this.firstPage); - for (EnchantConflictGroup conflict : ConfigHolder.CONFLICT_HOLDER.getConflictManager().getConflictList()) { - updateValueForConflict(conflict, false); - } - - update(); + super.reloadValues(); } - public static ItemStack createItemForConflict(EnchantConflictGroup conflict) { + @Override + public ItemStack createItemForGeneric(EnchantConflictGroup conflict) { ItemStack item = new ItemStack(conflict.getRepresentativeMaterial()); ItemMeta meta = item.getItemMeta(); @@ -245,14 +158,14 @@ public class EnchantConflictGui extends ChestGui { return item; } - public void updateValueForConflict(EnchantConflictGroup conflict, boolean shouldUpdate) { + @Override + protected void updateGeneric(EnchantConflictGroup conflict, ItemStack usedItem) { EnchantConflictSubSettingGui gui = this.conflictGuiMap.get(conflict); - ItemStack item = createItemForConflict(conflict); GuiItem guiItem; if (gui == null) { // Create new sub setting gui - guiItem = new GuiItem(item, CustomAnvil.instance); + guiItem = new GuiItem(usedItem, CustomAnvil.instance); gui = new EnchantConflictSubSettingGui(this, conflict, guiItem); guiItem.setAction(GuiGlobalActions.openGuiAction(gui)); @@ -262,152 +175,24 @@ public class EnchantConflictGui extends ChestGui { } else { // Replace item with the updated one guiItem = gui.getParentItemForThisGui(); - guiItem.setItem(item); + guiItem.setItem(usedItem); } - gui.updateLocal(); - if (shouldUpdate) { - update(); - } } - public void removeConflict(EnchantConflictGroup conflict) { + @Override + protected GuiItem findGuiItemForRemoval(EnchantConflictGroup conflict) { EnchantConflictSubSettingGui gui = this.conflictGuiMap.get(conflict); - if (gui == null) return; + if (gui == null) return null; this.conflictGuiMap.remove(conflict); - removeFromPage(gui.getParentItemForThisGui()); - - update(); + return gui.getParentItemForThisGui(); } - private void addToPage(GuiItem guiItem) { - // Get first available page or create one - OutlinePane page = this.pages.get(this.pages.size() - 1); - if (page.getItems().size() >= 5 * 9) { - page = createEmptyPage(); - this.pages.add(page); - } - - page.addItem(guiItem); - } - - private void removeFromPage(GuiItem guiItem) { - // get item page - OutlinePane page = null; - int pageID = 0; - while (pageID < this.pages.size()) { - OutlinePane tempPage = this.pages.get(pageID); - if (tempPage.getItems().contains(guiItem)) { - page = tempPage; - break; - } - pageID++; - } - - if (page == null) {// Why... - return; - } - removeFromPage(page, pageID, guiItem); - } - - private void removeFromPage(OutlinePane page, int pageID, GuiItem guiItem) { - page.removeItem(guiItem); - - // There is now a slot available, let fill it if possible - if (pageID < (this.pages.size() - 1)) { - OutlinePane newPage = this.pages.get(pageID + 1); - GuiItem nextPageItem = newPage.getItems().get(0); - - removeFromPage(newPage, pageID + 1, nextPageItem); - - OutlinePane thisPage = this.pages.get(pageID); - thisPage.addItem(nextPageItem); - } else if (pageID > 0 && page.getItems().isEmpty()) { - this.pages.remove(pageID); - } - } - - - public int getPlayerPageID(UUID uuid) { - int pageId = this.pageMap.getOrDefault(uuid, 0); - if (pageId >= this.pages.size()) { - pageId = this.pages.size() - 1; - } - return pageId; - } - - public void placeArrow(int page, boolean customise) { - - // Place left arrow - addPane(this.backgroundPane); - if (page > 0) { - if (customise) { - ItemStack leftItem = this.goLeftItem.getItem(); - ItemMeta leftMeta = leftItem.getItemMeta(); - - leftMeta.setDisplayName("\u00A7eReturn to page " + (page)); - - leftItem.setItemMeta(leftMeta); - this.goLeftItem.setItem(leftItem); - } - - this.backgroundPane.bindItem('L', this.goLeftItem); - } else { - this.backgroundPane.bindItem('L', GuiSharedConstant.SECONDARY_BACKGROUND_ITEM); - } - - // Place right arrow - if (page < pages.size() - 1) { - if (customise) { - ItemStack rightItem = this.goRightItem.getItem(); - ItemMeta rightMeta = rightItem.getItemMeta(); - - rightMeta.setDisplayName("\u00A7eGo to page " + (page + 2)); - - rightItem.setItemMeta(rightMeta); - this.goRightItem.setItem(rightItem); - } - - this.backgroundPane.bindItem('R', this.goRightItem); - } else { - this.backgroundPane.bindItem('R', GuiSharedConstant.SECONDARY_BACKGROUND_ITEM); - } - } - - @Override // assume will not be called in multiple thread - public void show(@NotNull HumanEntity humanEntity) { - int pageID = getPlayerPageID(humanEntity.getUniqueId()); - OutlinePane page = this.pages.get(pageID); - - getPanes().clear(); - - // display the page arrow pane - placeArrow(pageID, true); - // and add actual page - addPane(page); - - // set title - setTitle("Conflict Config (" + (pageID + 1) + "/" + (pages.size()) + ")"); - - super.show(humanEntity); - - } - - @Override // assume will not be called in multiple thread - public void click(@NotNull InventoryClickEvent event) { - int pageID = getPlayerPageID(event.getWhoClicked().getUniqueId()); - OutlinePane page = this.pages.get(pageID); - - getPanes().clear(); - - // set the page arrow pane - placeArrow(pageID, false); - // and add actual page - addPane(page); - - super.click(event); + @Override + protected List getEveryDisplayableInstanceOfGeneric() { + return ConfigHolder.CONFLICT_HOLDER.getConflictManager().getConflictList(); } } diff --git a/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantCostConfigGui.java b/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantCostConfigGui.java index 2c2427b..2a1937b 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantCostConfigGui.java +++ b/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantCostConfigGui.java @@ -8,7 +8,6 @@ import org.bukkit.inventory.meta.ItemMeta; import xyz.alexcrea.cuanvil.config.ConfigHolder; import xyz.alexcrea.cuanvil.enchant.EnchantmentProperties; import xyz.alexcrea.cuanvil.enchant.EnchantmentRarity; -import xyz.alexcrea.cuanvil.gui.config.AbstractEnchantConfigGui; import xyz.alexcrea.cuanvil.gui.config.settings.EnchantCostSettingsGui; import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems; import xyz.alexcrea.cuanvil.util.CasedStringUtil; diff --git a/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantLimitConfigGui.java b/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantLimitConfigGui.java index ae89b54..999f2a7 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantLimitConfigGui.java +++ b/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantLimitConfigGui.java @@ -4,7 +4,6 @@ import com.github.stefvanschie.inventoryframework.gui.GuiItem; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import xyz.alexcrea.cuanvil.config.ConfigHolder; -import xyz.alexcrea.cuanvil.gui.config.AbstractEnchantConfigGui; import xyz.alexcrea.cuanvil.gui.config.settings.IntSettingsGui; import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems; import xyz.alexcrea.cuanvil.util.CasedStringUtil; diff --git a/src/main/java/xyz/alexcrea/cuanvil/gui/config/settings/subsetting/EnchantConflictSubSettingGui.java b/src/main/java/xyz/alexcrea/cuanvil/gui/config/settings/subsetting/EnchantConflictSubSettingGui.java index 6671d12..d6f243f 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/gui/config/settings/subsetting/EnchantConflictSubSettingGui.java +++ b/src/main/java/xyz/alexcrea/cuanvil/gui/config/settings/subsetting/EnchantConflictSubSettingGui.java @@ -151,7 +151,7 @@ public class EnchantConflictSubSettingGui extends ValueUpdatableGui implements S @Override public void updateGuiValues() { - this.parent.updateValueForConflict(this.enchantConflict, true); + this.parent.updateValueForGeneric(this.enchantConflict, true); // Parent should call updateLocal }