mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Add merge config gui
This commit is contained in:
parent
6e1351dbbc
commit
fe754ffe2f
2 changed files with 78 additions and 6 deletions
|
|
@ -30,7 +30,7 @@ public class MainConfigGui extends ChestGui {
|
|||
public void init(PacketManager packetManager) {
|
||||
Pattern pattern = new Pattern(
|
||||
GuiSharedConstant.EMPTY_GUI_FULL_LINE,
|
||||
"012304567",
|
||||
"012345678",
|
||||
"Q00000000"
|
||||
);
|
||||
PatternPane pane = new PatternPane(0, 0, 9, 3, pattern);
|
||||
|
|
@ -62,6 +62,18 @@ public class MainConfigGui extends ChestGui {
|
|||
GuiItem enchantLimitItem = GuiGlobalItems.goToGuiItem(enchantLimitItemstack, new EnchantLimitConfigGui());
|
||||
pane.bindItem('2', enchantLimitItem);
|
||||
|
||||
// enchant level limit item
|
||||
ItemStack enchantMergeLimitItemstack = new ItemStack(Material.ENCHANTED_BOOK);
|
||||
ItemMeta enchantMergeLimitMeta = enchantMergeLimitItemstack.getItemMeta();
|
||||
assert enchantMergeLimitMeta != null;
|
||||
|
||||
enchantMergeLimitMeta.setDisplayName("§aEnchantment Merge Limit");
|
||||
enchantMergeLimitMeta.setLore(Collections.singletonList("§7Click here to open enchantment merge limit menu"));
|
||||
enchantMergeLimitItemstack.setItemMeta(enchantMergeLimitMeta);
|
||||
|
||||
GuiItem enchantMergeLimitItem = GuiGlobalItems.goToGuiItem(enchantMergeLimitItemstack, new EnchantMergeLimitConfigGui());
|
||||
pane.bindItem('3', enchantMergeLimitItem);
|
||||
|
||||
// enchant cost item
|
||||
ItemStack enchantCostItemstack = new ItemStack(Material.EXPERIENCE_BOTTLE);
|
||||
ItemMeta enchantCostMeta = enchantCostItemstack.getItemMeta();
|
||||
|
|
@ -72,7 +84,7 @@ public class MainConfigGui extends ChestGui {
|
|||
enchantCostItemstack.setItemMeta(enchantCostMeta);
|
||||
|
||||
GuiItem enchantCostItem = GuiGlobalItems.goToGuiItem(enchantCostItemstack, new EnchantCostConfigGui());
|
||||
pane.bindItem('3', enchantCostItem);
|
||||
pane.bindItem('4', enchantCostItem);
|
||||
|
||||
// Enchantment Conflicts item
|
||||
ItemStack enchantConflictItemstack = new ItemStack(Material.OAK_FENCE);
|
||||
|
|
@ -84,7 +96,7 @@ public class MainConfigGui extends ChestGui {
|
|||
enchantConflictItemstack.setItemMeta(enchantConflictMeta);
|
||||
|
||||
GuiItem enchantConflictItem = GuiGlobalItems.goToGuiItem(enchantConflictItemstack, EnchantConflictGui.getInstance());
|
||||
pane.bindItem('4', enchantConflictItem);
|
||||
pane.bindItem('5', enchantConflictItem);
|
||||
|
||||
// Group config items
|
||||
ItemStack groupItemstack = new ItemStack(Material.CHEST);
|
||||
|
|
@ -97,7 +109,7 @@ public class MainConfigGui extends ChestGui {
|
|||
|
||||
GuiItem groupConfigItem = GuiGlobalItems.goToGuiItem(groupItemstack, GroupConfigGui.getInstance());
|
||||
|
||||
pane.bindItem('5', groupConfigItem);
|
||||
pane.bindItem('6', groupConfigItem);
|
||||
|
||||
// Unit repair item
|
||||
ItemStack unirRepairItemstack = new ItemStack(Material.DIAMOND);
|
||||
|
|
@ -109,7 +121,7 @@ public class MainConfigGui extends ChestGui {
|
|||
unirRepairItemstack.setItemMeta(unitRepairMeta);
|
||||
|
||||
GuiItem unitRepairItem = GuiGlobalItems.goToGuiItem(unirRepairItemstack, UnitRepairConfigGui.getInstance());
|
||||
pane.bindItem('6', unitRepairItem);
|
||||
pane.bindItem('7', unitRepairItem);
|
||||
|
||||
// Custom recipe item
|
||||
ItemStack customRecipeItemstack = new ItemStack(Material.CRAFTING_TABLE);
|
||||
|
|
@ -121,7 +133,7 @@ public class MainConfigGui extends ChestGui {
|
|||
customRecipeItemstack.setItemMeta(customRecipeMeta);
|
||||
|
||||
GuiItem customRecipeItem = GuiGlobalItems.goToGuiItem(customRecipeItemstack, CustomRecipeConfigGui.getInstance());
|
||||
pane.bindItem('7', customRecipeItem);
|
||||
pane.bindItem('8', customRecipeItem);
|
||||
|
||||
// quit item
|
||||
ItemStack quitItemstack = new ItemStack(Material.BARRIER);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
package xyz.alexcrea.cuanvil.gui.config.global;
|
||||
|
||||
import com.github.stefvanschie.inventoryframework.gui.GuiItem;
|
||||
import org.bukkit.Material;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||
import xyz.alexcrea.cuanvil.enchant.CAEnchantment;
|
||||
import xyz.alexcrea.cuanvil.gui.config.settings.IntSettingsGui;
|
||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
public class EnchantMergeLimitConfigGui extends AbstractEnchantConfigGui<IntSettingsGui.IntSettingFactory> {
|
||||
|
||||
private static final String SECTION_NAME = "disable-merge-over";
|
||||
|
||||
private static EnchantMergeLimitConfigGui INSTANCE = null;
|
||||
|
||||
@Nullable
|
||||
public static EnchantMergeLimitConfigGui getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor of this Global gui for enchantment level limit settings.
|
||||
*/
|
||||
public EnchantMergeLimitConfigGui() {
|
||||
super("§8Enchantment Maximum Merge Level");
|
||||
if(INSTANCE == null) INSTANCE = this;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntSettingsGui.IntSettingFactory createFactory(CAEnchantment enchant) {
|
||||
String key = enchant.getKey().getKey().toLowerCase(Locale.ROOT);
|
||||
String prettyKey = CasedStringUtil.snakeToUpperSpacedCase(key);
|
||||
|
||||
return new IntSettingsGui.IntSettingFactory(prettyKey + " Merge Limit", this,
|
||||
SECTION_NAME + '.' + key, ConfigHolder.DEFAULT_CONFIG,
|
||||
Arrays.asList(
|
||||
"§7Maximum merge level for for " + prettyKey,
|
||||
"",
|
||||
"For example, if set to 2, lvl1 + lvl1 of will give a lvl2",
|
||||
"But lvl2 + lvl2 will not give lv 3.",
|
||||
"Will still not merge above max enchantment level even if above",
|
||||
"-1 will set the maximum to enchantment's maximum level"
|
||||
),
|
||||
-1, 255, -1,
|
||||
1, 5, 10, 50, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiItem itemFromFactory(CAEnchantment enchantment, IntSettingsGui.IntSettingFactory inventoryFactory) {
|
||||
return inventoryFactory.getItem(
|
||||
Material.ENCHANTED_BOOK,
|
||||
inventoryFactory.getTitle());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue