diff --git a/src/main/kotlin/cc/maxmc/blastingcrisis/game/Game.kt b/src/main/kotlin/cc/maxmc/blastingcrisis/game/Game.kt index c91c02b..f48ed5b 100644 --- a/src/main/kotlin/cc/maxmc/blastingcrisis/game/Game.kt +++ b/src/main/kotlin/cc/maxmc/blastingcrisis/game/Game.kt @@ -1,6 +1,7 @@ package cc.maxmc.blastingcrisis.game import cc.maxmc.blastingcrisis.map.GameMap +import cc.maxmc.blastingcrisis.misc.BlockGenManager import cc.maxmc.blastingcrisis.misc.debug import org.bukkit.Material import org.bukkit.entity.Player @@ -16,6 +17,7 @@ class Game( val timer: GameTimer = GameTimer(this) val players = ArrayList() val placeBreakRule = GamePlaceBreakRule(this) + val generator = BlockGenManager.getGenerator(map.blockGen) var state: GameState = GameState.WAITING private fun autoJoinTeam() { @@ -82,6 +84,12 @@ class Game( } } + private fun startOreGen() { + map.teams.forEach { + + } + } + fun checkEnd() { if (teams.filter { it.teamSurvive }.size > 1) { return diff --git a/src/main/kotlin/cc/maxmc/blastingcrisis/map/GameMap.kt b/src/main/kotlin/cc/maxmc/blastingcrisis/map/GameMap.kt index 0c68dd6..1b0c204 100644 --- a/src/main/kotlin/cc/maxmc/blastingcrisis/map/GameMap.kt +++ b/src/main/kotlin/cc/maxmc/blastingcrisis/map/GameMap.kt @@ -7,7 +7,8 @@ class GameMap( val area: Area, val wall: Area, val teams: List, - val maxPlayersPerTeam: Int + val maxPlayersPerTeam: Int, + val blockGen: String ) { val maxPlayer: Int get() = maxPlayersPerTeam * teams.size diff --git a/src/main/kotlin/cc/maxmc/blastingcrisis/misc/BlockGenManager.kt b/src/main/kotlin/cc/maxmc/blastingcrisis/misc/BlockGenManager.kt new file mode 100644 index 0000000..c22c098 --- /dev/null +++ b/src/main/kotlin/cc/maxmc/blastingcrisis/misc/BlockGenManager.kt @@ -0,0 +1,25 @@ +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() + + 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] +} \ No newline at end of file