add help command prefix for console
This commit is contained in:
parent
e625ead56d
commit
4c2c0ab7fc
1 changed files with 4 additions and 4 deletions
|
@ -21,9 +21,9 @@ public class CommandHelp extends Command {
|
||||||
return "[command]";
|
return "[command]";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String formatCommand(Command cmd, boolean prefix) {
|
private static String formatCommand(Command cmd) {
|
||||||
String args = cmd.getArgs();
|
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();
|
+ Formatter.GRAY + " - " + Formatter.YELLOW + cmd.getHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class CommandHelp extends Command {
|
||||||
if(args.length == 0) {
|
if(args.length == 0) {
|
||||||
for(Command cmd : proxy.getCommands().values()) {
|
for(Command cmd : proxy.getCommands().values()) {
|
||||||
if(cmd.canUse(player))
|
if(cmd.canUse(player))
|
||||||
sendMessage(player, formatCommand(cmd, player != null));
|
sendMessage(player, formatCommand(cmd));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class CommandHelp extends Command {
|
||||||
throw new RunException("Command '%s' not found", args[0]);
|
throw new RunException("Command '%s' not found", args[0]);
|
||||||
if(!cmd.canUse(player))
|
if(!cmd.canUse(player))
|
||||||
throw new RunException("Command '%s' can not be used", args[0]);
|
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) {
|
public Iterable<String> complete(Proxy proxy, ProxyHandler player, String[] args, String[] serverMatches) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue