mojira.dev
MC-101325

Loading Village.dat containing player reputation causes NullPointerException

Once a player has a reputation written to villages.dat, that file will fail to load. Instead it will cause a NullPointerException during startup and every village with player reputation will be removed from the file.

Steps to Reproduce:

  • Create or find a village

  • Kill a villager belonging to that village

  • Restart the server

  • Notice the NullPointerException on startup while loading villages.dat

Removing all player reputation from villages.dat and restarting fixes the exception.

Linked issues

Comments 28

Confirmed. Run in latest Spigot 1.9.2 server, got NullPointerException in console:

[10:00:01] [Server thread/WARN]: java.lang.NullPointerException
[10:00:01] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.Village.a(Village.java:394)
[10:00:01] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.PersistentVillage.a(SourceFile:215)
[10:00:01] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.PersistentCollection.get(PersistentCollection.java:50)
[10:00:01] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.WorldServer.b(WorldServer.java:75)
[10:00:01] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.MinecraftServer.a(MinecraftServer.java:268)
[10:00:01] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.DedicatedServer.init(DedicatedServer.java:269)
[10:00:01] [Server thread/WARN]: at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:527)
[10:00:01] [Server thread/WARN]: at java.lang.Thread.run(Unknown Source)

EDIT: Doesn't matter if the reputation is negative, positive, or zero. As long as it's there, you get the NullPointerException error.

Confirmed as well in 1.9 and above. I actually noticed this a couple of weeks back, but didn't think about it being a bug. I just removed the player reputation entry and it was fine. Good some one thought a bit more about it and filed this report.

1.9 and above

What versions exactly?

Applicable in 1.9 and 1.9.2. However I didn't check for the NullPointerException directly, but rather for a symptom: A village entry in the villages.dat file with a player reputation entry got removed once the world was loaded if this village is a fake entry (or the village wasn't a valid village, by covering up the doors). Therefore the entry in the villages.dat file would not re-generate instantly and only exist, because it existed before.

I believe this should be added to the bug description, to underline the severity of the bug: Every village with player reputation will be removed from the file.

@unknown, added to the description, the reason why I asked is because there's also a thing called snapshots, and you didn't seem to have tested those. 🙂

18 more comments
Olle Kelderman

good luck overwriting (aka removing) all villages that got created after the fixed file was made

@Jesse Visscher Could you please not use abbreviated links so that people know on what they are clicking? You only have to click on it anyway, so it isn't useful to abbreviate it.

Olle Kelderman

@Fabian, in his defense: it is the url used in the video-description from tango 😉

I'm seeing a similar, possibly related bug MC-106350 in 1.10.2. If interacting with villagers sets the player's reputation in the villages.dat, the console starts spamming "java.lang.IllegalArgumentException: Name and ID cannot both be blank" when attempting to save villages.dat. Deleting the Player subtags S and UUID from villages.dat stops the messages.

Is it possible that the fix was incomplete and/or triggered the new messages?

I just had a villages.dat file get zeroed out while I was afk and my iron titan quit working. No villagers or golems were killed, it just was zeroed out during an automatic save.

Tango Tek

michael

Community Consensus

Minecraft 1.9.2, Minecraft 1.9.3 Pre-Release 2, Minecraft 1.9.4

Minecraft 1.10 Pre-Release 1

Retrieved