mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-29 12:37:40 +01:00
Fix tab completions not being returned for empty strings (#538)
This commit is contained in:
parent
175a21c0e4
commit
3e8f7911af
@ -40,6 +40,7 @@ import org.bukkit.command.TabExecutor;
|
||||
import java.util.List;
|
||||
|
||||
public class BukkitCommandExecutor extends CommandManager implements CommandExecutor, TabExecutor {
|
||||
private static final Splitter TAB_COMPLETE_ARGUMENT_SPLITTER = Splitter.on(COMMAND_SEPARATOR_PATTERN);
|
||||
private static final Splitter ARGUMENT_SPLITTER = Splitter.on(COMMAND_SEPARATOR_PATTERN).omitEmptyStrings();
|
||||
private static final Joiner ARGUMENT_JOINER = Joiner.on(' ');
|
||||
|
||||
@ -62,7 +63,7 @@ public class BukkitCommandExecutor extends CommandManager implements CommandExec
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
||||
Sender lpSender = plugin.getSenderFactory().wrap(sender);
|
||||
List<String> arguments = Util.stripQuotes(ARGUMENT_SPLITTER.splitToList(ARGUMENT_JOINER.join(args)));
|
||||
List<String> arguments = Util.stripQuotes(TAB_COMPLETE_ARGUMENT_SPLITTER.splitToList(ARGUMENT_JOINER.join(args)));
|
||||
|
||||
return onTabComplete(lpSender, arguments);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ import net.md_5.bungee.api.plugin.TabExecutor;
|
||||
import java.util.List;
|
||||
|
||||
public class BungeeCommandExecutor extends Command implements TabExecutor {
|
||||
private static final Splitter TAB_COMPLETE_ARGUMENT_SPLITTER = Splitter.on(CommandManager.COMMAND_SEPARATOR_PATTERN);
|
||||
private static final Splitter ARGUMENT_SPLITTER = Splitter.on(CommandManager.COMMAND_SEPARATOR_PATTERN).omitEmptyStrings();
|
||||
private static final Joiner ARGUMENT_JOINER = Joiner.on(' ');
|
||||
|
||||
@ -62,7 +63,7 @@ public class BungeeCommandExecutor extends Command implements TabExecutor {
|
||||
@Override
|
||||
public Iterable<String> onTabComplete(CommandSender sender, String[] args) {
|
||||
Sender lpSender = plugin.getSenderFactory().wrap(sender);
|
||||
List<String> arguments = Util.stripQuotes(ARGUMENT_SPLITTER.splitToList(ARGUMENT_JOINER.join(args)));
|
||||
List<String> arguments = Util.stripQuotes(TAB_COMPLETE_ARGUMENT_SPLITTER.splitToList(ARGUMENT_JOINER.join(args)));
|
||||
|
||||
return manager.onTabComplete(lpSender, arguments);
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class SpongeCommandExecutor extends CommandManager implements CommandCallable {
|
||||
private static final Splitter TAB_COMPLETE_ARGUMENT_SPLITTER = Splitter.on(COMMAND_SEPARATOR_PATTERN);
|
||||
private static final Splitter ARGUMENT_SPLITTER = Splitter.on(COMMAND_SEPARATOR_PATTERN).omitEmptyStrings();
|
||||
|
||||
private final LPSpongePlugin plugin;
|
||||
@ -68,7 +69,7 @@ public class SpongeCommandExecutor extends CommandManager implements CommandCall
|
||||
@Override
|
||||
public List<String> getSuggestions(CommandSource source, String s, @Nullable Location<World> location) {
|
||||
Sender lpSender = plugin.getSenderFactory().wrap(source);
|
||||
List<String> arguments = processSelectors(source, Util.stripQuotes(ARGUMENT_SPLITTER.splitToList(s)));
|
||||
List<String> arguments = processSelectors(source, Util.stripQuotes(TAB_COMPLETE_ARGUMENT_SPLITTER.splitToList(s)));
|
||||
|
||||
return onTabComplete(lpSender, arguments);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user