JarHax / Prestige

A mod that allows progress to transfer between worlds.
GNU Lesser General Public License v2.1
1 stars 6 forks source link

Exception - Loading NBT data #14

Closed scollenburg closed 5 years ago

scollenburg commented 5 years ago

Log file: https://www.dropbox.com/s/uxjpcnq8z35t51d/prestige%20-%20exception%20-%20Loading%20NBT%20data.log?dl=0

I intentionally corrupted the prestige file (.dat file) (I'm an aggressive tester, what can I say) **. When I tried to create a new world, MC crashed. If the use case is cheating / hacking the file, then such is life. But, it is quite possible someones prestige file gets corrupted by accident, meaning the broken prestige file would prevent the player from playing any world.

  1. I would suggest catching the exception and least giving a warning message to the player that their prestige file is corrupted, and some brief instructions on what they can do e.g. point them to a wiki article for detailed instructions?
  2. Perhaps add a "regular" backup of the prestige file, in case of accidental / tech glitch corrupting the file. This could be very, very heartbreaking for folks on a server if their prestige file gets corrupted.

Not a serious issue, but wanted to let you know.

** Yes, I made a backup.

Cheers, Shawn

jaredlll08 commented 5 years ago

This is actually the default Minecraft behavior for dealing with a corrupt file, we do try and catch the issue though here: https://github.com/JarHax/Prestige/blob/master/src/main/java/com/jarhax/prestige/data/GlobalPrestigeData.java#L98

But I guess that isn't enough

Darkhax commented 5 years ago

This isn't to prevent cheating, you can just use the prestige command to add as many points as you want. This crash was an oversight on my part, as I expected a corrupt file to throw an IOException, but Minecraft throws their own special exception type in this case. Jared's commit should sufficiently fix this.