mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
2 small fix.
Fix included enchantment of conflicts back button returning to main menu instead of the selected conflict. Fix custom craft exact button count not setting the correct setting.
This commit is contained in:
parent
cf4cc740e8
commit
c74ea42734
5 changed files with 23 additions and 12 deletions
|
|
@ -16,7 +16,6 @@ import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
|
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
|
|
||||||
|
|
@ -31,14 +30,14 @@ public abstract class ElementListConfigGui< T > extends ChestGui implements Valu
|
||||||
|
|
||||||
protected PatternPane backgroundPane;
|
protected PatternPane backgroundPane;
|
||||||
|
|
||||||
protected ElementListConfigGui(@NotNull String title) {
|
protected ElementListConfigGui(@NotNull String title, Gui parent) {
|
||||||
super(6, title, CustomAnvil.instance);
|
super(6, title, CustomAnvil.instance);
|
||||||
this.namePrefix = title;
|
this.namePrefix = title;
|
||||||
|
|
||||||
// Back item panel
|
// Back item panel
|
||||||
Pattern pattern = getBackgroundPattern();
|
Pattern pattern = getBackgroundPattern();
|
||||||
this.backgroundPane = new PatternPane(0, 0, 9, 6, Pane.Priority.LOW, pattern);
|
this.backgroundPane = new PatternPane(0, 0, 9, 6, Pane.Priority.LOW, pattern);
|
||||||
GuiGlobalItems.addBackItem(this.backgroundPane, MainConfigGui.getInstance());
|
GuiGlobalItems.addBackItem(this.backgroundPane, parent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -17,7 +18,7 @@ public abstract class MappedElementListConfigGui< T, S > extends ElementListConf
|
||||||
|
|
||||||
protected final HashMap<T, S> elementGuiMap;
|
protected final HashMap<T, S> elementGuiMap;
|
||||||
protected MappedElementListConfigGui(@NotNull String title) {
|
protected MappedElementListConfigGui(@NotNull String title) {
|
||||||
super(title);
|
super(title, MainConfigGui.getInstance());
|
||||||
this.elementGuiMap = new HashMap<>();
|
this.elementGuiMap = new HashMap<>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
package xyz.alexcrea.cuanvil.gui.config.list;
|
package xyz.alexcrea.cuanvil.gui.config.list;
|
||||||
|
|
||||||
import com.github.stefvanschie.inventoryframework.gui.GuiItem;
|
import com.github.stefvanschie.inventoryframework.gui.GuiItem;
|
||||||
|
import com.github.stefvanschie.inventoryframework.gui.type.util.Gui;
|
||||||
import io.delilaheve.CustomAnvil;
|
import io.delilaheve.CustomAnvil;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.settings.SettingGui;
|
import xyz.alexcrea.cuanvil.gui.config.settings.SettingGui;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -17,12 +19,16 @@ public abstract class SettingGuiListConfigGui< T, S extends SettingGui.SettingGu
|
||||||
|
|
||||||
protected HashMap<T, GuiItem> guiItemMap;
|
protected HashMap<T, GuiItem> guiItemMap;
|
||||||
protected HashMap<T, S> factoryMap;
|
protected HashMap<T, S> factoryMap;
|
||||||
protected SettingGuiListConfigGui(@NotNull String title) {
|
protected SettingGuiListConfigGui(@NotNull String title, Gui parent) {
|
||||||
super(title);
|
super(title, parent);
|
||||||
this.guiItemMap = new HashMap<>();
|
this.guiItemMap = new HashMap<>();
|
||||||
this.factoryMap = new HashMap<>();
|
this.factoryMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected SettingGuiListConfigGui(@NotNull String title) {
|
||||||
|
this(title, MainConfigGui.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected GuiItem prepareCreateNewItem() {
|
protected GuiItem prepareCreateNewItem() {
|
||||||
ItemStack createItem = new ItemStack(Material.PAPER);
|
ItemStack createItem = new ItemStack(Material.PAPER);
|
||||||
|
|
|
||||||
|
|
@ -78,29 +78,33 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
|
||||||
|
|
||||||
IntRange costRange = AnvilCustomRecipe.Companion.getXP_COST_CONFIG_RANGE();
|
IntRange costRange = AnvilCustomRecipe.Companion.getXP_COST_CONFIG_RANGE();
|
||||||
this.exactCountFactory = BoolSettingsGui.boolFactory("§8Exact count ?", this,
|
this.exactCountFactory = BoolSettingsGui.boolFactory("§8Exact count ?", this,
|
||||||
ConfigHolder.DEFAULT_CONFIG,
|
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||||
this.anvilRecipe + "." + AnvilCustomRecipe.EXACT_COUNT_CONFIG, AnvilCustomRecipe.DEFAULT_EXACT_COUNT_CONFIG);
|
this.anvilRecipe + "." + AnvilCustomRecipe.EXACT_COUNT_CONFIG, AnvilCustomRecipe.DEFAULT_EXACT_COUNT_CONFIG);
|
||||||
|
|
||||||
this.xpCostFactory = IntSettingsGui.intFactory("§8Recipe Xp Cost", this,
|
this.xpCostFactory = IntSettingsGui.intFactory("§8Recipe Xp Cost", this,
|
||||||
this.anvilRecipe +"."+AnvilCustomRecipe.XP_COST_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
this.anvilRecipe +"."+AnvilCustomRecipe.XP_COST_CONFIG,
|
||||||
|
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||||
null,
|
null,
|
||||||
costRange.getFirst(), costRange.getLast(), AnvilCustomRecipe.DEFAULT_XP_COST_CONFIG, 1, 5, 10);
|
costRange.getFirst(), costRange.getLast(), AnvilCustomRecipe.DEFAULT_XP_COST_CONFIG, 1, 5, 10);
|
||||||
|
|
||||||
|
|
||||||
this.leftItemFactory = ItemSettingGui.itemFactory("§eRecipe Left §8Item", this,
|
this.leftItemFactory = ItemSettingGui.itemFactory("§eRecipe Left §8Item", this,
|
||||||
this.anvilRecipe + "." + AnvilCustomRecipe.LEFT_ITEM_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
this.anvilRecipe + "." + AnvilCustomRecipe.LEFT_ITEM_CONFIG,
|
||||||
|
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||||
AnvilCustomRecipe.Companion.getDEFAULT_LEFT_ITEM_CONFIG(),
|
AnvilCustomRecipe.Companion.getDEFAULT_LEFT_ITEM_CONFIG(),
|
||||||
"§7Set the left item of the custom craft",
|
"§7Set the left item of the custom craft",
|
||||||
"§7\u25A0 + \u25A1 = \u25A1");
|
"§7\u25A0 + \u25A1 = \u25A1");
|
||||||
|
|
||||||
this.rightItemFactory = ItemSettingGui.itemFactory("§eRecipe Right §8Item", this,
|
this.rightItemFactory = ItemSettingGui.itemFactory("§eRecipe Right §8Item", this,
|
||||||
this.anvilRecipe + "." + AnvilCustomRecipe.RIGHT_ITEM_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
this.anvilRecipe + "." + AnvilCustomRecipe.RIGHT_ITEM_CONFIG,
|
||||||
|
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||||
AnvilCustomRecipe.Companion.getDEFAULT_RIGHT_ITEM_CONFIG(),
|
AnvilCustomRecipe.Companion.getDEFAULT_RIGHT_ITEM_CONFIG(),
|
||||||
"§7Set the right item of the custom craft",
|
"§7Set the right item of the custom craft",
|
||||||
"§7\u25A1 + \u25A0 = \u25A1");
|
"§7\u25A1 + \u25A0 = \u25A1");
|
||||||
|
|
||||||
this.resultItemFactory = ItemSettingGui.itemFactory("§aRecipe Result §8Item", this,
|
this.resultItemFactory = ItemSettingGui.itemFactory("§aRecipe Result §8Item", this,
|
||||||
this.anvilRecipe + "." + AnvilCustomRecipe.RESULT_ITEM_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
this.anvilRecipe + "." + AnvilCustomRecipe.RESULT_ITEM_CONFIG,
|
||||||
|
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||||
AnvilCustomRecipe.Companion.getDEFAULT_RESULT_ITEM_CONFIG(),
|
AnvilCustomRecipe.Companion.getDEFAULT_RESULT_ITEM_CONFIG(),
|
||||||
"§7Set the result item of the custom craft",
|
"§7Set the result item of the custom craft",
|
||||||
"§7\u25A1 + \u25A1 = \u25A0");
|
"§7\u25A1 + \u25A1 = \u25A0");
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||||
import xyz.alexcrea.cuanvil.enchant.CAEnchantment;
|
import xyz.alexcrea.cuanvil.enchant.CAEnchantment;
|
||||||
import xyz.alexcrea.cuanvil.enchant.CAEnchantmentRegistry;
|
import xyz.alexcrea.cuanvil.enchant.CAEnchantmentRegistry;
|
||||||
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
||||||
|
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.SelectEnchantmentContainer;
|
import xyz.alexcrea.cuanvil.gui.config.SelectEnchantmentContainer;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.SettingGuiListConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.SettingGuiListConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||||
|
|
@ -35,7 +36,7 @@ public class EnchantSelectSettingGui extends SettingGuiListConfigGui<CAEnchantme
|
||||||
private boolean displayUnselected;
|
private boolean displayUnselected;
|
||||||
|
|
||||||
public EnchantSelectSettingGui(@NotNull String title, ValueUpdatableGui parent, SelectEnchantmentContainer enchantContainer) {
|
public EnchantSelectSettingGui(@NotNull String title, ValueUpdatableGui parent, SelectEnchantmentContainer enchantContainer) {
|
||||||
super(title);
|
super(title, parent instanceof Gui parentGui ? parentGui : MainConfigGui.getInstance()) ;
|
||||||
this.enchantContainer = enchantContainer;
|
this.enchantContainer = enchantContainer;
|
||||||
|
|
||||||
this.selectedEnchant = new HashSet<>(enchantContainer.getSelectedEnchantments());
|
this.selectedEnchant = new HashSet<>(enchantContainer.getSelectedEnchantments());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue