Closed jochembroekhoff closed 6 years ago
Hi, what's the reason behind changing the +
to *
?
The +
was there to make sure that empty strings are transformed to ""
instead of nothing.
You're right, i didn't see that you moved the quotes to that new method.
I also changed your pattern to A-Za-z, because A-z also includes all ASCII-characters between Z and a (which includes \, see http://www.asciitable.com/).
This PR adds support for the following two new features:
To check if a string needs to be escaped, it simply checks if the pattern
[A-z0-9_\\-+]+
does not match. I've tested that in-game and it seemed like the game only accepts non-escaped strings in that pattern.This makes it possible to really use the output of
toTagString()
in a Minecraft command. Without the array type indicator and without the string escaping, it might sometimes not work.I've updated the unit tests as well.