Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command literal aliases do not work with Brigadier #5

Open
Esophose opened this issue Dec 11, 2020 · 3 comments · May be fixed by #91
Open

Command literal aliases do not work with Brigadier #5

Esophose opened this issue Dec 11, 2020 · 3 comments · May be fixed by #91

Comments

@Esophose
Copy link

Esophose commented Dec 11, 2020

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
Copy link
Member

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
Copy link
Contributor

bergerkiller commented Dec 12, 2020

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
Copy link
Member

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.

@jpenilla jpenilla transferred this issue from Incendo/cloud Jan 15, 2024
metabrixkt added a commit to metabrixkt/cloud-minecraft that referenced this issue Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants