Skip to content

Commit

Permalink
修复配置文件中错误的不加载单独世界配置项的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
4o4E committed Jun 30, 2022
1 parent f53b61d commit 30af84f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/kotlin/config/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ import top.e404.eplugin.EPlugin.Companion.color
import top.e404.eplugin.EPlugin.Companion.formatAsConst
import top.e404.eplugin.EPlugin.Companion.placeholder
import top.e404.eplugin.config.EConfig
import top.e404.eplugin.util.*
import top.e404.eplugin.config.JarConfig
import top.e404.eplugin.util.SoundConfig
import top.e404.eplugin.util.forEachOp
import top.e404.eplugin.util.getBooleanOrNull
import top.e404.eplugin.util.getSoundConfig
import java.text.SimpleDateFormat
import java.util.*

object Config : EConfig(
plugin = PL,
path = "config.yml",
default = Companion.JarConfig(PL, "config.yml")
default = JarConfig(PL, "config.yml")
) {
var debug = false
var update = true
Expand All @@ -37,13 +41,15 @@ object Config : EConfig(
debug = getBoolean("debug")
update = getBoolean("update", true)
global = getWorldConfig("global")!!
each = getConfigurationSection("each")
?.getKeys(false)
val eachCfg = getConfigurationSection("each")
each = eachCfg?.getKeys(false)
?.mapNotNull { world ->
val worldConfig = getWorldConfig(world)
val worldConfig = eachCfg.getWorldConfig(world)
?: return@mapNotNull null
world to worldConfig
}?.toMap() ?: emptyMap()
}
?.toMap()
?: emptyMap()
stickName = getString("stick.name")?.color() ?: "stick.name"
stickLore = getStringList("stick.lore").map { it.color() }
}
Expand Down

0 comments on commit 30af84f

Please sign in to comment.