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

@@ -8,6 +8,7 @@ import net.william278.huskhomes.util.RegexUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -68,7 +69,7 @@ public class PublicHomeCommand extends CommandBase implements TabCompletable, Co
final List<String> publicHomes = new ArrayList<>();
plugin.getCache().publicHomes.forEach((ownerName, homeNames) ->
homeNames.forEach(homeName -> publicHomes.add(ownerName + "." + homeName)));
return publicHomes.stream().filter(publicHomeIdentifier ->
return args.length > 1 ? Collections.emptyList() : publicHomes.stream().filter(publicHomeIdentifier ->
publicHomeIdentifier.split(Pattern.quote("."))[1].toLowerCase()
.startsWith(args.length >= 1 ? args[0].toLowerCase() : ""))
.sorted().collect(Collectors.toList());