From 61d05ffdc6b3fb9544be72d333585a8aace835da Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Wed, 9 Apr 2014 18:37:41 -0400 Subject: [PATCH] Fix range check on item clearing to refer to the Main.item[] being cleared and not the fake coordinates being sent by the client. --- TShockAPI/GetDataHandlers.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 4709ee21..ae11532a 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2989,17 +2989,23 @@ namespace TShockAPI return true; } + if (type == 0) //Item removed, let client do this to prevent item duplication client side (but only if it passed the range check) + { + if (TShock.CheckRangePermission(args.Player, (int)(Main.item[id].position.X / 16f), (int)(Main.item[id].position.Y / 16f))) + { + args.Player.SendData(PacketTypes.ItemDrop, "", id); + return true; + } + + return false; + } + if (TShock.CheckRangePermission(args.Player, (int)(pos.X / 16f), (int)(pos.Y / 16f))) { args.Player.SendData(PacketTypes.ItemDrop, "", id); return true; } - if (type == 0) //Item removed, let client do this to prevent item duplication client side (but only if it passed the range check above) - { - return false; - } - if (Main.item[id].active && Main.item[id].netID != type) //stop the client from changing the item type of a drop but only if the client isn't picking up the item { args.Player.SendData(PacketTypes.ItemDrop, "", id);