diff --git a/eco-core/core-nms/v1_20_R3/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_20_R3/ModernEnchantmentRegisterer.kt b/eco-core/core-nms/v1_20_R3/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_20_R3/ModernEnchantmentRegisterer.kt index 3b873845..4340fd7b 100644 --- a/eco-core/core-nms/v1_20_R3/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_20_R3/ModernEnchantmentRegisterer.kt +++ b/eco-core/core-nms/v1_20_R3/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_20_R3/ModernEnchantmentRegisterer.kt @@ -2,6 +2,7 @@ package com.willfp.ecoenchants.proxy.v1_20_R3 import com.willfp.ecoenchants.enchant.EcoEnchant import com.willfp.ecoenchants.enchant.EcoEnchants +import com.willfp.ecoenchants.enchant.impl.EcoEnchantBase import com.willfp.ecoenchants.enchant.registration.modern.ModernEnchantmentRegistererProxy import com.willfp.ecoenchants.proxy.v1_20_R3.registration.EcoEnchantsCraftEnchantment import com.willfp.ecoenchants.proxy.v1_20_R3.registration.ModifiedVanillaCraftEnchantment @@ -79,7 +80,7 @@ class ModernEnchantmentRegisterer : ModernEnchantmentRegistererProxy { unregisteredIntrusiveHoldersField.set(BuiltInRegistries.ENCHANTMENT, IdentityHashMap>()) } - override fun register(enchant: EcoEnchant): Enchantment { + override fun register(enchant: EcoEnchantBase): Enchantment { if (BuiltInRegistries.ENCHANTMENT.containsKey(CraftNamespacedKey.toMinecraft(enchant.enchantmentKey))) { val nms = BuiltInRegistries.ENCHANTMENT[CraftNamespacedKey.toMinecraft(enchant.enchantmentKey)] @@ -96,7 +97,7 @@ class ModernEnchantmentRegisterer : ModernEnchantmentRegistererProxy { } - override fun unregister(enchant: EcoEnchant) { + override fun unregister(enchant: EcoEnchantBase) { /* You can't unregister from a minecraft registry, so we simply leave the stale reference there. diff --git a/eco-core/core-nms/v1_20_R3/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_20_R3/registration/EcoEnchantsCraftEnchantment.kt b/eco-core/core-nms/v1_20_R3/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_20_R3/registration/EcoEnchantsCraftEnchantment.kt index 9f73394f..cdc9a813 100644 --- a/eco-core/core-nms/v1_20_R3/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_20_R3/registration/EcoEnchantsCraftEnchantment.kt +++ b/eco-core/core-nms/v1_20_R3/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_20_R3/registration/EcoEnchantsCraftEnchantment.kt @@ -3,6 +3,7 @@ package com.willfp.ecoenchants.proxy.v1_20_R3.registration import com.willfp.eco.util.toComponent import com.willfp.ecoenchants.display.getFormattedName import com.willfp.ecoenchants.enchant.EcoEnchant +import com.willfp.ecoenchants.enchant.impl.EcoEnchantBase import io.papermc.paper.enchantments.EnchantmentRarity import net.kyori.adventure.text.Component import net.minecraft.world.item.enchantment.Enchantment @@ -14,7 +15,7 @@ import org.bukkit.inventory.ItemStack import java.util.Objects class EcoEnchantsCraftEnchantment( - private val enchant: EcoEnchant, + private val enchant: EcoEnchantBase, nmsEnchantment: Enchantment ) : CraftEnchantment(enchant.enchantmentKey, nmsEnchantment), EcoEnchant by enchant { init { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/EcoEnchant.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/EcoEnchant.kt index 9d4cfd43..5533748b 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/EcoEnchant.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/EcoEnchant.kt @@ -13,11 +13,6 @@ interface EcoEnchant : KRegistrable, EcoEnchantLike { */ val enchantmentKey: NamespacedKey - /** - * The enchantment. - */ - override var enchantment: Enchantment - /** * If this enchantment conflicts with all other enchantments. */ diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/registration/EnchantmentRegisterer.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/registration/EnchantmentRegisterer.kt index 58d00dc3..ebe56c41 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/registration/EnchantmentRegisterer.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/registration/EnchantmentRegisterer.kt @@ -1,10 +1,10 @@ package com.willfp.ecoenchants.enchant.registration -import com.willfp.ecoenchants.enchant.EcoEnchant +import com.willfp.ecoenchants.enchant.impl.EcoEnchantBase import org.bukkit.enchantments.Enchantment interface EnchantmentRegisterer { - fun register(enchant: EcoEnchant): Enchantment + fun register(enchant: EcoEnchantBase): Enchantment - fun unregister(enchant: EcoEnchant) + fun unregister(enchant: EcoEnchantBase) } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/registration/legacy/LegacyDelegatedEnchantment.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/registration/legacy/LegacyDelegatedEnchantment.kt index aad89a1b..ff99aebb 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/registration/legacy/LegacyDelegatedEnchantment.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/registration/legacy/LegacyDelegatedEnchantment.kt @@ -3,6 +3,7 @@ package com.willfp.ecoenchants.enchant.registration.legacy import com.willfp.eco.util.StringUtils import com.willfp.ecoenchants.display.getFormattedName import com.willfp.ecoenchants.enchant.EcoEnchant +import com.willfp.ecoenchants.enchant.impl.EcoEnchantBase import com.willfp.ecoenchants.enchant.wrap import io.papermc.paper.enchantments.EnchantmentRarity import net.kyori.adventure.text.Component @@ -14,7 +15,7 @@ import org.bukkit.inventory.ItemStack @Suppress("DEPRECATION") class LegacyDelegatedEnchantment( - private val enchant: EcoEnchant + private val enchant: EcoEnchantBase ) : Enchantment(enchant.enchantmentKey), EcoEnchant by enchant { init { enchant.enchantment = this diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/registration/legacy/LegacyEnchantmentRegisterer.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/registration/legacy/LegacyEnchantmentRegisterer.kt index f1b0feea..b5a11dfa 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/registration/legacy/LegacyEnchantmentRegisterer.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/registration/legacy/LegacyEnchantmentRegisterer.kt @@ -1,6 +1,6 @@ package com.willfp.ecoenchants.enchant.registration.legacy -import com.willfp.ecoenchants.enchant.EcoEnchant +import com.willfp.ecoenchants.enchant.impl.EcoEnchantBase import com.willfp.ecoenchants.enchant.registration.EnchantmentRegisterer import org.bukkit.NamespacedKey import org.bukkit.enchantments.Enchantment @@ -36,7 +36,7 @@ object LegacyEnchantmentRegisterer : EnchantmentRegisterer { Enchantment.registerEnchantment(enchantment) } - override fun register(enchant: EcoEnchant): Enchantment { + override fun register(enchant: EcoEnchantBase): Enchantment { val enchantment = LegacyDelegatedEnchantment(enchant) Enchantment.registerEnchantment(enchantment) @@ -44,7 +44,7 @@ object LegacyEnchantmentRegisterer : EnchantmentRegisterer { return enchantment } - override fun unregister(enchant: EcoEnchant) { + override fun unregister(enchant: EcoEnchantBase) { Enchantment::class.java.getDeclaredField("byKey") .apply { isAccessible = true