How to mimic vanilla command suggestions?

Discussion in 'Plugin Development' started by JimiIT92, Nov 10, 2022.

Thread Status:
Not open for further replies.
  1. Offline


    Hello everyone :D I'm messing around with tab completions for commands and was wondering: is there any way to mimic how vanilla tab completions works?
    Let me explain:
    In vanilla if you type a wrong argument for a command you are immediately blocked from going forward. For example, if you start typing the /time command and use something like 'blabla' as subcommand, you are blocked and notified immediately that 'blabla' is not a valid subcommand

    Now, in my plugin I've created a command which takes some subcommads.
    Specifically I have a /blazepoints add command which takes a numeric input. However if I type something that is not a valid argument (in this case a string), nothing stops me until I actually send the command and see an error


    So, is it possible to notify the user about any error in the arguments they are passing _before_ actually sending the command?

    Also: how can I suggest a JSON input, like the /tellraw command, and check at any point if that json is valid?
    For example, in the tellraw command, as long as you type a valid property for the JSON it takes it prompts you with the suggestion
    However as soon as you type an unknown property you get the error

    Attached Files:

  2. Offline


    Yes a TabCompleter has a CommandSender which you can call .sendMessage on.
  3. Offline


    @JimiIT92 I believe what you're looking for is Brigadier, the open-source library by Mojang.
Thread Status:
Not open for further replies.

Share This Page