sync code

This commit is contained in:
TONY_All 2022-10-22 01:01:05 +08:00
parent 7b7849194c
commit 94295d7f44
9 changed files with 105 additions and 4 deletions

View File

@ -10,6 +10,7 @@ version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
mavenLocal()
maven("https://repo.maxmc.cn/repository/maven-snapshots/") {
name = "maxmc"
credentials(PasswordCredentials::class.java)
@ -20,6 +21,8 @@ repositories {
dependencies {
implementation(kotlin("stdlib"))
implementation("ink.ptms.core:v10800:10800")
implementation("ink.ptms.core:v11200:11200")
implementation("ink.ptms:Adyeshach:1.5.12")
}
taboolib {

View File

@ -0,0 +1,18 @@
package cc.maxmc.blastingcrisis.command
import org.bukkit.Bukkit
import org.bukkit.Location
import org.bukkit.entity.Blaze
import org.bukkit.entity.EntityType
import taboolib.common.platform.command.command
object DebugCommand {
fun debug(cmd: String) = command(cmd) {
literal("game") {
}
literal("scoreboard") {
}
}
}

View File

@ -1,5 +1,14 @@
package cc.maxmc.blastingcrisis.game
class Game {
import cc.maxmc.blastingcrisis.map.GameMap
import org.bukkit.entity.Player
class Game(val map: GameMap, val teams: List<GameTeam>, val state: GameState, scoreboard: GameScoreboard) {
val players: List<Player>
get() {
val all = ArrayList<Player>()
teams.map { it.players }.forEach { all.addAll(it) }
return all
}
}

View File

@ -0,0 +1,36 @@
package cc.maxmc.blastingcrisis.game
import cc.maxmc.blastingcrisis.game.GameState.*
import org.bukkit.entity.Player
import taboolib.module.nms.sendScoreboard
import taboolib.platform.util.asLangText
class GameScoreboard(val game: Game) {
fun sendScoreboard() {
game.teams.forEach { g ->
g.players.forEach {
sendScoreboardPlayer(it)
}
}
}
fun sendScoreboardPlayer(player: Player) {
val scoreboardText = when (game.state) {
WAITING -> {
player.asLangText("scoreboard_waiting", game.players.size, game.map.maxPlayer)
}
COUNTING_DOWN -> {
player.asLangText("scoreboard_counting_down", game.players.size, game.map.maxPlayer)
}
START -> TODO()
WALL_FALL -> TODO()
FINISH -> TODO()
}
player.sendScoreboard(*scoreboardText.lines().toTypedArray())
}
}

View File

@ -0,0 +1,9 @@
package cc.maxmc.blastingcrisis.game
enum class GameState {
WAITING,
COUNTING_DOWN,
START,
WALL_FALL,
FINISH;
}

View File

@ -1,4 +1,8 @@
package cc.maxmc.blastingcrisis.game
class GameTeam {
import cc.maxmc.blastingcrisis.map.MapTeam
import org.bukkit.entity.Player
class GameTeam(val team: MapTeam, val players: List<Player>) {
}

View File

@ -0,0 +1,13 @@
package cc.maxmc.blastingcrisis.game
class GameTimer(val game: Game) {
val time2Start = 2
fun beginCountdown() {
}
fun startTimer() {
}
}

View File

@ -1,5 +1,6 @@
package cc.maxmc.blastingcrisis.map
class GameMap(val name: String,) {
class GameMap(val name: String, val teams: List<MapTeam>, val maxPlayersPerTeam: Int) {
val maxPlayer: Int
get() = maxPlayersPerTeam * teams.size
}

View File

@ -0,0 +1,8 @@
scoreboard_waiting: |-
§6Blasting§7Crisis
§a| §7当前玩家: §a{0}/{1}
§a| §7等待中...
§aplay.maxmc.cc