question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Subcommand Completion

See original GitHub issue

Maybe I’m too stupid, but I don’t get my command to tab-complete my subcommand names.

For example I have the following command:

@CommandAlias("test")
public class TestCommand extends BaseCommand {

   @Subcommand("bla")
   public final void onBla(CommandSender sender) {
      sender.sendMessage(ChatColor.AQUA + "Bla");
   }

   @Subcommand("lol")
   public void onLOL(CommandSender sender) {
      sender.sendMessage(ChatColor.GREEN + "LOL");
   }
}

Plugin:

public final class TestPlugin extends JavaPlugin {

    private PaperCommandManager commandManager;

    @Override
    public void onEnable() {
        this.registerCommands();
    }

    private void registerCommands() {
        this.commandManager = new PaperCommandManager(this);

        this.commandManager.registerCommand(new TestCommand());
    }
}

How can I setup completion, so that, when I type /test in minecraft, there appear the two completions bla and lol?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
aikarcommented, Jan 18, 2019

this is a known issue im going to be debugging tonight. it actually works on console, just not in game… I gotta figure out what the difference is (I’m actually suspecting bungee might be related)

0reactions
aikarcommented, Feb 5, 2019

@js6pak please update to Paper 515+ to fix that bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I autocomplete nested, multi-level subcommands?
I am trying to develop an autocomplete or tab-complete feature for my own set of commands. For example, assume foo is my binary:...
Read more >
writing bash completion script with subcommands
Following along from my last post, I'm going to detail how to write bash completion scripts for deeply nested subcommands.
Read more >
Writing zsh completions for CLIs with subcommands - DoltHub
Here's the key to getting subcommands working in a zsh completion script without tearing your hair out: the top-level completion function and ...
Read more >
Make completions for subcommands easier to add · Issue #7107
The current way to add completions for subcommands of a command, as can be seen from the default completions in share/completions, ...
Read more >
Completion Tool - 4.x - CakePHP Cookbook
The Completion Shell consists of a number of sub commands to assist the developer creating its completion script. ... bin/cake Completion subcommands bake....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found