diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/EcoEnchantsPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/EcoEnchantsPlugin.kt index fe2edcb9..a0e258ec 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/EcoEnchantsPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/EcoEnchantsPlugin.kt @@ -16,6 +16,7 @@ import com.willfp.ecoenchants.display.EnchantSorter import com.willfp.ecoenchants.enchants.EcoEnchantLevel import com.willfp.ecoenchants.enchants.EcoEnchants import com.willfp.ecoenchants.enchants.EnchantGUI +import com.willfp.ecoenchants.enchants.FoundEcoEnchantLevel import com.willfp.ecoenchants.enchants.LoreConversion import com.willfp.ecoenchants.enchants.registerVanillaEnchants import com.willfp.ecoenchants.integrations.EnchantRegistrations @@ -62,10 +63,10 @@ class EcoEnchantsPlugin : LibreforgePlugin() { override fun handleEnable() { registerHolderProvider { it.heldEnchantLevels } registerPlayerRefreshFunction { it.clearEnchantCache() } - registerHolderPlaceholderProvider { it, player -> + registerHolderPlaceholderProvider { it, _ -> listOf( NamedValue("level", it.level), - //NamedValue("active_level", player.getActiveEnchantLevel(it.enchant)) + NamedValue("active_level", it.activeLevel) ) } } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchantLevel.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchantLevel.kt index f7812ed4..6daa0d3c 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchantLevel.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchantLevel.kt @@ -31,3 +31,12 @@ class EcoEnchantLevel( return Objects.hash(this.id) } } + +data class FoundEcoEnchantLevel( + val level: EcoEnchantLevel, + val activeLevel: Int +): Holder { + override val effects = level.effects + override val conditions = level.conditions + override val id = level.id +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantLookup.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantLookup.kt index 059c46e3..632597a0 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantLookup.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantLookup.kt @@ -5,6 +5,7 @@ import com.willfp.eco.core.fast.fast import com.willfp.eco.core.items.HashedItem import com.willfp.ecoenchants.enchants.EcoEnchant import com.willfp.ecoenchants.enchants.EcoEnchantLevel +import com.willfp.ecoenchants.enchants.FoundEcoEnchantLevel import com.willfp.ecoenchants.target.EnchantLookup.getEnchantLevel import com.willfp.libreforge.ItemProvidedHolder import com.willfp.libreforge.ProvidedHolder @@ -304,7 +305,14 @@ object EnchantLookup { } } - return found + return found.map { + val level = it.holder as EcoEnchantLevel + + ItemProvidedHolder( + FoundEcoEnchantLevel(level, this.getActiveEnchantLevel(level.enchant)), + it.provider + ) + } } /**