brigadier
brigadier copied to clipboard
Allow scientific notation of numbers and `+` sign
This is a simple fix to allow for scientific notation of floating point numbers. This commit would also fix the following ticket on the Minecraft Bug tracker: https://bugs.mojang.com/browse/MC-130925
It might also be a good idea to allow the plus sign since all of Java's number parsing methods allow it, but it's also not necessary.
Maybe it would be a bit cleaner to split the isAllowedNumber method into isAllowedFloatingPointNumber and isAllowedIntegerNumber, but I'll wait for developer feedback for this.
Tests? :)
:+1: for splitting isAllowedNumber and allowing the + sign in both
Tests? :)
Good point. Added tests for double and float with both positive and negative exponent. That should be sufficient, I hope :)
I now added a method that is specific for integer numbers. The old method still exists and does the same thing as before (so backwards compatibility is supported). Both methods do accept the + sign now.
Did that. Makes sense to provide this information to the user. I'm a bit unsure about the recommended max line length of this project but I found that the examples of double and float became a bit long, so I split them into two lines now.
Thank you! Unfortunately, Mojang doesn't seem to care about user contributions anymore and this is effectively a dead repo.
i think they will probably take it for 1.14's additional releases or more likely, 1.15 snapshots
Well, this pr is from well before the 1.14 snapshot phase, so I am not that hopeful. In fact, the latest Mojang activity on user prs or issues was on Oct 14, 2018. The only pr that was worked on since then was an internal one, probably because boq told Dinnerbone to look at it when they were at work.
Closing and reopening to rerun checks. Hopefully this works... 🤞