Allow to append lore for setting gui's item.

This commit is contained in:
alexcrea 2024-04-28 19:39:11 +02:00
parent 95c976bd56
commit 91994a6e78
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
13 changed files with 159 additions and 73 deletions

View file

@ -79,7 +79,9 @@ public class BasicConfigGui extends ValueUpdatableGui {
// rename cost item
IntRange range = ConfigOptions.REPAIR_LIMIT_RANGE;
this.repairCostFactory = IntSettingsGui.intFactory("\u00A78Repair Cost Limit", this,
ConfigOptions.LIMIT_REPAIR_VALUE, ConfigHolder.DEFAULT_CONFIG, range.getFirst(), range.getLast(),
ConfigOptions.LIMIT_REPAIR_VALUE, ConfigHolder.DEFAULT_CONFIG,
null,
range.getFirst(), range.getLast(),
ConfigOptions.DEFAULT_LIMIT_REPAIR_VALUE,
1, 5, 10);
@ -99,27 +101,35 @@ public class BasicConfigGui extends ValueUpdatableGui {
// item repair cost
range = ConfigOptions.REPAIR_COST_RANGE;
this.itemRepairCost = IntSettingsGui.intFactory("\u00A78Item Repair Cost", this,
ConfigOptions.ITEM_REPAIR_COST, ConfigHolder.DEFAULT_CONFIG, range.getFirst(), range.getLast(),
ConfigOptions.ITEM_REPAIR_COST, ConfigHolder.DEFAULT_CONFIG,
null,
range.getFirst(), range.getLast(),
ConfigOptions.DEFAULT_ITEM_REPAIR_COST,
1, 5, 10, 50, 100);
// unit repair cost
this.unitRepairCost = IntSettingsGui.intFactory("\u00A78Unit Repair Cost", this,
ConfigOptions.UNIT_REPAIR_COST, ConfigHolder.DEFAULT_CONFIG, range.getFirst(), range.getLast(),
ConfigOptions.UNIT_REPAIR_COST, ConfigHolder.DEFAULT_CONFIG,
null,
range.getFirst(), range.getLast(),
ConfigOptions.DEFAULT_UNIT_REPAIR_COST,
1, 5, 10, 50, 100);
// item rename cost
range = ConfigOptions.ITEM_RENAME_COST_RANGE;
this.itemRenameCost = IntSettingsGui.intFactory("\u00A78Rename Cost", this,
ConfigOptions.ITEM_RENAME_COST, ConfigHolder.DEFAULT_CONFIG, range.getFirst(), range.getLast(),
ConfigOptions.ITEM_RENAME_COST, ConfigHolder.DEFAULT_CONFIG,
null,
range.getFirst(), range.getLast(),
ConfigOptions.DEFAULT_ITEM_RENAME_COST,
1, 5, 10, 50, 100);
// sacrifice illegal enchant cost
range = ConfigOptions.SACRIFICE_ILLEGAL_COST_RANGE;
this.sacrificeIllegalEnchantCost = IntSettingsGui.intFactory("\u00A78Sacrifice Illegal Enchant Cost", this,
ConfigOptions.SACRIFICE_ILLEGAL_COST, ConfigHolder.DEFAULT_CONFIG, range.getFirst(), range.getLast(),
ConfigOptions.SACRIFICE_ILLEGAL_COST, ConfigHolder.DEFAULT_CONFIG,
null,
range.getFirst(), range.getLast(),
ConfigOptions.DEFAULT_SACRIFICE_ILLEGAL_COST,
1, 5, 10, 50, 100);

View file

@ -49,7 +49,9 @@ public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSe
}
return EnchantCostSettingsGui.enchantCostFactory(prettyKey + " Level Cost", this,
SECTION_NAME + '.' + key, ConfigHolder.DEFAULT_CONFIG, 0, 255,
SECTION_NAME + '.' + key, ConfigHolder.DEFAULT_CONFIG,
null,
0, 255,
rarity.getItemValue(), rarity.getBookValue(),
1, 10, 50);
}

View file

@ -36,7 +36,9 @@ public class EnchantLimitConfigGui extends AbstractEnchantConfigGui<IntSettingsG
String prettyKey = CasedStringUtil.snakeToUpperSpacedCase(key);
return IntSettingsGui.intFactory(prettyKey + " Level Limit", this,
SECTION_NAME + '.' + key, ConfigHolder.DEFAULT_CONFIG, 0, 255,
SECTION_NAME + '.' + key, ConfigHolder.DEFAULT_CONFIG,
null,
0, 255,
enchant.getMaxLevel(),
1, 5, 10, 50, 100);
}

