diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index dad3ca4e..a4402849 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -377,6 +377,12 @@ namespace TShockAPI if (!shouldWarnPlayer) return false; + // Space out warnings by 2 seconds so that they don't get spammed. + if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - lastPermissionWarning) < 2000) + { + return false; + } + // If they should be warned, warn them. switch (failure) { @@ -391,6 +397,9 @@ namespace TShockAPI break; } + // Set the last warning time to now. + lastPermissionWarning = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; + return false; } @@ -449,24 +458,10 @@ namespace TShockAPI public List IceTiles; /// - /// Unused, can be removed. + /// The last time the player was warned for build permissions. + /// In MS, defaults to 1 (so it will warn on the first attempt). /// - public long RPm = 1; - - /// - /// World protection message cool down. - /// - public long WPm = 1; - - /// - /// Spawn protection message cool down. - /// - public long SPm = 1; - - /// - /// Permission to build message cool down. - /// - public long BPm = 1; + public long lastPermissionWarning = 1; /// /// The time in ms when the player has logged in.