Fix the TypeCombined Bug

This commit is contained in:
Olof Larsson 2016-02-10 01:02:45 +01:00
parent 7d2470b5aa
commit ecd30dfa96

View File

@ -212,25 +212,20 @@ public abstract class TypeCombined<T> extends TypeAbstract<T>
// TAB LIST // TAB LIST
// -------------------------------------------- // // -------------------------------------------- //
// TODO: Madus is the master of tab completion.
// TODO: Please help me make this work for other separators than spaces.
@Override @Override
public Collection<String> getTabList(CommandSender sender, String arg) public Collection<String> getTabList(CommandSender sender, String arg)
{ {
Type<?> innerType = this.getLastType(arg); Type<?> innerType = this.getLastType(arg);
if (innerType == null) return Collections.emptyList(); if (innerType == null) return Collections.emptyList();
String innerArg = this.getLastArg(arg); String innerArg = this.getLastArg(arg);
return innerType.getTabList(sender, innerArg); String prefix = arg.substring(0, arg.length() - innerArg.length());
} List<String> strings = innerType.getTabListFiltered(sender, innerArg);
List<String> ret = new MassiveList<String>();
@Override for (String string : strings)
public List<String> getTabListFiltered(CommandSender sender, String arg) {
{ ret.add(prefix + string);
Type<?> innerType = this.getLastType(arg); }
if (innerType == null) return Collections.emptyList(); return ret;
String innerArg = this.getLastArg(arg);
return innerType.getTabListFiltered(sender, innerArg);
} }
@Override @Override