From 0d350d53fa852505e3f16c370cacd4f2ef8056d0 Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Fri, 11 Oct 2013 21:02:05 -0400 Subject: [PATCH] Fix Skeletron Prime Crash Exploiting people, naughty naughty Set secondUpdate to stop displaying, because apparently no one knows that not being logged in is breaking the rules when requirelogin:true --- TShockAPI/GetDataHandlers.cs | 4 ++-- TShockAPI/TSPlayer.cs | 11 +++++++++-- TShockAPI/TShock.cs | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 924f0ef4..cba96c7c 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2955,8 +2955,8 @@ namespace TShockAPI var pvp = args.Data.ReadBoolean(); var crit = args.Data.ReadBoolean(); - if (dmg > 10000) //Abnormal values have the potential to cause infinite loops in the server. - { + if (dmg > 12000) //Abnormal values have the potential to cause infinite loops in the server. + { //12000 because Skely Prime Head does 10339 or some bs during the day. TShock.Utils.ForceKick(args.Player, "Crash Exploit Attempt", true); return false; } diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 67c00ee7..b0167100 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -790,7 +790,7 @@ namespace TShockAPI } private DateTime LastDisableNotification = DateTime.UtcNow; - public virtual void Disable(string reason = "") + public virtual void Disable(string reason = "", bool displayConsole = true) { LastThreat = DateTime.UtcNow; SetBuff(33, 330, true); //Weak @@ -800,7 +800,14 @@ namespace TShockAPI { if ((DateTime.UtcNow - LastDisableNotification).TotalMilliseconds > 5000) { - Log.ConsoleInfo(string.Format("Player {0} has been disabled for {1}.", Name, reason)); + if (displayConsole) + { + Log.ConsoleInfo(string.Format("Player {0} has been disabled for {1}.", Name, reason)); + } + else + { + Log.Info("Player {0} has been disabled for {1}.", Name, reason); + } LastDisableNotification = DateTime.UtcNow; } } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index bb63c3a4..dc28ab4c 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -760,7 +760,7 @@ namespace TShockAPI player.IgnoreActionsForDisabledArmor = check; if (CheckIgnores(player)) { - player.Disable("check ignores failed in SecondUpdate()"); + player.Disable("check ignores failed in SecondUpdate()", false); } else if (!player.Group.HasPermission(Permissions.usebanneditem) && Itembans.ItemIsBanned(player.TPlayer.inventory[player.TPlayer.selectedItem].name, player))