Fixes several bugs and problems

Fixes getting the name of enchantments
Fixes inconsistencies in material and enchantment name-checking
Allows using "null" or "-1" to unset per-material or per-enchantment configuration options
Fixes a bug where basePrice was set to a material name instead of the price for the material being displayed
Adds missing tab-completion for material/enchantment costs
Prevents inconsistencies in deciding if a value is null
This commit is contained in:
2022-10-24 13:57:58 +02:00
parent 39e164c9c8
commit cc7d66f270
8 changed files with 102 additions and 35 deletions

View File

@ -13,6 +13,17 @@ public final class InputParsingHelper {
}
/**
* Gets whether the input is an "empty" value treated as null
*
* @param input <p>The input to check</p>
* @return <p>True if the value is empty</p>
*/
public static boolean isEmpty(String input) {
return input == null || input.equalsIgnoreCase("null") || input.equals("\"\"") ||
input.trim().isEmpty() || input.equals("-1");
}
/**
* Tries to find the material matching the given input string
*

View File

@ -62,7 +62,7 @@ public final class TabCompleteValuesHelper {
private static List<String> getAllEnchantments() {
List<String> enchantments = new ArrayList<>();
for (Enchantment enchantment : Enchantment.values()) {
enchantments.add(enchantment.toString());
enchantments.add(enchantment.getKey().getKey());
}
return enchantments;
}