sync
This commit is contained in:
parent
9f5f657ea1
commit
31e52382b2
|
|
@ -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<Player>()
|
||||
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
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ class GameMap(
|
|||
val area: Area,
|
||||
val wall: Area,
|
||||
val teams: List<MapTeam>,
|
||||
val maxPlayersPerTeam: Int
|
||||
val maxPlayersPerTeam: Int,
|
||||
val blockGen: String
|
||||
) {
|
||||
val maxPlayer: Int
|
||||
get() = maxPlayersPerTeam * teams.size
|
||||
|
|
|
|||
|
|
@ -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<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]
|
||||
}
|
||||
Loading…
Reference in New Issue