Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 18:40:05 +01:00
Fixed incorrect help messages for nested commands.
Dieser Commit ist enthalten in:
Ursprung
ee4c1141c5
Commit
dfc7d074bd
@ -21,10 +21,10 @@ package com.sk89q.minecraft.util.commands;
|
|||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import com.sk89q.util.StringUtil;
|
import com.sk89q.util.StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -174,7 +174,7 @@ public class CommandsManager {
|
|||||||
|
|
||||||
command.append("<");
|
command.append("<");
|
||||||
|
|
||||||
List<String> allowedCommands = new ArrayList<String>();
|
Set<String> allowedCommands = new HashSet<String>();
|
||||||
|
|
||||||
for (Map.Entry<String, Method> entry : map.entrySet()) {
|
for (Map.Entry<String, Method> entry : map.entrySet()) {
|
||||||
Method childMethod = entry.getValue();
|
Method childMethod = entry.getValue();
|
||||||
@ -232,7 +232,7 @@ public class CommandsManager {
|
|||||||
if (parent == null) { // Root
|
if (parent == null) { // Root
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
player.printError(getNestedUsage(args, level - 1, method, player));
|
player.printError(getNestedUsage(args, level - 1, parent, player));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
package com.sk89q.util;
|
package com.sk89q.util;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String utilities.
|
* String utilities.
|
||||||
@ -144,14 +144,22 @@ public class StringUtil {
|
|||||||
* @param initialIndex
|
* @param initialIndex
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String joinString(List<String> str, String delimiter,
|
public static String joinString(Collection<?> str, String delimiter,
|
||||||
int initialIndex) {
|
int initialIndex) {
|
||||||
if (str.size() == 0) {
|
if (str.size() == 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
StringBuilder buffer = new StringBuilder(str.get(initialIndex).toString());
|
StringBuilder buffer = new StringBuilder();
|
||||||
for (int i = initialIndex + 1; i < str.size(); i++) {
|
int i = 0;
|
||||||
buffer.append(delimiter).append(str.get(i).toString());
|
for (Object o : str) {
|
||||||
|
if (i >= initialIndex) {
|
||||||
|
if (i > 0) {
|
||||||
|
buffer.append(delimiter);
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer.append(o.toString());
|
||||||
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren