CommandAPI icon indicating copy to clipboard operation
CommandAPI copied to clipboard

Custom arguments with suggestions breaks all other suggestions along the same command path

Open JorelAli opened this issue 3 years ago • 0 comments

CommandAPI version

8.5.0

Minecraft version

1.19

Are you shading the CommandAPI?

No

What I did

  • Register the following commands:
    new CommandAPICommand("sug")
        .withArguments(new StringArgument("my_str_arg")
      	  .includeSuggestions(ArgumentSuggestions.strings("hello", "world")))
        .executes((sender, args) -> {
      	  Bukkit.broadcastMessage("Test");
        })
        .register();
    
    new CommandAPICommand("sug")
        .withArguments(new LocationArgument("my_loc_arg"))
        .executes((sender, args) -> {
      	  Bukkit.broadcastMessage("Test");
        })
        .register();
    
    Argument<String> myCustArg = new CustomArgument<>(
        new StringArgument("my_cust_arg"), info -> {
      	  return "cust_arg_result";
        })
        .includeSuggestions(ArgumentSuggestions.strings(info -> {
      	  return new String[] {"goodbye", "moon"};
        }));
    
    new CommandAPICommand("sug")
        .withArguments(myCustArg)
        .executes((sender, args) -> {
      	  Bukkit.broadcastMessage("Test");
        })
        .register();
    
  • Type /sug in-game

What actually happened

No suggestions are displayed

What should have happened

The following suggestions should be displayed:

  • hello
  • world
  • goodbye
  • moon
  • ~
  • ~ ~
  • ~ ~ ~

Server logs and CommandAPI config

No response

Other

If you register the first two commands (with my_str_arg and my_loc_arg), suggestions work as intended. The introduction of the custom argument breaks all existing suggestions for some reason.

JorelAli avatar Aug 04 '22 10:08 JorelAli