25 lines
800 B
Kotlin
25 lines
800 B
Kotlin
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]
|
||
} |