mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-15 12:01:51 +01:00
Add ability to show a per-command usage + apply "correct indentation".
This commit is contained in:
parent
1aa62de1dd
commit
9b6c717fc0
@ -95,6 +95,9 @@ public abstract class AbstractCommand<A> implements TabExecutor{
|
||||
/** Aliases for the command label. */
|
||||
protected final String[] aliases;
|
||||
|
||||
/** This is only shown if a parent command receives false for onCommand and if it is not null. */
|
||||
protected String usage = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param access
|
||||
@ -176,7 +179,13 @@ public abstract class AbstractCommand<A> implements TabExecutor{
|
||||
sender.sendMessage(ChatColor.DARK_RED + "You don't have permission.");
|
||||
return true;
|
||||
}
|
||||
return subCommand.onCommand(sender, command, alias, args);
|
||||
final boolean res = subCommand.onCommand(sender, command, alias, args);
|
||||
if (!res && subCommand.usage != null) {
|
||||
sender.sendMessage(subCommand.usage);
|
||||
return true;
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Usage.
|
||||
|
Loading…
Reference in New Issue
Block a user