CommandAPI icon indicating copy to clipboard operation
CommandAPI copied to clipboard

[SUGGESTION] Allow registration of commands that point to subcommands

Open Asleeepp opened this issue 1 year ago • 5 comments

Description

I think it'd be nice if CommandAPI allowed you to register a command directly from a subcommand, say you have a gamemode command, and you also want to make a shortened version like /gmc, you could just register it as a command in the SubCommand, sort of the same concept as an alias.

Expected code

new CommandAPICommand("gamemode")
     .withSubcommand(new CommandAPICommand("creative")
             .withDirectCommand("gmc")
             // stuff

Extra details

No response

Asleeepp avatar Aug 08 '24 16:08 Asleeepp

withDirectCommand looks like it only supports a single direct command (withDirectCommand(String directCommand)). I would suggest changing it to something plural and supporting multiple aliases, e.g., withDirectAliases(String... directAliases).

Timongcraft avatar Aug 08 '24 16:08 Timongcraft

It would also be nice if you could somehow specify a specific usage, etc.

Timongcraft avatar Aug 08 '24 17:08 Timongcraft

withDirectCommand looks like it only supports a single direct command (withDirectCommand(String directCommand)). I would suggest changing it to something plural and supporting multiple aliases, e.g., withDirectAliases(String... directAliases).

I personally am not a fan of the name .withDirectAliases, i don't think it portrays the fact that its registering a command, and not an alias, if that makes sense

Asleeepp avatar Aug 08 '24 20:08 Asleeepp

withDirectCommand looks like it only supports a single direct command (withDirectCommand(String directCommand)). I would suggest changing it to something plural and supporting multiple aliases, e.g., withDirectAliases(String... directAliases).

I personally am not a fan of the name .withDirectAliases, i don't think it portrays the fact that its registering a command, and not an alias, if that makes sense

I would prefer using 'aliases' since the term is already associated with commands. Although vanilla doesn't have aliases, the CommandAPI has created a dummy command as an alias, which I think fits quite well.

Timongcraft avatar Aug 08 '24 20:08 Timongcraft

I personally do agree with @Timongcraft, the term "alias" fits quite well here as you're setting an alias for a certain command path.

DerEchtePilz avatar Aug 08 '24 20:08 DerEchtePilz