geforkt von Mirrors/Velocity
Fix "all" not appearing in the tab-complete for /server
Dieser Commit ist enthalten in:
Ursprung
9c9fa1c5ae
Commit
138a887d73
@ -17,6 +17,7 @@ import java.util.Comparator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import net.kyori.text.TextComponent;
|
import net.kyori.text.TextComponent;
|
||||||
import net.kyori.text.event.ClickEvent;
|
import net.kyori.text.event.ClickEvent;
|
||||||
import net.kyori.text.format.TextColor;
|
import net.kyori.text.format.TextColor;
|
||||||
@ -93,13 +94,12 @@ public class ServerCommand implements Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> suggest(CommandSource source, String @NonNull [] currentArgs) {
|
public List<String> suggest(CommandSource source, String @NonNull [] currentArgs) {
|
||||||
|
Stream<String> possibilities = Stream.concat(Stream.of("all"), server.getAllServers()
|
||||||
|
.stream().map(rs -> rs.getServerInfo().getName()));
|
||||||
if (currentArgs.length == 0) {
|
if (currentArgs.length == 0) {
|
||||||
return server.getAllServers().stream()
|
return possibilities.collect(Collectors.toList());
|
||||||
.map(rs -> rs.getServerInfo().getName())
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
} else if (currentArgs.length == 1) {
|
} else if (currentArgs.length == 1) {
|
||||||
return server.getAllServers().stream()
|
return possibilities
|
||||||
.map(rs -> rs.getServerInfo().getName())
|
|
||||||
.filter(name -> name.regionMatches(true, 0, currentArgs[0], 0, currentArgs[0].length()))
|
.filter(name -> name.regionMatches(true, 0, currentArgs[0], 0, currentArgs[0].length()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren