forked from SteamWar/SteamWar
Remove Component Messages
This commit is contained in:
@@ -19,14 +19,13 @@
|
||||
|
||||
package de.steamwar.tntleague.game
|
||||
|
||||
import de.steamwar.kotlin.message.*
|
||||
import de.steamwar.tntleague.colorByTeam
|
||||
import de.steamwar.tntleague.config.TNTLeagueWorldConfig
|
||||
import de.steamwar.tntleague.config.targetedBlocks
|
||||
import de.steamwar.tntleague.message
|
||||
import de.steamwar.tntleague.plugin
|
||||
import net.kyori.adventure.sound.Sound
|
||||
import net.kyori.adventure.text.format.NamedTextColor
|
||||
import net.kyori.adventure.text.format.TextColor
|
||||
import net.kyori.adventure.text.Component
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.enchantments.Enchantment
|
||||
@@ -52,7 +51,7 @@ data class TNTLeagueTeam(val config: TNTLeagueWorldConfig.TeamConfig, private va
|
||||
val name: String
|
||||
get() = team.name.lowercase()
|
||||
|
||||
val color: TextColor
|
||||
val color: Char
|
||||
get() = team.color
|
||||
|
||||
var isReady: Boolean = false
|
||||
@@ -61,13 +60,7 @@ data class TNTLeagueTeam(val config: TNTLeagueWorldConfig.TeamConfig, private va
|
||||
leader?.inventory?.setItem(4, readyItem())
|
||||
leader?.playSound(Sound.sound(org.bukkit.Sound.BLOCK_NOTE_BLOCK_PLING.key, Sound.Source.MASTER, 1f, 1f))
|
||||
|
||||
plugin.server.onlinePlayers.forEach { it.sendActionBar(translate(if (value) "isReady" else "isNotReady", translate(this.name).colorByTeam(this)).let { cmp ->
|
||||
if (value) {
|
||||
cmp.green()
|
||||
} else {
|
||||
cmp.red()
|
||||
}
|
||||
}) }
|
||||
message.broadcastActionbar(if (value) "isReady" else "isNotReady", name.colorByTeam(this))
|
||||
|
||||
if (value && opposite.isReady) {
|
||||
TNTLeagueGame.checkStart()
|
||||
@@ -97,7 +90,7 @@ data class TNTLeagueTeam(val config: TNTLeagueWorldConfig.TeamConfig, private va
|
||||
teleport(config.spawnLocation)
|
||||
gameMode = GameMode.ADVENTURE
|
||||
inventory.clear()
|
||||
plugin.server.broadcast(translate("joinTeam", name().colorByTeam(this@TNTLeagueTeam), translate(this@TNTLeagueTeam.name).colorByTeam(this@TNTLeagueTeam)).basic())
|
||||
message.broadcast("joinTeam", name.colorByTeam(this@TNTLeagueTeam), this@TNTLeagueTeam.name.colorByTeam(this@TNTLeagueTeam))
|
||||
}
|
||||
|
||||
if (leader == null) {
|
||||
@@ -110,13 +103,13 @@ data class TNTLeagueTeam(val config: TNTLeagueWorldConfig.TeamConfig, private va
|
||||
fun readyItem() = if (isReady) {
|
||||
ItemStack.of(Material.LIME_DYE).apply {
|
||||
itemMeta = itemMeta.apply {
|
||||
displayName(translate("ready").green().translate(leader!!))
|
||||
displayName(Component.text(message.parse("ready", leader!!)))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ItemStack.of(Material.RED_DYE).apply {
|
||||
itemMeta = itemMeta.apply {
|
||||
displayName(translate("notReady").red().translate(leader!!))
|
||||
displayName(Component.text(message.parse("notReady", leader!!)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,12 +151,12 @@ data class TNTLeagueTeam(val config: TNTLeagueWorldConfig.TeamConfig, private va
|
||||
teleport(TNTLeagueWorldConfig.lobby)
|
||||
gameMode = GameMode.SPECTATOR
|
||||
inventory.clear()
|
||||
plugin.server.broadcast(translate("quitTeam", name().colorByTeam(this@TNTLeagueTeam), translate(this@TNTLeagueTeam.name).colorByTeam(this@TNTLeagueTeam)).basic())
|
||||
message.broadcast("quitTeam", name.colorByTeam(this@TNTLeagueTeam), this@TNTLeagueTeam.name.colorByTeam(this@TNTLeagueTeam))
|
||||
}
|
||||
}
|
||||
|
||||
enum class Team(val color: TextColor) {
|
||||
BLUE(NamedTextColor.BLUE),
|
||||
RED(NamedTextColor.RED);
|
||||
enum class Team(val color: Char) {
|
||||
BLUE('9'),
|
||||
RED('c');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user