mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 17:57:38 +00:00
Added support for help text to be shown on syntax errors and such.
This commit is contained in:
parent
fcb7e62cb0
commit
6764704c22
@ -67,4 +67,9 @@ public @interface Command {
|
|||||||
* meaning that if it is given it must have a value
|
* meaning that if it is given it must have a value
|
||||||
*/
|
*/
|
||||||
String flags() default "";
|
String flags() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A long description for the command.
|
||||||
|
*/
|
||||||
|
String help() default "";
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ public abstract class CommandsManager<T> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected String getUsage(String[] args, int level, Command cmd) {
|
protected String getUsage(String[] args, int level, Command cmd) {
|
||||||
StringBuilder command = new StringBuilder();
|
final StringBuilder command = new StringBuilder();
|
||||||
|
|
||||||
command.append('/');
|
command.append('/');
|
||||||
|
|
||||||
@ -262,6 +262,12 @@ public abstract class CommandsManager<T> {
|
|||||||
}
|
}
|
||||||
command.append(cmd.usage());
|
command.append(cmd.usage());
|
||||||
|
|
||||||
|
final String help = cmd.help();
|
||||||
|
if (!help.isEmpty()) {
|
||||||
|
command.append("\n\n");
|
||||||
|
command.append(help);
|
||||||
|
}
|
||||||
|
|
||||||
return command.toString();
|
return command.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user