View file

@ -116,6 +116,7 @@ public class UnitRepairElementListGui extends SettingGuiListConfigGui<String, Do
this,
material.name().toLowerCase()+"."+materialName,
ConfigHolder.UNIT_REPAIR_HOLDER,
null,
2,
true, true,
0,

View file

@ -82,6 +82,7 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
this.xpCostFactory = IntSettingsGui.intFactory("\u00A78Recipe Xp Cost", this,
this.anvilRecipe +"."+AnvilCustomRecipe.XP_COST_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
null,
costRange.getFirst(), costRange.getLast(), AnvilCustomRecipe.Companion.getDEFAULT_XP_COST_CONFIG(), 1, 5, 10);

View file

@ -97,6 +97,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
this.minBeforeActiveSettingFactory = IntSettingsGui.intFactory(
"\u00A78Minimum enchantment count",
this, this.enchantConflict + ".maxEnchantmentBeforeConflict", ConfigHolder.CONFLICT_HOLDER,
null,
0, 255, 0, 1
);

View file

@ -119,7 +119,9 @@ public abstract class AbstractSettingGui extends ChestGui {
* It is better to keep a factory that hold setting data than find what parameters to use every time.
*/
public abstract static class SettingGuiFactory {
@NotNull
protected String configPath;
@NotNull
protected ConfigHolder config;
/**
@ -128,7 +130,7 @@ public abstract class AbstractSettingGui extends ChestGui {
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
*/
protected SettingGuiFactory(String configPath, ConfigHolder config) {
protected SettingGuiFactory(@NotNull String configPath, @NotNull ConfigHolder config) {
this.configPath = configPath;
this.config = config;
}
@ -136,6 +138,7 @@ public abstract class AbstractSettingGui extends ChestGui {
/**
* @return Configuration path of this setting.
*/
@NotNull
public String getConfigPath() {
return configPath;
}
@ -143,6 +146,7 @@ public abstract class AbstractSettingGui extends ChestGui {
/**
* @return Configuration holder of this setting.
*/
@NotNull
public ConfigHolder getConfigHolder() {
return config;
}

View file

@ -16,7 +16,9 @@ import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
import xyz.alexcrea.cuanvil.util.MetricsUtil;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
/**
@ -142,20 +144,22 @@ public class BoolSettingsGui extends AbstractSettingGui {
/**
* Create a bool setting factory from setting's parameters.
*
* @param title The title of the gui.
* @param parent Parent gui to go back when completed.
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
* @param defaultVal Default value if not found on the config.
* @param title The title of the gui.
* @param parent Parent gui to go back when completed.
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
* @param defaultVal Default value if not found on the config.
* @param displayLore Gui display item lore.
* @return A factory for a boolean setting gui.
*/
public static BoolSettingFactory boolFactory(@NotNull String title, ValueUpdatableGui parent,
String configPath, ConfigHolder config,
boolean defaultVal) {
public static BoolSettingFactory boolFactory(@NotNull String title, @NotNull ValueUpdatableGui parent,
@NotNull String configPath, @NotNull ConfigHolder config,
boolean defaultVal,
String... displayLore) {
return new BoolSettingFactory(
title, parent,
configPath, config,
defaultVal);
defaultVal, displayLore);
}
/**
@ -164,27 +168,33 @@ public class BoolSettingsGui extends AbstractSettingGui {
public static class BoolSettingFactory extends SettingGuiFactory {
@NotNull
String title;
@NotNull
ValueUpdatableGui parent;
boolean defaultVal;
@NotNull
List<String> displayLore;
/**
* Constructor for a boolean setting gui factory.
*
* @param title The title of the gui.
* @param parent Parent gui to go back when completed.
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
* @param defaultVal Default value if not found on the config.
* @param title The title of the gui.
* @param parent Parent gui to go back when completed.
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
* @param defaultVal Default value if not found on the config.
* @param displayLore Gui display item lore.
*/
protected BoolSettingFactory(
@NotNull String title, ValueUpdatableGui parent,
String configPath, ConfigHolder config,
boolean defaultVal) {
@NotNull String title, @NotNull ValueUpdatableGui parent,
@NotNull String configPath, @NotNull ConfigHolder config,
boolean defaultVal, String... displayLore) {
super(configPath, config);
this.title = title;
this.parent = parent;
this.defaultVal = defaultVal;
this.displayLore = Arrays.asList(displayLore);
}
/**
@ -233,7 +243,7 @@ public class BoolSettingsGui extends AbstractSettingGui {
}
itemName.append(name);
return GuiGlobalItems.createGuiItemFromProperties(this, itemMat, itemName, value);
return GuiGlobalItems.createGuiItemFromProperties(this, itemMat, itemName, value, this.displayLore);
}
/**

View file

@ -10,6 +10,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.alexcrea.cuanvil.config.ConfigHolder;
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
@ -338,6 +339,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
* @param parent Parent gui to go back when completed.
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
* @param displayLore Gui display item lore.
* @param scale The scale of the decimal.
* @param asPercentage If we should display the value as a %.
* @param nullOnZero Set the value as null (deleting it) when equal to 0
@ -350,13 +352,16 @@ public class DoubleSettingGui extends AbstractSettingGui {
* If step only contain 1 value, no step item should be displayed.
* @return A factory for a double setting gui.
*/
public static DoubleSettingFactory doubleFactory(@NotNull String title, ValueUpdatableGui parent,
String configPath, ConfigHolder config,
@NotNull
public static DoubleSettingFactory doubleFactory(@NotNull String title, @NotNull ValueUpdatableGui parent,
@NotNull String configPath, @NotNull ConfigHolder config,
@Nullable List<String> displayLore,
int scale, boolean asPercentage, boolean nullOnZero,
double min, double max, double defaultVal, double... steps) {
return new DoubleSettingFactory(
title, parent,
configPath, config,
displayLore,
scale, asPercentage, nullOnZero,
min, max, defaultVal, steps);
}
@ -367,6 +372,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
public static class DoubleSettingFactory extends SettingGuiFactory {
@NotNull
String title;
@NotNull
ValueUpdatableGui parent;
int scale;
@ -377,6 +383,9 @@ public class DoubleSettingGui extends AbstractSettingGui {
BigDecimal defaultVal;
BigDecimal[] steps;
@NotNull
List<String> displayLore;
/**
* Constructor for a double setting gui factory.
*
@ -384,6 +393,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
* @param parent Parent gui to go back when completed.
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
* @param displayLore Gui display item lore.
* @param scale The scale of the decimal.
* @param asPercentage If we should display the value as a %.
* @param nullOnZero Set the value as null (deleting it) when equal to 0
@ -396,8 +406,9 @@ public class DoubleSettingGui extends AbstractSettingGui {
* If step only contain 1 value, no step item should be displayed.
*/
protected DoubleSettingFactory(
@NotNull String title, ValueUpdatableGui parent,
String configPath, ConfigHolder config,
@NotNull String title, @NotNull ValueUpdatableGui parent,
@NotNull String configPath, @NotNull ConfigHolder config,
@Nullable List<String> displayLore,
int scale, boolean asPercentage, boolean nullOnZero,
double min, double max, double defaultVal, double... steps) {
super(configPath, config);
@ -414,6 +425,12 @@ public class DoubleSettingGui extends AbstractSettingGui {
for (int i = 0; i < steps.length; i++) {
this.steps[i] = BigDecimal.valueOf(steps[i]).setScale(scale, RoundingMode.HALF_UP);
}
if(displayLore == null){
this.displayLore = Collections.emptyList();
}else {
this.displayLore = displayLore;
}
}
/**
@ -449,7 +466,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
BigDecimal value = getConfiguredValue();
StringBuilder itemName = new StringBuilder("\u00A7a").append(name);
return GuiGlobalItems.createGuiItemFromProperties(this, itemMat, itemName, displayValue(value, this.asPercentage));
return GuiGlobalItems.createGuiItemFromProperties(this, itemMat, itemName, displayValue(value, this.asPercentage), this.displayLore);
}
public GuiItem getItem(Material itemMat){

View file

@ -10,6 +10,7 @@ import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.alexcrea.cuanvil.config.ConfigHolder;
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
@ -18,6 +19,7 @@ import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
import xyz.alexcrea.cuanvil.util.MetricsUtil;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
/**
@ -228,6 +230,7 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
* @param parent Parent gui to go back when completed.
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
* @param displayLore Gui display item lore.
* @param min Minimum value of this setting.
* @param max Maximum value of this setting.
* @param defaultItemVal Default item value if not found on the config.
@ -239,13 +242,15 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
* @return A factory for an enchant cost setting gui.
*/
public static EnchantCostSettingFactory enchantCostFactory(
@NotNull String title, ValueUpdatableGui parent,
String configPath, ConfigHolder config,
@NotNull String title, @NotNull ValueUpdatableGui parent,
@NotNull String configPath, @NotNull ConfigHolder config,
@Nullable List<String> displayLore,
int min, int max, int defaultItemVal, int defaultBookVal,
int... steps) {
return new EnchantCostSettingFactory(
title, parent,
configPath, config,
displayLore,
min, max, defaultItemVal, defaultBookVal, steps);
}
@ -263,6 +268,7 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
* @param parent Parent gui to go back when completed.
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
* @param displayLore Gui display item lore.
* @param min Minimum value of this setting.
* @param max Maximum value of this setting.
* @param defaultItemVal Default item value if not found on the config.
@ -274,12 +280,14 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
*/
protected EnchantCostSettingFactory(
@NotNull String title, ValueUpdatableGui parent,
String configPath, ConfigHolder config,
@NotNull String configPath, @NotNull ConfigHolder config,
@Nullable List<String> displayLore,
int min, int max, int defaultItemVal, int defaultBookVal,
int... steps) {
super(title, parent,
configPath, config,
displayLore,
min, max, defaultItemVal, steps);
this.defaultBookVal = defaultBookVal;
}

View file

@ -9,6 +9,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.alexcrea.cuanvil.config.ConfigHolder;
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
@ -267,25 +268,28 @@ public class IntSettingsGui extends AbstractSettingGui {
/**
* Create an int setting factory from setting's parameters.
*
* @param title The title of the gui.
* @param parent Parent gui to go back when completed.
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
* @param min Minimum value of this setting.
* @param max Maximum value of this setting.
* @param defaultVal Default value if not found on the config.
* @param steps List of step the value can increment/decrement.
* 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.
* @param title The title of the gui.
* @param parent Parent gui to go back when completed.
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
* @param displayLore Gui display item lore.
* @param min Minimum value of this setting.
* @param max Maximum value of this setting.
* @param defaultVal Default value if not found on the config.
* @param steps List of step the value can increment/decrement.
* 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 an int setting gui.
*/
public static IntSettingFactory intFactory(@NotNull String title, ValueUpdatableGui parent,
String configPath, ConfigHolder config,
@Nullable List<String> displayLore,
int min, int max, int defaultVal, int... steps) {
return new IntSettingFactory(
title, parent,
configPath, config,
displayLore,
min, max, defaultVal, steps);
}
@ -295,30 +299,36 @@ public class IntSettingsGui extends AbstractSettingGui {
public static class IntSettingFactory extends SettingGuiFactory {
@NotNull
String title;
@NotNull
ValueUpdatableGui parent;
int min;
int max;
int defaultVal;
int[] steps;
@NotNull
List<String> displayLore;
/**
* Constructor for an int setting gui factory.
*
* @param title The title of the gui.
* @param parent Parent gui to go back when completed.
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
* @param min Minimum value of this setting.
* @param max Maximum value of this setting.
* @param defaultVal Default value if not found on the config.
* @param steps List of step the value can increment/decrement.
* 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.
* @param title The title of the gui.
* @param parent Parent gui to go back when completed.
* @param configPath Configuration path of this setting.
* @param config Configuration holder of this setting.
* @param displayLore Gui display item lore.
* @param min Minimum value of this setting.
* @param max Maximum value of this setting.
* @param defaultVal Default value if not found on the config.
* @param steps List of step the value can increment/decrement.
* 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 IntSettingFactory(
@NotNull String title, ValueUpdatableGui parent,
String configPath, ConfigHolder config,
@NotNull String title, @NotNull ValueUpdatableGui parent,
@NotNull String configPath, @NotNull ConfigHolder config,
@Nullable List<String> displayLore,
int min, int max, int defaultVal, int... steps) {
super(configPath, config);
this.title = title;
@ -327,6 +337,12 @@ public class IntSettingsGui extends AbstractSettingGui {
this.max = max;
this.defaultVal = defaultVal;
this.steps = steps;
if(displayLore == null){
this.displayLore = Collections.emptyList();
}else {
this.displayLore = displayLore;
}
}
/**
@ -369,7 +385,7 @@ public class IntSettingsGui extends AbstractSettingGui {
int value = getConfiguredValue();
StringBuilder itemName = new StringBuilder("\u00A7a").append(name);
return GuiGlobalItems.createGuiItemFromProperties(this, itemMat, itemName, value);
return GuiGlobalItems.createGuiItemFromProperties(this, itemMat, itemName, value, this.displayLore);
}
/**

View file

@ -10,6 +10,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.alexcrea.cuanvil.config.ConfigHolder;
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
@ -171,9 +172,9 @@ public class ItemSettingGui extends AbstractSettingGui {
* @param displayLore Gui display item lore.
* @return A factory for an item setting gui.
*/
public static ItemSettingGui.ItemSettingFactory itemFactory(@NotNull String title, ValueUpdatableGui parent,
String configPath, ConfigHolder config,
ItemStack defaultVal,
public static ItemSettingGui.ItemSettingFactory itemFactory(@NotNull String title, @NotNull ValueUpdatableGui parent,
@NotNull String configPath, @NotNull ConfigHolder config,
@Nullable ItemStack defaultVal,
String... displayLore) {
return new ItemSettingGui.ItemSettingFactory(
title, parent,
@ -187,8 +188,11 @@ public class ItemSettingGui extends AbstractSettingGui {
public static class ItemSettingFactory extends SettingGuiFactory {
@NotNull
String title;
@NotNull
ValueUpdatableGui parent;
@Nullable
ItemStack defaultVal;
@NotNull
List<String> displayLore;
/**
@ -202,9 +206,9 @@ public class ItemSettingGui extends AbstractSettingGui {
* @param displayLore Gui display item lore.
*/
protected ItemSettingFactory(
@NotNull String title, ValueUpdatableGui parent,
String configPath, ConfigHolder config,
ItemStack defaultVal,
@NotNull String title, @NotNull ValueUpdatableGui parent,
@NotNull String configPath, @NotNull ConfigHolder config,
@Nullable ItemStack defaultVal,
String... displayLore) {
super(configPath, config);
this.title = title;
@ -229,8 +233,9 @@ public class ItemSettingGui extends AbstractSettingGui {
return this.config.getConfig().getItemStack(this.configPath, this.defaultVal);
}
@NotNull
public List<String> getDisplayLore() {
return displayLore;
return this.displayLore;
}
@Override

View file

@ -13,7 +13,9 @@ import org.jetbrains.annotations.NotNull;
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
import xyz.alexcrea.cuanvil.gui.config.settings.AbstractSettingGui;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* A utility class to store function that create generic GUI item.
@ -180,25 +182,32 @@ public class GuiGlobalItems {
/**
* Create an arbitrary GuiItem from a unique setting and item's property.
*
* @param factory The setting's GUI factory.
* @param itemMat Displayed material of the item.
* @param itemName Name of the item.
* @param value Value of the setting when the item is created.
* Will not update automatically, if the setting's value change, the item need to be created again.
* @param factory The setting's GUI factory.
* @param itemMat Displayed material of the item.
* @param itemName Name of the item.
* @param value Value of the setting when the item is created.
* Will not update automatically, if the setting's value change, the item need to be created again.
* @param displayLore Gui display item lore.
* @return A formatted GuiItem that will create and open a GUI for the setting.
*/
public static GuiItem createGuiItemFromProperties(
@NotNull AbstractSettingGui.SettingGuiFactory factory,
@NotNull Material itemMat,
@NotNull StringBuilder itemName,
@NotNull Object value
@NotNull Object value,
@NotNull List<String> displayLore
) {
// Prepare lore
ArrayList<String> lore = new ArrayList<>();
lore.add(SETTING_ITEM_LORE_PREFIX + value);
lore.addAll(displayLore);
// Create & initialise item
ItemStack item = new ItemStack(itemMat);
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(itemName.toString());
itemMeta.setLore(Collections.singletonList(SETTING_ITEM_LORE_PREFIX + value));
itemMeta.setLore(lore);
itemMeta.addItemFlags(ItemFlag.values());
item.setItemMeta(itemMeta);