From 722680aae007852b4afaba4dc5dc71ef37d26040 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Tue, 25 Apr 2023 16:06:32 +0100 Subject: [PATCH] libreforge-updater --- .../kotlin/com/willfp/ecoenchants/EcoEnchantsPlugin.kt | 9 +++++++++ .../kotlin/com/willfp/ecoenchants/enchants/EcoEnchant.kt | 8 -------- .../com/willfp/ecoenchants/enchants/EcoEnchantLevel.kt | 2 +- gradle.properties | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) 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 7e68c0d7..f7a4c50c 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 @@ -10,6 +10,7 @@ import com.willfp.ecoenchants.config.TargetsYml import com.willfp.ecoenchants.config.TypesYml import com.willfp.ecoenchants.config.VanillaEnchantsYml import com.willfp.ecoenchants.display.EnchantDisplay +import com.willfp.ecoenchants.enchants.EcoEnchantLevel import com.willfp.ecoenchants.enchants.EcoEnchants import com.willfp.ecoenchants.enchants.LoreConversion import com.willfp.ecoenchants.enchants.registerVanillaEnchants @@ -23,8 +24,10 @@ import com.willfp.ecoenchants.mechanics.LootSupport import com.willfp.ecoenchants.mechanics.VillagerSupport import com.willfp.ecoenchants.target.EnchantLookup.clearEnchantCache import com.willfp.ecoenchants.target.EnchantLookup.heldEnchantLevels +import com.willfp.libreforge.NamedValue import com.willfp.libreforge.loader.LibreforgePlugin import com.willfp.libreforge.loader.configs.ConfigCategory +import com.willfp.libreforge.registerHolderPlaceholderProvider import com.willfp.libreforge.registerHolderProvider import com.willfp.libreforge.registerPlayerRefreshFunction import org.bukkit.event.Listener @@ -50,6 +53,12 @@ class EcoEnchantsPlugin : LibreforgePlugin() { override fun handleEnable() { registerHolderProvider { it.heldEnchantLevels } registerPlayerRefreshFunction { it.clearEnchantCache() } + registerHolderPlaceholderProvider { (holder, _) -> + when (holder) { + is EcoEnchantLevel -> listOf(NamedValue("level", holder.level)) + else -> emptyList() + } + } } override fun handleAfterLoad() { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchant.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchant.kt index 0937a994..0a8aba33 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchant.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchant.kt @@ -121,14 +121,6 @@ abstract class EcoEnchant( init { checkDependencies() - config.injectPlaceholders( - PlayerStaticPlaceholder( - "level" - ) { p -> - p.getEnchantLevel(this).toString() - } - ) - conditions = Conditions.compile( config.getSubsections("conditions"), if (plugin.isLoaded) ViolationContext(plugin, "Enchantment $id") 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 d15ba4a7..0db4f413 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 @@ -8,7 +8,7 @@ import java.util.Objects class EcoEnchantLevel( parent: EcoEnchant, - level: Int, + val level: Int, override val effects: EffectList, override val conditions: ConditionList, plugin: EcoPlugin diff --git a/gradle.properties b/gradle.properties index 0ba16fee..82975c6b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ #libreforge-updater -#Tue Apr 25 13:13:32 BST 2023 +#Tue Apr 25 16:06:32 BST 2023 kotlin.code.style=official -libreforge-version=4.5.0 -version=10.5.0 +libreforge-version=4.6.0 +version=10.6.0