From 138a887d739d68cc2c1b8a48bfaee3fa2c9b0540 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 15 Sep 2019 19:54:33 -0400 Subject: [PATCH] Fix "all" not appearing in the tab-complete for /server --- .../velocitypowered/proxy/command/ServerCommand.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/command/ServerCommand.java b/proxy/src/main/java/com/velocitypowered/proxy/command/ServerCommand.java index b94cc34fb..b79d955bf 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/command/ServerCommand.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/command/ServerCommand.java @@ -17,6 +17,7 @@ import java.util.Comparator; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; +import java.util.stream.Stream; import net.kyori.text.TextComponent; import net.kyori.text.event.ClickEvent; import net.kyori.text.format.TextColor; @@ -93,13 +94,12 @@ public class ServerCommand implements Command { @Override public List suggest(CommandSource source, String @NonNull [] currentArgs) { + Stream possibilities = Stream.concat(Stream.of("all"), server.getAllServers() + .stream().map(rs -> rs.getServerInfo().getName())); if (currentArgs.length == 0) { - return server.getAllServers().stream() - .map(rs -> rs.getServerInfo().getName()) - .collect(Collectors.toList()); + return possibilities.collect(Collectors.toList()); } else if (currentArgs.length == 1) { - return server.getAllServers().stream() - .map(rs -> rs.getServerInfo().getName()) + return possibilities .filter(name -> name.regionMatches(true, 0, currentArgs[0], 0, currentArgs[0].length())) .collect(Collectors.toList()); } else {