mojira.dev
MC-130480

Input range entry and limits are reversed in error messages

Background

The command completion interface will warn the user when input is entered out of range for number types (integer, float, double).

The bug

The number that is invalid and the bound for the number range are reversed in the error messages telling the user that the number is invalid.

For these commands:

/playsound entity.lighting.thunder weather @s ~ ~ ~ -1.0
/weather clear 775849392

Expected Output:

Float must not be less than 0.0, found -1.0 at position: ...
Integer must not be larger than 1000000, found 775849392 at position: ...

Actual Output:

Float must not be less than -1.0, found 0.0 at position: ...
Integer must not be larger than 775849392, found 1000000 at position: ...

Affected platforms

This translation string is shown client side, above the text entry field during live command feedback.  The message is also shown server side when the input is a valid integer or float or double but still out of range.

Furthermore, these translation strings do not appear to be present in snapshot 18w21b.

Causes

There are multiple possible sources.  It could be created by the game building the message with the arguments in the wrong order, or it could be in the translation file where the arguments are specified in the string.

Translation File:

"argument.double.low": "Double must not be less than %s, found %s",
"argument.double.big": "Double must not be more than %s, found %s",
"argument.float.low": "Float must not be less than %s, found %s",
"argument.float.big": "Float must not be more than %s, found %s",
"argument.integer.low": "Integer must not be less than %s, found %s",
"argument.integer.big": "Integer must not be more than %s, found %s"

Solution

This problem can be fixed without even changing the code by updating the argument index of the translation strings to use the second argument first, and the first argument second.

Fixed Translation File:

"argument.double.low": "Double must not be less than %2$s, found %1$s",
"argument.double.big": "Double must not be more than %2$s, found %1$s",
"argument.float.low": "Float must not be less than %2$s, found %1$s",
"argument.float.big": "Float must not be more than %2$s, found %1$s",
"argument.integer.low": "Integer must not be less than %2$s, found %1$s",
"argument.integer.big": "Integer must not be more than %2$s, found %1$s"

A resource pack with the updated language strings is provided, which fixes the issue.

Linked issues

Attachments

Comments 2

Just noticed that too. Another example is the effect command.

[media]

[media]

Tedstar (Curtis Anderson)

boq

Confirmed

client, commands, console, error-message, input, localization, server, translation

Minecraft 18w22b, Minecraft 18w22c, Minecraft 1.13-pre1, Minecraft 1.13-pre2, Minecraft 1.13-pre3, Minecraft 1.13-pre4

Minecraft 1.13-pre5

Retrieved