diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs
index 4af756cf..d15528c6 100755
--- a/TShockAPI/Commands.cs
+++ b/TShockAPI/Commands.cs
@@ -873,8 +873,8 @@ namespace TShockAPI
private static void SetSpawn(CommandArgs args)
{
- ConfigurationManager.spawnTileX = args.Player.TileX;
- ConfigurationManager.spawnTileY = args.Player.TileY + 3;
+ ConfigurationManager.SpawnTileX = args.Player.TileX;
+ ConfigurationManager.SpawnTileY = args.Player.TileY + 3;
ConfigurationManager.Spawn_WorldID = Main.worldID;
ConfigurationManager.WriteJsonConfiguration();
args.Player.SendMessage("Set server spawn point to your position");
@@ -882,8 +882,8 @@ namespace TShockAPI
private static void SaveSpawn(CommandArgs args)
{
- Main.spawnTileX = ConfigurationManager.spawnTileX;
- Main.spawnTileY = ConfigurationManager.spawnTileY;
+ Main.spawnTileX = ConfigurationManager.SpawnTileX;
+ Main.spawnTileY = ConfigurationManager.SpawnTileY;
WorldGen.saveWorld();
args.Player.SendMessage("Saved current spawn point to file.");
}
diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs
index 87c57fc4..a1b2818c 100644
--- a/TShockAPI/ConfigFile.cs
+++ b/TShockAPI/ConfigFile.cs
@@ -54,8 +54,8 @@ namespace TShockAPI
public bool ListServer = false;
- public int spawnTileX;
- public int spawnTileY;
+ public int SpawnTileX;
+ public int SpawnTileY;
public int Spawn_WorldID;
public bool RememberLeavePos = false;
@@ -63,5 +63,7 @@ namespace TShockAPI
public bool HardcoreOnly = false;
public bool KickOnHardcoreOnlyDeath = false;
public bool BanOnHardcoreOnlyDeath = false;
+
+ public bool AutoSave = true;
}
}
\ No newline at end of file
diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs
index 84355d46..161593ad 100644
--- a/TShockAPI/ConfigurationManager.cs
+++ b/TShockAPI/ConfigurationManager.cs
@@ -78,15 +78,17 @@ namespace TShockAPI
public static bool ListServer = false;
public static int Spawn_WorldID;
- public static int originalSpawnX;
- public static int originalSpawnY;
- public static int spawnTileX;
- public static int spawnTileY;
+ public static int OriginalSpawnX;
+ public static int OriginalSpawnY;
+ public static int SpawnTileX;
+ public static int SpawnTileY;
- public static bool hardcoreOnly = false;
+ public static bool HardcoreOnly = false;
public static bool KickOnHardcoreDeath = false;
public static bool BanOnHardcoreDeath = false;
+ public static bool AutoSave = true;
+
public static void ReadJsonConfiguration()
{
TextReader tr = new StreamReader(FileTools.ConfigPath);
@@ -125,15 +127,16 @@ namespace TShockAPI
BackupInterval = cfg.BackupInterval;
BackupKeepFor = cfg.BackupKeepFor;
ListServer = cfg.ListServer;
- originalSpawnX = Main.spawnTileX;
- originalSpawnY = Main.spawnTileY;
- spawnTileX = cfg.spawnTileX;
- spawnTileY = cfg.spawnTileY;
+ OriginalSpawnX = Main.spawnTileX;
+ OriginalSpawnY = Main.spawnTileY;
+ SpawnTileX = cfg.SpawnTileX;
+ SpawnTileY = cfg.SpawnTileY;
Spawn_WorldID = cfg.Spawn_WorldID;
RememberLeavePos = cfg.RememberLeavePos;
- hardcoreOnly = cfg.HardcoreOnly;
+ HardcoreOnly = cfg.HardcoreOnly;
KickOnHardcoreDeath = cfg.KickOnHardcoreOnlyDeath;
BanOnHardcoreDeath = cfg.BanOnHardcoreOnlyDeath;
+ AutoSave = cfg.AutoSave;
}
public static void WriteJsonConfiguration()
@@ -168,13 +171,14 @@ namespace TShockAPI
cfg.BackupInterval = BackupInterval;
cfg.BackupKeepFor = BackupKeepFor;
cfg.ListServer = ListServer;
- cfg.spawnTileX = spawnTileX;
- cfg.spawnTileY = spawnTileY;
+ cfg.SpawnTileX = SpawnTileX;
+ cfg.SpawnTileY = SpawnTileY;
cfg.RememberLeavePos = RememberLeavePos;
cfg.Spawn_WorldID = Spawn_WorldID;
- cfg.HardcoreOnly = hardcoreOnly;
+ cfg.HardcoreOnly = HardcoreOnly;
cfg.BanOnHardcoreOnlyDeath = BanOnHardcoreDeath;
cfg.KickOnHardcoreOnlyDeath = KickOnHardcoreDeath;
+ cfg.AutoSave = AutoSave;
string json = JsonConvert.SerializeObject(cfg, Formatting.Indented);
TextWriter tr = new StreamWriter(FileTools.ConfigPath);
tr.Write(json);
diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index d36fe32b..ba7feda1 100755
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -164,7 +164,7 @@ namespace TShockAPI
{
return Tools.HandleGriefer(args.Player, "Sent client info more than once");
}
- if (ConfigurationManager.hardcoreOnly)
+ if (ConfigurationManager.HardcoreOnly)
if (!hardcore)
{
Tools.ForceKick(args.Player, "Server is set to hardcore characters only!");
@@ -459,7 +459,7 @@ namespace TShockAPI
if (args.Player.InitSpawn)
{
- if (ConfigurationManager.hardcoreOnly && (ConfigurationManager.KickOnHardcoreDeath || ConfigurationManager.BanOnHardcoreDeath))
+ if (ConfigurationManager.HardcoreOnly && (ConfigurationManager.KickOnHardcoreDeath || ConfigurationManager.BanOnHardcoreDeath))
if (args.TPlayer.selectedItem != 50)
{
if (ConfigurationManager.BanOnHardcoreDeath)
diff --git a/TShockAPI/Log.cs b/TShockAPI/Log.cs
index 7dcf6129..cb89e1e2 100644
--- a/TShockAPI/Log.cs
+++ b/TShockAPI/Log.cs
@@ -98,6 +98,16 @@ namespace TShockAPI
Write(message, LogLevel.Info);
}
+ ///
+ /// Writes an informative string to the log file. Also outputs to the console.
+ ///
+ /// The message to be written.
+ public static void ConsoleInfo(String message)
+ {
+ Console.WriteLine(message);
+ Write(message, LogLevel.Info);
+ }
+
///
/// Writes a debug string to the log file.
///
diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs
index ec7277ec..37351868 100644
--- a/TShockAPI/Properties/AssemblyInfo.cs
+++ b/TShockAPI/Properties/AssemblyInfo.cs
@@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.3.0.0624")]
-[assembly: AssemblyFileVersion("2.3.0.0624")]
\ No newline at end of file
+[assembly: AssemblyVersion("2.3.0.0625")]
+[assembly: AssemblyFileVersion("2.3.0.0625")]
\ No newline at end of file
diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs
index fa26effc..1ae46ca2 100755
--- a/TShockAPI/TShock.cs
+++ b/TShockAPI/TShock.cs
@@ -34,7 +34,7 @@ namespace TShockAPI
[APIVersion(1, 5)]
public class TShock : TerrariaPlugin
{
- public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
+ public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
public static readonly string VersionCodename = "Lol, packet changes.";
public static readonly string SavePath = "tshock";
@@ -107,10 +107,13 @@ namespace TShockAPI
ItemManager.LoadBans();
-
+ Main.autoSave = ConfigurationManager.AutoSave;
Backups.KeepFor = ConfigurationManager.BackupKeepFor;
Backups.Interval = ConfigurationManager.BackupInterval;
+ Log.ConsoleInfo("AutoSave " + (ConfigurationManager.AutoSave ? "Enabled" : "Disabled"));
+ Log.ConsoleInfo("Backups " + (Backups.Interval > 0 ? "Enabled" : "Disabled"));
+
HandleCommandLine(Environment.GetCommandLineArgs());
}
@@ -183,7 +186,6 @@ namespace TShockAPI
Console.WriteLine("This token will only display ONCE. This only works ONCE. If you don't use it and the server goes down, delete auth.lck.");
FileTools.CreateFile(Path.Combine(SavePath, "auth.lck"));
}
- ConfigurationManager.ReadJsonConfiguration();
}
private void OnUpdate(GameTime time)
@@ -232,10 +234,10 @@ namespace TShockAPI
var id = Main.worldID;
if (ConfigurationManager.Spawn_WorldID != Main.worldID)
{
- Main.spawnTileX = ConfigurationManager.originalSpawnX;
- Main.spawnTileY = ConfigurationManager.originalSpawnY;
- ConfigurationManager.spawnTileX = Main.spawnTileX;
- ConfigurationManager.spawnTileY = Main.spawnTileY;
+ Main.spawnTileX = ConfigurationManager.OriginalSpawnX;
+ Main.spawnTileY = ConfigurationManager.OriginalSpawnY;
+ ConfigurationManager.SpawnTileX = Main.spawnTileX;
+ ConfigurationManager.SpawnTileY = Main.spawnTileY;
ConfigurationManager.Spawn_WorldID = Main.worldID;
}
}