BlastingCrisis/src/main/kotlin/cc/maxmc/blastingcrisis/misc/BlockGenManager.kt

25 lines
800 B
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package cc.maxmc.blastingcrisis.misc
import cc.maxmc.blastingcrisis.game.GameOreGenerator
import taboolib.common.platform.function.getDataFolder
import taboolib.module.configuration.Configuration
object BlockGenManager {
private val generators = HashMap<String, GameOreGenerator>()
init {
load()
}
private fun load() {
getDataFolder().resolve("ore-generators").listFiles()!!.forEach {
try {
generators[it.nameWithoutExtension] = GameOreGenerator(Configuration.loadFromFile(it))
} catch (e: Exception) {
info("§c| §7加载矿石生成器 §c${it.nameWithoutExtension} §7时出现错误已跳过.")
}
}
}
fun getGenerator(name: String): GameOreGenerator? = generators[name]
}