Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

Use strict number format for the /pay command

Open imDaniX opened this issue 2 years ago • 1 comments

Information

This PR is related to #5495. The issue actually contains two issues, so can't say PR fixes it.

Details

Proposed fix:

Enforces more strict number format for the pay command. The difference with the #5496 approach is that this one also fixes cases like 12m34.56, which I don't think should be allowed. This also fixes the issue with inputs like 123.456.789 - previously Ess was just swallowing the NumberFormatException and was showing untranslated exception message to the player.

Environments tested:

OS: Linux Mint 21.2

Java version: openjdk 17.0.8 2023-07-18 LTS

  • [x] Most recent Paper version (1.20.1, git-Paper-171)
  • [ ] CraftBukkit/Spigot/Paper 1.12.2
  • [ ] CraftBukkit 1.8.8

Demonstration:

imDaniX avatar Sep 07 '23 10:09 imDaniX

Changed the Pattern to avoid nonsense like 1_'_,,'_`'.1. Something like 1,2_3`4'.5 still feels a bit wrong, but I think it's better worked on in https://github.com/EssentialsX/Essentials/issues/2355 with international (or configurable) decimal/thousands separators standards support in mind.

imDaniX avatar Sep 12 '23 22:09 imDaniX