Merge branch 'general-devel' of github.com:TShock/TShock
This commit is contained in:
commit
35eae48dfe
5 changed files with 19 additions and 23 deletions
|
|
@ -68,9 +68,13 @@ namespace TShockAPI
|
||||||
Directory.CreateDirectory(worldpath);
|
Directory.CreateDirectory(worldpath);
|
||||||
|
|
||||||
Tools.Broadcast("Server map saving, potential lag spike");
|
Tools.Broadcast("Server map saving, potential lag spike");
|
||||||
|
Console.WriteLine("Backing up world...");
|
||||||
Thread SaveWorld = new Thread(Tools.SaveWorld);
|
Thread SaveWorld = new Thread(Tools.SaveWorld);
|
||||||
SaveWorld.Start();
|
SaveWorld.Start();
|
||||||
|
|
||||||
|
while (SaveWorld.ThreadState == ThreadState.Running)
|
||||||
|
Thread.Sleep(50);
|
||||||
|
|
||||||
Main.worldPathName = worldname;
|
Main.worldPathName = worldname;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
public string Name { get { return Names[0]; } }
|
public string Name { get { return Names[0]; } }
|
||||||
public List<string> Names { get; protected set; }
|
public List<string> Names { get; protected set; }
|
||||||
|
public bool DoLog { get; set; }
|
||||||
private string permission;
|
private string permission;
|
||||||
private CommandDelegate command;
|
private CommandDelegate command;
|
||||||
|
|
||||||
|
|
@ -71,6 +72,7 @@ namespace TShockAPI
|
||||||
permission = null;
|
permission = null;
|
||||||
Names = new List<string>(names);
|
Names = new List<string>(names);
|
||||||
command = cmd;
|
command = cmd;
|
||||||
|
DoLog = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Run(string msg, TSPlayer ply, List<string> parms)
|
public bool Run(string msg, TSPlayer ply, List<string> parms)
|
||||||
|
|
@ -152,8 +154,8 @@ namespace TShockAPI
|
||||||
ChatCommands.Add(new Command(PartyChat, "p"));
|
ChatCommands.Add(new Command(PartyChat, "p"));
|
||||||
ChatCommands.Add(new Command(Rules, "rules"));
|
ChatCommands.Add(new Command(Rules, "rules"));
|
||||||
ChatCommands.Add(new Command("logs", Rules, "displaylogs"));
|
ChatCommands.Add(new Command("logs", Rules, "displaylogs"));
|
||||||
ChatCommands.Add(new Command("manageusers", ManageUsers, "user"));
|
ChatCommands.Add(new Command("manageusers", ManageUsers, "user") { DoLog = false });
|
||||||
ChatCommands.Add(new Command(AttemptLogin, "login"));
|
ChatCommands.Add(new Command(AttemptLogin, "login") { DoLog = false });
|
||||||
ChatCommands.Add(new Command("cfg", Broadcast, "broadcast", "bc"));
|
ChatCommands.Add(new Command("cfg", Broadcast, "broadcast", "bc"));
|
||||||
ChatCommands.Add(new Command("whisper", Whisper, "whisper", "w", "tell"));
|
ChatCommands.Add(new Command("whisper", Whisper, "whisper", "w", "tell"));
|
||||||
ChatCommands.Add(new Command("whisper", Reply, "reply", "r"));
|
ChatCommands.Add(new Command("whisper", Reply, "reply", "r"));
|
||||||
|
|
@ -191,10 +193,8 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!cmdText.Contains("login") && !cmdText.Contains("user"))
|
if (cmd.DoLog)
|
||||||
{
|
|
||||||
Tools.SendLogs(string.Format("{0} executed: /{1}", player.Name, cmdText), Color.Red);
|
Tools.SendLogs(string.Format("{0} executed: /{1}", player.Name, cmdText), Color.Red);
|
||||||
}
|
|
||||||
cmd.Run(cmdText, player, args);
|
cmd.Run(cmdText, player, args);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("2.3.2.0702")]
|
[assembly: AssemblyVersion("2.3.2.0704")]
|
||||||
[assembly: AssemblyFileVersion("2.3.2.0702")]
|
[assembly: AssemblyFileVersion("2.3.2.0704")]
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,6 @@ namespace TShockAPI
|
||||||
|
|
||||||
public static IDbConnection Sql;
|
public static IDbConnection Sql;
|
||||||
|
|
||||||
public static bool WorldSaving = false;
|
|
||||||
|
|
||||||
public override Version Version
|
public override Version Version
|
||||||
{
|
{
|
||||||
get { return VersionNum; }
|
get { return VersionNum; }
|
||||||
|
|
@ -540,15 +538,10 @@ namespace TShockAPI
|
||||||
|
|
||||||
private void OnSaveWorld(bool resettime, HandledEventArgs e)
|
private void OnSaveWorld(bool resettime, HandledEventArgs e)
|
||||||
{
|
{
|
||||||
if (!WorldSaving)
|
Tools.Broadcast("Saving world, might lag.", Color.Red);
|
||||||
{
|
Thread SaveWorld = new Thread(Tools.SaveWorld);
|
||||||
WorldSaving = true;
|
SaveWorld.Start();
|
||||||
Tools.Broadcast("Saving world, might lag.", Color.Red);
|
e.Handled = true;
|
||||||
Thread SaveWorld = new Thread(Tools.SaveWorld);
|
|
||||||
SaveWorld.Start();
|
|
||||||
WorldSaving = false;
|
|
||||||
e.Handled = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -627,7 +620,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
public void OnConfigRead(ConfigFile file)
|
public void OnConfigRead(ConfigFile file)
|
||||||
{
|
{
|
||||||
NPC.maxSpawns = file.DefaultMaximumSpawns;
|
NPC.defaultMaxSpawns = file.DefaultMaximumSpawns;
|
||||||
NPC.defaultSpawnRate = file.DefaultSpawnRate;
|
NPC.defaultSpawnRate = file.DefaultSpawnRate;
|
||||||
|
|
||||||
Main.autoSave = file.AutoSave;
|
Main.autoSave = file.AutoSave;
|
||||||
|
|
|
||||||
|
|
@ -106,11 +106,10 @@ namespace TShockAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SaveWorld()
|
public static void SaveWorld()
|
||||||
{
|
{
|
||||||
WorldGen.saveWorld();
|
WorldGen.RealsaveWorld();
|
||||||
|
|
||||||
Broadcast("World Saved", Color.Yellow);
|
Broadcast("World saved.", Color.Yellow);
|
||||||
Console.WriteLine("World backed up");
|
Log.Info(string.Format("World saved at ({0})", Main.worldPathName));
|
||||||
Log.Info(string.Format("World backed up ({0})", Main.worldPathName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue