Fix rare case in which level blockdb is not saved after level is auto-saved.

This commit is contained in:
UnknownShadow200 2016-07-11 11:40:13 +10:00
parent 1293736b4a
commit 30d99ccbd1
2 changed files with 10 additions and 12 deletions

View File

@ -104,7 +104,6 @@ namespace MCGalaxy.Games {
} else {
SendFreezeMessages();
MessageAll("&bPlayers Frozen");
mapon.countdowninprogress = true;
gamestatus = CountdownGameStatus.InProgress;
foreach (Player pl in players)
pl.countdownsettemps = true;
@ -239,7 +238,6 @@ namespace MCGalaxy.Games {
Cuboid(maxX - 4, 4, 4, maxX - 4, 4, maxZ - 4, Block.air, mapon);
if (!freezemode) {
mapon.countdowninprogress = true;
gamestatus = CountdownGameStatus.InProgress;
}
}

View File

@ -91,11 +91,8 @@ namespace MCGalaxy
public bool cancelsave1;
public bool cancelunload;
public bool changed;
public bool physicschanged
{
get { return ListCheck.Count > 0; }
}
public bool countdowninprogress;
public bool physicschanged { get { return ListCheck.Count > 0; } }
public bool ctfmode;
public int currentUndo;
public ushort Width, Height, Length;
@ -401,10 +398,9 @@ namespace MCGalaxy
}
MovePlayersToMain();
if (changed && ShouldSaveChanges()) {
Save(false, true);
saveChanges();
}
if (changed && ShouldSaveChanges()) Save(false, true);
if (ShouldSaveChanges()) saveChanges();
if (TntWarsGame.Find(this) != null)
{
foreach (TntWarsGame.player pl in TntWarsGame.Find(this).Players)
@ -683,7 +679,11 @@ namespace MCGalaxy
return false;
}
public void saveChanges() { LevelDB.SaveBlockDB(this); }
readonly object dbLock = new object();
public void saveChanges() {
lock (dbLock)
LevelDB.SaveBlockDB(this);
}
public List<Player> getPlayers() {
Player[] players = PlayerInfo.Online.Items;