The bug
/scoreboard players <targets> <targetObjective> >< <source> <sourceObjective> can mutate source scores even though <sourceObjective> is read-only.
How to reproduce
/scoreboard objectives add writable dummy/scoreboard objectives add readonly air/scoreboard players set value writable 42/scoreboard players operation value writable >< value readonly/scoreboard players get value readonly❌
value has 42 [readonly], the scorevaluein the objectivereadonlyis mutated.
Code analysis
net.minecraft.server.commands.ScoreboardCommandperformOperation( commandContext.getSource(), ScoreHolderArgument.getNamesWithDefaultWildcard(commandContext, "targets"), ObjectiveArgument.getWritableObjective(commandContext, "targetObjective"), OperationArgument.getOperation(commandContext, "operation"), ScoreHolderArgument.getNamesWithDefaultWildcard(commandContext, "source"), ObjectiveArgument.getObjective(commandContext, "sourceObjective") // accepts all objectives here (including read-only) );net.minecraft.commands.arguments.OperationArgumentprivate static Operation getOperation(String string) throws CommandSyntaxException { return string.equals("><") ? (score1, score2) -> { int integer3 = score1.getScore(); score1.setScore(score2.getScore()); score2.setScore(integer3); // mutated here } : getSimpleOperation(string); }
Can't reproduce, I get the error message as expected. Even doing the tellraw at the same tick with a chain command block reveals, that the score was not mutated in the tick.