A lot of tests, and some improvements
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good
Adds a lot more tests for some utility classes Adds a new option to disable the hard-coded limitation "EnchantmentTarget.BREAKABLE" which can be useful for servers with custom items or similar. Makes enchantment name matching case-insensitive. Prevents an exception is enchantment name contains invalid characters. Makes invalid objects supplied to asStringList return null instead of throwing an exception. Uses isBlank instead of trim.isEmpty in the isEmpty method Re-uses the random generator if calculating salvage several times
This commit is contained in:
@ -16,18 +16,19 @@ 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>
|
||||
* @return <p>The value as a string list, or null if not compatible</p>
|
||||
*/
|
||||
public static List<String> asStringList(Object value) {
|
||||
if (value instanceof String) {
|
||||
return List.of(((String) value).split(","));
|
||||
} else {
|
||||
} else if (value instanceof List<?> list) {
|
||||
List<String> strings = new ArrayList<>();
|
||||
List<?> list = (List<?>) value;
|
||||
for (Object object : list) {
|
||||
strings.add(String.valueOf(object));
|
||||
}
|
||||
return strings;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user