Exception - Loading NBT data
scollenburg opened this issue ยท 2 comments
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.
- 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?
- 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
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
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.