fix eco enchant issue

This commit is contained in:
alexcrea 2026-08-12 07:17:36 +02:00
parent 58c9fa129a
commit d18ee56ff1
Signed by: alexcrea
GPG key ID: E59DF23EE2A2266C
2 changed files with 7 additions and 7 deletions

View file

@ -69,10 +69,10 @@ dependencies {
compileOnly(files("libs/EnchantsSquared.jar")) compileOnly(files("libs/EnchantsSquared.jar"))
// EcoEnchants & item // EcoEnchants & item
compileOnly("com.willfp:libreforge:4.79.0:all") compileOnly("com.willfp:libreforge:2026.32:all")
compileOnly("com.willfp:eco:6.74.5") compileOnly("com.willfp:eco:2026.32")
compileOnly("com.willfp:EcoEnchants:12.11.1") compileOnly("com.willfp:EcoEnchants:2026.32:all")
compileOnly(project(":impl:LegacyEcoEnchant")) compileOnly(project(":impl:LegacyEcoEnchant"))
compileOnly("com.willfp:EcoItems:5.66.0") compileOnly("com.willfp:EcoItems:5.66.0")

View file

@ -3,7 +3,7 @@ package xyz.alexcrea.cuanvil.dependency.plugins
import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.EcoPlugin
import com.willfp.ecoenchants.enchant.EcoEnchant import com.willfp.ecoenchants.enchant.EcoEnchant
import com.willfp.ecoenchants.enchant.EcoEnchants import com.willfp.ecoenchants.enchant.EcoEnchants
import com.willfp.ecoenchants.mechanics.infiniteIfNegative import com.willfp.ecoenchants.enchant.UtilKt
import io.delilaheve.CustomAnvil import io.delilaheve.CustomAnvil
import org.bukkit.event.inventory.PrepareAnvilEvent import org.bukkit.event.inventory.PrepareAnvilEvent
import org.bukkit.plugin.Plugin import org.bukkit.plugin.Plugin
@ -35,7 +35,7 @@ class EcoEnchantDependency(private val ecoEnchantPlugin: Plugin) {
} }
public fun getEcoLevelLimit(): Int { public fun getEcoLevelLimit(): Int {
return (ecoEnchantPlugin as EcoPlugin).configYml.getInt("anvil.enchant-limit").infiniteIfNegative() return UtilKt.infiniteIfNegative((ecoEnchantPlugin as EcoPlugin).configYml.getInt("anvil.enchant-limit"))
} }
fun disableAnvilListener() { fun disableAnvilListener() {
@ -51,7 +51,7 @@ class EcoEnchantDependency(private val ecoEnchantPlugin: Plugin) {
return return
} }
val enchantments = EcoEnchants.values() val enchantments = EcoEnchants.INSTANCE.values()
for (ecoEnchant in enchantments) { for (ecoEnchant in enchantments) {
EnchantmentApi.unregisterEnchantment(ecoEnchant.enchantment) // As eco enchants is loaded before custom anvil and register enchantment to registry, we need to unregister old "vanilla" enchant. EnchantmentApi.unregisterEnchantment(ecoEnchant.enchantment) // As eco enchants is loaded before custom anvil and register enchantment to registry, we need to unregister old "vanilla" enchant.
EnchantmentApi.registerEnchantment(CAEcoEnchant(ecoEnchant)) EnchantmentApi.registerEnchantment(CAEcoEnchant(ecoEnchant))
@ -71,7 +71,7 @@ class EcoEnchantDependency(private val ecoEnchantPlugin: Plugin) {
// Should not happen in known case. // Should not happen in known case.
if (this.ecoEnchantOldEnchantments == null) return if (this.ecoEnchantOldEnchantments == null) return
val newEnchantments = EcoEnchants.values() val newEnchantments = EcoEnchants.INSTANCE.values()
// Add new enchantments // Add new enchantments
for (ecoEnchant in newEnchantments) for (ecoEnchant in newEnchantments)