Not long ago I started a minecraft world on a new 1.9 snapshot and friends wanted to join so I took my world file and dropped it in a server. Now a little later they are losing intrest in it already but I'm still having my fun. I tried copying the world file back in the saves folder but then I ran into a little problem. I started with the progress I was in before I put it on a server. I was in the same location with the same health, hunger, items, armor, ... This wasn't all a problem when I transfered it to a server. So how do I end up with the progress I was at when I last played on the server?
On both singleplayer and multiplayer, each player has their own data file in a world's
playerdata folder, named by their UUIDs:
These files contain their inventory, location, health, etc.
In addition to this storage location, on singleplayer, the same data is stored in
level.dat, always under the name "Player":
On singleplayer this default "Player" version takes precedence. If it exists, it will always be used first; it doesn't care who the user is, so long as it's singleplayer. This also allows singleplayer worlds to be played offline, as a UUID is not needed/used.
Both of these locations are saved to with your current in-game data when you are playing singleplayer, but only your UUID-named file is updated when playing multiplayer. The problem you are having is that only your UUID-named file was updated when playing on the server, but now the world is singleplayer again the "Player" file has taken precedence, which was only saved to on singleplayer (and thus remains in the state it was when you last played singleplayer).
To fix this, you'd first need a backup from before the transfer. Open up
level.dat with something like NBTExplorer, delete the "Player" file and then log into the world on singleplayer. This should force it to load your UUID file and then save the Player file based on that, rather than the other way around. Everything should work fine from there.