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.
This commit is contained in:
TDSTOS
2026-04-12 07:20:20 +02:00
parent 140ee8ef3e
commit 4a28c58d2e
8 changed files with 51 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
package club.mcscrims.speedhg package club.mcscrims.speedhg
import club.mcscrims.speedhg.client.LunarClientManager import club.mcscrims.speedhg.client.LunarClientManager
import club.mcscrims.speedhg.command.HelpCommand
import club.mcscrims.speedhg.command.KitCommand import club.mcscrims.speedhg.command.KitCommand
import club.mcscrims.speedhg.command.LeaderboardCommand import club.mcscrims.speedhg.command.LeaderboardCommand
import club.mcscrims.speedhg.command.PerksCommand 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.TeamCommand
import club.mcscrims.speedhg.command.TimerCommand import club.mcscrims.speedhg.command.TimerCommand
import club.mcscrims.speedhg.config.CustomGameManager import club.mcscrims.speedhg.config.CustomGameManager
import club.mcscrims.speedhg.config.CustomGameSettings
import club.mcscrims.speedhg.config.LanguageManager import club.mcscrims.speedhg.config.LanguageManager
import club.mcscrims.speedhg.database.DatabaseManager import club.mcscrims.speedhg.database.DatabaseManager
import club.mcscrims.speedhg.database.StatsManager import club.mcscrims.speedhg.database.StatsManager
@@ -282,6 +282,7 @@ class SpeedHG : JavaPlugin() {
getCommand( "leaderboard" )?.setExecutor( LeaderboardCommand() ) getCommand( "leaderboard" )?.setExecutor( LeaderboardCommand() )
getCommand( "perks" )?.setExecutor( PerksCommand() ) getCommand( "perks" )?.setExecutor( PerksCommand() )
getCommand( "help" )?.setExecutor( HelpCommand() )
} }
private fun registerListener() private fun registerListener()

View File

@@ -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<out String>
): Boolean
{
val player = sender as? Player ?: run {
sender.sendMessage("§cOnly players can execute this command.")
return true
}
player.sendMsg( "commands.help.message" )
return true
}
}

View File

@@ -35,6 +35,9 @@ class KitCommand : CommandExecutor, TabCompleter {
val selectedKit = plugin.kitManager.getSelectedKit( player ) val selectedKit = plugin.kitManager.getSelectedKit( player )
val isBackup = selectedKit is BackupKit val isBackup = selectedKit is BackupKit
if ( state == GameState.ENDING )
return true
val ingame = state == GameState.INVINCIBILITY || val ingame = state == GameState.INVINCIBILITY ||
state == GameState.INGAME state == GameState.INGAME

View File

@@ -32,7 +32,7 @@ class TeamCommand : CommandExecutor, TabCompleter {
args: Array<out String> args: Array<out String>
): Boolean { ): Boolean {
val player = sender as? Player ?: run { 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 return true
} }

View File

@@ -147,17 +147,17 @@ class LeaderboardMenu(
) )
meta.lore( listOf( meta.lore( listOf(
Component.empty(), Component.empty(),
mm.deserialize( "<dark_gray>▪</dark_gray><gray>Rank:</gray> $rankTag" ) mm.deserialize( "<dark_gray>▪</dark_gray> <gray>Rank:</gray> $rankTag" )
.decoration( TextDecoration.ITALIC, false ), .decoration( TextDecoration.ITALIC, false ),
mm.deserialize( "<dark_gray>▪</dark_gray><gray>Score:</gray> <white>${score} RR</white>" ) mm.deserialize( "<dark_gray>▪</dark_gray> <gray>Score:</gray> <white>${score} RR</white>" )
.decoration( TextDecoration.ITALIC, false ), .decoration( TextDecoration.ITALIC, false ),
mm.deserialize( "<dark_gray>▪</dark_gray><gray>Kills:</gray> <white>${stats.kills}</white>" ) mm.deserialize( "<dark_gray>▪</dark_gray> <gray>Kills:</gray> <white>${stats.kills}</white>" )
.decoration( TextDecoration.ITALIC, false ), .decoration( TextDecoration.ITALIC, false ),
mm.deserialize( "<dark_gray>▪</dark_gray><gray>K/D:</gray> <white>${stats.formattedKD}</white>" ) mm.deserialize( "<dark_gray>▪</dark_gray> <gray>K/D:</gray> <white>${stats.formattedKD}</white>" )
.decoration( TextDecoration.ITALIC, false ), .decoration( TextDecoration.ITALIC, false ),
mm.deserialize( "<dark_gray>▪</dark_gray><gray>Wins:</gray> <white>${stats.wins}</white>" ) mm.deserialize( "<dark_gray>▪</dark_gray> <gray>Wins:</gray> <white>${stats.wins}</white>" )
.decoration( TextDecoration.ITALIC, false ), .decoration( TextDecoration.ITALIC, false ),
mm.deserialize( "<dark_gray>▪</dark_gray><gray>Win Rate:</gray> <white>${stats.formattedWinRate}</white>" ) mm.deserialize( "<dark_gray>▪</dark_gray> <gray>Win Rate:</gray> <white>${stats.formattedWinRate}</white>" )
.decoration( TextDecoration.ITALIC, false ), .decoration( TextDecoration.ITALIC, false ),
Component.empty() Component.empty()
) ) ) )

