mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-27 05:00:08 +08:00
Simplified CommandsManager.getUsage.
This commit is contained in:
parent
259003d030
commit
11dadd7417
@ -244,25 +244,18 @@ public Map<String, String> getCommands() {
|
|||||||
protected String getUsage(String[] args, int level, Command cmd) {
|
protected String getUsage(String[] args, int level, Command cmd) {
|
||||||
StringBuilder command = new StringBuilder();
|
StringBuilder command = new StringBuilder();
|
||||||
|
|
||||||
command.append("/");
|
command.append('/');
|
||||||
|
|
||||||
for (int i = 0; i <= level; ++i) {
|
for (int i = 0; i <= level; ++i) {
|
||||||
command.append(args[i] + " ");
|
command.append(args[i]);
|
||||||
|
command.append(' ');
|
||||||
}
|
}
|
||||||
if (cmd.flags().length() > 0) {
|
if (cmd.flags().length() > 0) {
|
||||||
List<Character> flagChars = new ArrayList<Character>();
|
String flags = cmd.flags().replaceAll(".:", "");
|
||||||
char[] flags = cmd.flags().toCharArray();
|
if (flags.length() > 0) {
|
||||||
for (int i = 0; i < flags.length; ++i) {
|
|
||||||
if (flags.length > i + 1 && flags[i + 1] == ':') {
|
|
||||||
i++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
flagChars.add(flags[i]);
|
|
||||||
}
|
|
||||||
if (flagChars.size() > 0) {
|
|
||||||
command.append("[-");
|
command.append("[-");
|
||||||
for (char character : flagChars) {
|
for (int i = 0; i < flags.length(); ++i) {
|
||||||
command.append(character);
|
command.append(flags.charAt(i));
|
||||||
}
|
}
|
||||||
command.append("] ");
|
command.append("] ");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user