Scores on scoreboard objectives created with old stats causes scoreboards to not store changes to scoreboard.dat
The bug
If there is a score on a scoreboard objective created with pre-1.13 stats, for example stat.fallOneCm, scoreboards malfunction. Specifically, when this occurs, any changes to scoreboards during a play session are not stored to scoreboards.dat, and rejoining the world reverts all changes to their initial state. For example, if you open a world with a score on an objective based on stat.fallOneCm, then if you try to set your score, create or remove objectives, or change the sidebar display, etc., rejoining the world reverts all changes to how they were as if you never changed anything at all.
Logged error when saving (17w50a)
java.lang.NullPointerException
at bmo.a(SourceFile:348)
at java.util.HashMap$Values.forEach(Unknown Source)
at bmo.a(SourceFile:345)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.HashMap$ValueSpliterator.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.forEach(Unknown Source)
at bmo.i(SourceFile:344)
at bmp.b(SourceFile:148)
at bjz.a(SourceFile:95)
at bjz.a(SourceFile:81)
at qt.a(SourceFile:915)
at qt.a(SourceFile:867)
at net.minecraft.server.MinecraftServer.a(SourceFile:411)
at clm.v(SourceFile:142)
at net.minecraft.server.MinecraftServer.run(SourceFile:497)
at java.lang.Thread.run(Unknown Source)
How to reproduce
With invalid scoreboard.dat:
- Download scoreboard_INVALID.dat
and notice that it contains two objectives, Test (dummy) and Fall (stat.fallOneCm), and there are scores on both objectives - Create a world and put scoreboard_INVALID.dat into the data folder, and rename it to "scoreboard.dat"
- Join the world, and run
/scoreboard objectives setdisplay sidebar Test
- Run
/scoreboard players set test2 Test 1
- Run
/scoreboard objectives add Foo dummy
- Do any additional scoreboard changes you wish
- Notice that the sidebar now displays the objective and a score
- Exit and rejoin the world, notice that all scoreboard changes have reverted, the sidebar has cleared, test2's score doesn't exist, and the Foo objective no longer exists
With valid scoreboard.dat:
- Download scoreboard_VALID.dat
and notice that it only contains objective Test (dummy) and a score on the objective. I have removed the Fall objective and all scores related to it. - Create a world and put scoreboard_VALID.dat into the data folder, and rename it to "scoreboard.dat"
- Join the world, and run
/scoreboard objectives setdisplay sidebar Test
- Run
/scoreboard players set test2 Test 1
- Run
/scoreboard objectives add Foo dummy
- Do any additional scoreboard changes you wish
- Notice that the sidebar now displays the objective and a score
- Exit and rejoin the world, notice that all scoreboard changes are still present and nothing has reverted