From 4167a9b62743107c1847233827e52a8b57ea6c28 Mon Sep 17 00:00:00 2001 From: Tyler Watson Date: Thu, 26 Nov 2015 19:13:08 +1000 Subject: [PATCH] Removed unimportant messages from OnSecondUpdate() Removed check ignores failed and player disabled for not being logged in whilst SSC is enabled console messages, as they are incessant in larger servers. The messages are not informative as they are not reasonably actionable by the console, and there is no point in spamming server operators about such issues. --- TShockAPI/TSPlayer.cs | 20 +++++++++++++++----- TShockAPI/TShock.cs | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index c7a546b4..c5ed9371 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -875,13 +875,23 @@ namespace TShockAPI } } - var trace = new StackTrace(); - StackFrame frame = null; - frame = trace.GetFrame(1); - if (frame != null && frame.GetMethod().DeclaringType != null) - TShock.Log.Debug(frame.GetMethod().DeclaringType.Name + " called Disable()."); + /* + * Calling new StackTrace() is incredibly expensive, and must be disabled + * in release builds. Use a conditional call instead. + */ + LogStackFrame(); } + [Conditional("DEBUG")] + private void LogStackFrame() + { + var trace = new StackTrace(); + StackFrame frame = null; + frame = trace.GetFrame(1); + if (frame != null && frame.GetMethod().DeclaringType != null) + TShock.Log.Debug(frame.GetMethod().DeclaringType.Name + " called Disable()."); + } + public virtual void Whoopie(object time) { var time2 = (int) time; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index eaf38a5e..ecf16a75 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -966,7 +966,7 @@ namespace TShockAPI { if (CheckIgnores(player)) { - player.Disable("not being logged in while SSC is enabled", flags); + player.Disable(flags: flags); } else if (Itembans.ItemIsBanned(player.TPlayer.inventory[player.TPlayer.selectedItem].name, player)) { @@ -1046,7 +1046,7 @@ namespace TShockAPI if (CheckIgnores(player)) { - player.Disable("check ignores failed in OnSecondUpdate()", flags); + player.Disable(flags: flags); } else if (Itembans.ItemIsBanned(player.TPlayer.inventory[player.TPlayer.selectedItem].name, player)) {