forked from SteamWar/SteamWar
Remove Component Messages
This commit is contained in:
@@ -19,12 +19,12 @@
|
||||
|
||||
package de.steamwar.tntleague.game
|
||||
|
||||
import de.steamwar.kotlin.message.*
|
||||
import de.steamwar.kotlin.util.Area
|
||||
import de.steamwar.scoreboard.SWScoreboard
|
||||
import de.steamwar.sql.Fight
|
||||
import de.steamwar.sql.FightPlayer
|
||||
import de.steamwar.sql.SteamwarUser
|
||||
import de.steamwar.tntleague.colorByTeam
|
||||
import de.steamwar.tntleague.config.TNTLeagueConfig
|
||||
import de.steamwar.tntleague.config.TNTLeagueWorldConfig
|
||||
import de.steamwar.tntleague.config.world
|
||||
@@ -32,6 +32,7 @@ import de.steamwar.tntleague.events.DummyListener
|
||||
import de.steamwar.tntleague.events.IngameListener
|
||||
import de.steamwar.tntleague.events.LobbyListener
|
||||
import de.steamwar.tntleague.inventory.DealerInventory
|
||||
import de.steamwar.tntleague.message
|
||||
import de.steamwar.tntleague.plugin
|
||||
import de.steamwar.tntleague.util.*
|
||||
import net.kyori.adventure.bossbar.BossBar
|
||||
@@ -80,7 +81,7 @@ object TNTLeagueGame {
|
||||
blueTeam.start()
|
||||
redTeam.start()
|
||||
|
||||
plugin.server.broadcast(translate("gameStarted").success())
|
||||
message.broadcast("gameStarted")
|
||||
|
||||
val tnt = ItemStack(Material.TNT)
|
||||
|
||||
@@ -105,7 +106,7 @@ object TNTLeagueGame {
|
||||
}
|
||||
|
||||
if (gameTimeRemaining % 300 == 0) {
|
||||
plugin.server.broadcast(translate("timeRemaining", (gameTimeRemaining / 60).toString().yellow()).basic())
|
||||
message.broadcast("timeRemaining", (gameTimeRemaining / 60))
|
||||
plugin.server.onlinePlayers.forEach { it.playSound(Sound.sound(org.bukkit.Sound.BLOCK_NOTE_BLOCK_PLING.key, Sound.Source.MASTER, 1f, 1f)) }
|
||||
}
|
||||
}, 20, 20)
|
||||
@@ -123,7 +124,7 @@ object TNTLeagueGame {
|
||||
it.playSound(Sound.sound(org.bukkit.Sound.ENTITY_ENDER_DRAGON_DEATH.key, Sound.Source.MASTER, 1f, 1f))
|
||||
}
|
||||
|
||||
plugin.server.broadcast(translate("gameEnded").success())
|
||||
message.broadcast("gameEnded")
|
||||
|
||||
spawnerTask.cancel()
|
||||
|
||||
@@ -134,7 +135,7 @@ object TNTLeagueGame {
|
||||
plugin.server.shutdown()
|
||||
}
|
||||
|
||||
plugin.server.broadcast(translate("shutdown", shutdown.toString().yellow()).basic())
|
||||
message.broadcast("shutdown", shutdown)
|
||||
|
||||
shutdown--
|
||||
}, 20, 20)
|
||||
@@ -153,19 +154,15 @@ object TNTLeagueGame {
|
||||
state = GameState.STARTING
|
||||
|
||||
var countdown = TNTLeagueConfig.config.startDelay
|
||||
plugin.server.broadcast(translate("gameStarting", countdown.toString().yellow()).basic())
|
||||
val bar = BossBar.bossBar(translate("gameStart", countdown.toString().yellow()).gray(), (TNTLeagueConfig.config.startDelay - countdown) / TNTLeagueConfig.config.startDelay.toFloat(), BossBar.Color.GREEN, BossBar.Overlay.NOTCHED_10)
|
||||
plugin.server.onlinePlayers.forEach { bar.addViewer(it) }
|
||||
message.broadcast("gameStarting", countdown.toString())
|
||||
task = plugin.server.scheduler.scheduleSyncRepeatingTask(plugin, {
|
||||
plugin.server.onlinePlayers.forEach { it.playSound(Sound.sound(org.bukkit.Sound.ENTITY_EXPERIENCE_ORB_PICKUP.key, Sound.Source.MASTER, 1f, 1f)) }
|
||||
if (countdown-- == 0) {
|
||||
plugin.server.onlinePlayers.forEach { it.hideBossBar(bar) }
|
||||
if (--countdown == 0) {
|
||||
plugin.server.onlinePlayers.forEach { it.level = 0 }
|
||||
task = task?.also { plugin.server.scheduler.cancelTask(it) }.let { null }
|
||||
setup()
|
||||
} else {
|
||||
bar.name(translate("gameStart", countdown.toString().yellow()).gray())
|
||||
bar.progress((TNTLeagueConfig.config.startDelay - countdown) / TNTLeagueConfig.config.startDelay.toFloat())
|
||||
plugin.server.onlinePlayers.filter { !it.activeBossBars().contains(bar) }.forEach { bar.addViewer(it) }
|
||||
plugin.server.onlinePlayers.forEach { it.level = countdown }
|
||||
}
|
||||
}, 20, 20)
|
||||
|
||||
@@ -191,7 +188,6 @@ object TNTLeagueGame {
|
||||
|
||||
if (state == GameState.STARTING) {
|
||||
task = task?.also { plugin.server.scheduler.cancelTask(it) }.let { null }
|
||||
plugin.server.onlinePlayers.forEach { p -> p.activeBossBars().forEach { it.removeViewer(p) } }
|
||||
state = GameState.LOBBY
|
||||
}
|
||||
}
|
||||
@@ -199,7 +195,7 @@ object TNTLeagueGame {
|
||||
fun win(tntLeagueTeam: TNTLeagueTeam, reason: WinReason) {
|
||||
if (state != GameState.RUNNING) return
|
||||
end()
|
||||
plugin.server.broadcast(translate("teamWin", translate(tntLeagueTeam.name).color(tntLeagueTeam.color)).success())
|
||||
plugin.server.onlinePlayers.forEach { message.send("teamWin", it, message.parse(tntLeagueTeam.name, it).colorByTeam(tntLeagueTeam)) }
|
||||
statistic(tntLeagueTeam, reason)
|
||||
explode(tntLeagueTeam.opposite)
|
||||
}
|
||||
@@ -207,7 +203,7 @@ object TNTLeagueGame {
|
||||
fun draw(reason: WinReason) {
|
||||
if (state != GameState.RUNNING) return
|
||||
end()
|
||||
plugin.server.broadcast(translate("draw").success())
|
||||
message.broadcast("draw")
|
||||
statistic(null, reason)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user