'execute store' ignores value validation
The bug
/execute store ignores value validation, allowing you to set values which would be considered invalid when used in the respective command.
Partially relevant /r/Mojira discussion
Affected situations
- bossbar max
- bossbar value
- read-only scoreboard objectives
How to reproduce
bossbar max
- Create a bossbar
/bossbar add custom:test "test" - Try setting a negative maximum
/bossbar set custom:test max -1
→
It fails as expected - Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1
- Try storing the score as bossbar max
/execute store result bossbar custom:test max run scoreboard players get value test
- Get the bossbar max
/bossbar get custom:test max
→
It shows -1
Read only scoreboard objectives
- Create a read only scoreboard objective and have it displayed on the sidebar
/scoreboard objectives add health health /scoreboard objectives setdisplay sidebar health
- Take damage or heal to update the score (see MC-111729)
- Try setting a value for the health objective
/scoreboard players set @s health -1
→
It fails as expected - Create a scoreboard objective and set a negative score
/scoreboard objectives add test dummy /scoreboard players set value test -1
- Try storing the score as value for the read-only objective
/execute store result score @s health run scoreboard players get value test
→
Your health score changed to -1
2018-02-01, 04:31 PM
2023-10-26, 07:42 PM
19
12
/bossbar, /execute-store, read-only-scoreboard-objectives
-