mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 23:02:04 -04:00
Fix players sometimes becoming invisible and their block changes not recorded. (Thanks fucbillgates)
This commit is contained in:
parent
d6e425e5f7
commit
4ddf7f438d
@ -286,8 +286,7 @@ namespace MCGalaxy
|
|||||||
cancelunload = false;
|
cancelunload = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerInfo.players.ForEach(
|
MovePlayersToMain();
|
||||||
delegate(Player pl) { if (pl.level == this) Command.all.Find("goto").Use(pl, Server.mainLevel.name); });
|
|
||||||
|
|
||||||
if (changed && (!Server.ZombieModeOn || !Server.noLevelSaving))
|
if (changed && (!Server.ZombieModeOn || !Server.noLevelSaving))
|
||||||
{
|
{
|
||||||
@ -308,7 +307,7 @@ namespace MCGalaxy
|
|||||||
TntWarsGame.GameList.Remove(TntWarsGame.Find(this));
|
TntWarsGame.GameList.Remove(TntWarsGame.Find(this));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
MovePlayersToMain();
|
||||||
Server.levels.Remove(this);
|
Server.levels.Remove(this);
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -336,6 +335,17 @@ namespace MCGalaxy
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MovePlayersToMain() {
|
||||||
|
PlayerInfo.players.ForEach(
|
||||||
|
p => {
|
||||||
|
if (p.level.name.ToLower() == name.ToLower()) {
|
||||||
|
Player.SendMessage(p, "You were moved to the main level as " + name + " was unloaded.");
|
||||||
|
Command.all.Find("goto").Use(p, Server.mainLevel.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public unsafe void saveChanges() {
|
public unsafe void saveChanges() {
|
||||||
if (blockCache.Count == 0) return;
|
if (blockCache.Count == 0) return;
|
||||||
List<BlockPos> tempCache = blockCache;
|
List<BlockPos> tempCache = blockCache;
|
||||||
@ -450,11 +460,14 @@ namespace MCGalaxy
|
|||||||
if (clearPhysics)
|
if (clearPhysics)
|
||||||
ClearPhysics();
|
ClearPhysics();
|
||||||
|
|
||||||
LvlFile.Save(this, path + ".back");
|
if (File.Exists(path)) {
|
||||||
File.Delete(path + ".backup");
|
if (File.Exists(path + ".prev"))
|
||||||
File.Copy(path + ".back", path + ".backup");
|
File.Delete(path + ".prev");
|
||||||
File.Delete(path);
|
File.Copy(path, path + ".prev");
|
||||||
File.Move(path + ".back", path);
|
File.Delete(path);
|
||||||
|
}
|
||||||
|
LvlFile.Save(this, path + ".backup");
|
||||||
|
File.Copy(path + ".backup", path);
|
||||||
SaveSettings(this);
|
SaveSettings(this);
|
||||||
|
|
||||||
Server.s.Log(string.Format("SAVED: Level \"{0}\". ({1}/{2}/{3})", name, players.Count,
|
Server.s.Log(string.Format("SAVED: Level \"{0}\". ({1}/{2}/{3})", name, players.Count,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user