From 728e89257ce4d908bced373f54027803e8a59a98 Mon Sep 17 00:00:00 2001 From: Sid Shakal Date: Fri, 18 Mar 2016 12:00:20 -0500 Subject: [PATCH] Wrap 1.9 enchant defs in if statements for 1.8 compatibility This takes care of the NoSuchField errors on initialization of EnchantmentUtils with 1.8 versions of Bukkit. --- .../java/com/gmail/nossr50/util/EnchantmentUtils.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/util/EnchantmentUtils.java b/src/main/java/com/gmail/nossr50/util/EnchantmentUtils.java index b780e6551..f48ee4285 100644 --- a/src/main/java/com/gmail/nossr50/util/EnchantmentUtils.java +++ b/src/main/java/com/gmail/nossr50/util/EnchantmentUtils.java @@ -31,9 +31,13 @@ public class EnchantmentUtils { enchants.put("FLAME", Enchantment.ARROW_FIRE); enchants.put("KNOCKBACK", Enchantment.KNOCKBACK); enchants.put("THORNS", Enchantment.THORNS); - enchants.put("MENDING", Enchantment.MENDING); + if (Enchantment.getByName("MENDING") != null) { + enchants.put("MENDING", Enchantment.MENDING); + } enchants.put("DEPTH_STRIDER", Enchantment.DEPTH_STRIDER); - enchants.put("FROST_WALKER", Enchantment.FROST_WALKER); + if (Enchantment.getByName("FROST_WALKER") != null) { + enchants.put("FROST_WALKER", Enchantment.FROST_WALKER); + } } /**