diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index aaf1d9a0..8e7012cb 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -177,7 +177,10 @@ namespace TShockAPI [Description("Enable Server Side Inventory checks, EXPERIMENTAL")] public bool ServerSideInventory = false; - public static ConfigFile Read(string path) + [Description("Disables reporting of playercount to the stat system.")] + public bool DisablePlayerCountReporting = false; + + public static ConfigFile Read(string path) { if (!File.Exists(path)) return new ConfigFile(); diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 1a3b5c52..762ee69e 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -35,6 +35,5 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] - [assembly: AssemblyVersion("3.4.1.1222")] [assembly: AssemblyFileVersion("3.4.1.1222")] diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 860e4f88..4fa17756 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -71,7 +71,7 @@ namespace TShockAPI public static SecureRest RestApi; public static RestManager RestManager; public static Utils Utils = new Utils(); - + public static StatTracker StatTracker = new StatTracker(); /// /// Called after TShock is initialized. Useful for plugins that needs hooks before tshock but also depend on tshock being loaded. /// @@ -226,49 +226,7 @@ namespace TShockAPI } - private void callHome() - { - string fp; - string lolpath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/.tshock/"; - if (!Directory.Exists(lolpath)) - { - Directory.CreateDirectory(lolpath); - } - if (!File.Exists(Path.Combine(lolpath, Netplay.serverPort + ".fingerprint"))) - { - fp = ""; - int random = Utils.Random.Next(500000, 1000000); - fp += random; - - fp = Utils.HashPassword(Netplay.serverIP + fp + Netplay.serverPort + Netplay.serverListenIP); - TextWriter tw = new StreamWriter(Path.Combine(lolpath, Netplay.serverPort + ".fingerprint")); - tw.Write(fp); - tw.Close(); - } else - { - fp = ""; - TextReader tr = new StreamReader(Path.Combine(lolpath, Netplay.serverPort + ".fingerprint")); - fp = tr.ReadToEnd(); - tr.Close(); - } - - using (var client = new WebClient()) - { - client.Headers.Add("user-agent", - "TShock (" + VersionNum + ")"); - try - { - string response = client.DownloadString("http://tshock.co/tickto.php?do=log&fp=" + fp + "&ver=" + VersionNum + "&port=" + Netplay.serverPort); - Console.ForegroundColor = ConsoleColor.Cyan; - Console.WriteLine("\nRegistered with stat tracker: " + response + "\n"); - Console.ForegroundColor = ConsoleColor.Gray; - } - catch (Exception e) - { - Log.Error(e.ToString()); - } - } - } + RestObject RestApi_Verify(string username, string password) { @@ -455,8 +413,7 @@ namespace TShockAPI if (Config.RestApiEnabled) RestApi.Start(); - Thread t = new Thread(callHome); - t.Start(); + StatTracker.checkin(); } @@ -466,7 +423,7 @@ namespace TShockAPI private void OnUpdate() { UpdateManager.UpdateProcedureCheck(); - + StatTracker.checkin(); if (Backups.IsBackupTime) Backups.Backup(); diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 3d024668..dbdb91bc 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -125,6 +125,7 @@ + @@ -181,7 +182,7 @@ - +