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

View File

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