From 4a28c58d2edd3761cddd90fa32e4ae59645bcf8a Mon Sep 17 00:00:00 2001 From: TDSTOS Date: Sun, 12 Apr 2026 07:20:20 +0200 Subject: [PATCH] Add /help command and various gameplay fixes Introduce a HelpCommand (/help) and register it in SpeedHG; add its localized help text and plugin.yml entry. Prevent kit ability use while in gladiator by checking metadata in KitEventDispatcher and add a matching translation key. Early-return in KitCommand during ENDING state. Fix English message in TeamCommand and adjust spacing in LeaderboardMenu lore. Remove an unused import in SpeedHG and add necessary imports. --- .../kotlin/club/mcscrims/speedhg/SpeedHG.kt | 3 ++- .../mcscrims/speedhg/command/HelpCommand.kt | 27 +++++++++++++++++++ .../mcscrims/speedhg/command/KitCommand.kt | 3 +++ .../mcscrims/speedhg/command/TeamCommand.kt | 2 +- .../speedhg/gui/menu/LeaderboardMenu.kt | 12 ++++----- .../kit/listener/KitEventDispatcher.kt | 7 +++++ src/main/resources/languages/en_US.yml | 4 ++- src/main/resources/plugin.yml | 2 ++ 8 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 src/main/kotlin/club/mcscrims/speedhg/command/HelpCommand.kt diff --git a/src/main/kotlin/club/mcscrims/speedhg/SpeedHG.kt b/src/main/kotlin/club/mcscrims/speedhg/SpeedHG.kt index b41457f..bc1842d 100644 --- a/src/main/kotlin/club/mcscrims/speedhg/SpeedHG.kt +++ b/src/main/kotlin/club/mcscrims/speedhg/SpeedHG.kt @@ -1,6 +1,7 @@ package club.mcscrims.speedhg import club.mcscrims.speedhg.client.LunarClientManager +import club.mcscrims.speedhg.command.HelpCommand import club.mcscrims.speedhg.command.KitCommand import club.mcscrims.speedhg.command.LeaderboardCommand import club.mcscrims.speedhg.command.PerksCommand @@ -8,7 +9,6 @@ import club.mcscrims.speedhg.command.RankingCommand import club.mcscrims.speedhg.command.TeamCommand import club.mcscrims.speedhg.command.TimerCommand import club.mcscrims.speedhg.config.CustomGameManager -import club.mcscrims.speedhg.config.CustomGameSettings import club.mcscrims.speedhg.config.LanguageManager import club.mcscrims.speedhg.database.DatabaseManager import club.mcscrims.speedhg.database.StatsManager @@ -282,6 +282,7 @@ class SpeedHG : JavaPlugin() { getCommand( "leaderboard" )?.setExecutor( LeaderboardCommand() ) getCommand( "perks" )?.setExecutor( PerksCommand() ) + getCommand( "help" )?.setExecutor( HelpCommand() ) } private fun registerListener() diff --git a/src/main/kotlin/club/mcscrims/speedhg/command/HelpCommand.kt b/src/main/kotlin/club/mcscrims/speedhg/command/HelpCommand.kt new file mode 100644 index 0000000..1bbfff3 --- /dev/null +++ b/src/main/kotlin/club/mcscrims/speedhg/command/HelpCommand.kt @@ -0,0 +1,27 @@ +package club.mcscrims.speedhg.command + +import club.mcscrims.speedhg.util.sendMsg +import org.bukkit.command.Command +import org.bukkit.command.CommandExecutor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +class HelpCommand : CommandExecutor { + + override fun onCommand( + sender: CommandSender, + command: Command, + label: String, + args: Array + ): Boolean + { + val player = sender as? Player ?: run { + sender.sendMessage("§cOnly players can execute this command.") + return true + } + + player.sendMsg( "commands.help.message" ) + return true + } + +} \ No newline at end of file diff --git a/src/main/kotlin/club/mcscrims/speedhg/command/KitCommand.kt b/src/main/kotlin/club/mcscrims/speedhg/command/KitCommand.kt index a7b741c..8c9d563 100644 --- a/src/main/kotlin/club/mcscrims/speedhg/command/KitCommand.kt +++ b/src/main/kotlin/club/mcscrims/speedhg/command/KitCommand.kt @@ -35,6 +35,9 @@ class KitCommand : CommandExecutor, TabCompleter { val selectedKit = plugin.kitManager.getSelectedKit( player ) val isBackup = selectedKit is BackupKit + if ( state == GameState.ENDING ) + return true + val ingame = state == GameState.INVINCIBILITY || state == GameState.INGAME diff --git a/src/main/kotlin/club/mcscrims/speedhg/command/TeamCommand.kt b/src/main/kotlin/club/mcscrims/speedhg/command/TeamCommand.kt index 9799f77..6b09085 100644 --- a/src/main/kotlin/club/mcscrims/speedhg/command/TeamCommand.kt +++ b/src/main/kotlin/club/mcscrims/speedhg/command/TeamCommand.kt @@ -32,7 +32,7 @@ class TeamCommand : CommandExecutor, TabCompleter { args: Array ): Boolean { val player = sender as? Player ?: run { - sender.sendMessage("§cNur Spieler können diesen Befehl nutzen.") + sender.sendMessage("§cOnly players can use this command.") return true } diff --git a/src/main/kotlin/club/mcscrims/speedhg/gui/menu/LeaderboardMenu.kt b/src/main/kotlin/club/mcscrims/speedhg/gui/menu/LeaderboardMenu.kt index d1c5281..7f052fc 100644 --- a/src/main/kotlin/club/mcscrims/speedhg/gui/menu/LeaderboardMenu.kt +++ b/src/main/kotlin/club/mcscrims/speedhg/gui/menu/LeaderboardMenu.kt @@ -147,17 +147,17 @@ class LeaderboardMenu( ) meta.lore( listOf( Component.empty(), - mm.deserialize( "Rank: $rankTag" ) + mm.deserialize( " Rank: $rankTag" ) .decoration( TextDecoration.ITALIC, false ), - mm.deserialize( "Score: ${score} RR" ) + mm.deserialize( " Score: ${score} RR" ) .decoration( TextDecoration.ITALIC, false ), - mm.deserialize( "Kills: ${stats.kills}" ) + mm.deserialize( " Kills: ${stats.kills}" ) .decoration( TextDecoration.ITALIC, false ), - mm.deserialize( "K/D: ${stats.formattedKD}" ) + mm.deserialize( " K/D: ${stats.formattedKD}" ) .decoration( TextDecoration.ITALIC, false ), - mm.deserialize( "Wins: ${stats.wins}" ) + mm.deserialize( " Wins: ${stats.wins}" ) .decoration( TextDecoration.ITALIC, false ), - mm.deserialize( "Win Rate: ${stats.formattedWinRate}" ) + mm.deserialize( " Win Rate: ${stats.formattedWinRate}" ) .decoration( TextDecoration.ITALIC, false ), Component.empty() ) ) diff --git a/src/main/kotlin/club/mcscrims/speedhg/kit/listener/KitEventDispatcher.kt b/src/main/kotlin/club/mcscrims/speedhg/kit/listener/KitEventDispatcher.kt index e91007e..0338951 100644 --- a/src/main/kotlin/club/mcscrims/speedhg/kit/listener/KitEventDispatcher.kt +++ b/src/main/kotlin/club/mcscrims/speedhg/kit/listener/KitEventDispatcher.kt @@ -180,6 +180,13 @@ class KitEventDispatcher( return } + // Check if player is in gladiator, cancel if he is + if (player.hasMetadata( KitMetaData.IN_GLADIATOR.getKey() )) + { + player.sendActionBar(player.trans( "kits.gladiator.messages.cannot_use_abilities" )) + return + } + // ── Consume the charge, then execute ───────────────────────────────── chargeData.consume() diff --git a/src/main/resources/languages/en_US.yml b/src/main/resources/languages/en_US.yml index 57d5bc1..f3a2c07 100644 --- a/src/main/resources/languages/en_US.yml +++ b/src/main/resources/languages/en_US.yml @@ -170,6 +170,8 @@ commands: rank_usage: 'Usage: /ranking rank ' player_not_found: 'Player is not online.' rank_info: 'Player ( RR · games)' + help: + message: '━━━━━ SpeedHG Help ━━━━━ Discord: discord.gg/HyZV4CdUgV Store: https://mcscrims.club /msg /r /report /leaderboard /team ━━━━━ SpeedHG Help ━━━━━' scoreboard: title: 'SpeedHG' @@ -327,7 +329,7 @@ kits: name: 'Cage' description: 'Fight an enemy in a 1v1 above the skies' messages: - ability_charged: 'Your ability has been recharged!' + cannot_use_abilities: 'You cannot use abilities while in a gladiator fight!' goblin: name: 'Goblin' diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index b06b027..ef03cf5 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -23,6 +23,8 @@ permissions: default: false commands: + help: + description: 'Help Command' kit: description: 'Select kits via command' usage: '/kit '