From 0a4dde0a30887e8f9fa9735cfb4fd3a6f5587f7e Mon Sep 17 00:00:00 2001 From: Auxilor Date: Mon, 26 Sep 2022 18:32:43 +0100 Subject: [PATCH] Load order bug --- .../willfp/ecoenchants/EcoEnchantsPlugin.kt | 8 ------- .../ecoenchants/enchants/EcoEnchants.kt | 21 ++++++++++++++++++- 2 files changed, 20 insertions(+), 9 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 022116df..817edbe6 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 @@ -49,14 +49,6 @@ class EcoEnchantsPlugin : LibReforgePlugin() { } override fun handleReloadAdditional() { - // Load hardcoded enchantments - EnchantmentTelekinesis(this) - EnchantmentPermanenceCurse(this) - EnchantmentRepairing(this) - EnchantmentRapid(this) - EnchantmentReplenish(this) - EnchantmentSoulbound(this) - registerVanillaEnchants(this) logger.info(EcoEnchants.values().size.toString() + " Enchants Loaded") diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchants.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchants.kt index 0d6a983e..b9469e9b 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchants.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchants.kt @@ -4,6 +4,12 @@ import com.google.common.collect.HashBiMap import com.google.common.collect.ImmutableSet import com.willfp.eco.core.config.updating.ConfigUpdater import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.enchants.impl.EnchantmentPermanenceCurse +import com.willfp.ecoenchants.enchants.impl.EnchantmentRapid +import com.willfp.ecoenchants.enchants.impl.EnchantmentRepairing +import com.willfp.ecoenchants.enchants.impl.EnchantmentReplenish +import com.willfp.ecoenchants.enchants.impl.EnchantmentSoulbound +import com.willfp.ecoenchants.enchants.impl.EnchantmentTelekinesis import com.willfp.ecoenchants.integrations.EnchantRegistrations import com.willfp.ecoenchants.rarity.EnchantmentRarities import com.willfp.ecoenchants.target.EnchantmentTargets @@ -97,6 +103,8 @@ object EcoEnchants { LibReforgeEcoEnchant(id, config, plugin) } } + + registerHardcodedEnchantments(plugin) } /** @@ -129,7 +137,8 @@ object EcoEnchants { /** * Add new [EcoEnchant] to EcoEnchants. * - * Only for internal use, enchants are automatically added in the constructor. + * Only for internal use, enchants are automatically added in the + * constructor. * * @param enchant The [EcoEnchant] to add. */ @@ -159,4 +168,14 @@ object EcoEnchants { Enchantment.registerEnchantment(enchantment) EnchantRegistrations.registerEnchantments() } + + /** Register the hardcoded enchantments. */ + private fun registerHardcodedEnchantments(plugin: EcoEnchantsPlugin) { + EnchantmentTelekinesis(plugin) + EnchantmentPermanenceCurse(plugin) + EnchantmentRepairing(plugin) + EnchantmentRapid(plugin) + EnchantmentReplenish(plugin) + EnchantmentSoulbound(plugin) + } }