Fixes, changes and Refactors

This commit is contained in:
2024-11-17 12:04:07 +01:00
parent 78853c70f8
commit 4bb1bc0cbd
13 changed files with 85 additions and 51 deletions
@@ -20,13 +20,19 @@
package de.steamwar.tntleague
import de.steamwar.kotlin.message.ComponentMessage
import de.steamwar.kotlin.message.StyleConfig
import de.steamwar.kotlin.message.darkGray
import de.steamwar.kotlin.message.gray
import de.steamwar.tntleague.command.AcceptCommand
import de.steamwar.tntleague.command.InviteCommand
import de.steamwar.tntleague.command.LeaveCommand
import de.steamwar.tntleague.command.RemoveCommand
import de.steamwar.tntleague.events.GlobalListener
import de.steamwar.tntleague.events.LobbyListener
import de.steamwar.tntleague.game.TNTLeagueTeam
import net.kyori.adventure.key.Key
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.format.NamedTextColor
import net.kyori.adventure.translation.GlobalTranslator
import net.kyori.adventure.translation.TranslationRegistry
import net.kyori.adventure.util.UTF8ResourceBundleControl
@@ -36,9 +42,14 @@ import java.util.*
lateinit var plugin: TNTLeague
lateinit var message: ComponentMessage
val tntLeaguePrefix = Component.text("TNT").color(NamedTextColor.DARK_RED)
.append(Component.text("League").color(NamedTextColor.GOLD))
class TNTLeague : JavaPlugin() {
init {
plugin = this
StyleConfig.prefix = tntLeaguePrefix
}
override fun onEnable() {
@@ -58,3 +69,8 @@ class TNTLeague : JavaPlugin() {
LeaveCommand.register()
}
}
fun Component.colorByTeam(team: TNTLeagueTeam?) = when (team) {
null -> this.gray()
else -> this.color(team.color)
}