1.16.5 TabCompleter Placeholder?

Discussion in 'Spigot Plugin Development' started by TaskID, Nov 15, 2020.

  1. Hi, how do I set a placeholder like on the picture below? So that I can't tab it, but I can see what argument is needed there.

    image.jpg
     
  2. NathanWolf

    Supporter

    Let me save you 20 minutes of your life, OP, that video doesn't have what you're looking for.

    Have you seen a plugin that does this? I am curious how to do it, too, but I don't think the TabExecutor API can do it. Anything you put in there will be a tab-complete option, not just a suggestion.
     
  3. Lee

    Lee

    You can simply add the string for the arg, this is how I would do it (class implements TabCompleter):
    Code (Java):
    if (args.length == 3) return StringUtil.copyPartialMatches(args[2], Collections.singletonList("[<command>]"), new ArrayList<>());
     
  4. Please read the whole thread before posting. As OP mentions, he doesn’t want default tab-completion, as the text shouldn’t be put into the command/tab-completable. He wants to use it as a suggestion without the player being able to actually tab-complete it.

    I personally have never done anything like this and am curious to see if someone else can answer it. I don’t think it is possible through the spigot API, you probably have to use Mojang’s brigadier API
     
    • Agree Agree x 2
    • Like Like x 1
  5. Lee

    Lee

    Well, when you type it disappears using my code but yes you can still tab-complete it. Maybe you would find this useful, I have not used it but it looks like it can do what you want: https://github.com/lucko/commodore