mojira.dev
MC-184699

'/spreadplayers under' does not prevent invalid values

The bug

The /spreadplayers ... under option which was added in 20w21a does prevent invalid maxHeight values where it is never able to spread players, when parsing the arguments.
These are values <= 0.
Additionally it does not prevent values > 256 even though they are effectively the same as 256.

Reproduction steps

  1. Enter the following in chat

    /spreadplayers ~ ~ 1 10 under -1 false @s

    ❌ The command is considered valid

  2. Try to run the command
    ✔ It fails, as expected

Comments 4

Additionally it does not prevent values > 255 even though they are effectively the same as 255.

Valid range should be [1,256]. The top face of the blocks at level 255 is y=256

Thanks for pointing that out, fixed it.

Additionally it does not prevent values > 256 even though they are effectively the same as 256.

This still happens. In the fix, the validation checks only that the provided number is a nonnegative integer. However, the following still works:

/spreadplayers ~ ~ 1 10 under 300 false @s

Technically, this is valid, so this may be intended, however things get weird when this value is too large: For example,

/spreadplayers ~ ~ 1 10 under 1000000000 false @s

seems to take the server considerably longer, despite being functionally identical to

/spreadplayers ~ ~ 1 10 under 256 false @s

In any case, something is definitely wrong here, though I'm not sure if the solution is to add more validation or to change the internal command behaviour.

Affects 1.16 pre4, with respect to my previous comment.

marcono1234

Erik Broes

Confirmed

Low

Commands

20w21a

1.16 Pre-release 3

Retrieved