View File

@@ -180,6 +180,13 @@ class KitEventDispatcher(
return 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 ───────────────────────────────── // ── Consume the charge, then execute ─────────────────────────────────
chargeData.consume() chargeData.consume()

View File

@@ -170,6 +170,8 @@ commands:
rank_usage: '<red>Usage: /ranking rank <player></red>' rank_usage: '<red>Usage: /ranking rank <player></red>'
player_not_found: '<red>Player <name> is not online.</red>' player_not_found: '<red>Player <name> is not online.</red>'
rank_info: '<prefix><gray>Player <white><name></white> — <rank> <gray>(<score> RR · <games> games)</gray>' rank_info: '<prefix><gray>Player <white><name></white> — <rank> <gray>(<score> RR · <games> games)</gray>'
help:
message: '<gray>━━━━━ <gradient:red:gold>SpeedHG</gradient> <red>Help</red> ━━━━━</gray><newline><gray>▪</gray> <blue>Discord:</blue> discord.gg/HyZV4CdUgV<newline><gray>▪</gray> <gold>Store:</gold> https://mcscrims.club<newline><white><newline><gray>▪</gray> <yellow>/msg <player> <message></yellow><newline><gray>▪</gray> <yellow>/r <message></yellow><newline><gray>▪</gray> <yellow>/report <player></yellow><newline><gray>▪</gray> <yellow>/leaderboard</yellow><newline><gray>▪</gray> <yellow>/team <invite|accept|deny></yellow><newline><gray>━━━━━ <gradient:red:gold>SpeedHG</gradient> <red>Help</red> ━━━━━</gray>'
scoreboard: scoreboard:
title: '<gradient:red:gold><bold>SpeedHG</bold></gradient>' title: '<gradient:red:gold><bold>SpeedHG</bold></gradient>'
@@ -327,7 +329,7 @@ kits:
name: '<gray>Cage</gray>' name: '<gray>Cage</gray>'
description: 'Fight an enemy in a 1v1 above the skies' description: 'Fight an enemy in a 1v1 above the skies'
messages: messages:
ability_charged: '<yellow>Your ability has been recharged!</yellow>' cannot_use_abilities: '<red>You cannot use abilities while in a gladiator fight!</red>'
goblin: goblin:
name: '<gradient:dark_green:gray><bold>Goblin</bold></gradient>' name: '<gradient:dark_green:gray><bold>Goblin</bold></gradient>'

View File

@@ -23,6 +23,8 @@ permissions:
default: false default: false
commands: commands:
help:
description: 'Help Command'
kit: kit:
description: 'Select kits via command' description: 'Select kits via command'
usage: '/kit <kitName> <playstyle>' usage: '/kit <kitName> <playstyle>'