mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 06:50:25 +01:00
Use API method to create offset command completions
This commit is contained in:
parent
2bc7d1df25
commit
a5b9c7b3ee
1 changed files with 2 additions and 3 deletions
|
@ -48,9 +48,8 @@ public class BukkitCommandWrapper implements com.mojang.brigadier.Command<Comman
|
||||||
public CompletableFuture<Suggestions> getSuggestions(CommandContext<CommandListenerWrapper> context, SuggestionsBuilder builder) throws CommandSyntaxException {
|
public CompletableFuture<Suggestions> getSuggestions(CommandContext<CommandListenerWrapper> context, SuggestionsBuilder builder) throws CommandSyntaxException {
|
||||||
List<String> results = server.tabComplete(context.getSource().getBukkitSender(), builder.getInput(), context.getSource().getWorld(), context.getSource().getPosition(), true);
|
List<String> results = server.tabComplete(context.getSource().getBukkitSender(), builder.getInput(), context.getSource().getWorld(), context.getSource().getPosition(), true);
|
||||||
|
|
||||||
// These are normally only set based on sub nodes, but we have just one giant args node
|
// Defaults to sub nodes, but we have just one giant args node, so offset accordingly
|
||||||
builder.start = builder.getInput().lastIndexOf(' ') + 1;
|
builder = builder.createOffset(builder.getInput().lastIndexOf(' ') + 1);
|
||||||
builder.remaining = builder.getInput().substring(builder.start);
|
|
||||||
|
|
||||||
for (String s : results) {
|
for (String s : results) {
|
||||||
builder.suggest(s);
|
builder.suggest(s);
|
||||||
|
|
Loading…
Reference in a new issue