mojira.dev
MC-123011

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:

  1. Download

[media]
  1. and notice that it contains two objectives, Test (dummy) and Fall (stat.fallOneCm), and there are scores on both objectives

  2. Create a world and put scoreboard_INVALID.dat into the data folder, and rename it to "scoreboard.dat"

  3. Join the world, and run

    /scoreboard objectives setdisplay sidebar Test
  4. Run

    /scoreboard players set test2 Test 1
  5. Run

    /scoreboard objectives add Foo dummy
  6. Do any additional scoreboard changes you wish

  7. Notice that the sidebar now displays the objective and a score

  8. 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:

  1. Download

[media]
  1. 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.

  2. Create a world and put scoreboard_VALID.dat into the data folder, and rename it to "scoreboard.dat"

  3. Join the world, and run

    /scoreboard objectives setdisplay sidebar Test
  4. Run

    /scoreboard players set test2 Test 1
  5. Run

    /scoreboard objectives add Foo dummy
  6. Do any additional scoreboard changes you wish

  7. Notice that the sidebar now displays the objective and a score

  8. Exit and rejoin the world, notice that all scoreboard changes are still present and nothing has reverted

Linked issues

MC-124234 Removed scoreboards appear again after a relog Resolved MC-124306 NullPointerException while saving leads to unsaved scoreboard Resolved MC-124397 Scoreboard scores/settings don't save when exit world Resolved MC-124905 Scoreboard updates not saved when quit Resolved MC-128406 Exception printed into Console when World is being saved Resolved

Attachments

Comments 5

Do a copy of the world and delete in the folder data "scoreboard.dat". Readd the scoreboard objectives. This should fix it (temorarly).

If you have an NBT data editor, then you can change the old criteria to the newer criteria

still happens in 18w03a and 18w03b

The issue must be that the game doesn't recognize the old format of the stats that were changed and does not know how to handle it, thus causing bugged, unexpected behavior to occur. It's likely that this has always been an underlying issue that only surfaced now because some of the stat formats were changed. Hopefully this gets fixed because it can break a lot of pre 1.13 worlds that rely heavily on scoreboard objectives. Deleting the "scoreboard.dat" file may solve the issue, but you would have to take note of every single score that each player has for every objective that exists. On a multiplayer server this would just be impractical, and on a single player world with several objectives it would just be inconvenient.

onnowhere

Fry

Confirmed

scoreboard, scoreboard-objectives

Minecraft 17w49b, Minecraft 17w50a, Minecraft 18w01a, Minecraft 18w02a, Minecraft 18w03b, Minecraft 18w06a, Minecraft 18w20c, Minecraft 18w21b, Minecraft 18w22c, Minecraft 1.13-pre1

Minecraft 1.13-pre3

Retrieved