From 4ef324e0264c1bc342332dacda4a238b201cc0b3 Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Sun, 19 Jan 2014 18:45:45 -0500 Subject: [PATCH] Fix bypassing SSC using items in hand (trashcans are still exploitable until Redigit or his merry men decide that its a bug and fix it) --- TShockAPI/GetDataHandlers.cs | 6 ++++++ TShockAPI/TSPlayer.cs | 1 + TShockAPI/TShock.cs | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 57ffe22a..9dc09447 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1310,6 +1310,12 @@ namespace TShockAPI args.Player.IgnoreActionsForClearingTrashCan = true; } + if (slot == 58) //this is the hand + { + item.stack = stack; + args.Player.ItemInHand = item; + } + return false; } diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 67bee342..24525246 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -809,6 +809,7 @@ namespace TShockAPI private DateTime LastDisableNotification = DateTime.UtcNow; public int ActiveChest = -1; + public Item ItemInHand = new Item(); public virtual void Disable(string reason = "", bool displayConsole = true) { diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 647693da..b453c4f0 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -393,6 +393,12 @@ namespace TShockAPI { if (args.Player.IsLoggedIn) args.Player.SaveServerCharacter(); + + if (args.Player.ItemInHand.type != 0) + { + args.Player.SendErrorMessage("Attempting to bypass SSC with item in hand."); + args.Handled = true; + } } private void NetHooks_NameCollision(NameCollisionEventArgs args)