mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Add javadoc to global gui
This commit is contained in:
parent
2a3c085aaa
commit
2bb23e75bf
4 changed files with 65 additions and 12 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
package xyz.alexcrea.cuanvil.gui.config;
|
package xyz.alexcrea.cuanvil.gui.config;
|
||||||
|
|
||||||
import com.github.stefvanschie.inventoryframework.gui.GuiItem;
|
import com.github.stefvanschie.inventoryframework.gui.GuiItem;
|
||||||
|
import com.github.stefvanschie.inventoryframework.gui.type.util.Gui;
|
||||||
import com.github.stefvanschie.inventoryframework.pane.Orientable;
|
import com.github.stefvanschie.inventoryframework.pane.Orientable;
|
||||||
import com.github.stefvanschie.inventoryframework.pane.OutlinePane;
|
import com.github.stefvanschie.inventoryframework.pane.OutlinePane;
|
||||||
import com.github.stefvanschie.inventoryframework.pane.Pane;
|
import com.github.stefvanschie.inventoryframework.pane.Pane;
|
||||||
|
|
@ -19,16 +20,40 @@ import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract Global Config gui for enchantment setting configuration.
|
||||||
|
* @param <T> Type of the factory of the type of setting the gui should edit.
|
||||||
|
*/
|
||||||
public abstract class AbstractEnchantConfigGui<T extends AbstractSettingGui.SettingGuiFactory> extends ValueUpdatableGui {
|
public abstract class AbstractEnchantConfigGui<T extends AbstractSettingGui.SettingGuiFactory> extends ValueUpdatableGui {
|
||||||
|
|
||||||
private final static Material SECONDARY_BACKGROUND_MATERIAL = Material.BLACK_STAINED_GLASS_PANE;
|
private final static Material SECONDARY_BACKGROUND_MATERIAL = Material.BLACK_STAINED_GLASS_PANE;
|
||||||
|
|
||||||
protected AbstractEnchantConfigGui(String title){
|
private final Gui backGui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for a gui displaying available enchantment to edit a enchantment setting.
|
||||||
|
* @param title Title of the gui.
|
||||||
|
* @param backGui Gui to go back on click on the "back" button.
|
||||||
|
*/
|
||||||
|
protected AbstractEnchantConfigGui(String title, Gui backGui){
|
||||||
super(6, title, CustomAnvil.instance);
|
super(6, title, CustomAnvil.instance);
|
||||||
|
this.backGui = backGui;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Constructor for a gui displaying available enchantment to edit a enchantment setting.
|
||||||
|
* @param title Title of the gui.
|
||||||
|
*/
|
||||||
|
protected AbstractEnchantConfigGui(String title){
|
||||||
|
this(title, MainConfigGui.INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
PatternPane backItems;
|
PatternPane backgroundItems;
|
||||||
OutlinePane filledEnchant;
|
OutlinePane filledEnchant;
|
||||||
|
|
||||||
|
// Why is called like it is rn
|
||||||
|
/**
|
||||||
|
* Initialise value updatable gui pattern
|
||||||
|
*/
|
||||||
protected void init(){
|
protected void init(){
|
||||||
// Back item panel
|
// Back item panel
|
||||||
Pattern pattern = new Pattern(
|
Pattern pattern = new Pattern(
|
||||||
|
|
@ -39,25 +64,29 @@ public abstract class AbstractEnchantConfigGui<T extends AbstractSettingGui.Sett
|
||||||
"000000000",
|
"000000000",
|
||||||
"B11111111"
|
"B11111111"
|
||||||
);
|
);
|
||||||
backItems = new PatternPane(0, 0, 9, 6, Pane.Priority.LOW, pattern);
|
this.backgroundItems = new PatternPane(0, 0, 9, 6, Pane.Priority.LOW, pattern);
|
||||||
addPane(backItems);
|
addPane(this.backgroundItems);
|
||||||
|
|
||||||
GuiGlobalItems.addBackItem(backItems, MainConfigGui.INSTANCE);
|
GuiGlobalItems.addBackItem(this.backgroundItems, this.backGui);
|
||||||
|
|
||||||
GuiGlobalItems.addBackgroundItem(backItems);
|
GuiGlobalItems.addBackgroundItem(this.backgroundItems);
|
||||||
backItems.bindItem('1', GuiGlobalItems.backgroundItem(SECONDARY_BACKGROUND_MATERIAL));
|
this.backgroundItems.bindItem('1', GuiGlobalItems.backgroundItem(SECONDARY_BACKGROUND_MATERIAL));
|
||||||
|
|
||||||
// enchant item panel
|
// enchant item panel
|
||||||
filledEnchant = new OutlinePane(0, 0, 9, 5);
|
this.filledEnchant = new OutlinePane(0, 0, 9, 5);
|
||||||
filledEnchant.align(OutlinePane.Alignment.BEGIN);
|
this.filledEnchant.align(OutlinePane.Alignment.BEGIN);
|
||||||
filledEnchant.setOrientation(Orientable.Orientation.HORIZONTAL);
|
this.filledEnchant.setOrientation(Orientable.Orientation.HORIZONTAL);
|
||||||
addPane(filledEnchant);
|
addPane(this.filledEnchant);
|
||||||
|
|
||||||
prepareValues();
|
prepareValues();
|
||||||
updateGuiValues();
|
updateGuiValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<T> bookItemFactoryList;
|
private List<T> bookItemFactoryList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare enchantment config gui displayed items factory.
|
||||||
|
*/
|
||||||
protected void prepareValues(){
|
protected void prepareValues(){
|
||||||
bookItemFactoryList = new ArrayList<>();
|
bookItemFactoryList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@ import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global config to edit basic basic settings.
|
||||||
|
*/
|
||||||
public class BasicConfigGui extends ValueUpdatableGui {
|
public class BasicConfigGui extends ValueUpdatableGui {
|
||||||
|
|
||||||
public final static BasicConfigGui INSTANCE = new BasicConfigGui();
|
public final static BasicConfigGui INSTANCE = new BasicConfigGui();
|
||||||
|
|
@ -27,12 +30,18 @@ public class BasicConfigGui extends ValueUpdatableGui {
|
||||||
INSTANCE.init();
|
INSTANCE.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor of this Global gui for basic settings.
|
||||||
|
*/
|
||||||
private BasicConfigGui(){
|
private BasicConfigGui(){
|
||||||
super(3, "\u00A78Basic Config", CustomAnvil.instance);
|
super(3, "\u00A78Basic Config", CustomAnvil.instance);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PatternPane pane;
|
PatternPane pane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise Basic gui
|
||||||
|
*/
|
||||||
private void init(){
|
private void init(){
|
||||||
Pattern pattern = new Pattern(
|
Pattern pattern = new Pattern(
|
||||||
"000000000",
|
"000000000",
|
||||||
|
|
@ -58,6 +67,9 @@ public class BasicConfigGui extends ValueUpdatableGui {
|
||||||
private IntSettingsGui.IntSettingFactory itemRenameCost;
|
private IntSettingsGui.IntSettingFactory itemRenameCost;
|
||||||
private IntSettingsGui.IntSettingFactory sacrificeIllegalEnchantCost;
|
private IntSettingsGui.IntSettingFactory sacrificeIllegalEnchantCost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare basic gui displayed items factory and static items..
|
||||||
|
*/
|
||||||
protected void prepareValues(){
|
protected void prepareValues(){
|
||||||
// limit repair item
|
// limit repair item
|
||||||
this.limitRepairFactory = BoolSettingsGui.boolFactory("\u00A78Limit Repair Cost ?",this,
|
this.limitRepairFactory = BoolSettingsGui.boolFactory("\u00A78Limit Repair Cost ?",this,
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,9 @@ import xyz.alexcrea.cuanvil.util.StringUtil;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global Config gui for enchantment cost settings.
|
||||||
|
*/
|
||||||
public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSettingsGui.EnchantCostSettingFactory> {
|
public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSettingsGui.EnchantCostSettingFactory> {
|
||||||
|
|
||||||
private final static String SECTION_NAME = "enchant_values";
|
private final static String SECTION_NAME = "enchant_values";
|
||||||
|
|
@ -25,6 +28,9 @@ public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSe
|
||||||
INSTANCE.init();
|
INSTANCE.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor of this Global gui for enchantment cost settings.
|
||||||
|
*/
|
||||||
private EnchantCostConfigGui() {
|
private EnchantCostConfigGui() {
|
||||||
super("\u00A78Enchantment Level Limit");
|
super("\u00A78Enchantment Level Limit");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ import xyz.alexcrea.cuanvil.util.StringUtil;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global Config gui for enchantment level limit settings.
|
||||||
|
*/
|
||||||
public class EnchantLimitConfigGui extends AbstractEnchantConfigGui<IntSettingsGui.IntSettingFactory> {
|
public class EnchantLimitConfigGui extends AbstractEnchantConfigGui<IntSettingsGui.IntSettingFactory> {
|
||||||
|
|
||||||
private final static String SECTION_NAME = "enchant_limits";
|
private final static String SECTION_NAME = "enchant_limits";
|
||||||
|
|
@ -20,6 +23,9 @@ public class EnchantLimitConfigGui extends AbstractEnchantConfigGui<IntSettingsG
|
||||||
INSTANCE.init();
|
INSTANCE.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor of this Global gui for enchantment level limit settings.
|
||||||
|
*/
|
||||||
private EnchantLimitConfigGui() {
|
private EnchantLimitConfigGui() {
|
||||||
super("\u00A78Enchantment Level Limit");
|
super("\u00A78Enchantment Level Limit");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue