From 3abddd6f848ab21690153cbafb81f8789811aaf1 Mon Sep 17 00:00:00 2001 From: pop4959 Date: Tue, 8 Jun 2021 17:50:17 -0700 Subject: [PATCH] Fix tab complete on /enchant failing on empty key (#4215) --- .../src/main/java/com/earth2me/essentials/Enchantments.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/Enchantments.java b/Essentials/src/main/java/com/earth2me/essentials/Enchantments.java index 29cf88d7b..cd6cf4b60 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/Enchantments.java +++ b/Essentials/src/main/java/com/earth2me/essentials/Enchantments.java @@ -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); }