Tweak TAB completion

This commit is contained in:
William committed 2022-08-17 23:12:43 +01:00
1 parent 629188a6c2
commit 435a9b9dff
4 files changed
+10 -6

No files matched your search

@@ -6,6 +6,7 @@ import net.william278.huskhomes.util.Permission;
import net.william278.huskhomes.util.RegexUtil;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -51,7 +52,7 @@ public class HomeCommand extends CommandBase implements TabCompletable, ConsoleE
@Override
public @NotNull List<String> onTabComplete(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
return plugin.getCache().homes.get(onlineUser.uuid).stream()
return args.length > 1 ? Collections.emptyList() : plugin.getCache().homes.get(onlineUser.uuid).stream()
.filter(s -> s.toLowerCase().startsWith(args.length >= 1 ? args[0].toLowerCase() : ""))
.sorted().collect(Collectors.toList());
}