Fix tab complete on /enchant failing on empty key (#4215)

This commit is contained in:
pop4959 2021-06-08 17:50:17 -07:00 committed by GitHub
parent 8e712bc827
commit 3abddd6f84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -277,6 +277,9 @@ public final class Enchantments {
}
public static Enchantment getByName(final String name) {
if (name == null || name.isEmpty()) {
return null;
}
Enchantment enchantment = null;
if (isFlat) { // 1.13+ only
enchantment = Enchantment.getByKey(NamespacedKey.minecraft(name.toLowerCase()));
@ -287,7 +290,7 @@ public final class Enchantments {
}
if (enchantment == null) {
enchantment = Enchantment.getByName(name.toLowerCase());
}
}
if (enchantment == null) {
enchantment = Enchantment.getByName(name);
}