Add TypeMapper.tabCompletes with previous TabCompletes
Dieser Commit ist enthalten in:
Ursprung
9436616440
Commit
7bc47a8997
@ -138,7 +138,7 @@ public class SWCommandUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tabCompletes(CommandSender commandSender, String s) {
|
public List<String> tabCompletes(CommandSender commandSender, String[] previous, String s) {
|
||||||
return tabCompleter.apply(commandSender, s);
|
return tabCompleter.apply(commandSender, s);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -112,7 +112,7 @@ class SubCommand {
|
|||||||
}
|
}
|
||||||
for (TypeMapper<?> argument : arguments) {
|
for (TypeMapper<?> argument : arguments) {
|
||||||
String s = argsList.remove(0);
|
String s = argsList.remove(0);
|
||||||
if (argsList.isEmpty()) return argument.tabCompletes(commandSender, s);
|
if (argsList.isEmpty()) return argument.tabCompletes(commandSender, Arrays.copyOf(args, args.length - 1), s);
|
||||||
try {
|
try {
|
||||||
if (argument.map(s) == null) {
|
if (argument.map(s) == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
@ -124,7 +124,7 @@ class SubCommand {
|
|||||||
if (varArgs && !argsList.isEmpty()) {
|
if (varArgs && !argsList.isEmpty()) {
|
||||||
while (!argsList.isEmpty()) {
|
while (!argsList.isEmpty()) {
|
||||||
String s = argsList.remove(0);
|
String s = argsList.remove(0);
|
||||||
if (argsList.isEmpty()) return arguments[arguments.length - 1].tabCompletes(commandSender, s);
|
if (argsList.isEmpty()) return arguments[arguments.length - 1].tabCompletes(commandSender, Arrays.copyOf(args, args.length - 1), s);
|
||||||
try {
|
try {
|
||||||
arguments[arguments.length - 1].map(s);
|
arguments[arguments.length - 1].map(s);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -26,5 +26,5 @@ import java.util.List;
|
|||||||
public interface TypeMapper<T> {
|
public interface TypeMapper<T> {
|
||||||
T map(String s);
|
T map(String s);
|
||||||
|
|
||||||
List<String> tabCompletes(CommandSender commandSender, String s);
|
List<String> tabCompletes(CommandSender commandSender, String[] previousArguments, String s);
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren