From cc265a1dea023d049f209d027c57eb6443df2d3a Mon Sep 17 00:00:00 2001 From: TDSTOS Date: Wed, 25 Mar 2026 03:09:17 +0100 Subject: [PATCH] Add language entries; include prefix placeholders Include the default prefix as a placeholder when deserializing messages (LanguageManager). Pass the invincibility time placeholder in GameManager broadcasts. Unify GoblinKit action bar messages to a single "ability_charged" language key. ScoreboardManager now imports legacySerializer and serializes the selected kit display name for the scoreboard. Large update to en_US.yml: added many game/timer/title/antirunner/build/craft/commands translations, updated player welcome and scoreboard title coloring, and added kits.goblin names, lore, items and messages. --- .../speedhg/config/LanguageManager.kt | 4 +- .../club/mcscrims/speedhg/game/GameManager.kt | 2 +- .../mcscrims/speedhg/kit/impl/GoblinKit.kt | 4 +- .../speedhg/scoreboard/ScoreboardManager.kt | 7 +- src/main/resources/languages/en_US.yml | 66 ++++++++++++++++++- 5 files changed, 72 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/club/mcscrims/speedhg/config/LanguageManager.kt b/src/main/kotlin/club/mcscrims/speedhg/config/LanguageManager.kt index 3c75b8e..fbb372c 100644 --- a/src/main/kotlin/club/mcscrims/speedhg/config/LanguageManager.kt +++ b/src/main/kotlin/club/mcscrims/speedhg/config/LanguageManager.kt @@ -104,8 +104,10 @@ class LanguageManager( placeholders: Map ): Component { + val prefixRaw = getRawMessage( player, "default.prefix" ) + val prefixTag = Placeholder.parsed( "prefix", prefixRaw ) val raw = getRawMessage( player, key ) - val tags = placeholders.map { (k, v) -> Placeholder.parsed( k, v ) } + val tags = placeholders.map { (k, v) -> Placeholder.parsed( k, v ) }.plus( prefixTag ) return miniMessage.deserialize( raw, *tags.toTypedArray() ) } diff --git a/src/main/kotlin/club/mcscrims/speedhg/game/GameManager.kt b/src/main/kotlin/club/mcscrims/speedhg/game/GameManager.kt index c29963e..f30cfdf 100644 --- a/src/main/kotlin/club/mcscrims/speedhg/game/GameManager.kt +++ b/src/main/kotlin/club/mcscrims/speedhg/game/GameManager.kt @@ -178,7 +178,7 @@ class GameManager( } Bukkit.getOnlinePlayers().forEach { player -> - player.sendMsg( "game.invincibility-start" ) + player.sendMsg( "game.invincibility-start", "time" to invincibilityTime.toString() ) } } diff --git a/src/main/kotlin/club/mcscrims/speedhg/kit/impl/GoblinKit.kt b/src/main/kotlin/club/mcscrims/speedhg/kit/impl/GoblinKit.kt index d557b9f..b0fbe07 100644 --- a/src/main/kotlin/club/mcscrims/speedhg/kit/impl/GoblinKit.kt +++ b/src/main/kotlin/club/mcscrims/speedhg/kit/impl/GoblinKit.kt @@ -149,7 +149,7 @@ class GoblinKit : Kit() { player: Player ) { player.playSound( player.location, Sound.BLOCK_ANVIL_USE, 0.8f, 1.5f ) - player.sendActionBar(player.trans( "kits.goblin.messages.steal_kit_charged" )) + player.sendActionBar(player.trans( "kits.goblin.messages.ability_charged" )) } } @@ -203,7 +203,7 @@ class GoblinKit : Kit() { player: Player ) { player.playSound( player.location, Sound.BLOCK_ANVIL_USE, 0.8f, 1.5f ) - player.sendActionBar(player.trans( "kits.goblin.messages.bunker_charged" )) + player.sendActionBar(player.trans( "kits.goblin.messages.ability_charged" )) } } diff --git a/src/main/kotlin/club/mcscrims/speedhg/scoreboard/ScoreboardManager.kt b/src/main/kotlin/club/mcscrims/speedhg/scoreboard/ScoreboardManager.kt index 80e067d..498f1dd 100644 --- a/src/main/kotlin/club/mcscrims/speedhg/scoreboard/ScoreboardManager.kt +++ b/src/main/kotlin/club/mcscrims/speedhg/scoreboard/ScoreboardManager.kt @@ -2,6 +2,7 @@ package club.mcscrims.speedhg.scoreboard import club.mcscrims.speedhg.SpeedHG import club.mcscrims.speedhg.game.GameState +import club.mcscrims.speedhg.util.legacySerializer import club.mcscrims.speedhg.util.trans import club.mcscrims.speedhg.util.transList import fr.mrmicky.fastboard.adventure.FastBoard @@ -50,9 +51,7 @@ class ScoreboardManager( { boards.forEach { (key, value) -> val player = Bukkit.getPlayer( key ) - - if ( player != null ) - updateBoard( player, value ) + if ( player != null ) updateBoard( player, value ) } } @@ -67,7 +66,7 @@ class ScoreboardManager( val online = Bukkit.getOnlinePlayers().size.toString() val max = Bukkit.getMaxPlayers().toString() - val kitName = "None" // TODO + val kitName = legacySerializer.serialize(plugin.kitManager.getSelectedKit( player )?.displayName ?: Component.text( "None" )) val lines: List diff --git a/src/main/resources/languages/en_US.yml b/src/main/resources/languages/en_US.yml index 91a2825..71c4bf4 100644 --- a/src/main/resources/languages/en_US.yml +++ b/src/main/resources/languages/en_US.yml @@ -9,12 +9,48 @@ default: game: join: ' has joined the game.' quit: ' has quit the game.' + start-aborted: 'The game start has been aborted due to the lack of players!' + started: 'The game has started! Good Luck!' + invincibility-start: 'Invincibility has started and ends in ' + fighting-started: 'The battle has begun! Try not to die!' + death-killed: ' has died whilst fighting ! There are players left.' + death-pve: ' has died! There are players left.' + win-chat: ' has won the game! Thanks for playing!' + +title: + fight-main: 'The battle has begun!' + fight-sub: 'Try not to die!' + win-main: ' has won the game!' + win-sub: 'Thanks for playing!' + +timer: + lobby: 'The game starts in ' + actionbar-invincibility: 'Invincibility ends in ' + +antirunner: + warning: 'Fight and you will not be punished!' + punish: 'You have been punished due to not fighting your enemy!' player: - welcome: 'Welcome to SpeedHG!' + welcome: 'Welcome to SpeedHG!' + +build: + no_diamonds: 'Diamonds are not allowed in SpeedHG!' + no_iron_before_feast: 'Iron is not allowed before the Feast has started!' + +craft: + no_shift_click: 'Shift-click is not allowed while crafting!' + no_shield: 'Shields are not allowed in SpeedHG!' + iron_nerf: 'Your item has been nerfed as it contains iron!' + +commands: + kit: + usage: 'Usage: /kit ' + kitNotFound: ' is not a registered kit!' + selected: 'You have selected as your Kit!' scoreboard: - title: 'SpeedHG' + title: 'SpeedHG' lobby: - " " - "Spieler: /" @@ -31,4 +67,28 @@ scoreboard: - "" - "Border: " - "" - - "play.mcscrims.club" \ No newline at end of file + - "play.mcscrims.club" + +kits: + goblin: + name: 'Goblin' + lore: + - ' ' + - 'Use your abilities to either copy' + - 'your enemies kit or hide in a bunker' + - ' ' + - 'PlayStyle: §e%playstyle%' + - ' ' + - 'Left-click to select' + - 'Right-click to change playstyle' + items: + steal: + name: '§cSteal Kit' + description: 'Steal the kit of your opponent for 60 seconds' + bunker: + name: '§2Bunker' + description: 'Create a bunker around yourself for 15 seconds' + messages: + stole_kit: 'You have stolen the kit of your opponent (Kit: )!' + spawn_bunker: 'You have created a bunker around yourself!' + ability_charged: 'Your ability has been recharged!' \ No newline at end of file