diff --git a/build.gradle.kts b/build.gradle.kts index 9d60573..3f29b82 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,6 +26,9 @@ val effectiveVersion = "$version" + repositories { // EcoEnchants maven(url = "https://repo.auxilor.io/repository/maven-public/") + + // ExcellentEnchants + maven(url = "https://repo.nightexpressdev.com/releases") } dependencies { @@ -46,10 +49,11 @@ dependencies { compileOnly(project(":impl:LegacyEcoEnchant")) // ExcellentEnchants - compileOnly(files("libs/nightcore-2.7.3.jar")) - compileOnly(files("libs/ExcellentEnchants-5.0.0.jar")) - compileOnly(files("libs/ExcellentEnchants-4.3.1.jar")) // For legacy excellent enchants (can/should be stripped) - compileOnly(files("libs/ExcellentEnchants 4.1.0-striped.jar")) // For legacy excellent enchants + compileOnly("su.nightexpress.excellentenchants:Core:5.1.0") { + exclude("org.spigotmc") + } + compileOnly(files("libs/ExcellentEnchants-4.3.3-striped.jar")) // For pre v5 excellent enchants + compileOnly(files("libs/ExcellentEnchants-4.1.0-striped.jar")) // For legacy excellent enchants // Disenchantment compileOnly(files("libs/Disenchantment-6.1.5.jar")) diff --git a/libs/ExcellentEnchants 4.1.0-striped.jar b/libs/ExcellentEnchants-4.1.0-striped.jar similarity index 100% rename from libs/ExcellentEnchants 4.1.0-striped.jar rename to libs/ExcellentEnchants-4.1.0-striped.jar diff --git a/libs/ExcellentEnchants-4.3.1.jar b/libs/ExcellentEnchants-4.3.1.jar deleted file mode 100644 index 47ea157..0000000 Binary files a/libs/ExcellentEnchants-4.3.1.jar and /dev/null differ diff --git a/libs/ExcellentEnchants-4.3.3-striped.jar b/libs/ExcellentEnchants-4.3.3-striped.jar new file mode 100644 index 0000000..ff0656b Binary files /dev/null and b/libs/ExcellentEnchants-4.3.3-striped.jar differ diff --git a/libs/ExcellentEnchants-5.0.0.jar b/libs/ExcellentEnchants-5.0.0.jar deleted file mode 100644 index cd96e5d..0000000 Binary files a/libs/ExcellentEnchants-5.0.0.jar and /dev/null differ diff --git a/src/main/java/xyz/alexcrea/cuanvil/enchant/wrapped/CAEEPreV5Enchantment.java b/src/main/java/xyz/alexcrea/cuanvil/enchant/wrapped/CAEEPreV5Enchantment.java index 1842681..d3082c9 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/enchant/wrapped/CAEEPreV5Enchantment.java +++ b/src/main/java/xyz/alexcrea/cuanvil/enchant/wrapped/CAEEPreV5Enchantment.java @@ -7,8 +7,9 @@ import su.nightexpress.excellentenchants.api.enchantment.CustomEnchantment; import su.nightexpress.excellentenchants.api.enchantment.Definition; import xyz.alexcrea.cuanvil.enchant.AdditionalTestEnchantment; import xyz.alexcrea.cuanvil.enchant.CAEnchantment; -import xyz.alexcrea.cuanvil.enchant.EnchantmentRarity; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.Map; import java.util.Set; @@ -18,12 +19,25 @@ public class CAEEPreV5Enchantment extends CABukkitEnchantment implements Additio @NotNull Definition definition; public CAEEPreV5Enchantment(@NotNull CustomEnchantment enchantment) { - super(enchantment.getBukkitEnchantment(), EnchantmentRarity.getRarity(enchantment.getDefinition().getAnvilCost())); + super(enchantment.getBukkitEnchantment(), getRarity(enchantment.getBukkitEnchantment())); this.eeenchantment = enchantment; - this.definition = (Definition) enchantment.getDefinition(); + try { + this.definition = (Definition) getDefinition.invoke(enchantment); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } } + private final static Method getDefinition; + static { + try { + getDefinition = CustomEnchantment.class.getMethod("getDefinition"); + } catch (NoSuchMethodException e) { + throw new RuntimeException(e); + } + } + @Override public boolean isEnchantConflict(@NotNull Map enchantments, @NotNull Material itemMat) { if (!definition.hasConflicts()) return false;