From 5d5a80286b2cef902fcf31937a660eb101ca4e1a Mon Sep 17 00:00:00 2001 From: Auxilor Date: Wed, 20 Dec 2023 12:14:17 +0000 Subject: [PATCH] Fixed legacy registration --- .../registration/legacy/LegacyEnchantmentRegisterer.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 d19eeba7..cc2888b9 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 @@ -8,19 +8,17 @@ import org.bukkit.enchantments.Enchantment @Suppress("UNCHECKED_CAST") object LegacyEnchantmentRegisterer : EnchantmentRegisterer { - init { + /** + * Register an enchantment to bukkit (for replacing vanilla CraftEnchantments) + */ + fun registerToBukkit(enchantment: Enchantment) { // Allow registering new enchantments Enchantment::class.java.getDeclaredField("acceptingNew") .apply { isAccessible = true set(null, true) } - } - /** - * Register an enchantment to bukkit (for replacing vanilla CraftEnchantments) - */ - fun registerToBukkit(enchantment: Enchantment) { Enchantment::class.java.getDeclaredField("byKey") .apply { isAccessible = true