dslake / WorldDownloader

Clones a Minecraft multiplayer world from a remote server to your singleplayer folder
http://www.minecraftforum.net/topic/1444862-
62 stars 19 forks source link

[v2 beta] After dying while downloading, the world metadata will not be saved #1

Closed nairol closed 12 years ago

nairol commented 12 years ago

Original report: http://www.minecraftforum.net/topic/1444862-132-world-downloader-mod/page__st__60#entry17787808

Steps to reproduce

=> World metadata is not saved, because a NullPointerException is thrown.

Problem Seems like mc.thePlayer is null after dying. The method WDL.saveEverything has the following line:

mc.thePlayer.writeToNBT( playerNBT );

This throws the Exception if thePlayer is null.

Possible solution Keep a reference to mc.thePlayer in the WDL class so that we can use that in saveEverything(). Initialize it in onWorldChanged().

dslake commented 12 years ago

I added the player to a static field but it doesn't fix the problem because there is no hook for when the player dies or gets disconnected in the beta v2 version. I'l looking where to add that and then I'll push the fix.

nairol commented 12 years ago

Hmm, strange that it doesn't work. I had it like that in an older version and removed it again because I couldn't remember why I added it in the first place. :) I don't know why you'd need to know when the player dies. The important thing to have is a reference to the last active player (dead or not) when the metadata and player data is saved. I might be missing something though. I don't have the code here at the moment.

nairol commented 12 years ago

By the way, should I fix bugs in master, in new branches or in a branch in a fork?

EDIT: I meant "wdl2" when I wrote "master".

dslake commented 12 years ago

In the dslake repo, there is a master branch and a wdl2 branch. On master, I have your older code, updated for 1.3.2. On wdl2, I have your latest code updated for 1.3.2 with some of the bugs I've fixed and stuff like ender chests. If you want to work on the latest stuff, it's in wdl2. I'm not really planning to continue working on the master branch and eventually once I get the seed saving and this dying bug fixed, I'll probably merge wdl2 into master. Then, there will not be a beta version anymore, just World Downloader latest. Thanks for taking a look at these. I was at PAX in Seattle, Washington all weekend so I didn't get a chance to make progress on these. I'll have more time this week and if you check in a fix, I'll compile and update the beta download files. Thanks!

On Tue, Sep 4, 2012 at 1:29 PM, Florian notifications@github.com wrote:

By the way, should I fix bugs in master, in new branches or in a branch in a fork?

— Reply to this email directly or view it on GitHubhttps://github.com/dslake/WorldDownloader/issues/1#issuecomment-8277618.

danthedad

nairol commented 12 years ago

I missed a few mc.thePlayers in other files...