More preload fixes

This commit is contained in:
Will FP 2024-01-14 15:48:25 +00:00
parent a98bfa5afe
commit 0959d55d85
3 changed files with 10 additions and 6 deletions

View File

@ -23,7 +23,10 @@ class EcoEnchantsCraftEnchantment(
}
override fun onRegister() {
enchant.onRegister()
// Fix for hardcoded enchantments
if (plugin.isLoaded) {
enchant.onRegister()
}
}
override fun onRemove() {

View File

@ -1,10 +1,7 @@
package com.willfp.ecoenchants.enchant.impl
import com.willfp.eco.core.config.interfaces.Config
import com.willfp.eco.core.fast.fast
import com.willfp.eco.core.placeholder.PlayerlessPlaceholder
import com.willfp.eco.core.placeholder.context.PlaceholderContext
import com.willfp.eco.core.placeholder.templates.SimpleInjectablePlaceholder
import com.willfp.eco.util.containsIgnoreCase
import com.willfp.ecoenchants.EcoEnchantsPlugin
import com.willfp.ecoenchants.display.getFormattedName
@ -15,6 +12,7 @@ import com.willfp.ecoenchants.rarity.EnchantmentRarity
import com.willfp.ecoenchants.target.EnchantmentTargets
import com.willfp.ecoenchants.type.EnchantmentType
import com.willfp.ecoenchants.type.EnchantmentTypes
import com.willfp.libreforge.SilentViolationContext
import com.willfp.libreforge.ViolationContext
import com.willfp.libreforge.conditions.Conditions
import org.bukkit.Bukkit
@ -68,7 +66,7 @@ abstract class EcoEnchantBase(
override val conditions = Conditions.compile(
config.getSubsections("conditions"),
context.with("conditions")
if (plugin.isLoaded) context.with("conditions") else SilentViolationContext
)
override val isObtainableThroughEnchanting = config.getBool("enchantable")

View File

@ -22,7 +22,10 @@ class LegacyDelegatedEnchantment(
}
override fun onRegister() {
enchant.onRegister()
// Fix for hardcoded enchantments
if (plugin.isLoaded) {
enchant.onRegister()
}
}
override fun onRemove() {