diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 149c20e5..61f53364 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ using System; -using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; diff --git a/TShockAPI/DB/IQueryBuilder.cs b/TShockAPI/DB/IQueryBuilder.cs index e88d7c9c..96e71b8c 100644 --- a/TShockAPI/DB/IQueryBuilder.cs +++ b/TShockAPI/DB/IQueryBuilder.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Data; using System.Linq; using System.Text; using MySql.Data.MySqlClient; diff --git a/TShockAPI/DB/InventoryManager.cs b/TShockAPI/DB/InventoryManager.cs index a7d45e66..97feb6b4 100644 --- a/TShockAPI/DB/InventoryManager.cs +++ b/TShockAPI/DB/InventoryManager.cs @@ -18,9 +18,7 @@ along with this program. If not, see . using System; using System.Data; - using MySql.Data.MySqlClient; -using Terraria; namespace TShockAPI.DB { diff --git a/TShockAPI/DB/ItemManager.cs b/TShockAPI/DB/ItemManager.cs index ff3180d8..960e8b0c 100644 --- a/TShockAPI/DB/ItemManager.cs +++ b/TShockAPI/DB/ItemManager.cs @@ -1,13 +1,9 @@ using System; using System.Collections.Generic; using System.Data; -using System.Diagnostics.CodeAnalysis; - using System.IO; using System.Linq; -using System.Xml; using MySql.Data.MySqlClient; -using Terraria; namespace TShockAPI.DB { diff --git a/TShockAPI/DB/SqlTable.cs b/TShockAPI/DB/SqlTable.cs index 21d289e1..b2610538 100644 --- a/TShockAPI/DB/SqlTable.cs +++ b/TShockAPI/DB/SqlTable.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Data; using System.Linq; -using System.Text; using MySql.Data.MySqlClient; namespace TShockAPI.DB diff --git a/TShockAPI/DB/SqlValue.cs b/TShockAPI/DB/SqlValue.cs index f74d3149..a5520236 100644 --- a/TShockAPI/DB/SqlValue.cs +++ b/TShockAPI/DB/SqlValue.cs @@ -1,5 +1,4 @@ using System.Data; -using MySql.Data.MySqlClient; using System.Collections.Generic; namespace TShockAPI.DB diff --git a/TShockAPI/Extensions/LinqExt.cs b/TShockAPI/Extensions/LinqExt.cs index b8a891ed..bd8384fc 100644 --- a/TShockAPI/Extensions/LinqExt.cs +++ b/TShockAPI/Extensions/LinqExt.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; namespace TShockAPI { diff --git a/TShockAPI/Extensions/RandomExt.cs b/TShockAPI/Extensions/RandomExt.cs index e49b50f0..517e445b 100644 --- a/TShockAPI/Extensions/RandomExt.cs +++ b/TShockAPI/Extensions/RandomExt.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Text; namespace TShockAPI.Extensions diff --git a/TShockAPI/Extensions/StringExt.cs b/TShockAPI/Extensions/StringExt.cs index b74c3170..569cd1f8 100644 --- a/TShockAPI/Extensions/StringExt.cs +++ b/TShockAPI/Extensions/StringExt.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace TShockAPI { diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 870c8982..38b06a81 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -17,7 +17,6 @@ along with this program. If not, see . */ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Text; @@ -25,7 +24,6 @@ using Terraria; using TShockAPI.Net; using System.IO.Streams; -using System.Net; namespace TShockAPI { @@ -159,9 +157,12 @@ namespace TShockAPI int cur = args.Data.ReadInt16(); int max = args.Data.ReadInt16(); - if (cur > 500 || max > 500) + if (args.Player.FirstMaxHP == 0) + args.Player.FirstMaxHP = max; + + if (max > 400 && max > args.Player.FirstMaxHP) { - TShock.Utils.ForceKick(args.Player, "You have Hacked Health/Mana, Please use a different character."); + TShock.Utils.ForceKick(args.Player, "Hacked Client Detected."); return false; } @@ -179,9 +180,13 @@ namespace TShockAPI int cur = args.Data.ReadInt16(); int max = args.Data.ReadInt16(); - if (cur > 500 || max > 500) + if (args.Player.FirstMaxMP == 0) + args.Player.FirstMaxMP = max; + + if (max > 400 && max > args.Player.FirstMaxMP) { - TShock.Utils.ForceKick(args.Player, "You have Hacked Health/Mana, Please use a different character."); + TShock.Utils.ForceKick(args.Player, "Hacked Client Detected."); + return false; } return false; @@ -334,7 +339,7 @@ namespace TShockAPI if (TShock.Utils.ActivePlayers() + 1 > TShock.Config.MaxSlots && !args.Player.Group.HasPermission(Permissions.reservedslot)) { TShock.Utils.ForceKick(args.Player, TShock.Config.ServerFullReason); - return false; + return true; } NetMessage.SendData((int)PacketTypes.TimeSet, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY); @@ -352,6 +357,8 @@ namespace TShockAPI if (TShock.Config.DisplayIPToAdmins) TShock.Utils.SendLogs(string.Format("{0} has joined. IP: {1}", args.Player.Name, args.Player.IP), Color.Blue); + + return false; } private static bool HandleSendTileSquare(GetDataHandlerArgs args) diff --git a/TShockAPI/Net/BaseMsg.cs b/TShockAPI/Net/BaseMsg.cs index 38e9c055..5e41e2ee 100644 --- a/TShockAPI/Net/BaseMsg.cs +++ b/TShockAPI/Net/BaseMsg.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; using System.IO.Streams; -using System.Linq; -using System.Text; namespace TShockAPI.Net { diff --git a/TShockAPI/Rest/RestManager.cs b/TShockAPI/Rest/RestManager.cs index cf20d8ef..b43e6542 100644 --- a/TShockAPI/Rest/RestManager.cs +++ b/TShockAPI/Rest/RestManager.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using HttpServer; using Rests; using Terraria; diff --git a/TShockAPI/Rest/SecureRest.cs b/TShockAPI/Rest/SecureRest.cs index db12f1fe..4563f4b6 100644 --- a/TShockAPI/Rest/SecureRest.cs +++ b/TShockAPI/Rest/SecureRest.cs @@ -2,9 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Net; -using System.Text; using HttpServer; -using TShockAPI; namespace Rests { diff --git a/TShockAPI/StatTracker.cs b/TShockAPI/StatTracker.cs index 9e239f1f..87ba219e 100644 --- a/TShockAPI/StatTracker.cs +++ b/TShockAPI/StatTracker.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using System.Net; -using System.Text; using System.Threading; using Terraria; diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index d4d94813..2a5ce28b 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -36,8 +36,8 @@ namespace TShockAPI public int ProjectileThreshold { get; set; } public Dictionary TilesDestroyed { get; protected set; } public Dictionary TilesCreated { get; protected set; } - public bool SyncHP { get; set; } - public bool SyncMP { get; set; } + public int FirstMaxHP { get; set; } + public int FirstMaxMP { get; set; } public Group Group { get; set; } public bool ReceivedInfo { get; set; } public int Index { get; protected set; } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 474393b8..967834f0 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -32,12 +32,10 @@ using System.Diagnostics; using System.IO; using System.Net; using System.Reflection; -using System.Runtime.InteropServices; using System.Threading; using Mono.Data.Sqlite; using Hooks; using MySql.Data.MySqlClient; -using Newtonsoft.Json; using Rests; using Terraria; using TShockAPI.DB;