mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-21 14:55:17 +01:00
Fixed preloading
This commit is contained in:
parent
fb6a98faee
commit
e8dfce7a00
@ -24,6 +24,8 @@ import org.bukkit.ChatColor
|
||||
object EcoEnchants : RegistrableCategory<EcoEnchant>("enchant", "enchants") {
|
||||
private val BY_NAME = HashBiMap.create<String, EcoEnchant>()
|
||||
|
||||
override val shouldPreload = true
|
||||
|
||||
override fun clear(plugin: LibreforgePlugin) {
|
||||
plugin as EcoEnchantsPlugin
|
||||
|
||||
@ -56,6 +58,26 @@ object EcoEnchants : RegistrableCategory<EcoEnchant>("enchant", "enchants") {
|
||||
registerHardcodedEnchantments(plugin)
|
||||
}
|
||||
|
||||
override fun acceptPreloadConfig(plugin: LibreforgePlugin, id: String, config: Config) {
|
||||
plugin as EcoEnchantsPlugin
|
||||
|
||||
if (!config.has("effects")) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
val enchant = LibreforgeEcoEnchant(
|
||||
id,
|
||||
config,
|
||||
plugin
|
||||
)
|
||||
|
||||
doRegister(plugin, enchant)
|
||||
} catch (e: MissingDependencyException) {
|
||||
// Ignore missing dependencies for preloaded enchants
|
||||
}
|
||||
}
|
||||
|
||||
override fun acceptConfig(plugin: LibreforgePlugin, id: String, config: Config) {
|
||||
plugin as EcoEnchantsPlugin
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user