This commit is contained in:
2024-12-03 17:17:29 +01:00
parent 677eb4137a
commit 19a4d0e93a
8 changed files with 79 additions and 79 deletions
@@ -17,33 +17,33 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# #
PREFIX=§4TNT§6League§8» PREFIX=§eTNT§7League§8»
join=§e{0} §7joined the game! JOIN=§e{0} §7joined the game!
joinTeam={0} §7joined the {1} §7team! JOIN_TEAM={0} §7joined the {1} §7team!
quit={0} §cleft the game! QUIT={0} §7left the game!
quitTeam={0} §7left the {1} §7team! QUIT_TEAM={0} §7left the {1} §7team!
blue=Blue BLUE=blue
red=Red RED=red
shutdown=§cThe server stops in §e{0} §cseconds! SHUTDOWN=§7The server stops in §e{0} §cseconds!
teamWin=§aTeam {0} §awins! TEAM_WIN=§aTeam {0} §awins!
notEnoughCoins=§cYou don't have enough coins to buy this item! NOT_ENOUGH_COINS=§cYou don't have enough coins to buy this item!
gameStarting=§aThe game starts in §e{0} §aseconds! GAME_STARTING=§aThe game starts in §e{0} §aseconds!
gameStart= GAME_START=
gameStarted=§aThe game has started! GAME_STARTED=§aThe game has started!
timeRemaining=§e{0} §7minutes remaining! TIME_REMAINING=§e{0} §7minutes remaining!
gameEnded=§cThe game has ended! GAME_ENDED=§cThe game has ended!
draw=§cThe game ended in a draw! DRAW=§cThe game ended in a draw!
dealer=Shopkeeper DEALER=Shopkeeper
dealerItem={0} {1} DEALER_ITEM={0} {1}
dealerPrice= DEALER_PRICE=
scoreboardTarget= SCOREBOARD_TARGET=
scoreboardTime=§7Time: §e{0}§8:§e{1} SCOREBOARD_TIME=§7Time§8: §e{0}§8:§e{1}
scoreboardCoins=§7Coins: §e{0} SCOREBOARD_COINS=§7Coins§8: §e{0}
scoreboardTeam=§7Team {0}§8: §e{1} SCOREBOARD_TEAM=§7Team {0}§8: §e{1}
ready=§aReady READY=§aReady
notReady=§cNot ready NOT_READY=§cNot ready
isReady=§aTeam {0} §ais ready! IS_READY=§aTeam {0} §ais ready!
isNotReady=§cTeam {0} §cis not ready! IS_NOT_READY=§cTeam {0} §cis not ready!
invited={0} §ainvited you to join the {1} §ateam! §e*Click* INVITED={0} §ainvited you to join team {1}§7! §e*Click*
invitedHover=§7Click to join the {0} §7team! INVITED_HOVER=§7Click to join team {0}§7!
invitedPlayer=§aInvited §e{0} §ato join your team! INVITED_PLAYER=§aInvited §e{0} §ato join your team!
@@ -16,29 +16,29 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# #
join=§e{0} §7ist dem Spiel beigetreten! JOIN=§e{0} §7ist dem Spiel beigetreten!
joinTeam={0} §7ist dem {1} §7team begetreten! JOIN_TEAM={0} §7ist Team {1} §7begetreten!
quit={0} §chat das Spiel verlassen! QUIT={0} §7hat das Spiel verlassen!
quitTeam={0} §7hat Team {1} §7verlassen! QUIT_TEAM={0} §7hat Team {1} §7verlassen!
blue=Blau BLUE=Blau
red=Rot RED=Rot
shutdown=§cDer Server fährt in §e{0} §csekunden herunter! SHUTDOWN=§7Der Server fährt in §e{0} §cSekunden herunter!
teamWin=§aTeam {0} §agewinnt! TEAM_WIN=§aTeam {0} §agewinnt!
notEnoughCoins=§cDu hast nicht genug Coins um dir das zu kaufen! NOT_ENOUGH_COINS=§cDu hast nicht genug Coins um dir das zu kaufen!
gameStarting=§aDas Spiel beginnt in §e{0} §aSekunden! GAME_STARTING=§aDas Spiel beginnt in §e{0} §aSekunden!
gameStarted=§aDas Spiel beginnt! GAME_STARTED=§aDas Spiel beginnt!
timeRemaining=§7noch §e{0} §7Minuten! TIME_REMAINING=§7noch §e{0} §7Minuten!
gameEnded=§cDas Spiel ist vorbei! GAME_ENDED=§cDas Spiel ist vorbei!
draw=§cKeiner hat gewonnen! DRAW=§cKeiner hat gewonnen!
dealer=Händler DEALER=Händler
dealerPrice=§7Kosten: §e{0} Coins DEALER_PRICE=§7Kosten: §e{0} Coins
scoreboardTarget=§7Ziel: {0} SCOREBOARD_TARGET=§7Ziel§8: {0}
scoreboardTime=§7Zeit: §e{0}§8:§e{1} SCOREBOARD_TIME=§7Zeit§8: §e{0}§8:§e{1}
ready=§aBereit READY=§aBereit
notReady=§cNicht bereit NOT_READY=§cNicht bereit
isReady=§aTeam {0} §aist bereit! IS_READY=§aTeam {0} §aist bereit!
isNotReady=§cTeam {0} §cist nicht bereit! IS_NOT_READY=§cTeam {0} §cist nicht bereit!
invited={0} §ahat dich in team {1} §aeingeladen! §e*Klick* INVITED={0} §ahat dich in Team {1} §aeingeladen! §e*Klick*
invitedHover=§7Team {0} §7beitreten! INVITED_HOVER=§7Team {0} §7beitreten!
invitedPlayer={0} §awurde eingeladen! INVITED_PLAYER={0} §awurde eingeladen!
@@ -38,10 +38,10 @@ object InviteCommand: SWCommand("invite") {
team.invites.add(target) team.invites.add(target)
message message
.send("invited", target, message.parse("invitedHover", target, team.name.colorByTeam(team)), .send("INVITED", target, message.parse("INVITED_HOVER", target, team.name.colorByTeam(team)),
ClickEvent(ClickEvent.Action.RUN_COMMAND, "/accept "), sender.name, team.name.colorByTeam(team), ) ClickEvent(ClickEvent.Action.RUN_COMMAND, "/accept "), sender.name, team.name.colorByTeam(team), )
message.send("invitedPlayer", sender, target.name) message.send("INVITED_PLAYER", sender, target.name)
} }
@Validator("isLeader", local = false) @Validator("isLeader", local = false)
@@ -45,7 +45,7 @@ object GlobalListener: Listener {
with(e.player) { with(e.player) {
teleport(TNTLeagueWorldConfig.lobby) teleport(TNTLeagueWorldConfig.lobby)
inventory.clear() inventory.clear()
message.broadcast("join", name) message.broadcast("JOIN", name)
isOp = false isOp = false
gameMode = GameMode.SPECTATOR gameMode = GameMode.SPECTATOR
respawnLocation = TNTLeagueWorldConfig.lobby respawnLocation = TNTLeagueWorldConfig.lobby
@@ -55,7 +55,7 @@ object GlobalListener: Listener {
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
fun onPlayerQuit(e: PlayerQuitEvent) { fun onPlayerQuit(e: PlayerQuitEvent) {
e.quitMessage(null) e.quitMessage(null)
message.broadcast("quit", e.player.name.colorByTeam(TNTLeagueGame.getTeam(e.player))) message.broadcast("QUIT", e.player.name.colorByTeam(TNTLeagueGame.getTeam(e.player)))
TNTLeagueGame.playerLeave(e.player) TNTLeagueGame.playerLeave(e.player)
} }
@@ -81,7 +81,7 @@ object TNTLeagueGame {
blueTeam.start() blueTeam.start()
redTeam.start() redTeam.start()
message.broadcast("gameStarted") message.broadcast("GAME_STARTED")
val tnt = ItemStack(Material.TNT) val tnt = ItemStack(Material.TNT)
@@ -106,7 +106,7 @@ object TNTLeagueGame {
} }
if (gameTimeRemaining % 300 == 0) { if (gameTimeRemaining % 300 == 0) {
message.broadcast("timeRemaining", (gameTimeRemaining / 60)) message.broadcast("TIME_REMAINING", (gameTimeRemaining / 60))
plugin.server.onlinePlayers.forEach { it.playSound(Sound.sound(org.bukkit.Sound.BLOCK_NOTE_BLOCK_PLING.key, Sound.Source.MASTER, 1f, 1f)) } plugin.server.onlinePlayers.forEach { it.playSound(Sound.sound(org.bukkit.Sound.BLOCK_NOTE_BLOCK_PLING.key, Sound.Source.MASTER, 1f, 1f)) }
} }
}, 20, 20) }, 20, 20)
@@ -124,7 +124,7 @@ object TNTLeagueGame {
it.playSound(Sound.sound(org.bukkit.Sound.ENTITY_ENDER_DRAGON_DEATH.key, Sound.Source.MASTER, 1f, 1f)) it.playSound(Sound.sound(org.bukkit.Sound.ENTITY_ENDER_DRAGON_DEATH.key, Sound.Source.MASTER, 1f, 1f))
} }
message.broadcast("gameEnded") message.broadcast("GAME_ENDED")
spawnerTask.cancel() spawnerTask.cancel()
@@ -135,7 +135,7 @@ object TNTLeagueGame {
plugin.server.shutdown() plugin.server.shutdown()
} }
message.broadcast("shutdown", shutdown) message.broadcast("SHUTDOWN", shutdown)
shutdown-- shutdown--
}, 20, 20) }, 20, 20)
@@ -154,7 +154,7 @@ object TNTLeagueGame {
state = GameState.STARTING state = GameState.STARTING
var countdown = TNTLeagueConfig.config.startDelay var countdown = TNTLeagueConfig.config.startDelay
message.broadcast("gameStarting", countdown.toString()) message.broadcast("GAME_STARTING", countdown.toString())
task = plugin.server.scheduler.scheduleSyncRepeatingTask(plugin, { 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)) } plugin.server.onlinePlayers.forEach { it.playSound(Sound.sound(org.bukkit.Sound.ENTITY_EXPERIENCE_ORB_PICKUP.key, Sound.Source.MASTER, 1f, 1f)) }
if (--countdown == 0) { if (--countdown == 0) {
@@ -195,7 +195,7 @@ object TNTLeagueGame {
fun win(tntLeagueTeam: TNTLeagueTeam, reason: WinReason) { fun win(tntLeagueTeam: TNTLeagueTeam, reason: WinReason) {
if (state != GameState.RUNNING) return if (state != GameState.RUNNING) return
end() end()
plugin.server.onlinePlayers.forEach { message.send("teamWin", it, message.parse(tntLeagueTeam.name, it).colorByTeam(tntLeagueTeam)) } plugin.server.onlinePlayers.forEach { message.send("TEAM_WIN", it, message.parse(tntLeagueTeam.name, it).colorByTeam(tntLeagueTeam)) }
statistic(tntLeagueTeam, reason) statistic(tntLeagueTeam, reason)
explode(tntLeagueTeam.opposite) explode(tntLeagueTeam.opposite)
} }
@@ -203,7 +203,7 @@ object TNTLeagueGame {
fun draw(reason: WinReason) { fun draw(reason: WinReason) {
if (state != GameState.RUNNING) return if (state != GameState.RUNNING) return
end() end()
message.broadcast("draw") message.broadcast("DRAW")
statistic(null, reason) statistic(null, reason)
} }
@@ -60,7 +60,7 @@ data class TNTLeagueTeam(val config: TNTLeagueWorldConfig.TeamConfig, private va
leader?.inventory?.setItem(4, readyItem()) leader?.inventory?.setItem(4, readyItem())
leader?.playSound(Sound.sound(org.bukkit.Sound.BLOCK_NOTE_BLOCK_PLING.key, Sound.Source.MASTER, 1f, 1f)) leader?.playSound(Sound.sound(org.bukkit.Sound.BLOCK_NOTE_BLOCK_PLING.key, Sound.Source.MASTER, 1f, 1f))
message.broadcastActionbar(if (value) "isReady" else "isNotReady", name.colorByTeam(this)) message.broadcastActionbar(if (value) "IS_READY" else "IS_NOT_READY", name.colorByTeam(this))
if (value && opposite.isReady) { if (value && opposite.isReady) {
TNTLeagueGame.checkStart() TNTLeagueGame.checkStart()
@@ -90,7 +90,7 @@ data class TNTLeagueTeam(val config: TNTLeagueWorldConfig.TeamConfig, private va
teleport(config.spawnLocation) teleport(config.spawnLocation)
gameMode = GameMode.ADVENTURE gameMode = GameMode.ADVENTURE
inventory.clear() inventory.clear()
message.broadcast("joinTeam", name.colorByTeam(this@TNTLeagueTeam), this@TNTLeagueTeam.name.colorByTeam(this@TNTLeagueTeam)) message.broadcast("JOIN_TEAM", name.colorByTeam(this@TNTLeagueTeam), this@TNTLeagueTeam.name.colorByTeam(this@TNTLeagueTeam))
} }
if (leader == null) { if (leader == null) {
@@ -103,13 +103,13 @@ data class TNTLeagueTeam(val config: TNTLeagueWorldConfig.TeamConfig, private va
fun readyItem() = if (isReady) { fun readyItem() = if (isReady) {
ItemStack.of(Material.LIME_DYE).apply { ItemStack.of(Material.LIME_DYE).apply {
itemMeta = itemMeta.apply { itemMeta = itemMeta.apply {
displayName(Component.text(message.parse("ready", leader!!))) displayName(Component.text(message.parse("READY", leader!!)))
} }
} }
} else { } else {
ItemStack.of(Material.RED_DYE).apply { ItemStack.of(Material.RED_DYE).apply {
itemMeta = itemMeta.apply { itemMeta = itemMeta.apply {
displayName(Component.text(message.parse("notReady", leader!!))) displayName(Component.text(message.parse("NOT_READY", leader!!)))
} }
} }
} }
@@ -151,7 +151,7 @@ data class TNTLeagueTeam(val config: TNTLeagueWorldConfig.TeamConfig, private va
teleport(TNTLeagueWorldConfig.lobby) teleport(TNTLeagueWorldConfig.lobby)
gameMode = GameMode.SPECTATOR gameMode = GameMode.SPECTATOR
inventory.clear() inventory.clear()
message.broadcast("quitTeam", name.colorByTeam(this@TNTLeagueTeam), this@TNTLeagueTeam.name.colorByTeam(this@TNTLeagueTeam)) message.broadcast("QUIT_TEAM", name.colorByTeam(this@TNTLeagueTeam), this@TNTLeagueTeam.name.colorByTeam(this@TNTLeagueTeam))
} }
} }
@@ -48,7 +48,7 @@ class DealerInventory(val player: Player): SWInventoryHolder() {
val team = TNTLeagueGame.getTeam(player) ?: return@to val team = TNTLeagueGame.getTeam(player) ?: return@to
if (team.coins < price) { if (team.coins < price) {
message.send("notEnoughCoins", player) message.send("NOT_ENOUGH_COINS", player)
player.playSound(Sound.sound(org.bukkit.Sound.ENTITY_VILLAGER_HURT.key, net.kyori.adventure.sound.Sound.Source.MASTER, 1f, 1f)) player.playSound(Sound.sound(org.bukkit.Sound.ENTITY_VILLAGER_HURT.key, net.kyori.adventure.sound.Sound.Source.MASTER, 1f, 1f))
return@to return@to
} }
@@ -59,7 +59,7 @@ class DealerInventory(val player: Player): SWInventoryHolder() {
} }
} }
override fun createInventory(): Inventory = plugin.server.createInventory(this, ceil(TNTLeagueConfig.config.prices.size / 9f).toInt() * 9, Component.text(message.parse("dealer", player))) override fun createInventory(): Inventory = plugin.server.createInventory(this, ceil(TNTLeagueConfig.config.prices.size / 9f).toInt() * 9, Component.text(message.parse("DEALER", player)))
companion object { companion object {
private val priceKey = NamespacedKey(plugin, "price") private val priceKey = NamespacedKey(plugin, "price")
@@ -36,23 +36,23 @@ data class TNTLeagueScoreboard(val p: Player): ScoreboardCallback {
val minutes = TNTLeagueGame.gameTimeRemaining.floorDiv(60) val minutes = TNTLeagueGame.gameTimeRemaining.floorDiv(60)
val seconds = TNTLeagueGame.gameTimeRemaining.rem(60).toString().padStart(2, '0') val seconds = TNTLeagueGame.gameTimeRemaining.rem(60).toString().padStart(2, '0')
lines.add(message.parse("scoreboardTime", p, minutes, seconds)) lines.add(message.parse("SCOREBOARD_TIME", p, minutes, seconds))
lines.add("§2") lines.add("§2")
when (val team = TNTLeagueGame.getTeam(p)) { when (val team = TNTLeagueGame.getTeam(p)) {
is TNTLeagueTeam -> lines.add(message.parse("scoreboardCoins", p, team.coins)) is TNTLeagueTeam -> lines.add(message.parse("SCOREBOARD_COINS", p, team.coins))
else -> lines.add(message.parse("scoreboardCoins", p, else -> lines.add(message.parse("SCOREBOARD_COINS", p,
"§${TNTLeagueGame.blueTeam.color}${TNTLeagueGame.blueTeam.coins}§8:§${TNTLeagueGame.redTeam.color}${TNTLeagueGame.redTeam.coins}")) "§${TNTLeagueGame.blueTeam.color}${TNTLeagueGame.blueTeam.coins}§8:§${TNTLeagueGame.redTeam.color}${TNTLeagueGame.redTeam.coins}"))
} }
lines.add("§3") lines.add("§3")
with(TNTLeagueGame.redTeam) { with(TNTLeagueGame.redTeam) {
lines.add(message.parse("scoreboardTeam", p, message.parse(name, p).colorByTeam(this), targetedBlocks - damagedBlocks)) lines.add(message.parse("SCOREBOARD_TEAM", p, message.parse(name, p).colorByTeam(this), targetedBlocks - damagedBlocks))
} }
with(TNTLeagueGame.blueTeam) { with(TNTLeagueGame.blueTeam) {
lines.add(message.parse("scoreboardTeam", p, message.parse(name, p).colorByTeam(this), targetedBlocks - damagedBlocks)) lines.add(message.parse("SCOREBOARD_TEAM", p, message.parse(name, p).colorByTeam(this), targetedBlocks - damagedBlocks))
} }
lines.add("§4") lines.add("§4")
@@ -61,5 +61,5 @@ data class TNTLeagueScoreboard(val p: Player): ScoreboardCallback {
.foldIndexed(HashMap()) { index, acc, component -> acc.also { it[component] = index } } .foldIndexed(HashMap()) { index, acc, component -> acc.also { it[component] = index } }
} }
override fun getTitle(): String = message.parse("PREFIX", p) override fun getTitle(): String = message.parse("PREFIX", p).dropLast(1)
} }