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

Is it possible to add a similar overload for the command? #147

Closed
KocTu4eK opened this issue Dec 31, 2021 · 24 comments
Closed

Is it possible to add a similar overload for the command? #147

KocTu4eK opened this issue Dec 31, 2021 · 24 comments

Comments

@KocTu4eK
Copy link

Is it possible to add an argument like this "add" and "stop" to the command overload?
image

@KocTu4eK
Copy link
Author

KocTu4eK commented Dec 31, 2021

No, you misunderstood me. I meant no <name: type> argument, just text like "add" and "stop".

@KocTu4eK
Copy link
Author

KocTu4eK commented Dec 31, 2021

for example, the camerashake command has two overloads: the first "add" and the second "stop".
"add" and "stop" do not have <op: string>, they are just text without <> and [].
image

@dreamguxiang
Copy link
Member

This may not be possible

@dreamguxiang
Copy link
Member

For example, MC's /gametest is the same,
image

@KocTu4eK
Copy link
Author

I hope there is a way, because without this it is impossible to beautifully implement different functionality for one team.

@dreamguxiang
Copy link
Member

dreamguxiang commented Dec 31, 2021

image
this?
image

@dreamguxiang
Copy link
Member

image
You can refer to this paragraph

@KocTu4eK
Copy link
Author

yes, thanks! I'll try it now

@KocTu4eK
Copy link
Author

KocTu4eK commented Dec 31, 2021

seems to work, but very strange.

here is my command:
image
image

and whatever I enter, the parser throws me on the inspect overload:
image
image

Upd: I guess the parser has priority for short commands ...

@dreamguxiang
Copy link
Member

With two String, BDS can't tell if it's the first or the second. This is no longer part of the LL discussion.

@dreamguxiang
Copy link
Member

dreamguxiang commented Dec 31, 2021

Please use back to enum, this may also be the reason why BDS uses that method internally

Sorry I couldn't help you.

@KocTu4eK
Copy link
Author

thanks for trying to help.

I hope that soon it will be possible to add something like "names" to overloads, like add & stop in camerashake, etc.

@xiaoqch
Copy link

xiaoqch commented Dec 31, 2021

No, you misunderstood me. I meant no <name: type> argument, just text like "add" and "stop".

you should call CommandParameterData::addOptions()
for example:
image

@KocTu4eK
Copy link
Author

I'll now try it

@KocTu4eK
Copy link
Author

what is the CommandParameterOption? what heading is it in?

@dreamguxiang
Copy link
Member

add enum CommandParameterOption in your code

@KocTu4eK
Copy link
Author

ok, but it doesn't solve my current parsing problem.
or am I missing something?

@KawaiiNahida
Copy link
Member

  • [TODO] BDS CommandRegistery API Docs

@KocTu4eK
Copy link
Author

KocTu4eK commented Jan 2, 2022

Sorry i didn't get the gist of addOptions() yesterday.
Today I figured out what you advised me, and everything works, thanks!
I think the question can be closed (but the documentation for the CommandRegistry API will still be useful).

image

@dreamguxiang
Copy link
Member

Thank you for your reply. Documentation will be available as soon as possible

@MCBEPluginModer
Copy link

MCBEPluginModer commented Jan 19, 2022

Thank you for your reply. Documentation will be available as soon as possible

How to make the parser work adequately with different arguments in 2 overloads?
For example:
/cmd
/cmd enum
And if I enter /cmd enum, then it would choose enum, and not the first overload option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

7 participants
@xiaoqch @RimuruChan @KawaiiNahida @dreamguxiang @KocTu4eK @MCBEPluginModer and others