Don't ask for player
This commit is contained in:
parent
56010fb9ad
commit
8d6efe0265
|
|
@ -31,21 +31,6 @@ public class Report {
|
||||||
LiteralCommandNode<CommandSource> command = LiteralArgumentBuilder
|
LiteralCommandNode<CommandSource> command = LiteralArgumentBuilder
|
||||||
.<CommandSource>literal("report")
|
.<CommandSource>literal("report")
|
||||||
.requires(ctx -> ctx.hasPermission("command.chat.report"))
|
.requires(ctx -> ctx.hasPermission("command.chat.report"))
|
||||||
.then(RequiredArgumentBuilder.<CommandSource, String>argument("username", StringArgumentType.string())
|
|
||||||
.suggests((context, builder) -> {
|
|
||||||
Collection<String> possibleValues = new ArrayList<>();
|
|
||||||
for (Player player : proxyServer.getAllPlayers()) {
|
|
||||||
possibleValues.add(player.getGameProfile().getName());
|
|
||||||
}
|
|
||||||
if(possibleValues.isEmpty()) return Suggestions.empty();
|
|
||||||
String remaining = builder.getRemaining().toLowerCase();
|
|
||||||
for (String str : possibleValues) {
|
|
||||||
if (str.toLowerCase().startsWith(remaining)) {
|
|
||||||
builder.suggest(StringArgumentType.escapeIfRequired(str));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return builder.buildFuture();
|
|
||||||
})
|
|
||||||
.then(RequiredArgumentBuilder
|
.then(RequiredArgumentBuilder
|
||||||
.<CommandSource, String>argument("report", StringArgumentType.greedyString())
|
.<CommandSource, String>argument("report", StringArgumentType.greedyString())
|
||||||
.executes(context -> {
|
.executes(context -> {
|
||||||
|
|
@ -79,7 +64,6 @@ public class Report {
|
||||||
return 1;
|
return 1;
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
|
||||||
.executes(context -> 0)
|
.executes(context -> 0)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user