Adds a new enchantmentBlocklist option
The enchantmentBlocklist allows specifying a list of enchantments blacksmiths should be blocked from adding to items. Especially curse of binding and curse of vanishing are problematic as the effect is quite bad. Mending is possibly undesirable as it's supposed to be quite rare.
This commit is contained in:
@ -1,5 +1,8 @@
|
||||
package net.knarcraft.blacksmith.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A helper class for getting an object value as the correct type
|
||||
*/
|
||||
@ -9,6 +12,25 @@ public final class ConfigHelper {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the given value as a string list
|
||||
*
|
||||
* @param value <p>The raw string list value</p>
|
||||
* @return <p>The value as a string list</p>
|
||||
*/
|
||||
public static List<String> asStringList(Object value) {
|
||||
if (value instanceof String) {
|
||||
return List.of(((String) value).split(","));
|
||||
} else {
|
||||
List<String> strings = new ArrayList<>();
|
||||
List<?> list = (List<?>) value;
|
||||
for (Object object : list) {
|
||||
strings.add(String.valueOf(object));
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the given value as a double
|
||||
*
|
||||
|
Reference in New Issue
Block a user