mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Edit DoubleSettingGui to use BigDecimal.
This commit is contained in:
parent
9ea7624bff
commit
abc9dc89d3
2 changed files with 130 additions and 71 deletions
|
|
@ -5,6 +5,7 @@ import com.github.stefvanschie.inventoryframework.pane.PatternPane;
|
||||||
import com.github.stefvanschie.inventoryframework.pane.util.Pattern;
|
import com.github.stefvanschie.inventoryframework.pane.util.Pattern;
|
||||||
import io.delilaheve.CustomAnvil;
|
import io.delilaheve.CustomAnvil;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
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;
|
||||||
|
|
@ -14,18 +15,25 @@ import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||||
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;
|
||||||
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
import xyz.alexcrea.cuanvil.util.MetricsUtil;
|
import xyz.alexcrea.cuanvil.util.MetricsUtil;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class DoubleSettingGui extends AbstractSettingGui {
|
public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
|
|
||||||
protected final DoubleSettingFactory holder;
|
protected final DoubleSettingFactory holder;
|
||||||
protected final double before;
|
protected final boolean asPercentage;
|
||||||
protected double now;
|
@NotNull
|
||||||
protected double step;
|
protected final BigDecimal before;
|
||||||
|
@NotNull
|
||||||
|
protected BigDecimal now;
|
||||||
|
protected BigDecimal step;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a double setting config gui.
|
* Create a double setting config gui.
|
||||||
|
|
@ -33,10 +41,12 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
* @param holder Configuration factory of this setting.
|
* @param holder Configuration factory of this setting.
|
||||||
* @param now The defined value of this setting.
|
* @param now The defined value of this setting.
|
||||||
*/
|
*/
|
||||||
protected DoubleSettingGui(DoubleSettingFactory holder, double now) {
|
protected DoubleSettingGui(DoubleSettingFactory holder, @NotNull BigDecimal now, boolean asPercentage) {
|
||||||
super(3, holder.getTitle(), holder.parent);
|
super(3, holder.getTitle(), holder.parent);
|
||||||
assert holder.steps.length > 0 && holder.steps.length <= 9;
|
assert holder.steps.length > 0 && holder.steps.length <= 9;
|
||||||
this.holder = holder;
|
this.holder = holder;
|
||||||
|
this.asPercentage = asPercentage;
|
||||||
|
|
||||||
this.before = now;
|
this.before = now;
|
||||||
this.now = now;
|
this.now = now;
|
||||||
this.step = holder.steps[0];
|
this.step = holder.steps[0];
|
||||||
|
|
@ -66,7 +76,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
|
||||||
meta.setDisplayName("\u00A7eReset to default value");
|
meta.setDisplayName("\u00A7eReset to default value");
|
||||||
meta.setLore(Collections.singletonList("\u00A77Default value is: " + holder.defaultVal));
|
meta.setLore(Collections.singletonList("\u00A77Default value is: " + displayValue(holder.defaultVal)));
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
returnToDefault = new GuiItem(item, event -> {
|
returnToDefault = new GuiItem(item, event -> {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
@ -83,34 +93,24 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
|
|
||||||
PatternPane pane = getPane();
|
PatternPane pane = getPane();
|
||||||
|
|
||||||
// minus item
|
|
||||||
GuiItem minusItem;
|
|
||||||
if (now > holder.min) {
|
|
||||||
double planned = Math.max(holder.min, now - step);
|
|
||||||
ItemStack item = new ItemStack(Material.RED_TERRACOTTA);
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
meta.setDisplayName("\u00A7e" + now + " -> " + planned + " \u00A7r(\u00A7c-" + (now - planned) + "\u00A7r)");
|
|
||||||
meta.setLore(AbstractSettingGui.CLICK_LORE);
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
|
|
||||||
minusItem = new GuiItem(item, updateNowConsumer(planned), CustomAnvil.instance);
|
//minus item
|
||||||
|
GuiItem minusItem;
|
||||||
|
if (now.compareTo(holder.min) > 0) {
|
||||||
|
BigDecimal planned = holder.min.max(now.subtract(step));
|
||||||
|
|
||||||
|
minusItem = getSetValueItem(Material.RED_TERRACOTTA, planned, "\u00A7c-");
|
||||||
} else {
|
} else {
|
||||||
minusItem = GuiGlobalItems.backgroundItem(Material.BARRIER);
|
minusItem = GuiGlobalItems.backgroundItem(Material.BARRIER);
|
||||||
}
|
}
|
||||||
pane.bindItem('-', minusItem);
|
pane.bindItem('-', minusItem);
|
||||||
|
|
||||||
//plus item
|
//plus item
|
||||||
// may do a function to generalise ?
|
|
||||||
GuiItem plusItem;
|
GuiItem plusItem;
|
||||||
if (now < holder.max) {
|
if (now.compareTo(holder.max) < 0) {
|
||||||
double planned = Math.min(holder.max, now + step);
|
BigDecimal planned = holder.max.min(now.add(step));
|
||||||
ItemStack item = new ItemStack(Material.GREEN_TERRACOTTA);
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
meta.setDisplayName("\u00A7e" + now + " -> " + planned + " \u00A7r(\u00A7a+" + (planned - now) + "\u00A7r)");
|
|
||||||
meta.setLore(AbstractSettingGui.CLICK_LORE);
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
|
|
||||||
plusItem = new GuiItem(item, updateNowConsumer(planned), CustomAnvil.instance);
|
plusItem = getSetValueItem(Material.GREEN_TERRACOTTA, planned, "\u00A7a+");
|
||||||
} else {
|
} else {
|
||||||
plusItem = GuiGlobalItems.backgroundItem(Material.BARRIER);
|
plusItem = GuiGlobalItems.backgroundItem(Material.BARRIER);
|
||||||
}
|
}
|
||||||
|
|
@ -119,7 +119,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
// "result" display
|
// "result" display
|
||||||
ItemStack resultPaper = new ItemStack(Material.PAPER);
|
ItemStack resultPaper = new ItemStack(Material.PAPER);
|
||||||
ItemMeta resultMeta = resultPaper.getItemMeta();
|
ItemMeta resultMeta = resultPaper.getItemMeta();
|
||||||
resultMeta.setDisplayName("\u00A7eValue: " + now);
|
resultMeta.setDisplayName("\u00A7eValue: " + displayValue(now));
|
||||||
resultPaper.setItemMeta(resultMeta);
|
resultPaper.setItemMeta(resultMeta);
|
||||||
GuiItem resultItem = new GuiItem(resultPaper, GuiGlobalActions.stayInPlace, CustomAnvil.instance);
|
GuiItem resultItem = new GuiItem(resultPaper, GuiGlobalActions.stayInPlace, CustomAnvil.instance);
|
||||||
|
|
||||||
|
|
@ -127,7 +127,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
|
|
||||||
// reset to default
|
// reset to default
|
||||||
GuiItem returnToDefault;
|
GuiItem returnToDefault;
|
||||||
if (now != holder.defaultVal) {
|
if (!now.equals(holder.defaultVal)) {
|
||||||
returnToDefault = this.returnToDefault;
|
returnToDefault = this.returnToDefault;
|
||||||
} else {
|
} else {
|
||||||
returnToDefault = GuiGlobalItems.backgroundItem();
|
returnToDefault = GuiGlobalItems.backgroundItem();
|
||||||
|
|
@ -137,11 +137,22 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GuiItem getSetValueItem(Material mat, BigDecimal planned, String numberPrefix){
|
||||||
|
ItemStack item = new ItemStack(mat);
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
meta.setDisplayName("\u00A7e" + displayValue(now) + " -> " + displayValue(planned)
|
||||||
|
+ " \u00A7r(" + numberPrefix + (displayValue(planned.subtract(now).abs()) + "\u00A7r)"));
|
||||||
|
meta.setLore(AbstractSettingGui.CLICK_LORE);
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
|
||||||
|
return new GuiItem(item, updateNowConsumer(planned), CustomAnvil.instance);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param planned Value to change current setting to.
|
* @param planned Value to change current setting to.
|
||||||
* @return A consumer to update the current setting's value.
|
* @return A consumer to update the current setting's value.
|
||||||
*/
|
*/
|
||||||
protected Consumer<InventoryClickEvent> updateNowConsumer(double planned) {
|
protected Consumer<InventoryClickEvent> updateNowConsumer(BigDecimal planned) {
|
||||||
return event -> {
|
return event -> {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
now = planned;
|
now = planned;
|
||||||
|
|
@ -199,25 +210,25 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
* @return A step item corresponding to its index value.
|
* @return A step item corresponding to its index value.
|
||||||
*/
|
*/
|
||||||
protected GuiItem stepGuiItem(int stepIndex) {
|
protected GuiItem stepGuiItem(int stepIndex) {
|
||||||
double stepValue = holder.steps[stepIndex];
|
BigDecimal stepValue = holder.steps[stepIndex];
|
||||||
|
|
||||||
// Get material properties
|
// Get material properties
|
||||||
Material stepMat;
|
Material stepMat;
|
||||||
StringBuilder stepName = new StringBuilder("\u00A7");
|
StringBuilder stepName = new StringBuilder("\u00A7");
|
||||||
List<String> stepLore;
|
List<String> stepLore;
|
||||||
Consumer<InventoryClickEvent> clickEvent;
|
Consumer<InventoryClickEvent> clickEvent;
|
||||||
if (stepValue == step) {
|
if (Objects.equals(stepValue, step)) {
|
||||||
stepMat = Material.GREEN_STAINED_GLASS_PANE;
|
stepMat = Material.GREEN_STAINED_GLASS_PANE;
|
||||||
stepName.append('a');
|
stepName.append('a');
|
||||||
stepLore = Collections.singletonList("\u00A77Value is changing by " + stepValue);
|
stepLore = Collections.singletonList("\u00A77Value is changing by " + displayValue(stepValue));
|
||||||
clickEvent = GuiGlobalActions.stayInPlace;
|
clickEvent = GuiGlobalActions.stayInPlace;
|
||||||
} else {
|
} else {
|
||||||
stepMat = Material.RED_STAINED_GLASS_PANE;
|
stepMat = Material.RED_STAINED_GLASS_PANE;
|
||||||
stepName.append('c');
|
stepName.append('c');
|
||||||
stepLore = Collections.singletonList("\u00A77Click here to change the value by " + stepValue);
|
stepLore = Collections.singletonList("\u00A77Click here to change the value by " + displayValue(stepValue));
|
||||||
clickEvent = updateStepValue(stepValue);
|
clickEvent = updateStepValue(stepValue);
|
||||||
}
|
}
|
||||||
stepName.append("Step of: ").append(stepValue);
|
stepName.append("Step of ").append(displayValue(stepValue));
|
||||||
|
|
||||||
// Create item stack then gui item
|
// Create item stack then gui item
|
||||||
ItemStack item = new ItemStack(stepMat);
|
ItemStack item = new ItemStack(stepMat);
|
||||||
|
|
@ -234,7 +245,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
* @param stepValue Value to change current step to.
|
* @param stepValue Value to change current step to.
|
||||||
* @return A consumer to update the current step of this setting.
|
* @return A consumer to update the current step of this setting.
|
||||||
*/
|
*/
|
||||||
protected Consumer<InventoryClickEvent> updateStepValue(double stepValue) {
|
protected Consumer<InventoryClickEvent> updateStepValue(BigDecimal stepValue) {
|
||||||
return event -> {
|
return event -> {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
this.step = stepValue;
|
this.step = stepValue;
|
||||||
|
|
@ -246,7 +257,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onSave() {
|
public boolean onSave() {
|
||||||
holder.config.getConfig().set(holder.configPath, now);
|
holder.config.getConfig().set(holder.configPath, now.doubleValue());
|
||||||
|
|
||||||
MetricsUtil.INSTANCE.notifyChange(this.holder.config, this.holder.configPath);
|
MetricsUtil.INSTANCE.notifyChange(this.holder.config, this.holder.configPath);
|
||||||
if (GuiSharedConstant.TEMPORARY_DO_SAVE_TO_DISK_EVERY_CHANGE) {
|
if (GuiSharedConstant.TEMPORARY_DO_SAVE_TO_DISK_EVERY_CHANGE) {
|
||||||
|
|
@ -257,31 +268,47 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hadChange() {
|
public boolean hadChange() {
|
||||||
return now != before;
|
return !now.equals(before);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final BigDecimal PERCENTAGE_OFFSET = BigDecimal.valueOf(100);
|
||||||
|
public String displayValue(BigDecimal value){
|
||||||
|
return displayValue(value, this.asPercentage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String displayValue(BigDecimal value, boolean isAsPercentage){
|
||||||
|
if(isAsPercentage){
|
||||||
|
return value.multiply(PERCENTAGE_OFFSET).setScale(value.scale()-2, RoundingMode.HALF_UP) + "%";
|
||||||
|
}
|
||||||
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a double setting factory from setting's parameters.
|
* Create a double setting factory from setting's parameters.
|
||||||
*
|
*
|
||||||
* @param title The title of the gui.
|
* @param title The title of the gui.
|
||||||
* @param parent Parent gui to go back when completed.
|
* @param parent Parent gui to go back when completed.
|
||||||
* @param configPath Configuration path of this setting.
|
* @param configPath Configuration path of this setting.
|
||||||
* @param config Configuration holder of this setting.
|
* @param config Configuration holder of this setting.
|
||||||
* @param min Minimum value of this setting.
|
* @param scale The scale of the decimal.
|
||||||
* @param max Maximum value of this setting.
|
* @param asPercentage If we should display the value as a %.
|
||||||
* @param defaultVal Default value if not found on the config.
|
* @param min Minimum value of this setting.
|
||||||
* @param steps List of step the value can increment/decrement.
|
* @param max Maximum value of this setting.
|
||||||
* List's size should be between 1 (included) and 5 (included).
|
* @param defaultVal Default value if not found on the config.
|
||||||
* it is visually preferable to have an odd number of step.
|
* @param steps List of step the value can increment/decrement.
|
||||||
* If step only contain 1 value, no step item should be displayed.
|
* List's size should be between 1 (included) and 5 (included).
|
||||||
|
* it is visually preferable to have an odd number of step.
|
||||||
|
* If step only contain 1 value, no step item should be displayed.
|
||||||
* @return A factory for a double setting gui.
|
* @return A factory for a double setting gui.
|
||||||
*/
|
*/
|
||||||
public static DoubleSettingFactory doubleFactory(@NotNull String title, ValueUpdatableGui parent,
|
public static DoubleSettingFactory doubleFactory(@NotNull String title, ValueUpdatableGui parent,
|
||||||
String configPath, ConfigHolder config,
|
String configPath, ConfigHolder config,
|
||||||
|
int scale, boolean asPercentage,
|
||||||
double min, double max, double defaultVal, double... steps) {
|
double min, double max, double defaultVal, double... steps) {
|
||||||
return new DoubleSettingFactory(
|
return new DoubleSettingFactory(
|
||||||
title, parent,
|
title, parent,
|
||||||
configPath, config,
|
configPath, config,
|
||||||
|
scale, asPercentage,
|
||||||
min, max, defaultVal, steps);
|
min, max, defaultVal, steps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -292,37 +319,49 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
@NotNull
|
@NotNull
|
||||||
String title;
|
String title;
|
||||||
ValueUpdatableGui parent;
|
ValueUpdatableGui parent;
|
||||||
double min;
|
|
||||||
double max;
|
int scale;
|
||||||
double defaultVal;
|
boolean asPercentage;
|
||||||
double[] steps;
|
BigDecimal min;
|
||||||
|
BigDecimal max;
|
||||||
|
BigDecimal defaultVal;
|
||||||
|
BigDecimal[] steps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a double setting gui factory.
|
* Constructor for a double setting gui factory.
|
||||||
*
|
*
|
||||||
* @param title The title of the gui.
|
* @param title The title of the gui.
|
||||||
* @param parent Parent gui to go back when completed.
|
* @param parent Parent gui to go back when completed.
|
||||||
* @param configPath Configuration path of this setting.
|
* @param configPath Configuration path of this setting.
|
||||||
* @param config Configuration holder of this setting.
|
* @param config Configuration holder of this setting.
|
||||||
* @param min Minimum value of this setting.
|
* @param scale The scale of the decimal.
|
||||||
* @param max Maximum value of this setting.
|
* @param asPercentage If we should display the value as a %.
|
||||||
* @param defaultVal Default value if not found on the config.
|
* @param min Minimum value of this setting.
|
||||||
* @param steps List of step the value can increment/decrement.
|
* @param max Maximum value of this setting.
|
||||||
* List's size should be between 1 (included) and 5 (included).
|
* @param defaultVal Default value if not found on the config.
|
||||||
* it is visually preferable to have an odd number of step.
|
* @param steps List of step the value can increment/decrement.
|
||||||
* If step only contain 1 value, no step item should be displayed.
|
* List's size should be between 1 (included) and 5 (included).
|
||||||
|
* it is visually preferable to have an odd number of step.
|
||||||
|
* If step only contain 1 value, no step item should be displayed.
|
||||||
*/
|
*/
|
||||||
protected DoubleSettingFactory(
|
protected DoubleSettingFactory(
|
||||||
@NotNull String title, ValueUpdatableGui parent,
|
@NotNull String title, ValueUpdatableGui parent,
|
||||||
String configPath, ConfigHolder config,
|
String configPath, ConfigHolder config,
|
||||||
|
int scale, boolean asPercentage,
|
||||||
double min, double max, double defaultVal, double... steps) {
|
double min, double max, double defaultVal, double... steps) {
|
||||||
super(configPath, config);
|
super(configPath, config);
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.min = min;
|
this.scale = scale;
|
||||||
this.max = max;
|
this.asPercentage = asPercentage;
|
||||||
this.defaultVal = defaultVal;
|
this.min = BigDecimal.valueOf(min).setScale(scale, RoundingMode.HALF_UP);
|
||||||
this.steps = steps;
|
this.max = BigDecimal.valueOf(max).setScale(scale, RoundingMode.HALF_UP);
|
||||||
|
this.defaultVal = BigDecimal.valueOf(defaultVal).setScale(scale, RoundingMode.HALF_UP);
|
||||||
|
|
||||||
|
this.steps = new BigDecimal[steps.length];
|
||||||
|
for (int i = 0; i < steps.length; i++) {
|
||||||
|
this.steps[i] = BigDecimal.valueOf(steps[i]).setScale(scale, RoundingMode.HALF_UP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -336,16 +375,36 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
/**
|
/**
|
||||||
* @return The configured value for the associated setting.
|
* @return The configured value for the associated setting.
|
||||||
*/
|
*/
|
||||||
public double getConfiguredValue() {
|
public BigDecimal getConfiguredValue() {
|
||||||
return this.config.getConfig().getDouble(this.configPath, this.defaultVal);
|
ConfigurationSection section = this.config.getConfig();
|
||||||
|
if(section.isDouble(this.configPath)){
|
||||||
|
return BigDecimal.valueOf(section.getDouble(this.configPath)).setScale(2, RoundingMode.HALF_UP);
|
||||||
|
}
|
||||||
|
return this.defaultVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractSettingGui create() {
|
public AbstractSettingGui create() {
|
||||||
// Get value or default
|
// Get value or default
|
||||||
double now = getConfiguredValue();
|
BigDecimal now = getConfiguredValue();
|
||||||
// create new gui
|
// create new gui
|
||||||
return new DoubleSettingGui(this, now);
|
return new DoubleSettingGui(this, now, this.asPercentage);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public GuiItem getItem(Material itemMat, String name){
|
||||||
|
// Get item properties
|
||||||
|
BigDecimal value = getConfiguredValue();
|
||||||
|
StringBuilder itemName = new StringBuilder("\u00A7a").append(name);
|
||||||
|
|
||||||
|
return GuiGlobalItems.createGuiItemFromProperties(this, itemMat, itemName, displayValue(value, this.asPercentage));
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiItem getItem(Material itemMat){
|
||||||
|
// Get item properties
|
||||||
|
String configPath = GuiGlobalItems.getConfigNameFromPath(getConfigPath());
|
||||||
|
|
||||||
|
return getItem(itemMat, CasedStringUtil.detectToUpperSpacedCase(configPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ public class GuiGlobalItems {
|
||||||
* Will not update automatically, if the setting's value change, the item need to be created again.
|
* Will not update automatically, if the setting's value change, the item need to be created again.
|
||||||
* @return A formatted GuiItem that will create and open a GUI for the setting.
|
* @return A formatted GuiItem that will create and open a GUI for the setting.
|
||||||
*/
|
*/
|
||||||
private static GuiItem createGuiItemFromProperties(
|
public static GuiItem createGuiItemFromProperties(
|
||||||
@NotNull AbstractSettingGui.SettingGuiFactory factory,
|
@NotNull AbstractSettingGui.SettingGuiFactory factory,
|
||||||
@NotNull Material itemMat,
|
@NotNull Material itemMat,
|
||||||
@NotNull StringBuilder itemName,
|
@NotNull StringBuilder itemName,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue