added a bool to the world save mechanism. This should prevent it from saving 3 times at once. Hopefully thats what was causing server crashes
This commit is contained in:
parent
95946ba060
commit
38011f6364
2 changed files with 13 additions and 6 deletions
|
|
@ -971,10 +971,13 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSaveWorld(bool resettime, HandledEventArgs e)
|
void OnSaveWorld(bool resettime, HandledEventArgs e)
|
||||||
|
{
|
||||||
|
if (!Utils.saving)
|
||||||
{
|
{
|
||||||
Utils.Broadcast("Saving world. Momentary lag might result from this.", Color.Red);
|
Utils.Broadcast("Saving world. Momentary lag might result from this.", Color.Red);
|
||||||
var SaveWorld = new Thread(Utils.SaveWorld);
|
var SaveWorld = new Thread(Utils.SaveWorld);
|
||||||
SaveWorld.Start();
|
SaveWorld.Start();
|
||||||
|
}
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
public class Utils
|
public class Utils
|
||||||
{
|
{
|
||||||
|
public static bool saving = false;
|
||||||
|
|
||||||
public Utils()
|
public Utils()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -110,9 +112,11 @@ namespace TShockAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SaveWorld()
|
public void SaveWorld()
|
||||||
{
|
{
|
||||||
|
saving = true;
|
||||||
WorldGen.realsaveWorld();
|
WorldGen.realsaveWorld();
|
||||||
Broadcast("World saved.", Color.Yellow);
|
Broadcast("World saved.", Color.Yellow);
|
||||||
Log.Info(string.Format("World saved at ({0})", Main.worldPathName));
|
Log.Info(string.Format("World saved at ({0})", Main.worldPathName));
|
||||||
|
saving = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue