mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Suppressed most fixable warning.
This commit is contained in:
parent
91994a6e78
commit
3ff6505adf
22 changed files with 97 additions and 24 deletions
|
|
@ -41,6 +41,7 @@ public class MainConfigGui extends ChestGui {
|
|||
// Basic config item
|
||||
ItemStack basicConfigItemstack = new ItemStack(Material.COMMAND_BLOCK);
|
||||
ItemMeta basicConfigMeta = basicConfigItemstack.getItemMeta();
|
||||
assert basicConfigMeta != null;
|
||||
|
||||
basicConfigMeta.setDisplayName("\u00A7aBasic 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
|
||||
ItemStack enchantLimitItemstack = new ItemStack(Material.ENCHANTED_BOOK);
|
||||
ItemMeta enchantLimitMeta = enchantLimitItemstack.getItemMeta();
|
||||
assert enchantLimitMeta != null;
|
||||
|
||||
enchantLimitMeta.setDisplayName("\u00A7aEnchantment Level Limit");
|
||||
enchantLimitMeta.setLore(Collections.singletonList("\u00A77Click here to open enchantment level limit menu"));
|
||||
|
|
@ -63,6 +65,7 @@ public class MainConfigGui extends ChestGui {
|
|||
// enchant cost item
|
||||
ItemStack enchantCostItemstack = new ItemStack(Material.EXPERIENCE_BOTTLE);
|
||||
ItemMeta enchantCostMeta = enchantCostItemstack.getItemMeta();
|
||||
assert enchantCostMeta != null;
|
||||
|
||||
enchantCostMeta.setDisplayName("\u00A7aEnchantment Cost");
|
||||
enchantCostMeta.setLore(Collections.singletonList("\u00A77Click here to open enchantment costs menu"));
|
||||
|
|
@ -72,20 +75,22 @@ public class MainConfigGui extends ChestGui {
|
|||
pane.bindItem('3', enchantCostItem);
|
||||
|
||||
// Enchantment Conflicts item
|
||||
ItemStack EnchantConflictItemstack = new ItemStack(Material.OAK_FENCE);
|
||||
ItemMeta enchantConflictMeta = EnchantConflictItemstack.getItemMeta();
|
||||
ItemStack enchantConflictItemstack = new ItemStack(Material.OAK_FENCE);
|
||||
ItemMeta enchantConflictMeta = enchantConflictItemstack.getItemMeta();
|
||||
assert enchantConflictMeta != null;
|
||||
|
||||
enchantConflictMeta.setDisplayName("\u00A7aEnchantment Conflict");
|
||||
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);
|
||||
|
||||
// Group config items
|
||||
ItemStack groupItemstack = new ItemStack(Material.CHEST);
|
||||
|
||||
ItemMeta groupMeta = groupItemstack.getItemMeta();
|
||||
assert groupMeta != null;
|
||||
|
||||
groupMeta.setDisplayName("\u00A7aGroups");
|
||||
groupMeta.setLore(Collections.singletonList("\u00A77Click here to open material group menu"));
|
||||
groupItemstack.setItemMeta(groupMeta);
|
||||
|
|
@ -97,6 +102,7 @@ public class MainConfigGui extends ChestGui {
|
|||
// Unit repair item
|
||||
ItemStack unirRepairItemstack = new ItemStack(Material.DIAMOND);
|
||||
ItemMeta unitRepairMeta = unirRepairItemstack.getItemMeta();
|
||||
assert unitRepairMeta != null;
|
||||
|
||||
unitRepairMeta.setDisplayName("\u00A7aUnit Repair");
|
||||
unitRepairMeta.setLore(Collections.singletonList("\u00A77Click here to open anvil unit repair menu"));
|
||||
|
|
@ -107,7 +113,8 @@ public class MainConfigGui extends ChestGui {
|
|||
|
||||
// Custom recipe item
|
||||
ItemStack customRecipeItemstack = new ItemStack(Material.CRAFTING_TABLE);
|
||||
ItemMeta customRecipeMeta = EnchantConflictItemstack.getItemMeta();
|
||||
ItemMeta customRecipeMeta = customRecipeItemstack.getItemMeta();
|
||||
assert customRecipeMeta != null;
|
||||
|
||||
customRecipeMeta.setDisplayName("\u00A7aCustom recipes");
|
||||
customRecipeMeta.setLore(Collections.singletonList("\u00A77Click here to open anvil custom recipe menu"));
|
||||
|
|
@ -119,6 +126,8 @@ public class MainConfigGui extends ChestGui {
|
|||
// quit item
|
||||
ItemStack quitItemstack = new ItemStack(Material.BARRIER);
|
||||
ItemMeta quitMeta = quitItemstack.getItemMeta();
|
||||
assert quitMeta != null;
|
||||
|
||||
quitMeta.setDisplayName("\u00A7cQuit");
|
||||
quitItemstack.setItemMeta(quitMeta);
|
||||
|
||||
|
|
@ -131,6 +140,7 @@ public class MainConfigGui extends ChestGui {
|
|||
// create & bind "info" item
|
||||
ItemStack infoItemstack = new ItemStack(Material.PAPER);
|
||||
ItemMeta infoMeta = infoItemstack.getItemMeta();
|
||||
assert infoMeta != null;
|
||||
|
||||
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 !"));
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package xyz.alexcrea.cuanvil.gui.config;
|
||||
|
||||
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 java.util.*;
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ public class BasicConfigGui extends ValueUpdatableGui {
|
|||
// rename cost not needed
|
||||
ItemStack item = new ItemStack(Material.BARRIER);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7cRepair Cost Value");
|
||||
meta.setLore(Collections.singletonList("\u00A77Please, enable repair cost limit for this variable to be editable."));
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
|
|||
|
||||
// edit displayed item
|
||||
ItemMeta meta = displaydItem.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(recipe.toString()) + " \u00A7fCustom recipe");
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
|
|
@ -73,8 +74,8 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
|
|||
// Create new empty conflict and display it to the admin
|
||||
AnvilCustomRecipe recipe = new AnvilCustomRecipe(
|
||||
name,
|
||||
AnvilCustomRecipe.Companion.getDEFAULT_EXACT_COUNT_CONFIG(),
|
||||
AnvilCustomRecipe.Companion.getDEFAULT_XP_COST_CONFIG(),
|
||||
AnvilCustomRecipe.DEFAULT_EXACT_COUNT_CONFIG,
|
||||
AnvilCustomRecipe.DEFAULT_XP_COST_CONFIG,
|
||||
AnvilCustomRecipe.Companion.getDEFAULT_LEFT_ITEM_CONFIG(),
|
||||
AnvilCustomRecipe.Companion.getDEFAULT_RIGHT_ITEM_CONFIG(),
|
||||
AnvilCustomRecipe.Companion.getDEFAULT_RESULT_ITEM_CONFIG());
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ public class EnchantConflictGui extends MappedGuiListConfigGui<EnchantConflictGr
|
|||
ItemStack item = new ItemStack(conflict.getRepresentativeMaterial());
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(conflict.toString()) + " \u00A7fConflict");
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSe
|
|||
// Create item
|
||||
ItemStack item = new ItemStack(Material.ENCHANTED_BOOK);
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
assert itemMeta != null;
|
||||
|
||||
// Edit name and lore
|
||||
itemMeta.setDisplayName(itemName);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public class GroupConfigGui extends MappedGuiListConfigGui<IncludeGroup, GroupCo
|
|||
protected ItemStack createItemForGeneric(IncludeGroup group) {
|
||||
ItemStack item = new ItemStack(group.getRepresentativeMaterial());
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(group.getName())+ " \u00A7fGroup");
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public class UnitRepairConfigGui extends MappedGuiListConfigGui<Material, UnitRe
|
|||
|
||||
ItemStack item = new ItemStack(material);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7eRepaired by " +materialName);
|
||||
meta.setLore(Arrays.asList(
|
||||
|
|
@ -78,6 +79,7 @@ public class UnitRepairConfigGui extends MappedGuiListConfigGui<Material, UnitRe
|
|||
// Create new conflict item
|
||||
ItemStack createItem = new ItemStack(Material.PAPER);
|
||||
ItemMeta createMeta = createItem.getItemMeta();
|
||||
assert createMeta != null;
|
||||
|
||||
createMeta.setDisplayName("\u00A7aSelect a new unit material");
|
||||
createMeta.setLore(Arrays.asList(
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public abstract class MappedElementListConfigGui< T, S > extends ElementListConf
|
|||
// Create new conflict item
|
||||
ItemStack createItem = new ItemStack(Material.PAPER);
|
||||
ItemMeta createMeta = createItem.getItemMeta();
|
||||
assert createMeta != null;
|
||||
|
||||
createMeta.setDisplayName("\u00A7aCreate new "+genericDisplayedName());
|
||||
createMeta.setLore(Arrays.asList(
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public abstract class SettingGuiListConfigGui< T, S extends AbstractSettingGui.S
|
|||
protected GuiItem prepareCreateNewItem() {
|
||||
ItemStack createItem = new ItemStack(Material.PAPER);
|
||||
ItemMeta createMeta = createItem.getItemMeta();
|
||||
assert createMeta != null;
|
||||
|
||||
createMeta.setDisplayName(createItemName());
|
||||
createMeta.setLore(getCreateItemLore());
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
|
|||
// Delete item
|
||||
ItemStack deleteItem = new ItemStack(Material.RED_TERRACOTTA);
|
||||
ItemMeta deleteMeta = deleteItem.getItemMeta();
|
||||
assert deleteMeta != null;
|
||||
|
||||
deleteMeta.setDisplayName("\u00A74DELETE RECIPE");
|
||||
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();
|
||||
this.exactCountFactory = BoolSettingsGui.boolFactory("\u00A78Exact count ?", this,
|
||||
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.anvilRecipe +"."+AnvilCustomRecipe.XP_COST_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
|||
// Delete item
|
||||
ItemStack deleteItem = new ItemStack(Material.RED_TERRACOTTA);
|
||||
ItemMeta deleteMeta = deleteItem.getItemMeta();
|
||||
assert deleteMeta != null;
|
||||
|
||||
deleteMeta.setDisplayName("\u00A74DELETE CONFLICT");
|
||||
deleteMeta.setLore(Collections.singletonList("\u00A7cCaution with this button !"));
|
||||
|
|
@ -186,6 +187,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
|||
// Configure enchant setting item
|
||||
ItemStack enchantItem = this.enchantSettingItem.getItem();
|
||||
ItemMeta enchantMeta = enchantItem.getItemMeta();
|
||||
assert enchantMeta != null;
|
||||
|
||||
enchantMeta.setDisplayName("\u00A7aSelect included \u00A75Enchantments \u00A7aSettings");
|
||||
enchantMeta.setLore(enchantLore);
|
||||
|
|
@ -197,6 +199,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
|||
// Configure group setting item
|
||||
ItemStack groupItem = this.groupSettingItem.getItem();
|
||||
ItemMeta groupMeta = groupItem.getItemMeta();
|
||||
assert groupMeta != null;
|
||||
|
||||
groupMeta.setDisplayName("\u00A7aSelect excluded \u00A73Groups \u00A7aSettings");
|
||||
groupMeta.setLore(groupLore);
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ public class BoolSettingsGui extends AbstractSettingGui {
|
|||
protected void prepareReturnToDefault() {
|
||||
ItemStack item = new ItemStack(Material.COMMAND_BLOCK);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7eReset to default value");
|
||||
meta.setLore(Collections.singletonList("\u00A77Default value is: " + holder.defaultVal));
|
||||
|
|
@ -95,6 +96,8 @@ public class BoolSettingsGui extends AbstractSettingGui {
|
|||
|
||||
ItemStack valueItemStack = new ItemStack(displayedMat);
|
||||
ItemMeta valueMeta = valueItemStack.getItemMeta();
|
||||
assert valueMeta != null;
|
||||
|
||||
valueMeta.setDisplayName(displayedName);
|
||||
valueMeta.setLore(AbstractSettingGui.CLICK_LORE);
|
||||
valueItemStack.setItemMeta(valueMeta);
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
|||
private static final ItemStack DELETE_ITEM_STACK = new ItemStack(Material.RED_TERRACOTTA);
|
||||
static {
|
||||
ItemMeta meta = DELETE_ITEM_STACK.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7cDisable item being repaired ?");
|
||||
meta.setLore(Arrays.asList("\u00A77Confirm disabling unit repair for this item..",
|
||||
|
|
@ -117,6 +118,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
|||
protected void prepareReturnToDefault() {
|
||||
ItemStack item = new ItemStack(Material.COMMAND_BLOCK);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7eReset to default value");
|
||||
meta.setLore(Collections.singletonList("\u00A77Default value is " + displayValue(holder.defaultVal)));
|
||||
|
|
@ -161,6 +163,8 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
|||
// "result" display
|
||||
ItemStack resultPaper = new ItemStack(Material.PAPER);
|
||||
ItemMeta resultMeta = resultPaper.getItemMeta();
|
||||
assert resultMeta != null;
|
||||
|
||||
resultMeta.setDisplayName("\u00A7eValue: " + displayValue(now));
|
||||
resultPaper.setItemMeta(resultMeta);
|
||||
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){
|
||||
ItemStack item = new ItemStack(mat);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7e" + displayValue(now) + " -> " + displayValue(planned)
|
||||
+ " \u00A7r(" + numberPrefix + (displayValue(planned.subtract(now).abs()) + "\u00A7r)"));
|
||||
meta.setLore(AbstractSettingGui.CLICK_LORE);
|
||||
|
|
@ -274,6 +280,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
|||
// Create item stack then gui item
|
||||
ItemStack item = new ItemStack(stepMat);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName(stepName.toString());
|
||||
meta.setLore(stepLore);
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
|
|||
// book display
|
||||
ItemStack bookItemstack = new ItemStack(Material.BOOK);
|
||||
ItemMeta bookMeta = bookItemstack.getItemMeta();
|
||||
assert bookMeta != null;
|
||||
|
||||
bookMeta.setDisplayName("\u00A7aCost of an Enchantment by Book");
|
||||
bookMeta.setLore(Arrays.asList(
|
||||
|
|
@ -90,8 +91,9 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
|
|||
// sword display
|
||||
ItemStack swordItemstack = new ItemStack(Material.WOODEN_SWORD);
|
||||
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.setLore(Arrays.asList(
|
||||
"\u00A77Cost per result item level of an sacrifice enchantment",
|
||||
|
|
@ -107,6 +109,7 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
|
|||
protected void prepareReturnToDefault() {
|
||||
ItemStack item = new ItemStack(Material.COMMAND_BLOCK);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
// assume holder is an instance of EnchantCostSettingFactory
|
||||
EnchantCostSettingFactory holder = (EnchantCostSettingFactory) this.holder;
|
||||
|
|
@ -141,6 +144,8 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
|
|||
int planned = Math.max(holder.min, nowBook - step);
|
||||
ItemStack item = new ItemStack(Material.RED_TERRACOTTA);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7e" + nowBook + " -> " + planned + " \u00A7r(\u00A7c-" + (nowBook - planned) + "\u00A7r)");
|
||||
meta.setLore(AbstractSettingGui.CLICK_LORE);
|
||||
item.setItemMeta(meta);
|
||||
|
|
@ -157,6 +162,8 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
|
|||
int planned = Math.min(holder.max, nowBook + step);
|
||||
ItemStack item = new ItemStack(Material.GREEN_TERRACOTTA);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7e" + nowBook + " -> " + planned + " \u00A7r(\u00A7a+" + (planned - nowBook) + "\u00A7r)");
|
||||
meta.setLore(AbstractSettingGui.CLICK_LORE);
|
||||
item.setItemMeta(meta);
|
||||
|
|
@ -170,8 +177,11 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
|
|||
// "result" display
|
||||
ItemStack resultPaper = new ItemStack(Material.PAPER);
|
||||
ItemMeta resultMeta = resultPaper.getItemMeta();
|
||||
assert resultMeta != null;
|
||||
|
||||
resultMeta.setDisplayName("\u00A7eValue: " + nowBook);
|
||||
resultPaper.setItemMeta(resultMeta);
|
||||
|
||||
GuiItem resultItem = new GuiItem(resultPaper, GuiGlobalActions.stayInPlace, CustomAnvil.instance);
|
||||
|
||||
pane.bindItem('V', resultItem);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ public class IntSettingsGui extends AbstractSettingGui {
|
|||
protected void prepareReturnToDefault() {
|
||||
ItemStack item = new ItemStack(Material.COMMAND_BLOCK);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7eReset to default value");
|
||||
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);
|
||||
ItemStack item = new ItemStack(Material.RED_TERRACOTTA);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7e" + now + " -> " + planned + " \u00A7r(\u00A7c-" + (now - planned) + "\u00A7r)");
|
||||
meta.setLore(AbstractSettingGui.CLICK_LORE);
|
||||
item.setItemMeta(meta);
|
||||
|
|
@ -111,6 +114,8 @@ public class IntSettingsGui extends AbstractSettingGui {
|
|||
int planned = Math.min(holder.max, now + step);
|
||||
ItemStack item = new ItemStack(Material.GREEN_TERRACOTTA);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7e" + now + " -> " + planned + " \u00A7r(\u00A7a+" + (planned - now) + "\u00A7r)");
|
||||
meta.setLore(AbstractSettingGui.CLICK_LORE);
|
||||
item.setItemMeta(meta);
|
||||
|
|
@ -124,6 +129,8 @@ public class IntSettingsGui extends AbstractSettingGui {
|
|||
// "result" display
|
||||
ItemStack resultPaper = new ItemStack(Material.PAPER);
|
||||
ItemMeta resultMeta = resultPaper.getItemMeta();
|
||||
assert resultMeta != null;
|
||||
|
||||
resultMeta.setDisplayName("\u00A7eValue: " + now);
|
||||
resultPaper.setItemMeta(resultMeta);
|
||||
GuiItem resultItem = new GuiItem(resultPaper, GuiGlobalActions.stayInPlace, CustomAnvil.instance);
|
||||
|
|
@ -227,6 +234,7 @@ public class IntSettingsGui extends AbstractSettingGui {
|
|||
// Create item stack then gui item
|
||||
ItemStack item = new ItemStack(stepMat);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName(stepName.toString());
|
||||
meta.setLore(stepLore);
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ public class ItemSettingGui extends AbstractSettingGui {
|
|||
protected void prepareReturnToDefault() {
|
||||
ItemStack item = new ItemStack(Material.COMMAND_BLOCK);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7eReset to default value");
|
||||
meta.setLore(Collections.singletonList("\u00A77Default value is: " + holder.defaultVal));
|
||||
|
|
@ -101,6 +102,7 @@ public class ItemSettingGui extends AbstractSettingGui {
|
|||
}else{
|
||||
displayedItem = new ItemStack(Material.BARRIER);
|
||||
ItemMeta valueMeta = displayedItem.getItemMeta();
|
||||
assert valueMeta != null;
|
||||
|
||||
valueMeta.setDisplayName("\u00A74NO ITEM SET");
|
||||
valueMeta.setLore(CLICK_LORE);
|
||||
|
|
@ -262,6 +264,8 @@ public class ItemSettingGui extends AbstractSettingGui {
|
|||
item = item.clone();
|
||||
}
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7a" + name);
|
||||
meta.setLore(getDisplayLore());
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
|
|||
// Select new mat item
|
||||
ItemStack selectItem = new ItemStack(Material.BLUE_STAINED_GLASS_PANE);
|
||||
ItemMeta selectMeta = selectItem.getItemMeta();
|
||||
assert selectMeta != null;
|
||||
|
||||
selectMeta.setDisplayName("\u00A7aAdd Item");
|
||||
selectMeta.setLore(Arrays.asList(
|
||||
|
|
@ -102,6 +103,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
|
|||
// Instant Remove On item
|
||||
ItemStack instantRemoveOnItem = new ItemStack(Material.LIME_STAINED_GLASS_PANE);
|
||||
ItemMeta instantRemoveOnMeta = instantRemoveOnItem.getItemMeta();
|
||||
assert instantRemoveOnMeta != null;
|
||||
|
||||
instantRemoveOnMeta.setDisplayName("\u00A7eInstant remove is \u00A7aEnabled \u00A7e!");
|
||||
instantRemoveOnMeta.setLore(
|
||||
|
|
@ -112,6 +114,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
|
|||
// Instant Remove Off item
|
||||
ItemStack instantRemoveOffItem = new ItemStack(Material.RED_STAINED_GLASS_PANE);
|
||||
ItemMeta instantRemoveOffMeta = instantRemoveOffItem.getItemMeta();
|
||||
assert instantRemoveOffMeta != null;
|
||||
|
||||
instantRemoveOffMeta.setDisplayName("\u00A7eInstant remove is \u00A7cDisabled \u00A7e!");
|
||||
instantRemoveOffMeta.setLore(
|
||||
|
|
@ -138,6 +141,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
|
|||
private GuiItem prepareSaveItem() {
|
||||
ItemStack saveItemStack = new ItemStack(GuiGlobalItems.DEFAULT_SAVE_ITEM);
|
||||
ItemMeta saveMeta = saveItemStack.getItemMeta();
|
||||
assert saveMeta != null;
|
||||
|
||||
saveMeta.setDisplayName("\u00A7aSave");
|
||||
|
||||
|
|
@ -153,7 +157,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
|
|||
player.sendMessage(GuiGlobalActions.NO_EDIT_PERM);
|
||||
return;
|
||||
}
|
||||
if(!testCanSave()) return;
|
||||
if(testCantSave()) return;
|
||||
|
||||
|
||||
// Save setting
|
||||
|
|
@ -274,7 +278,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
|
|||
}
|
||||
|
||||
private void setSaveItem() {
|
||||
if(!testCanSave()){
|
||||
if(testCantSave()){
|
||||
this.backgroundPane.bindItem('S', this.noChangeItem);
|
||||
}else{
|
||||
this.backgroundPane.bindItem('S', this.saveItem);
|
||||
|
|
@ -282,8 +286,8 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
|
|||
|
||||
}
|
||||
|
||||
private boolean testCanSave() {
|
||||
return this.defaultMaterialHash != this.nowMaterialHash;
|
||||
private boolean testCantSave() {
|
||||
return this.defaultMaterialHash == this.nowMaterialHash;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ public class GuiGlobalItems {
|
|||
static {
|
||||
BACK_ITEM = new ItemStack(Material.BARRIER);
|
||||
ItemMeta meta = BACK_ITEM.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7cBack");
|
||||
BACK_ITEM.setItemMeta(meta);
|
||||
}
|
||||
|
|
@ -78,6 +80,8 @@ public class GuiGlobalItems {
|
|||
public static GuiItem backgroundItem(Material backgroundMat) {
|
||||
ItemStack item = new ItemStack(backgroundMat);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7c");
|
||||
item.setItemMeta(meta);
|
||||
return new GuiItem(item, GuiGlobalActions.stayInPlace, CustomAnvil.instance);
|
||||
|
|
@ -133,6 +137,8 @@ public class GuiGlobalItems {
|
|||
|
||||
ItemStack item = new ItemStack(DEFAULT_SAVE_ITEM);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7aSave");
|
||||
item.setItemMeta(meta);
|
||||
return new GuiItem(item,
|
||||
|
|
@ -146,6 +152,8 @@ public class GuiGlobalItems {
|
|||
static {
|
||||
ItemStack item = new ItemStack(DEFAULT_NO_CHANGE_ITEM);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A77No change. can't save.");
|
||||
item.setItemMeta(meta);
|
||||
NO_CHANGE_ITEM = new GuiItem(item, GuiGlobalActions.stayInPlace, CustomAnvil.instance);
|
||||
|
|
@ -205,6 +213,7 @@ public class GuiGlobalItems {
|
|||
// Create & initialise item
|
||||
ItemStack item = new ItemStack(itemMat);
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
assert itemMeta != null;
|
||||
|
||||
itemMeta.setDisplayName(itemName.toString());
|
||||
itemMeta.setLore(lore);
|
||||
|
|
@ -232,6 +241,7 @@ public class GuiGlobalItems {
|
|||
public static GuiItem temporaryCloseGuiToSelectItem(Material itemMaterial, Gui openBack){
|
||||
ItemStack item = new ItemStack(itemMaterial);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7eTemporary close this menu");
|
||||
meta.setLore(Collections.singletonList("\u00A77Allow you to chose other item then return here."));
|
||||
|
|
|
|||
|
|
@ -60,18 +60,24 @@ public class GuiSharedConstant {
|
|||
static {
|
||||
CANCEL_ITEM = new ItemStack(Material.RED_TERRACOTTA);
|
||||
ItemMeta meta = CANCEL_ITEM.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7cCancel");
|
||||
meta.setLore(Collections.singletonList("\u00A77Cancel current action and return to previous menu."));
|
||||
CANCEL_ITEM.setItemMeta(meta);
|
||||
|
||||
CONFIRM_ITEM = new ItemStack(Material.GREEN_TERRACOTTA);
|
||||
meta = CONFIRM_ITEM.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7aConfirm");
|
||||
meta.setLore(Collections.singletonList("\u00A77Confirm current action."));
|
||||
CONFIRM_ITEM.setItemMeta(meta);
|
||||
|
||||
CONFIRM_PERMANENT_ITEM = new ItemStack(Material.GREEN_TERRACOTTA);
|
||||
meta = CONFIRM_PERMANENT_ITEM.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7aConfirm");
|
||||
meta.setLore(Arrays.asList("\u00A77Confirm current action.",
|
||||
"\u00A74Cation: This action can't be canceled."));
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class EnchantConflictManager {
|
|||
// Read and add enchantment to conflict
|
||||
val enchantList = section.getStringList(ENCH_LIST_PATH)
|
||||
for (enchantName in enchantList) {
|
||||
val enchant = getEnchantByName(enchantName);
|
||||
val enchant = getEnchantByName(enchantName)
|
||||
if (enchant == null) {
|
||||
if (!futureUse) {
|
||||
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)
|
||||
return Enchantment.getByKey(enchantKey);
|
||||
return Enchantment.getByKey(enchantKey)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,20 +32,20 @@ class AnvilCustomRecipe(
|
|||
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_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_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
|
||||
|
||||
fun getFromConfig(name: String, configSection: ConfigurationSection?): AnvilCustomRecipe? {
|
||||
if(configSection == null) return null;
|
||||
if(configSection == null) return null
|
||||
return AnvilCustomRecipe(
|
||||
name,
|
||||
configSection.getBoolean(EXACT_COUNT_CONFIG, DEFAULT_EXACT_COUNT_CONFIG),
|
||||
|
|
@ -89,7 +89,7 @@ class AnvilCustomRecipe(
|
|||
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue