diff --git a/TebexOxide/TebexOxide/TebexDonate.cs b/TebexOxide/TebexOxide/TebexDonate.cs index eb1d29a..79421e8 100644 --- a/TebexOxide/TebexOxide/TebexDonate.cs +++ b/TebexOxide/TebexOxide/TebexDonate.cs @@ -23,7 +23,7 @@ namespace Oxide.Plugins { - [Info("Tebex Donate", "Tebex", "1.6.3")] + [Info("Tebex Donate", "Tebex", "1.6.4")] [Description("Official Plugin for the Tebex Server Monetization Platform.")] public class TebexDonate : CovalencePlugin { @@ -409,6 +409,8 @@ private static string HexToRust(string hex, float alpha = 1f) private bool debugLogActions; private bool debugLogResponseErrors; private bool debugLogStackTraces; + private float commandCheckInterval; + private float eventLogInterval; private string secretKey; #endregion @@ -448,6 +450,12 @@ protected override void LoadDefaultConfig() Config["Debug", "Log Actions"] = debugLogActions = GetConfig("Debug", "Log Actions", true); Config["Debug", "Log Stack Traces"] = debugLogStackTraces = GetConfig("Debug", "Log Stack Traces", true); Config["Debug", "Log Response Errors"] = debugLogResponseErrors = GetConfig("Debug", "Log Response Errors", true); + Config["Command Check Interval"] = commandCheckInterval = GetConfig("Command Check Interval", 225f); + Config["Event Log Interval"] = eventLogInterval = GetConfig("Event Log Interval", 60f); + + if (eventLogInterval < 60f) + eventLogInterval = 60f; + Config["Secret key of your shop (do not tell it anyone)"] = secretKey = GetConfig("Secret key of your shop (do not tell it anyone)", ""); SaveConfig(); @@ -716,6 +724,9 @@ private void CheckCommandQueue(bool first) return; } + if (commandCheckInterval > secondsUntilNextCheck) + secondsUntilNextCheck = commandCheckInterval; + checkTimer = timer.In(secondsUntilNextCheck, () => CheckCommandQueue(false)); PrintError($"An unhandled error occurred whilst checking the command queue (response code: {code})."); }, this, RequestMethod.GET, AddToHeaders(secretKey), 3000f); @@ -1025,7 +1036,7 @@ private void FetchStoreInformation(bool command, string secretKey) logEvents = jObject["account"]["log_events"].ToObject(); if (logEvents) - StartEventTimer(60f); + StartEventTimer(eventLogInterval); else if (eventTimer != null && !eventTimer.Destroyed) eventTimer.Destroy(); @@ -1058,7 +1069,7 @@ private void LogEvents() eventTimer.Destroy(); Queue events = new Queue(this.events); - eventTimer = timer.In(60f, () => LogEvents()); + eventTimer = timer.In(eventLogInterval, () => LogEvents()); if (events.Count < 1) return;