geforkt von Mirrors/Velocity
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
|
ArgumentCommandNode<CommandSource, String> serverNode = RequiredArgumentBuilder
|
||||||
.<CommandSource, String>argument(SERVER_ARG, StringArgumentType.string())
|
.<CommandSource, String>argument(SERVER_ARG, StringArgumentType.string())
|
||||||
.suggests((context, builder) -> {
|
.suggests((context, builder) -> {
|
||||||
|
String argument = context.getArguments().containsKey(SERVER_ARG)
|
||||||
|
? context.getArgument(SERVER_ARG, String.class)
|
||||||
|
: "";
|
||||||
for (RegisteredServer server : server.getAllServers()) {
|
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();
|
return builder.buildFuture();
|
||||||
})
|
})
|
||||||
.executes(this::serverCount)
|
.executes(this::serverCount)
|
||||||
|
@ -56,21 +56,35 @@ public class SendCommand {
|
|||||||
.executes(this::usage)
|
.executes(this::usage)
|
||||||
.build();
|
.build();
|
||||||
ArgumentCommandNode<CommandSource, String> playerNode = RequiredArgumentBuilder
|
ArgumentCommandNode<CommandSource, String> playerNode = RequiredArgumentBuilder
|
||||||
.<CommandSource, String>argument("player", StringArgumentType.word())
|
.<CommandSource, String>argument(PLAYER_ARG, StringArgumentType.word())
|
||||||
.suggests((context, builder) -> {
|
.suggests((context, builder) -> {
|
||||||
|
String argument = context.getArguments().containsKey(PLAYER_ARG)
|
||||||
|
? context.getArgument(PLAYER_ARG, String.class)
|
||||||
|
: "";
|
||||||
for (Player player : server.getAllPlayers()) {
|
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();
|
return builder.buildFuture();
|
||||||
})
|
})
|
||||||
.executes(this::usage)
|
.executes(this::usage)
|
||||||
.build();
|
.build();
|
||||||
ArgumentCommandNode<CommandSource, String> serverNode = RequiredArgumentBuilder
|
ArgumentCommandNode<CommandSource, String> serverNode = RequiredArgumentBuilder
|
||||||
.<CommandSource, String>argument("server", StringArgumentType.word())
|
.<CommandSource, String>argument(SERVER_ARG, StringArgumentType.word())
|
||||||
.suggests((context, builder) -> {
|
.suggests((context, builder) -> {
|
||||||
|
String argument = context.getArguments().containsKey(SERVER_ARG)
|
||||||
|
? context.getArgument(SERVER_ARG, String.class)
|
||||||
|
: "";
|
||||||
for (RegisteredServer server : server.getAllServers()) {
|
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();
|
return builder.buildFuture();
|
||||||
})
|
})
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren