The new value for the setting
*/ public void changeValue(@NotNull BlacksmithSetting blacksmithSetting, @Nullable Object newValue) { - if (blacksmithSetting.getValueType() == SettingValueType.STRING_LIST || + if (blacksmithSetting.getValueType() == SettingValueType.ENCHANTMENT_LIST || blacksmithSetting.getValueType() == SettingValueType.REFORGE_ABLE_ITEMS) { //Workaround to make sure it's treated as the correct type this.settings.put(blacksmithSetting, newValue == null ? null : ConfigHelper.asStringList(newValue)); diff --git a/src/main/java/net/knarcraft/blacksmith/config/scrapper/ScrapperSetting.java b/src/main/java/net/knarcraft/blacksmith/config/scrapper/ScrapperSetting.java index 8abbef6..1d5b035 100644 --- a/src/main/java/net/knarcraft/blacksmith/config/scrapper/ScrapperSetting.java +++ b/src/main/java/net/knarcraft/blacksmith/config/scrapper/ScrapperSetting.java @@ -181,7 +181,7 @@ public enum ScrapperSetting implements Setting { * Which items are ignored when calculating salvage for a given material */ IGNORED_SALVAGE("ignoredSalvage", SettingValueType.STRING_LIST, - new ArrayList<>(List.of("*_SHOVEL,*_PICKAXE,*_AXE,*_HOE,*_SWORD:STICK")), + new ArrayList<>(List.of("*_SHOVEL;*_PICKAXE;*_AXE;*_HOE;*_SWORD:STICK")), "Items ignored during salvage calculation. This follows the format: " + "\"MATERIAL[,MATERIAL2][,MATERIAL3]:IGNORED\", so the material or materials listed will ignore " + "the material specified after the \":\" when calculating salvage (* matches any character). This " + @@ -223,7 +223,7 @@ public enum ScrapperSetting implements Setting { this.valueType = valueType; this.childPath = key; if (key.contains(".")) { - String[] pathParts = path.split("\\."); + String[] pathParts = key.split("\\."); this.commandName = pathParts[0]; } else { this.commandName = key; diff --git a/src/main/java/net/knarcraft/blacksmith/util/TabCompleteValuesHelper.java b/src/main/java/net/knarcraft/blacksmith/util/TabCompleteValuesHelper.java index aa1b5e8..066abe9 100644 --- a/src/main/java/net/knarcraft/blacksmith/util/TabCompleteValuesHelper.java +++ b/src/main/java/net/knarcraft/blacksmith/util/TabCompleteValuesHelper.java @@ -36,25 +36,11 @@ public final class TabCompleteValuesHelper { case PERCENTAGE -> getPercentages(); case REFORGE_ABLE_ITEMS -> getReforgeAbleMaterials(); case MATERIAL -> getAllReforgeAbleMaterialNames(); - case ENCHANTMENT -> getAllEnchantments(); - case STRING_LIST -> getExampleEnchantmentBlockLists(); + case ENCHANTMENT, ENCHANTMENT_LIST -> getAllEnchantments(); + case STRING_LIST -> List.of("*_SHOVEL,*_PICKAXE,*_AXE,*_HOE,*_SWORD:STICK,SMITHING_TABLE:*_PLANKS"); }; } - /** - * Gets example enchantment block lists - * - * @returnSome example enchantment block lists
- */ - private static @NotNull ListThe value to check
+ * @param senderThe command sender to use for printing error messages
+ * @returnTrue if the value is an enchantment list
+ */ + private static boolean isEnchantmentList(@Nullable Object value, @Nullable CommandSender sender) { + // Check whether a string list is given + if (!isStringList(value, sender)) { + return false; + } + + // Make sure the input can be converted to a string list + List