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
Enter the following in chat
/spreadplayers ~ ~ 1 10 under -1 false @s
❌ The command is considered valid
Try to run the command
✔ It fails, as expected
Comments 4
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.
Valid range should be [1,256]. The top face of the blocks at level 255 is y=256