Sponge: Subcommands don't show proper suggestions or hint text

Created on 18 Oct 2015  路  9Comments  路  Source: SpongePowered/Sponge

Given some command a with a sub command b which takes arguments c d the following will occur:

/a b
<press tab>
/a b b

The expected behaviour is to list the options for C, not list the sub command again. Additionally, the hint text will be wrong.
Given the input:

/a b b

You will receive:

Input command b was not a valid subcommand!
b b
^
Usage: /a b 

Which does not help the user what so ever.

command bug

All 9 comments

@zml2008 Anything on this?

this is a known issue due to how trimming is handled on command arguments. I think there's already an issue dealing with it.

Related: #49

Not able to reproduce using bleeding branch.

I'm not sure if this was fixed with the related issue or by #1305, but it can be closed.

I remember asking dualspiral about this a few weeks ago, what commands did you test this with @ImMorpheus ? last time I checked /sponge subcommands still had this issue

image

Code:

    @Listener
    public void onServerStart(GameStartedServerEvent event) {
        CommandSpec b = CommandSpec.builder()
                .arguments(
                        GenericArguments.onlyOne(GenericArguments.player(Text.of("player"))),
                        GenericArguments.onlyOne(GenericArguments.string(Text.of("message"))))
                .executor(((src, args) -> {
                    src.sendMessage(Text.of(args.getOne("message")));
                    return CommandResult.success();
                }))
                .build();


        CommandSpec a = CommandSpec.builder()
                .arguments(GenericArguments.none())
                .child(b, "test")
                .build();

        Sponge.getCommandManager().register(this, a,  "pr");

    }

"/pr test < press tab >" didn't list the subcommand again, but the options for c (player list in this case)

"/pr test test" returned "No values matching pattern test present for player!" (expected behavior)

Thanks, closing this then.

@ImMorpheus there is some ambiguity over whether you would be expected to do /pr test<tab><tab> or /pr test<space><tab><tab>

Have you tested both? From memory one worked, one didn't but that may have well been addressed in my PR.

I tested both.
I also tried with a sponge subcommand (since phit mentioned them), specifically /sponge tps, no issues so far.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

XakepSDK picture XakepSDK  路  5Comments

Eufranio picture Eufranio  路  4Comments

Rasgnarok picture Rasgnarok  路  4Comments

nikosgram picture nikosgram  路  3Comments

jeffreykog picture jeffreykog  路  4Comments