mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-27 01:40:48 +08:00
Prevent exception when retrieving enchantments (#4297)
This commit is contained in:
parent
5c08a0e72c
commit
94c509b1e2
@ -282,7 +282,11 @@ public final class Enchantments {
|
||||
}
|
||||
Enchantment enchantment = null;
|
||||
if (isFlat) { // 1.13+ only
|
||||
enchantment = Enchantment.getByKey(NamespacedKey.minecraft(name.toLowerCase()));
|
||||
try {
|
||||
enchantment = Enchantment.getByKey(NamespacedKey.minecraft(name.toLowerCase()));
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
// NamespacedKey throws IAE if key does not match regex
|
||||
}
|
||||
}
|
||||
|
||||
if (enchantment == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user