aikar / aikar/commands

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

オープン
#373 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
628
フォーク
150
PR マージ指標
30日以内にマージされた PR はありません

説明

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(" ")
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!

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。