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

"Expected whitespace" error when using tilde or caret in string arguments with Brigadier enabled #373

Open
Mowstyl opened this issue Aug 21, 2022 · 1 comment

Comments

@Mowstyl
Copy link

Mowstyl commented Aug 21, 2022

I've been using some commands that get coordinates as arguments for some time.
Recently I've noticed they stopped working when trying to use relative coordinates.
The error I get each time I try to execute one of those commands is:
"Expected whitespace to end one argument, but found trailing data"
That is shown when Brigadier throws SimpleCommandExceptionType DISPATCHER_EXPECTED_ARGUMENT_SEPARATOR.

As a simple example, I've written this small command:
`

@Subcommand("coords")
@Syntax("<x> <y> <z>")
public static void coordsCommand(CommandSender sender, String rawX, String rawY, @Single String rawZ) {
    sender.sendMessage("Coords: " + rawX + " " + rawY + " " + rawZ);
}

`

When not having enabled brigadier unstable API, everything works fine for both the Console and Player sender.
With brigadier support enabled, the Console still gets the right result for any input, but the player receives said
error when any of the arguments contains a tilde ~ or a caret ^.
For example, "/gp coords 1 3 2" works but "/gp coords ~ ~ ~" doesn't.
As I said this only happens when brigadier support is enabled. I know it's unstable but I think this has to be a bug
and it has to be reported.

Since I don't really need brigadier I'll work without enabling it, yet I wonder if a CommandContext could be added that turns three coordinates into a Vector, making use of the native methods Minecraft has to calculate coordinates using relative or local coordinates.

Thanks for your attention and for creating such an incredible framework!

@chickeneer
Copy link
Collaborator

This is an issue with how the commands are processed by the server. Recently commands are being executed by the brigadier parser which does not allow ~ in the arguments.
There is not sufficient API (yet) to properly implement Minecraft brigadier.

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