Incendo / cloud-minecraft

Integrations between Minecraft and Cloud Command Framework
https://cloud.incendo.org/minecraft/
MIT License
25 stars 8 forks source link

Command literal aliases do not work with Brigadier #5

Open Esophose opened 3 years ago

Esophose commented 3 years ago

Aliases of literal arguments do not show up in the command suggestions for Brigadier. The commands do, however, still work if you use the aliases. I had a little chat on the Discord server with a couple of the devs and found that this is intentional due to polluting the Brigadier command node map. I would recommend either documenting that this is intentional somewhere (the wiki perhaps?), or maybe add an option to enable this functionality explicitly since it has downsides.

Example code: https://pastebin.com/71hT3fSW Gif of executing the command with suggestions: https://gyazo.com/c78e08a403f6e95194e1574167e70990

jpenilla commented 3 years ago

Just for clarity, the issue here is with inner node aliases. Root node aliases work fine.

Working example (root node aliases): /example and /ex

Example with issue (inner node aliases): /example test and /example testalias

bergerkiller commented 3 years ago

I noticed this too and thought it was intentional. Personally I would do it like so:

  1. Only show the non-aliases as suggestions by default
  2. If none match with user input, only then consider aliases and show those.

Say my command is registered 'test' and alias is 'thetest', then /t will only suggest 'test' and typing /th will only suggest 'thetest'.

Was not aware this was only an issue with brigadier though.

Citymonstret commented 3 years ago

I noticed this too and thought it was intentional. Personally I would do it like so:

  1. Only show the non-aliases as suggestions by default
  2. If none match with user input, only then consider aliases and show those.

Say my command is registered 'test' and alias is 'thetest', then /t will only suggest 'test' and typing /th will only suggest 'thetest'.

Was not aware this was only an issue with brigadier though.

Brigadier would then show the entire command chain as invalid, as it's not aware of the alias literals. The literal suggestions are handled by the client. This would require the use of a custom argument.