SteamWar/SpigotCore
Archiviert
13
0

Optimize imports SubCommand

Dieser Commit ist enthalten in:
yoyosource 2021-03-25 20:10:50 +01:00
Ursprung ed0ee1b0a7
Commit 1b10c96dc6

Datei anzeigen

@ -21,7 +21,6 @@ package de.steamwar.command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Parameter; import java.lang.reflect.Parameter;
@ -107,16 +106,16 @@ class SubCommand {
List<String> tabComplete(CommandSender commandSender, String[] args) { List<String> tabComplete(CommandSender commandSender, String[] args) {
List<String> argsList = Arrays.asList(args); List<String> argsList = Arrays.asList(args);
for (int i = 0; i < subCommand.length; i++) { for (String value : subCommand) {
String s = argsList.remove(0); String s = argsList.remove(0);
if (argsList.isEmpty()) return Collections.singletonList(subCommand[i]); if (argsList.isEmpty()) return Collections.singletonList(value);
if (!subCommand[i].equals(s)) return Collections.emptyList(); if (!value.equals(s)) return Collections.emptyList();
} }
for (int i = 0; i < arguments.length; i++) { for (TypeMapper<?> argument : arguments) {
String s = argsList.remove(0); String s = argsList.remove(0);
if (argsList.isEmpty()) return arguments[i].tabCompletes(s); if (argsList.isEmpty()) return argument.tabCompletes(s);
try { try {
arguments[i].map(s); argument.map(s);
} catch (Exception e) { } catch (Exception e) {
return Collections.emptyList(); return Collections.emptyList();
} }