mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-01-05 23:08:23 +00:00
Prevent exception when retrieving enchantments (#4297)
This commit is contained in:
parent
5c08a0e72c
commit
94c509b1e2
1 changed files with 5 additions and 1 deletions
|
@ -282,7 +282,11 @@ public final class Enchantments {
|
||||||
}
|
}
|
||||||
Enchantment enchantment = null;
|
Enchantment enchantment = null;
|
||||||
if (isFlat) { // 1.13+ only
|
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) {
|
if (enchantment == null) {
|
||||||
|
|
Loading…
Reference in a new issue