The bug
String argument type in Brigadier doesn't parse correctly if it's of string type SINGLE_WORD or QUOTABLE_PHRASE without quotes. It reads only a-z, 0-9 and some other basic ASCII characters.
Because of this, for example, I can't use Russian usernames (custom launcher) in commands without quoting, although minecraft works with them perfectly fine. In other Minecraft versions (1.12.2 or older) it works as it should.
Proposed fix: Read unquoted strings in StringReader
class until first space, not until first 'not allowed' character.
Linked issues
is duplicated by 1
Attachments
Comments 2
I can confirm that the issue is present all the way up to (and including) the latest snapshot (24w13a).
Clarification of the issue
This issue makes it impossible to use brigadiers tab-completion and the clients highlighting for any arguments that are either:
international (like city names on a non-English survival server) without explaining to users that they have to wrap the word in quotes (for no apparent reason) and then handling the user entering a space in that quoted string when you actually only wanted to accept a single word (but you had to use QUOTABLE_PHRASE instead of SINGLE_WORD because that does not support international characters (again for no apparent reason))
or contain any character not conforming to the RegEx [A-Za-z0-9\._-+] for some other reason
Resolving this issue would also make brigadier more consistent, since literals do not have to be quoted if they include international characters.
Current workarounds
The main workaround employed by all the sources I checked is (next to using quoted strings for everything, eliminating the point of SINGLE_WORD entirely and leading to frustrating user experience (since no one guesses that you have to wrap your string in quotes if you want to use non [A-Za-z0-9\._-+] characters)) to use GREEDY_PHRASE and do the tab-completion on your own (giving up all syntax highlighting in the process).
The community cares (more than 4 people)
This issue has been reported multiple times (in slightly different variations)
https://github.com/Mojang/brigadier/issues/44 (Nov 8, 2018) (fundamentally had this problem though it was avoided)
https://github.com/Mojang/brigadier/issues/103 (Nov 7, 2021)
https://github.com/Mojang/brigadier/issues/146 (Jan 28, 2024) (duplicate of https://github.com/Mojang/brigadier/issues/103 )
Multiple fixing (or alternative providing) pull requests have been opened (and not jet merged):
https://github.com/Mojang/brigadier/pull/56 (Jun 26, 2019) (also does a lot of other stuff)
https://github.com/Mojang/brigadier/pull/131 (May 6, 2023) (solves this issue only (additionally the serialization methods of the net.minecraft.commands.synchronization.brigadier.StringArgumentSerializer class have to be adjusted slightly)) (also has 16 upvotes which should effectively increase this issues votes accordingly) (my recommendation)
https://github.com/Mojang/brigadier/pull/56 (Jan 5, 2024) (server only)
Also this kind of issue tends to only be reported by a few developers even though it affects and is noticed by way more people.
Why report it here?
@tryashtar mentioned that this issue should be reported to the brigadier GitHub page, but since it was not yet officially commented there (nor any other non-Mojang issue or PR for the past 5-6 years as far as I could tell (even if they are very small bug fixes)) and it has not been commented on the Feedback page either (https://feedback.minecraft.net/hc/en-us/community/posts/8241302508941-Custom-Arguments-for-Plugin-Development), I thought I should raise awareness of it again.
Final words
I hope this issue will be resolved making highlighted international commands possible1 and brigadier more consistent (especially since it should be an fairly easy fix, considering that the brigadier side of things has already been implemented (https://github.com/Mojang/brigadier/pull/131) and only one additional class has to be changed (as far as I can tell)).
1other than the mentioned workarounds
Thanks for your time and effort! 🙂
You might be better off submitting an issue or PR at
https://github.com/mojang/brigadier