Workaround for 1.20.6

This commit is contained in:
Will FP 2024-05-11 16:45:21 +01:00
parent 8adad9a935
commit 7dfff80be9

View File

@ -40,6 +40,7 @@ import com.willfp.libreforge.loader.configs.ConfigCategory
import com.willfp.libreforge.registerHolderPlaceholderProvider
import com.willfp.libreforge.registerHolderProvider
import com.willfp.libreforge.registerSpecificRefreshFunction
import org.bukkit.Bukkit
import org.bukkit.entity.LivingEntity
import org.bukkit.event.Listener
@ -66,13 +67,6 @@ class EcoEnchantsPlugin : LibreforgePlugin() {
if (Prerequisite.HAS_1_20_3.isMet) {
plugin.getProxy(ModernEnchantmentRegistererProxy::class.java).replaceRegistry()
}
if (Prerequisite.HAS_1_20_5.isMet) {
if (!this.configYml.getBool("enable-1-20-6")) {
throw IllegalStateException("EcoEnchants should not be ran in production on 1.20.6. " +
"If this is a development environment, please set 'enable-1-20-6' to true in config.yml. ")
}
}
}
override fun loadConfigCategories(): List<ConfigCategory> {
@ -101,6 +95,16 @@ class EcoEnchantsPlugin : LibreforgePlugin() {
override fun handleAfterLoad() {
isLoaded = true
// Run in afterLoad to prevent items from having their enchantments deleted
if (Prerequisite.HAS_1_20_5.isMet) {
if (!this.configYml.getBool("enable-1-20-6")) {
Bukkit.getPluginManager().disablePlugin(this)
throw IllegalStateException("EcoEnchants should not be ran in production on 1.20.6. " +
"If this is a development environment, please set 'enable-1-20-6' to true in config.yml. ")
}
}
}
override fun handleReload() {