Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-25 15:50:19 +01:00
Improve tab completion of glist and send command (#1126)
Dieser Commit ist enthalten in:
Ursprung
81145e45df
Commit
9b71564c5b
@ -66,10 +66,18 @@ public class GlistCommand {
|
||||
ArgumentCommandNode<CommandSource, String> serverNode = RequiredArgumentBuilder
|
||||
.<CommandSource, String>argument(SERVER_ARG, StringArgumentType.string())
|
||||
.suggests((context, builder) -> {
|
||||
String argument = context.getArguments().containsKey(SERVER_ARG)
|
||||
? context.getArgument(SERVER_ARG, String.class)
|
||||
: "";
|
||||
for (RegisteredServer server : server.getAllServers()) {
|
||||
builder.suggest(server.getServerInfo().getName());
|
||||
String serverName = server.getServerInfo().getName();
|
||||
if (serverName.regionMatches(true, 0, argument, 0, argument.length())) {
|
||||
builder.suggest(serverName);
|
||||
}
|
||||
}
|
||||
if ("all".regionMatches(true, 0, argument, 0, argument.length())) {
|
||||
builder.suggest("all");
|
||||
}
|
||||
builder.suggest("all");
|
||||
return builder.buildFuture();
|
||||
})
|
||||
.executes(this::serverCount)
|
||||
|
@ -56,21 +56,35 @@ public class SendCommand {
|
||||
.executes(this::usage)
|
||||
.build();
|
||||
ArgumentCommandNode<CommandSource, String> playerNode = RequiredArgumentBuilder
|
||||
.<CommandSource, String>argument("player", StringArgumentType.word())
|
||||
.<CommandSource, String>argument(PLAYER_ARG, StringArgumentType.word())
|
||||
.suggests((context, builder) -> {
|
||||
String argument = context.getArguments().containsKey(PLAYER_ARG)
|
||||
? context.getArgument(PLAYER_ARG, String.class)
|
||||
: "";
|
||||
for (Player player : server.getAllPlayers()) {
|
||||
builder.suggest(player.getUsername());
|
||||
String playerName = player.getUsername();
|
||||
if (playerName.regionMatches(true, 0, argument, 0, argument.length())) {
|
||||
builder.suggest(playerName);
|
||||
}
|
||||
}
|
||||
if ("all".regionMatches(true, 0, argument, 0, argument.length())) {
|
||||
builder.suggest("all");
|
||||
}
|
||||
builder.suggest("all");
|
||||
return builder.buildFuture();
|
||||
})
|
||||
.executes(this::usage)
|
||||
.build();
|
||||
ArgumentCommandNode<CommandSource, String> serverNode = RequiredArgumentBuilder
|
||||
.<CommandSource, String>argument("server", StringArgumentType.word())
|
||||
.<CommandSource, String>argument(SERVER_ARG, StringArgumentType.word())
|
||||
.suggests((context, builder) -> {
|
||||
String argument = context.getArguments().containsKey(SERVER_ARG)
|
||||
? context.getArgument(SERVER_ARG, String.class)
|
||||
: "";
|
||||
for (RegisteredServer server : server.getAllServers()) {
|
||||
builder.suggest(server.getServerInfo().getName());
|
||||
String serverName = server.getServerInfo().getName();
|
||||
if (serverName.regionMatches(true, 0, argument, 0, argument.length())) {
|
||||
builder.suggest(serverName);
|
||||
}
|
||||
}
|
||||
return builder.buildFuture();
|
||||
})
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren