Skip to content

Commit

Permalink
Add support for 1.21 enchantments
Browse files Browse the repository at this point in the history
  • Loading branch information
JRoy authored and mdcfe committed Jun 29, 2024
1 parent 6624e66 commit 1ea080e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Essentials/src/main/java/com/earth2me/essentials/Enchantments.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,24 @@ public final class Enchantments {
} catch (final IllegalArgumentException ignored) {
}

try { // 1.21
final Enchantment breach = Enchantment.getByName("BREACH");
if (breach != null) {
ENCHANTMENTS.put("breach", breach);
}
final Enchantment density = Enchantment.getByName("DENSITY");
if (density != null) {
ENCHANTMENTS.put("density", density);
}
final Enchantment windBurst = Enchantment.getByName("WIND_BURST");
if (breach != null) {
ENCHANTMENTS.put("windburst", windBurst);
ALIASENCHANTMENTS.put("wind", windBurst);
ALIASENCHANTMENTS.put("burst", windBurst);
}
} catch (final IllegalArgumentException ignored) {
}

try {
final Class<?> namespacedKeyClass = Class.forName("org.bukkit.NamespacedKey");
final Class<?> enchantmentClass = Class.forName("org.bukkit.enchantments.Enchantment");
Expand Down

0 comments on commit 1ea080e

Please sign in to comment.