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