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

Not working "switch" arguments only for players #40

Closed
SkytAsul opened this issue Dec 23, 2022 · 2 comments
Closed

Not working "switch" arguments only for players #40

SkytAsul opened this issue Dec 23, 2022 · 2 comments

Comments

@SkytAsul
Copy link
Contributor

SkytAsul commented Dec 23, 2022

With those two commands:

	@Subcommand("test")
	public void test(int dumbArg, @Optional Player optionalArg, @Switch boolean switchArg) {}

	@Subcommand("test2")
	public void test2(int dumbArg, @Switch boolean switchArg) {}

It's working normally when I do:

/mycommand test2 4
/mycommand test 5
/mycommand test 5 -switchArgs

But I am getting this:
image
when executing:

/mycommand test2 4 -switchArg
/mycommand test 5 SkytAsul -switchArg

But if I execute all of these commands in console, I get no issue. It's only for players.
I also get normal syntax coloring in chat when typing the 2 failing commands, it only fails after I hit enter.

I can't find a reason why those two commands are failing.

@Revxrsal
Copy link
Owner

This is because of Brigadier. I'll try to look for better ways to structure commands that mix optional parameters with switches/flags, but if the issue is bugging you more than needed, you could disable Brigadier until it's fixed.

@Revxrsal
Copy link
Owner

Switches and flags have been removed in v4 (until further notice, at best). They introduced many bugs and always required special handling as they do not fit quite well on most platforms' paradigms.

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

No branches or pull requests

2 participants