mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
try fix old ee definition issue (#84)
This commit is contained in:
commit
600149c237
6 changed files with 25 additions and 7 deletions
|
|
@ -26,6 +26,9 @@ val effectiveVersion = "$version" +
|
||||||
repositories {
|
repositories {
|
||||||
// EcoEnchants
|
// EcoEnchants
|
||||||
maven(url = "https://repo.auxilor.io/repository/maven-public/")
|
maven(url = "https://repo.auxilor.io/repository/maven-public/")
|
||||||
|
|
||||||
|
// ExcellentEnchants
|
||||||
|
maven(url = "https://repo.nightexpressdev.com/releases")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
@ -46,10 +49,11 @@ dependencies {
|
||||||
compileOnly(project(":impl:LegacyEcoEnchant"))
|
compileOnly(project(":impl:LegacyEcoEnchant"))
|
||||||
|
|
||||||
// ExcellentEnchants
|
// ExcellentEnchants
|
||||||
compileOnly(files("libs/nightcore-2.7.3.jar"))
|
compileOnly("su.nightexpress.excellentenchants:Core:5.1.0") {
|
||||||
compileOnly(files("libs/ExcellentEnchants-5.0.0.jar"))
|
exclude("org.spigotmc")
|
||||||
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(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
|
// Disenchantment
|
||||||
compileOnly(files("libs/Disenchantment-6.1.5.jar"))
|
compileOnly(files("libs/Disenchantment-6.1.5.jar"))
|
||||||
|
|
|
||||||
Binary file not shown.
BIN
libs/ExcellentEnchants-4.3.3-striped.jar
Normal file
BIN
libs/ExcellentEnchants-4.3.3-striped.jar
Normal file
Binary file not shown.
Binary file not shown.
|
|
@ -7,8 +7,9 @@ import su.nightexpress.excellentenchants.api.enchantment.CustomEnchantment;
|
||||||
import su.nightexpress.excellentenchants.api.enchantment.Definition;
|
import su.nightexpress.excellentenchants.api.enchantment.Definition;
|
||||||
import xyz.alexcrea.cuanvil.enchant.AdditionalTestEnchantment;
|
import xyz.alexcrea.cuanvil.enchant.AdditionalTestEnchantment;
|
||||||
import xyz.alexcrea.cuanvil.enchant.CAEnchantment;
|
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.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
@ -18,12 +19,25 @@ public class CAEEPreV5Enchantment extends CABukkitEnchantment implements Additio
|
||||||
@NotNull Definition definition;
|
@NotNull Definition definition;
|
||||||
|
|
||||||
public CAEEPreV5Enchantment(@NotNull CustomEnchantment enchantment) {
|
public CAEEPreV5Enchantment(@NotNull CustomEnchantment enchantment) {
|
||||||
super(enchantment.getBukkitEnchantment(), EnchantmentRarity.getRarity(enchantment.getDefinition().getAnvilCost()));
|
super(enchantment.getBukkitEnchantment(), getRarity(enchantment.getBukkitEnchantment()));
|
||||||
this.eeenchantment = enchantment;
|
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
|
@Override
|
||||||
public boolean isEnchantConflict(@NotNull Map<CAEnchantment, Integer> enchantments, @NotNull Material itemMat) {
|
public boolean isEnchantConflict(@NotNull Map<CAEnchantment, Integer> enchantments, @NotNull Material itemMat) {
|
||||||
if (!definition.hasConflicts()) return false;
|
if (!definition.hasConflicts()) return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue