From a5b9c7b3ee2bca1b5362e930ac49aaf09d26a9f8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 28 Dec 2018 10:34:51 +1100 Subject: [PATCH] Use API method to create offset command completions --- .../org/bukkit/craftbukkit/command/BukkitCommandWrapper.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java index acd3f17c67..5f33c9e52a 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java @@ -48,9 +48,8 @@ public class BukkitCommandWrapper implements com.mojang.brigadier.Command getSuggestions(CommandContext context, SuggestionsBuilder builder) throws CommandSyntaxException { List 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 - builder.start = builder.getInput().lastIndexOf(' ') + 1; - builder.remaining = builder.getInput().substring(builder.start); + // Defaults to sub nodes, but we have just one giant args node, so offset accordingly + builder = builder.createOffset(builder.getInput().lastIndexOf(' ') + 1); for (String s : results) { builder.suggest(s);