Check that enchantment names are spelled correctly, fixes #566

This commit is contained in:
BuildTools 2018-12-09 16:26:26 -05:00
parent 039ed174fb
commit 7d72d9129c

View File

@ -168,7 +168,11 @@ public class ItemUtil {
} else if (arg.startsWith("enchantment-")) {
String[] temp = arg.substring(12).split(" ");
try {
enchs.put(Quests.getEnchantment(temp[0]), Integer.parseInt(temp[1]));
if (Quests.getEnchantment(temp[0]) != null) {
enchs.put(Quests.getEnchantment(temp[0]), Integer.parseInt(temp[1]));
} else {
Bukkit.getLogger().severe("The enchantment name \'" + temp[0] + "\' is invalid. Make sure it is spelled correctly");
}
} catch (IllegalArgumentException e) {
Bukkit.getLogger().severe("The enchantment name \'" + temp[0] + "\' is invalid. Make sure quests.yml is UTF-8 encoded");
return null;