add help command prefix for console

This commit is contained in:
Sen 2025-06-10 11:01:22 +02:00
parent e625ead56d
commit 4c2c0ab7fc
Signed by: sen
GPG key ID: 3AC50A6F47D1B722

View file

@ -21,9 +21,9 @@ public class CommandHelp extends Command {
return "[command]";
}
private static String formatCommand(Command cmd, boolean prefix) {
private static String formatCommand(Command cmd) {
String args = cmd.getArgs();
return (prefix ? Formatter.DARK_GRAY + "/" : "") + Formatter.AQUA + cmd.getName() + (args == null || args.isEmpty() ? "" : Formatter.GREEN + " " + args)
return Formatter.DARK_GRAY + "/" + Formatter.AQUA + cmd.getName() + (args == null || args.isEmpty() ? "" : Formatter.GREEN + " " + args)
+ Formatter.GRAY + " - " + Formatter.YELLOW + cmd.getHelp();
}
@ -31,7 +31,7 @@ public class CommandHelp extends Command {
if(args.length == 0) {
for(Command cmd : proxy.getCommands().values()) {
if(cmd.canUse(player))
sendMessage(player, formatCommand(cmd, player != null));
sendMessage(player, formatCommand(cmd));
}
return;
}
@ -40,7 +40,7 @@ public class CommandHelp extends Command {
throw new RunException("Command '%s' not found", args[0]);
if(!cmd.canUse(player))
throw new RunException("Command '%s' can not be used", args[0]);
sendMessage(player, formatCommand(cmd, player != null));
sendMessage(player, formatCommand(cmd));
}
public Iterable<String> complete(Proxy proxy, ProxyHandler player, String[] args, String[] serverMatches) {