-
Notifications
You must be signed in to change notification settings - Fork 0
2 Reduce
The Reduce mood changes it's targets stats by decreasing them. If it was executed through the chat, it will provide the executor with feedback showing the stat's new value.
statistics reduce [@p] [stat type] [stat] [? int | scoreboard objective] [? unit]
Reduce takes takes the standard three arguments: player target(s), stat type, stat.
Optionally, it can take an int or scoreboard objective, after which it can also take a unit.
A positive whole number.
A scoreboard objective.
Unit is a string word argument which is associated with a conversion factor (eg, an in is 2.54 cm).
For each of its targets, Reduce will decrease the requested stat's value by one. It will not decrease a stat below zero; if it would do so, it instead sets it to zero. If it cannot find a player, a stat, or otherwise incurs an error, it returns -1.
The modified stat will be decreased by the value of the int instead of one. Notable this means that the following two commands are functionally identical:
statistics reduce @p custom minecraft:jumped
statistics reduce @p custom minecraft:jumped 1
It still cannot reduce a stat below zero, but will reduce it as much as it can, up-to zero.
The command will read the scoreboard objective's value for each target and use that to variably decrease the target's stat by the target's score.
When given a string, it will check if that string can be parsed as a unit, if that unit make sense for the stat being modified. If no, it will return provide feedback about the error and return -1 early. If the unit can be parsed and is sensical, it will multiple the value of the preceding argument by the unit's conversion factor while modifying the stat and give unique feedback.
When finished, the return value will still be the sum of all decreases made.