Fixes some bugs
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

Fixes some config commands not being registered
Bumps KnarLib version to include bug-fix
Fixes and improves tab-completion for enchantment block-list
This commit is contained in:
2024-05-04 14:11:43 +02:00
parent 7e5525bd00
commit f9463f58d1
9 changed files with 51 additions and 25 deletions

View File

@ -50,4 +50,9 @@ public enum SettingValueType {
*/
REFORGE_ABLE_ITEMS,
/**
* A list of enchantments
*/
ENCHANTMENT_LIST,
}

View File

@ -64,7 +64,7 @@ public class BlacksmithNPCSettings implements TraitSettings<BlacksmithSetting> {
@Override
public void changeValue(@NotNull BlacksmithSetting setting, @Nullable Object newValue) {
if (setting.getValueType() == SettingValueType.STRING_LIST ||
if (setting.getValueType() == SettingValueType.ENCHANTMENT_LIST ||
setting.getValueType() == SettingValueType.REFORGE_ABLE_ITEMS) {
//Workaround to make sure it's treated as the correct type
currentValues.put(setting, newValue == null ? null : ConfigHelper.asStringList(newValue));

View File

@ -90,7 +90,7 @@ public enum BlacksmithSetting implements Setting {
/**
* The setting for the enchantments a blacksmith cannot apply to items
*/
ENCHANTMENT_BLOCK_LIST("enchantmentBlockList", SettingValueType.STRING_LIST, List.of("binding_curse",
ENCHANTMENT_BLOCK_LIST("enchantmentBlockList", SettingValueType.ENCHANTMENT_LIST, List.of("binding_curse",
"mending", "vanishing_curse"), "The enchantments a " +
"blacksmith is denied from applying to an item. Disable anything you find too op or annoying.",
true, false),
@ -277,7 +277,7 @@ public enum BlacksmithSetting 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;

View File

@ -73,7 +73,7 @@ public class GlobalBlacksmithSettings implements Settings<BlacksmithSetting> {
* @param newValue <p>The new value for the setting</p>
*/
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));

View File

@ -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;