Add UUID tab completion with threshold.

This commit is contained in:
Olof Larsson 2016-02-13 14:45:44 +01:00
parent 1053646a45
commit fabf315bb5
2 changed files with 7 additions and 1 deletions

View File

@ -38,6 +38,8 @@ public abstract class TypeAbstract<T> implements Type<T>
public static final ChatColor COLOR_DEFAULT = ChatColor.YELLOW; public static final ChatColor COLOR_DEFAULT = ChatColor.YELLOW;
public static final ChatColor COLOR_NUMBER = ChatColor.LIGHT_PURPLE; public static final ChatColor COLOR_NUMBER = ChatColor.LIGHT_PURPLE;
public static final int TAB_LIST_UUID_THRESHOLD = 5;
// -------------------------------------------- // // -------------------------------------------- //
// META // META
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -155,10 +155,14 @@ public abstract class TypeSenderIdAbstract<T> extends TypeAbstract<T>
Set<String> ids = IdUtil.getIds(presence, type); Set<String> ids = IdUtil.getIds(presence, type);
// Step 4: Create Ret with visible names // Step 4: Create Ret with visible names
Set<String> ret = new MassiveSet<String>(ids.size()); boolean addIds = (arg.length() >= TAB_LIST_UUID_THRESHOLD);
int size = ids.size();
if (addIds) size *= 2;
Set<String> ret = new MassiveSet<String>(size);
for (String id : ids) for (String id : ids)
{ {
if ( ! Mixin.isVisible(id, sender)) continue; if ( ! Mixin.isVisible(id, sender)) continue;
if (addIds) ret.add(id);
String name = IdUtil.getName(id); String name = IdUtil.getName(id);
if (name == null) continue; if (name == null) continue;
ret.add(name); ret.add(name);