Suppressed most fixable warning.

This commit is contained in:
alexcrea 2024-04-28 19:58:36 +02:00
parent 91994a6e78
commit 3ff6505adf
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
22 changed files with 97 additions and 24 deletions

View file

@ -41,6 +41,7 @@ public class MainConfigGui extends ChestGui {
// Basic config item // Basic config item
ItemStack basicConfigItemstack = new ItemStack(Material.COMMAND_BLOCK); ItemStack basicConfigItemstack = new ItemStack(Material.COMMAND_BLOCK);
ItemMeta basicConfigMeta = basicConfigItemstack.getItemMeta(); ItemMeta basicConfigMeta = basicConfigItemstack.getItemMeta();
assert basicConfigMeta != null;
basicConfigMeta.setDisplayName("\u00A7aBasic Config Menu"); basicConfigMeta.setDisplayName("\u00A7aBasic Config Menu");
basicConfigMeta.setLore(Collections.singletonList("\u00A77Click here to open basic config menu")); basicConfigMeta.setLore(Collections.singletonList("\u00A77Click here to open basic config menu"));
@ -52,6 +53,7 @@ public class MainConfigGui extends ChestGui {
// enchant level limit item // enchant level limit item
ItemStack enchantLimitItemstack = new ItemStack(Material.ENCHANTED_BOOK); ItemStack enchantLimitItemstack = new ItemStack(Material.ENCHANTED_BOOK);
ItemMeta enchantLimitMeta = enchantLimitItemstack.getItemMeta(); ItemMeta enchantLimitMeta = enchantLimitItemstack.getItemMeta();
assert enchantLimitMeta != null;
enchantLimitMeta.setDisplayName("\u00A7aEnchantment Level Limit"); enchantLimitMeta.setDisplayName("\u00A7aEnchantment Level Limit");
enchantLimitMeta.setLore(Collections.singletonList("\u00A77Click here to open enchantment level limit menu")); enchantLimitMeta.setLore(Collections.singletonList("\u00A77Click here to open enchantment level limit menu"));
@ -63,6 +65,7 @@ public class MainConfigGui extends ChestGui {
// enchant cost item // enchant cost item
ItemStack enchantCostItemstack = new ItemStack(Material.EXPERIENCE_BOTTLE); ItemStack enchantCostItemstack = new ItemStack(Material.EXPERIENCE_BOTTLE);
ItemMeta enchantCostMeta = enchantCostItemstack.getItemMeta(); ItemMeta enchantCostMeta = enchantCostItemstack.getItemMeta();
assert enchantCostMeta != null;
enchantCostMeta.setDisplayName("\u00A7aEnchantment Cost"); enchantCostMeta.setDisplayName("\u00A7aEnchantment Cost");
enchantCostMeta.setLore(Collections.singletonList("\u00A77Click here to open enchantment costs menu")); enchantCostMeta.setLore(Collections.singletonList("\u00A77Click here to open enchantment costs menu"));
@ -72,20 +75,22 @@ public class MainConfigGui extends ChestGui {
pane.bindItem('3', enchantCostItem); pane.bindItem('3', enchantCostItem);
// Enchantment Conflicts item // Enchantment Conflicts item
ItemStack EnchantConflictItemstack = new ItemStack(Material.OAK_FENCE); ItemStack enchantConflictItemstack = new ItemStack(Material.OAK_FENCE);
ItemMeta enchantConflictMeta = EnchantConflictItemstack.getItemMeta(); ItemMeta enchantConflictMeta = enchantConflictItemstack.getItemMeta();
assert enchantConflictMeta != null;
enchantConflictMeta.setDisplayName("\u00A7aEnchantment Conflict"); enchantConflictMeta.setDisplayName("\u00A7aEnchantment Conflict");
enchantConflictMeta.setLore(Collections.singletonList("\u00A77Click here to open enchantment conflict menu")); enchantConflictMeta.setLore(Collections.singletonList("\u00A77Click here to open enchantment conflict menu"));
EnchantConflictItemstack.setItemMeta(enchantConflictMeta); enchantConflictItemstack.setItemMeta(enchantConflictMeta);
GuiItem enchantConflictItem = GuiGlobalItems.goToGuiItem(EnchantConflictItemstack, EnchantConflictGui.INSTANCE); GuiItem enchantConflictItem = GuiGlobalItems.goToGuiItem(enchantConflictItemstack, EnchantConflictGui.INSTANCE);
pane.bindItem('4', enchantConflictItem); pane.bindItem('4', enchantConflictItem);
// Group config items // Group config items
ItemStack groupItemstack = new ItemStack(Material.CHEST); ItemStack groupItemstack = new ItemStack(Material.CHEST);
ItemMeta groupMeta = groupItemstack.getItemMeta(); ItemMeta groupMeta = groupItemstack.getItemMeta();
assert groupMeta != null;
groupMeta.setDisplayName("\u00A7aGroups"); groupMeta.setDisplayName("\u00A7aGroups");
groupMeta.setLore(Collections.singletonList("\u00A77Click here to open material group menu")); groupMeta.setLore(Collections.singletonList("\u00A77Click here to open material group menu"));
groupItemstack.setItemMeta(groupMeta); groupItemstack.setItemMeta(groupMeta);
@ -97,6 +102,7 @@ public class MainConfigGui extends ChestGui {
// Unit repair item // Unit repair item
ItemStack unirRepairItemstack = new ItemStack(Material.DIAMOND); ItemStack unirRepairItemstack = new ItemStack(Material.DIAMOND);
ItemMeta unitRepairMeta = unirRepairItemstack.getItemMeta(); ItemMeta unitRepairMeta = unirRepairItemstack.getItemMeta();
assert unitRepairMeta != null;
unitRepairMeta.setDisplayName("\u00A7aUnit Repair"); unitRepairMeta.setDisplayName("\u00A7aUnit Repair");
unitRepairMeta.setLore(Collections.singletonList("\u00A77Click here to open anvil unit repair menu")); unitRepairMeta.setLore(Collections.singletonList("\u00A77Click here to open anvil unit repair menu"));
@ -107,7 +113,8 @@ public class MainConfigGui extends ChestGui {
// Custom recipe item // Custom recipe item
ItemStack customRecipeItemstack = new ItemStack(Material.CRAFTING_TABLE); ItemStack customRecipeItemstack = new ItemStack(Material.CRAFTING_TABLE);
ItemMeta customRecipeMeta = EnchantConflictItemstack.getItemMeta(); ItemMeta customRecipeMeta = customRecipeItemstack.getItemMeta();
assert customRecipeMeta != null;
customRecipeMeta.setDisplayName("\u00A7aCustom recipes"); customRecipeMeta.setDisplayName("\u00A7aCustom recipes");
customRecipeMeta.setLore(Collections.singletonList("\u00A77Click here to open anvil custom recipe menu")); customRecipeMeta.setLore(Collections.singletonList("\u00A77Click here to open anvil custom recipe menu"));
@ -119,6 +126,8 @@ public class MainConfigGui extends ChestGui {
// quit item // quit item
ItemStack quitItemstack = new ItemStack(Material.BARRIER); ItemStack quitItemstack = new ItemStack(Material.BARRIER);
ItemMeta quitMeta = quitItemstack.getItemMeta(); ItemMeta quitMeta = quitItemstack.getItemMeta();
assert quitMeta != null;
quitMeta.setDisplayName("\u00A7cQuit"); quitMeta.setDisplayName("\u00A7cQuit");
quitItemstack.setItemMeta(quitMeta); quitItemstack.setItemMeta(quitMeta);
@ -131,6 +140,7 @@ public class MainConfigGui extends ChestGui {
// create & bind "info" item // create & bind "info" item
ItemStack infoItemstack = new ItemStack(Material.PAPER); ItemStack infoItemstack = new ItemStack(Material.PAPER);
ItemMeta infoMeta = infoItemstack.getItemMeta(); ItemMeta infoMeta = infoItemstack.getItemMeta();
assert infoMeta != null;
infoMeta.setDisplayName("\u00A7eThis is a alpha version of the gui !"); infoMeta.setDisplayName("\u00A7eThis is a alpha version of the gui !");
infoMeta.setLore(Collections.singletonList("\u00A77If you have feedback or idea you can send them to the dev !")); infoMeta.setLore(Collections.singletonList("\u00A77If you have feedback or idea you can send them to the dev !"));

View file

@ -1,8 +1,6 @@
package xyz.alexcrea.cuanvil.gui.config; package xyz.alexcrea.cuanvil.gui.config;
import org.bukkit.Material; import org.bukkit.Material;
import xyz.alexcrea.cuanvil.group.AbstractMaterialGroup;
import xyz.alexcrea.cuanvil.gui.config.list.elements.GroupConfigSubSettingGui;
import xyz.alexcrea.cuanvil.util.CasedStringUtil; import xyz.alexcrea.cuanvil.util.CasedStringUtil;
import java.util.*; import java.util.*;

View file

@ -88,6 +88,7 @@ public class BasicConfigGui extends ValueUpdatableGui {
// rename cost not needed // rename cost not needed
ItemStack item = new ItemStack(Material.BARRIER); ItemStack item = new ItemStack(Material.BARRIER);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7cRepair Cost Value"); meta.setDisplayName("\u00A7cRepair Cost Value");
meta.setLore(Collections.singletonList("\u00A77Please, enable repair cost limit for this variable to be editable.")); meta.setLore(Collections.singletonList("\u00A77Please, enable repair cost limit for this variable to be editable."));

View file

@ -41,6 +41,7 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
// edit displayed item // edit displayed item
ItemMeta meta = displaydItem.getItemMeta(); ItemMeta meta = displaydItem.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(recipe.toString()) + " \u00A7fCustom recipe"); meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(recipe.toString()) + " \u00A7fCustom recipe");
meta.addItemFlags(ItemFlag.values()); meta.addItemFlags(ItemFlag.values());
@ -73,8 +74,8 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
// Create new empty conflict and display it to the admin // Create new empty conflict and display it to the admin
AnvilCustomRecipe recipe = new AnvilCustomRecipe( AnvilCustomRecipe recipe = new AnvilCustomRecipe(
name, name,
AnvilCustomRecipe.Companion.getDEFAULT_EXACT_COUNT_CONFIG(), AnvilCustomRecipe.DEFAULT_EXACT_COUNT_CONFIG,
AnvilCustomRecipe.Companion.getDEFAULT_XP_COST_CONFIG(), AnvilCustomRecipe.DEFAULT_XP_COST_CONFIG,
AnvilCustomRecipe.Companion.getDEFAULT_LEFT_ITEM_CONFIG(), AnvilCustomRecipe.Companion.getDEFAULT_LEFT_ITEM_CONFIG(),
AnvilCustomRecipe.Companion.getDEFAULT_RIGHT_ITEM_CONFIG(), AnvilCustomRecipe.Companion.getDEFAULT_RIGHT_ITEM_CONFIG(),
AnvilCustomRecipe.Companion.getDEFAULT_RESULT_ITEM_CONFIG()); AnvilCustomRecipe.Companion.getDEFAULT_RESULT_ITEM_CONFIG());

View file

@ -58,6 +58,7 @@ public class EnchantConflictGui extends MappedGuiListConfigGui<EnchantConflictGr
ItemStack item = new ItemStack(conflict.getRepresentativeMaterial()); ItemStack item = new ItemStack(conflict.getRepresentativeMaterial());
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.addItemFlags(ItemFlag.values()); meta.addItemFlags(ItemFlag.values());
meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(conflict.toString()) + " \u00A7fConflict"); meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(conflict.toString()) + " \u00A7fConflict");

View file

@ -65,6 +65,7 @@ public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSe
// Create item // Create item
ItemStack item = new ItemStack(Material.ENCHANTED_BOOK); ItemStack item = new ItemStack(Material.ENCHANTED_BOOK);
ItemMeta itemMeta = item.getItemMeta(); ItemMeta itemMeta = item.getItemMeta();
assert itemMeta != null;
// Edit name and lore // Edit name and lore
itemMeta.setDisplayName(itemName); itemMeta.setDisplayName(itemName);

View file

@ -34,6 +34,7 @@ public class GroupConfigGui extends MappedGuiListConfigGui<IncludeGroup, GroupCo
protected ItemStack createItemForGeneric(IncludeGroup group) { protected ItemStack createItemForGeneric(IncludeGroup group) {
ItemStack item = new ItemStack(group.getRepresentativeMaterial()); ItemStack item = new ItemStack(group.getRepresentativeMaterial());
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.addItemFlags(ItemFlag.values()); meta.addItemFlags(ItemFlag.values());
meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(group.getName())+ " \u00A7fGroup"); meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(group.getName())+ " \u00A7fGroup");

View file

@ -48,6 +48,7 @@ public class UnitRepairConfigGui extends MappedGuiListConfigGui<Material, UnitRe
ItemStack item = new ItemStack(material); ItemStack item = new ItemStack(material);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7eRepaired by " +materialName); meta.setDisplayName("\u00A7eRepaired by " +materialName);
meta.setLore(Arrays.asList( meta.setLore(Arrays.asList(
@ -78,6 +79,7 @@ public class UnitRepairConfigGui extends MappedGuiListConfigGui<Material, UnitRe
// Create new conflict item // Create new conflict item
ItemStack createItem = new ItemStack(Material.PAPER); ItemStack createItem = new ItemStack(Material.PAPER);
ItemMeta createMeta = createItem.getItemMeta(); ItemMeta createMeta = createItem.getItemMeta();
assert createMeta != null;
createMeta.setDisplayName("\u00A7aSelect a new unit material"); createMeta.setDisplayName("\u00A7aSelect a new unit material");
createMeta.setLore(Arrays.asList( createMeta.setLore(Arrays.asList(

View file

@ -27,6 +27,7 @@ public abstract class MappedElementListConfigGui< T, S > extends ElementListConf
// Create new conflict item // Create new conflict item
ItemStack createItem = new ItemStack(Material.PAPER); ItemStack createItem = new ItemStack(Material.PAPER);
ItemMeta createMeta = createItem.getItemMeta(); ItemMeta createMeta = createItem.getItemMeta();
assert createMeta != null;
createMeta.setDisplayName("\u00A7aCreate new "+genericDisplayedName()); createMeta.setDisplayName("\u00A7aCreate new "+genericDisplayedName());
createMeta.setLore(Arrays.asList( createMeta.setLore(Arrays.asList(

View file

@ -27,6 +27,7 @@ public abstract class SettingGuiListConfigGui< T, S extends AbstractSettingGui.S
protected GuiItem prepareCreateNewItem() { protected GuiItem prepareCreateNewItem() {
ItemStack createItem = new ItemStack(Material.PAPER); ItemStack createItem = new ItemStack(Material.PAPER);
ItemMeta createMeta = createItem.getItemMeta(); ItemMeta createMeta = createItem.getItemMeta();
assert createMeta != null;
createMeta.setDisplayName(createItemName()); createMeta.setDisplayName(createItemName());
createMeta.setLore(getCreateItemLore()); createMeta.setLore(getCreateItemLore());

View file

@ -66,6 +66,7 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
// Delete item // Delete item
ItemStack deleteItem = new ItemStack(Material.RED_TERRACOTTA); ItemStack deleteItem = new ItemStack(Material.RED_TERRACOTTA);
ItemMeta deleteMeta = deleteItem.getItemMeta(); ItemMeta deleteMeta = deleteItem.getItemMeta();
assert deleteMeta != null;
deleteMeta.setDisplayName("\u00A74DELETE RECIPE"); deleteMeta.setDisplayName("\u00A74DELETE RECIPE");
deleteMeta.setLore(Collections.singletonList("\u00A7cCaution with this button !")); deleteMeta.setLore(Collections.singletonList("\u00A7cCaution with this button !"));
@ -78,12 +79,12 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
IntRange costRange = AnvilCustomRecipe.Companion.getXP_COST_CONFIG_RANGE(); IntRange costRange = AnvilCustomRecipe.Companion.getXP_COST_CONFIG_RANGE();
this.exactCountFactory = BoolSettingsGui.boolFactory("\u00A78Exact count ?", this, this.exactCountFactory = BoolSettingsGui.boolFactory("\u00A78Exact count ?", this,
this.anvilRecipe + "." + AnvilCustomRecipe.EXACT_COUNT_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER, this.anvilRecipe + "." + AnvilCustomRecipe.EXACT_COUNT_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
AnvilCustomRecipe.Companion.getDEFAULT_EXACT_COUNT_CONFIG()); AnvilCustomRecipe.DEFAULT_EXACT_COUNT_CONFIG);
this.xpCostFactory = IntSettingsGui.intFactory("\u00A78Recipe Xp Cost", this, this.xpCostFactory = IntSettingsGui.intFactory("\u00A78Recipe Xp Cost", this,
this.anvilRecipe +"."+AnvilCustomRecipe.XP_COST_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER, this.anvilRecipe +"."+AnvilCustomRecipe.XP_COST_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
null, null,
costRange.getFirst(), costRange.getLast(), AnvilCustomRecipe.Companion.getDEFAULT_XP_COST_CONFIG(), 1, 5, 10); costRange.getFirst(), costRange.getLast(), AnvilCustomRecipe.DEFAULT_XP_COST_CONFIG, 1, 5, 10);
this.leftItemFactory = ItemSettingGui.itemFactory("\u00A7eRecipe Left \u00A78Item", this, this.leftItemFactory = ItemSettingGui.itemFactory("\u00A7eRecipe Left \u00A78Item", this,

View file

@ -70,6 +70,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
// Delete item // Delete item
ItemStack deleteItem = new ItemStack(Material.RED_TERRACOTTA); ItemStack deleteItem = new ItemStack(Material.RED_TERRACOTTA);
ItemMeta deleteMeta = deleteItem.getItemMeta(); ItemMeta deleteMeta = deleteItem.getItemMeta();
assert deleteMeta != null;
deleteMeta.setDisplayName("\u00A74DELETE CONFLICT"); deleteMeta.setDisplayName("\u00A74DELETE CONFLICT");
deleteMeta.setLore(Collections.singletonList("\u00A7cCaution with this button !")); deleteMeta.setLore(Collections.singletonList("\u00A7cCaution with this button !"));
@ -186,6 +187,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
// Configure enchant setting item // Configure enchant setting item
ItemStack enchantItem = this.enchantSettingItem.getItem(); ItemStack enchantItem = this.enchantSettingItem.getItem();
ItemMeta enchantMeta = enchantItem.getItemMeta(); ItemMeta enchantMeta = enchantItem.getItemMeta();
assert enchantMeta != null;
enchantMeta.setDisplayName("\u00A7aSelect included \u00A75Enchantments \u00A7aSettings"); enchantMeta.setDisplayName("\u00A7aSelect included \u00A75Enchantments \u00A7aSettings");
enchantMeta.setLore(enchantLore); enchantMeta.setLore(enchantLore);
@ -197,6 +199,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
// Configure group setting item // Configure group setting item
ItemStack groupItem = this.groupSettingItem.getItem(); ItemStack groupItem = this.groupSettingItem.getItem();
ItemMeta groupMeta = groupItem.getItemMeta(); ItemMeta groupMeta = groupItem.getItemMeta();
assert groupMeta != null;
groupMeta.setDisplayName("\u00A7aSelect excluded \u00A73Groups \u00A7aSettings"); groupMeta.setDisplayName("\u00A7aSelect excluded \u00A73Groups \u00A7aSettings");
groupMeta.setLore(groupLore); groupMeta.setLore(groupLore);

View file

@ -64,6 +64,7 @@ public class BoolSettingsGui extends AbstractSettingGui {
protected void prepareReturnToDefault() { protected void prepareReturnToDefault() {
ItemStack item = new ItemStack(Material.COMMAND_BLOCK); ItemStack item = new ItemStack(Material.COMMAND_BLOCK);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
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: " + holder.defaultVal));
@ -95,6 +96,8 @@ public class BoolSettingsGui extends AbstractSettingGui {
ItemStack valueItemStack = new ItemStack(displayedMat); ItemStack valueItemStack = new ItemStack(displayedMat);
ItemMeta valueMeta = valueItemStack.getItemMeta(); ItemMeta valueMeta = valueItemStack.getItemMeta();
assert valueMeta != null;
valueMeta.setDisplayName(displayedName); valueMeta.setDisplayName(displayedName);
valueMeta.setLore(AbstractSettingGui.CLICK_LORE); valueMeta.setLore(AbstractSettingGui.CLICK_LORE);
valueItemStack.setItemMeta(valueMeta); valueItemStack.setItemMeta(valueMeta);

View file

@ -65,6 +65,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
private static final ItemStack DELETE_ITEM_STACK = new ItemStack(Material.RED_TERRACOTTA); private static final ItemStack DELETE_ITEM_STACK = new ItemStack(Material.RED_TERRACOTTA);
static { static {
ItemMeta meta = DELETE_ITEM_STACK.getItemMeta(); ItemMeta meta = DELETE_ITEM_STACK.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7cDisable item being repaired ?"); meta.setDisplayName("\u00A7cDisable item being repaired ?");
meta.setLore(Arrays.asList("\u00A77Confirm disabling unit repair for this item..", meta.setLore(Arrays.asList("\u00A77Confirm disabling unit repair for this item..",
@ -117,6 +118,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
protected void prepareReturnToDefault() { protected void prepareReturnToDefault() {
ItemStack item = new ItemStack(Material.COMMAND_BLOCK); ItemStack item = new ItemStack(Material.COMMAND_BLOCK);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7eReset to default value"); meta.setDisplayName("\u00A7eReset to default value");
meta.setLore(Collections.singletonList("\u00A77Default value is " + displayValue(holder.defaultVal))); meta.setLore(Collections.singletonList("\u00A77Default value is " + displayValue(holder.defaultVal)));
@ -161,6 +163,8 @@ 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();
assert resultMeta != null;
resultMeta.setDisplayName("\u00A7eValue: " + displayValue(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);
@ -181,6 +185,8 @@ public class DoubleSettingGui extends AbstractSettingGui {
private GuiItem getSetValueItem(Material mat, BigDecimal planned, String numberPrefix){ private GuiItem getSetValueItem(Material mat, BigDecimal planned, String numberPrefix){
ItemStack item = new ItemStack(mat); ItemStack item = new ItemStack(mat);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7e" + displayValue(now) + " -> " + displayValue(planned) meta.setDisplayName("\u00A7e" + displayValue(now) + " -> " + displayValue(planned)
+ " \u00A7r(" + numberPrefix + (displayValue(planned.subtract(now).abs()) + "\u00A7r)")); + " \u00A7r(" + numberPrefix + (displayValue(planned.subtract(now).abs()) + "\u00A7r)"));
meta.setLore(AbstractSettingGui.CLICK_LORE); meta.setLore(AbstractSettingGui.CLICK_LORE);
@ -274,6 +280,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
// Create item stack then gui item // Create item stack then gui item
ItemStack item = new ItemStack(stepMat); ItemStack item = new ItemStack(stepMat);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName(stepName.toString()); meta.setDisplayName(stepName.toString());
meta.setLore(stepLore); meta.setLore(stepLore);

View file

@ -80,6 +80,7 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
// book display // book display
ItemStack bookItemstack = new ItemStack(Material.BOOK); ItemStack bookItemstack = new ItemStack(Material.BOOK);
ItemMeta bookMeta = bookItemstack.getItemMeta(); ItemMeta bookMeta = bookItemstack.getItemMeta();
assert bookMeta != null;
bookMeta.setDisplayName("\u00A7aCost of an Enchantment by Book"); bookMeta.setDisplayName("\u00A7aCost of an Enchantment by Book");
bookMeta.setLore(Arrays.asList( bookMeta.setLore(Arrays.asList(
@ -90,8 +91,9 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
// sword display // sword display
ItemStack swordItemstack = new ItemStack(Material.WOODEN_SWORD); ItemStack swordItemstack = new ItemStack(Material.WOODEN_SWORD);
ItemMeta swordMeta = swordItemstack.getItemMeta(); ItemMeta swordMeta = swordItemstack.getItemMeta();
swordMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); assert swordMeta != null;
swordMeta.addItemFlags(ItemFlag.values());
swordMeta.setDisplayName("\u00A7aCost of an Enchantment by Item"); swordMeta.setDisplayName("\u00A7aCost of an Enchantment by Item");
swordMeta.setLore(Arrays.asList( swordMeta.setLore(Arrays.asList(
"\u00A77Cost per result item level of an sacrifice enchantment", "\u00A77Cost per result item level of an sacrifice enchantment",
@ -107,6 +109,7 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
protected void prepareReturnToDefault() { protected void prepareReturnToDefault() {
ItemStack item = new ItemStack(Material.COMMAND_BLOCK); ItemStack item = new ItemStack(Material.COMMAND_BLOCK);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
// assume holder is an instance of EnchantCostSettingFactory // assume holder is an instance of EnchantCostSettingFactory
EnchantCostSettingFactory holder = (EnchantCostSettingFactory) this.holder; EnchantCostSettingFactory holder = (EnchantCostSettingFactory) this.holder;
@ -141,6 +144,8 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
int planned = Math.max(holder.min, nowBook - step); int planned = Math.max(holder.min, nowBook - step);
ItemStack item = new ItemStack(Material.RED_TERRACOTTA); ItemStack item = new ItemStack(Material.RED_TERRACOTTA);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7e" + nowBook + " -> " + planned + " \u00A7r(\u00A7c-" + (nowBook - planned) + "\u00A7r)"); meta.setDisplayName("\u00A7e" + nowBook + " -> " + planned + " \u00A7r(\u00A7c-" + (nowBook - planned) + "\u00A7r)");
meta.setLore(AbstractSettingGui.CLICK_LORE); meta.setLore(AbstractSettingGui.CLICK_LORE);
item.setItemMeta(meta); item.setItemMeta(meta);
@ -157,6 +162,8 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
int planned = Math.min(holder.max, nowBook + step); int planned = Math.min(holder.max, nowBook + step);
ItemStack item = new ItemStack(Material.GREEN_TERRACOTTA); ItemStack item = new ItemStack(Material.GREEN_TERRACOTTA);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7e" + nowBook + " -> " + planned + " \u00A7r(\u00A7a+" + (planned - nowBook) + "\u00A7r)"); meta.setDisplayName("\u00A7e" + nowBook + " -> " + planned + " \u00A7r(\u00A7a+" + (planned - nowBook) + "\u00A7r)");
meta.setLore(AbstractSettingGui.CLICK_LORE); meta.setLore(AbstractSettingGui.CLICK_LORE);
item.setItemMeta(meta); item.setItemMeta(meta);
@ -170,8 +177,11 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
// "result" display // "result" display
ItemStack resultPaper = new ItemStack(Material.PAPER); ItemStack resultPaper = new ItemStack(Material.PAPER);
ItemMeta resultMeta = resultPaper.getItemMeta(); ItemMeta resultMeta = resultPaper.getItemMeta();
assert resultMeta != null;
resultMeta.setDisplayName("\u00A7eValue: " + nowBook); resultMeta.setDisplayName("\u00A7eValue: " + nowBook);
resultPaper.setItemMeta(resultMeta); resultPaper.setItemMeta(resultMeta);
GuiItem resultItem = new GuiItem(resultPaper, GuiGlobalActions.stayInPlace, CustomAnvil.instance); GuiItem resultItem = new GuiItem(resultPaper, GuiGlobalActions.stayInPlace, CustomAnvil.instance);
pane.bindItem('V', resultItem); pane.bindItem('V', resultItem);

View file

@ -69,6 +69,7 @@ public class IntSettingsGui extends AbstractSettingGui {
protected void prepareReturnToDefault() { protected void prepareReturnToDefault() {
ItemStack item = new ItemStack(Material.COMMAND_BLOCK); ItemStack item = new ItemStack(Material.COMMAND_BLOCK);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
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: " + holder.defaultVal));
@ -94,6 +95,8 @@ public class IntSettingsGui extends AbstractSettingGui {
int planned = Math.max(holder.min, now - step); int planned = Math.max(holder.min, now - step);
ItemStack item = new ItemStack(Material.RED_TERRACOTTA); ItemStack item = new ItemStack(Material.RED_TERRACOTTA);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7e" + now + " -> " + planned + " \u00A7r(\u00A7c-" + (now - planned) + "\u00A7r)"); meta.setDisplayName("\u00A7e" + now + " -> " + planned + " \u00A7r(\u00A7c-" + (now - planned) + "\u00A7r)");
meta.setLore(AbstractSettingGui.CLICK_LORE); meta.setLore(AbstractSettingGui.CLICK_LORE);
item.setItemMeta(meta); item.setItemMeta(meta);
@ -111,6 +114,8 @@ public class IntSettingsGui extends AbstractSettingGui {
int planned = Math.min(holder.max, now + step); int planned = Math.min(holder.max, now + step);
ItemStack item = new ItemStack(Material.GREEN_TERRACOTTA); ItemStack item = new ItemStack(Material.GREEN_TERRACOTTA);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7e" + now + " -> " + planned + " \u00A7r(\u00A7a+" + (planned - now) + "\u00A7r)"); meta.setDisplayName("\u00A7e" + now + " -> " + planned + " \u00A7r(\u00A7a+" + (planned - now) + "\u00A7r)");
meta.setLore(AbstractSettingGui.CLICK_LORE); meta.setLore(AbstractSettingGui.CLICK_LORE);
item.setItemMeta(meta); item.setItemMeta(meta);
@ -124,6 +129,8 @@ public class IntSettingsGui 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();
assert resultMeta != null;
resultMeta.setDisplayName("\u00A7eValue: " + now); resultMeta.setDisplayName("\u00A7eValue: " + 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);
@ -227,6 +234,7 @@ public class IntSettingsGui extends AbstractSettingGui {
// Create item stack then gui item // Create item stack then gui item
ItemStack item = new ItemStack(stepMat); ItemStack item = new ItemStack(stepMat);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName(stepName.toString()); meta.setDisplayName(stepName.toString());
meta.setLore(stepLore); meta.setLore(stepLore);

View file

@ -74,6 +74,7 @@ public class ItemSettingGui extends AbstractSettingGui {
protected void prepareReturnToDefault() { protected void prepareReturnToDefault() {
ItemStack item = new ItemStack(Material.COMMAND_BLOCK); ItemStack item = new ItemStack(Material.COMMAND_BLOCK);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
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: " + holder.defaultVal));
@ -101,6 +102,7 @@ public class ItemSettingGui extends AbstractSettingGui {
}else{ }else{
displayedItem = new ItemStack(Material.BARRIER); displayedItem = new ItemStack(Material.BARRIER);
ItemMeta valueMeta = displayedItem.getItemMeta(); ItemMeta valueMeta = displayedItem.getItemMeta();
assert valueMeta != null;
valueMeta.setDisplayName("\u00A74NO ITEM SET"); valueMeta.setDisplayName("\u00A74NO ITEM SET");
valueMeta.setLore(CLICK_LORE); valueMeta.setLore(CLICK_LORE);
@ -262,6 +264,8 @@ public class ItemSettingGui extends AbstractSettingGui {
item = item.clone(); item = item.clone();
} }
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7a" + name); meta.setDisplayName("\u00A7a" + name);
meta.setLore(getDisplayLore()); meta.setLore(getDisplayLore());

View file

@ -83,6 +83,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
// Select new mat item // Select new mat item
ItemStack selectItem = new ItemStack(Material.BLUE_STAINED_GLASS_PANE); ItemStack selectItem = new ItemStack(Material.BLUE_STAINED_GLASS_PANE);
ItemMeta selectMeta = selectItem.getItemMeta(); ItemMeta selectMeta = selectItem.getItemMeta();
assert selectMeta != null;
selectMeta.setDisplayName("\u00A7aAdd Item"); selectMeta.setDisplayName("\u00A7aAdd Item");
selectMeta.setLore(Arrays.asList( selectMeta.setLore(Arrays.asList(
@ -102,6 +103,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
// Instant Remove On item // Instant Remove On item
ItemStack instantRemoveOnItem = new ItemStack(Material.LIME_STAINED_GLASS_PANE); ItemStack instantRemoveOnItem = new ItemStack(Material.LIME_STAINED_GLASS_PANE);
ItemMeta instantRemoveOnMeta = instantRemoveOnItem.getItemMeta(); ItemMeta instantRemoveOnMeta = instantRemoveOnItem.getItemMeta();
assert instantRemoveOnMeta != null;
instantRemoveOnMeta.setDisplayName("\u00A7eInstant remove is \u00A7aEnabled \u00A7e!"); instantRemoveOnMeta.setDisplayName("\u00A7eInstant remove is \u00A7aEnabled \u00A7e!");
instantRemoveOnMeta.setLore( instantRemoveOnMeta.setLore(
@ -112,6 +114,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
// Instant Remove Off item // Instant Remove Off item
ItemStack instantRemoveOffItem = new ItemStack(Material.RED_STAINED_GLASS_PANE); ItemStack instantRemoveOffItem = new ItemStack(Material.RED_STAINED_GLASS_PANE);
ItemMeta instantRemoveOffMeta = instantRemoveOffItem.getItemMeta(); ItemMeta instantRemoveOffMeta = instantRemoveOffItem.getItemMeta();
assert instantRemoveOffMeta != null;
instantRemoveOffMeta.setDisplayName("\u00A7eInstant remove is \u00A7cDisabled \u00A7e!"); instantRemoveOffMeta.setDisplayName("\u00A7eInstant remove is \u00A7cDisabled \u00A7e!");
instantRemoveOffMeta.setLore( instantRemoveOffMeta.setLore(
@ -138,6 +141,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
private GuiItem prepareSaveItem() { private GuiItem prepareSaveItem() {
ItemStack saveItemStack = new ItemStack(GuiGlobalItems.DEFAULT_SAVE_ITEM); ItemStack saveItemStack = new ItemStack(GuiGlobalItems.DEFAULT_SAVE_ITEM);
ItemMeta saveMeta = saveItemStack.getItemMeta(); ItemMeta saveMeta = saveItemStack.getItemMeta();
assert saveMeta != null;
saveMeta.setDisplayName("\u00A7aSave"); saveMeta.setDisplayName("\u00A7aSave");
@ -153,7 +157,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
player.sendMessage(GuiGlobalActions.NO_EDIT_PERM); player.sendMessage(GuiGlobalActions.NO_EDIT_PERM);
return; return;
} }
if(!testCanSave()) return; if(testCantSave()) return;
// Save setting // Save setting
@ -274,7 +278,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
} }
private void setSaveItem() { private void setSaveItem() {
if(!testCanSave()){ if(testCantSave()){
this.backgroundPane.bindItem('S', this.noChangeItem); this.backgroundPane.bindItem('S', this.noChangeItem);
}else{ }else{
this.backgroundPane.bindItem('S', this.saveItem); this.backgroundPane.bindItem('S', this.saveItem);
@ -282,8 +286,8 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
} }
private boolean testCanSave() { private boolean testCantSave() {
return this.defaultMaterialHash != this.nowMaterialHash; return this.defaultMaterialHash == this.nowMaterialHash;
} }

View file

@ -28,6 +28,8 @@ public class GuiGlobalItems {
static { static {
BACK_ITEM = new ItemStack(Material.BARRIER); BACK_ITEM = new ItemStack(Material.BARRIER);
ItemMeta meta = BACK_ITEM.getItemMeta(); ItemMeta meta = BACK_ITEM.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7cBack"); meta.setDisplayName("\u00A7cBack");
BACK_ITEM.setItemMeta(meta); BACK_ITEM.setItemMeta(meta);
} }
@ -78,6 +80,8 @@ public class GuiGlobalItems {
public static GuiItem backgroundItem(Material backgroundMat) { public static GuiItem backgroundItem(Material backgroundMat) {
ItemStack item = new ItemStack(backgroundMat); ItemStack item = new ItemStack(backgroundMat);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7c"); meta.setDisplayName("\u00A7c");
item.setItemMeta(meta); item.setItemMeta(meta);
return new GuiItem(item, GuiGlobalActions.stayInPlace, CustomAnvil.instance); return new GuiItem(item, GuiGlobalActions.stayInPlace, CustomAnvil.instance);
@ -133,6 +137,8 @@ public class GuiGlobalItems {
ItemStack item = new ItemStack(DEFAULT_SAVE_ITEM); ItemStack item = new ItemStack(DEFAULT_SAVE_ITEM);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7aSave"); meta.setDisplayName("\u00A7aSave");
item.setItemMeta(meta); item.setItemMeta(meta);
return new GuiItem(item, return new GuiItem(item,
@ -146,6 +152,8 @@ public class GuiGlobalItems {
static { static {
ItemStack item = new ItemStack(DEFAULT_NO_CHANGE_ITEM); ItemStack item = new ItemStack(DEFAULT_NO_CHANGE_ITEM);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A77No change. can't save."); meta.setDisplayName("\u00A77No change. can't save.");
item.setItemMeta(meta); item.setItemMeta(meta);
NO_CHANGE_ITEM = new GuiItem(item, GuiGlobalActions.stayInPlace, CustomAnvil.instance); NO_CHANGE_ITEM = new GuiItem(item, GuiGlobalActions.stayInPlace, CustomAnvil.instance);
@ -205,6 +213,7 @@ public class GuiGlobalItems {
// Create & initialise item // Create & initialise item
ItemStack item = new ItemStack(itemMat); ItemStack item = new ItemStack(itemMat);
ItemMeta itemMeta = item.getItemMeta(); ItemMeta itemMeta = item.getItemMeta();
assert itemMeta != null;
itemMeta.setDisplayName(itemName.toString()); itemMeta.setDisplayName(itemName.toString());
itemMeta.setLore(lore); itemMeta.setLore(lore);
@ -232,6 +241,7 @@ public class GuiGlobalItems {
public static GuiItem temporaryCloseGuiToSelectItem(Material itemMaterial, Gui openBack){ public static GuiItem temporaryCloseGuiToSelectItem(Material itemMaterial, Gui openBack){
ItemStack item = new ItemStack(itemMaterial); ItemStack item = new ItemStack(itemMaterial);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7eTemporary close this menu"); meta.setDisplayName("\u00A7eTemporary close this menu");
meta.setLore(Collections.singletonList("\u00A77Allow you to chose other item then return here.")); meta.setLore(Collections.singletonList("\u00A77Allow you to chose other item then return here."));

View file

@ -60,18 +60,24 @@ public class GuiSharedConstant {
static { static {
CANCEL_ITEM = new ItemStack(Material.RED_TERRACOTTA); CANCEL_ITEM = new ItemStack(Material.RED_TERRACOTTA);
ItemMeta meta = CANCEL_ITEM.getItemMeta(); ItemMeta meta = CANCEL_ITEM.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7cCancel"); meta.setDisplayName("\u00A7cCancel");
meta.setLore(Collections.singletonList("\u00A77Cancel current action and return to previous menu.")); meta.setLore(Collections.singletonList("\u00A77Cancel current action and return to previous menu."));
CANCEL_ITEM.setItemMeta(meta); CANCEL_ITEM.setItemMeta(meta);
CONFIRM_ITEM = new ItemStack(Material.GREEN_TERRACOTTA); CONFIRM_ITEM = new ItemStack(Material.GREEN_TERRACOTTA);
meta = CONFIRM_ITEM.getItemMeta(); meta = CONFIRM_ITEM.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7aConfirm"); meta.setDisplayName("\u00A7aConfirm");
meta.setLore(Collections.singletonList("\u00A77Confirm current action.")); meta.setLore(Collections.singletonList("\u00A77Confirm current action."));
CONFIRM_ITEM.setItemMeta(meta); CONFIRM_ITEM.setItemMeta(meta);
CONFIRM_PERMANENT_ITEM = new ItemStack(Material.GREEN_TERRACOTTA); CONFIRM_PERMANENT_ITEM = new ItemStack(Material.GREEN_TERRACOTTA);
meta = CONFIRM_PERMANENT_ITEM.getItemMeta(); meta = CONFIRM_PERMANENT_ITEM.getItemMeta();
assert meta != null;
meta.setDisplayName("\u00A7aConfirm"); meta.setDisplayName("\u00A7aConfirm");
meta.setLore(Arrays.asList("\u00A77Confirm current action.", meta.setLore(Arrays.asList("\u00A77Confirm current action.",
"\u00A74Cation: This action can't be canceled.")); "\u00A74Cation: This action can't be canceled."));

View file

@ -82,7 +82,7 @@ class EnchantConflictManager {
// Read and add enchantment to conflict // Read and add enchantment to conflict
val enchantList = section.getStringList(ENCH_LIST_PATH) val enchantList = section.getStringList(ENCH_LIST_PATH)
for (enchantName in enchantList) { for (enchantName in enchantList) {
val enchant = getEnchantByName(enchantName); val enchant = getEnchantByName(enchantName)
if (enchant == null) { if (enchant == null) {
if (!futureUse) { if (!futureUse) {
CustomAnvil.instance.logger.warning("Enchantment $enchantName do not exist but was asked for conflict $conflictName") CustomAnvil.instance.logger.warning("Enchantment $enchantName do not exist but was asked for conflict $conflictName")
@ -110,7 +110,7 @@ class EnchantConflictManager {
} }
val enchantKey = NamespacedKey.minecraft(enchantName) val enchantKey = NamespacedKey.minecraft(enchantName)
return Enchantment.getByKey(enchantKey); return Enchantment.getByKey(enchantKey)
} }

View file

@ -32,20 +32,20 @@ class AnvilCustomRecipe(
const val RESULT_ITEM_CONFIG = "result_item" const val RESULT_ITEM_CONFIG = "result_item"
val DEFAULT_EXACT_COUNT_CONFIG = true const val DEFAULT_EXACT_COUNT_CONFIG = true
//val DEFAULT_EXACT_LEFT_CONFIG = true //val DEFAULT_EXACT_LEFT_CONFIG = true
//val DEFAULT_EXACT_RIGHT_CONFIG = true //val DEFAULT_EXACT_RIGHT_CONFIG = true
val DEFAULT_XP_COST_CONFIG = 1 const val DEFAULT_XP_COST_CONFIG = 1
val DEFAULT_LEFT_ITEM_CONFIG: ItemStack? = null val DEFAULT_LEFT_ITEM_CONFIG: ItemStack? = null
val DEFAULT_RIGHT_ITEM_CONFIG: ItemStack? = null val DEFAULT_RIGHT_ITEM_CONFIG: ItemStack? = null
val DEFAULT_RESULT_ITEM_CONFIG: ItemStack? = null; val DEFAULT_RESULT_ITEM_CONFIG: ItemStack? = null
val XP_COST_CONFIG_RANGE = 0..255 val XP_COST_CONFIG_RANGE = 0..255
fun getFromConfig(name: String, configSection: ConfigurationSection?): AnvilCustomRecipe? { fun getFromConfig(name: String, configSection: ConfigurationSection?): AnvilCustomRecipe? {
if(configSection == null) return null; if(configSection == null) return null
return AnvilCustomRecipe( return AnvilCustomRecipe(
name, name,
configSection.getBoolean(EXACT_COUNT_CONFIG, DEFAULT_EXACT_COUNT_CONFIG), configSection.getBoolean(EXACT_COUNT_CONFIG, DEFAULT_EXACT_COUNT_CONFIG),
@ -89,7 +89,7 @@ class AnvilCustomRecipe(
if (GuiSharedConstant.TEMPORARY_DO_SAVE_TO_DISK_EVERY_CHANGE) { if (GuiSharedConstant.TEMPORARY_DO_SAVE_TO_DISK_EVERY_CHANGE) {
ConfigHolder.CUSTOM_RECIPE_HOLDER.saveToDisk(GuiSharedConstant.TEMPORARY_DO_BACKUP_EVERY_SAVE); ConfigHolder.CUSTOM_RECIPE_HOLDER.saveToDisk(GuiSharedConstant.TEMPORARY_DO_BACKUP_EVERY_SAVE)
} }
} }