Add javadoc to global gui

This commit is contained in:
alexcrea 2024-03-13 19:37:07 +01:00
parent 2a3c085aaa
commit 2bb23e75bf
4 changed files with 65 additions and 12 deletions

View file

@ -1,6 +1,7 @@
package xyz.alexcrea.cuanvil.gui.config;
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.OutlinePane;
import com.github.stefvanschie.inventoryframework.pane.Pane;
@ -19,16 +20,40 @@ import java.util.Arrays;
import java.util.Comparator;
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 {
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);
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;
// Why is called like it is rn
/**
* Initialise value updatable gui pattern
*/
protected void init(){
// Back item panel
Pattern pattern = new Pattern(
@ -39,25 +64,29 @@ public abstract class AbstractEnchantConfigGui<T extends AbstractSettingGui.Sett
"000000000",
"B11111111"
);
backItems = new PatternPane(0, 0, 9, 6, Pane.Priority.LOW, pattern);
addPane(backItems);
this.backgroundItems = new PatternPane(0, 0, 9, 6, Pane.Priority.LOW, pattern);
addPane(this.backgroundItems);
GuiGlobalItems.addBackItem(backItems, MainConfigGui.INSTANCE);
GuiGlobalItems.addBackItem(this.backgroundItems, this.backGui);
GuiGlobalItems.addBackgroundItem(backItems);
backItems.bindItem('1', GuiGlobalItems.backgroundItem(SECONDARY_BACKGROUND_MATERIAL));
GuiGlobalItems.addBackgroundItem(this.backgroundItems);
this.backgroundItems.bindItem('1', GuiGlobalItems.backgroundItem(SECONDARY_BACKGROUND_MATERIAL));
// enchant item panel
filledEnchant = new OutlinePane(0, 0, 9, 5);
filledEnchant.align(OutlinePane.Alignment.BEGIN);
filledEnchant.setOrientation(Orientable.Orientation.HORIZONTAL);
addPane(filledEnchant);
this.filledEnchant = new OutlinePane(0, 0, 9, 5);
this.filledEnchant.align(OutlinePane.Alignment.BEGIN);
this.filledEnchant.setOrientation(Orientable.Orientation.HORIZONTAL);
addPane(this.filledEnchant);
prepareValues();
updateGuiValues();
}
private List<T> bookItemFactoryList;
/**
* Prepare enchantment config gui displayed items factory.
*/
protected void prepareValues(){
bookItemFactoryList = new ArrayList<>();

View file

@ -19,6 +19,9 @@ import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
import java.util.Collections;
/**
* Global config to edit basic basic settings.
*/
public class BasicConfigGui extends ValueUpdatableGui {
public final static BasicConfigGui INSTANCE = new BasicConfigGui();
@ -27,12 +30,18 @@ public class BasicConfigGui extends ValueUpdatableGui {
INSTANCE.init();
}
/**
* Constructor of this Global gui for basic settings.
*/
private BasicConfigGui(){
super(3, "\u00A78Basic Config", CustomAnvil.instance);
}
PatternPane pane;
/**
* Initialise Basic gui
*/
private void init(){
Pattern pattern = new Pattern(
"000000000",
@ -58,6 +67,9 @@ public class BasicConfigGui extends ValueUpdatableGui {
private IntSettingsGui.IntSettingFactory itemRenameCost;
private IntSettingsGui.IntSettingFactory sacrificeIllegalEnchantCost;
/**
* Prepare basic gui displayed items factory and static items..
*/
protected void prepareValues(){
// limit repair item
this.limitRepairFactory = BoolSettingsGui.boolFactory("\u00A78Limit Repair Cost ?",this,

View file

@ -15,6 +15,9 @@ import xyz.alexcrea.cuanvil.util.StringUtil;
import java.util.Arrays;
import java.util.Locale;
/**
* Global Config gui for enchantment cost settings.
*/
public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSettingsGui.EnchantCostSettingFactory> {
private final static String SECTION_NAME = "enchant_values";
@ -25,6 +28,9 @@ public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSe
INSTANCE.init();
}
/**
* Constructor of this Global gui for enchantment cost settings.
*/
private EnchantCostConfigGui() {
super("\u00A78Enchantment Level Limit");

View file

@ -10,6 +10,9 @@ import xyz.alexcrea.cuanvil.util.StringUtil;
import java.util.Locale;
/**
* Global Config gui for enchantment level limit settings.
*/
public class EnchantLimitConfigGui extends AbstractEnchantConfigGui<IntSettingsGui.IntSettingFactory> {
private final static String SECTION_NAME = "enchant_limits";
@ -20,6 +23,9 @@ public class EnchantLimitConfigGui extends AbstractEnchantConfigGui<IntSettingsG
INSTANCE.init();
}
/**
* Constructor of this Global gui for enchantment level limit settings.
*/
private EnchantLimitConfigGui() {
super("\u00A78Enchantment Level Limit");