From 16e5cfe3425cbc65ce6d387a5b03c96cb15b329e Mon Sep 17 00:00:00 2001 From: Deathmax Date: Fri, 3 Jun 2011 22:38:13 +0800 Subject: [PATCH] Fixed issue where players with > 100 MP/HP would get flagged as their max didn't get synced. --- TShockAPI/TSPlayer.cs | 2 ++ TShockAPI/TShock.cs | 32 +++++++++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 028e91c4..a2504cba 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -11,6 +11,8 @@ namespace TShockAPI private int player; private bool admin; private bool adminSet; + public bool syncHP = false; + public bool syncMP = false; public TSPlayer(int ply) { diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index dd72497f..95aaff90 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -199,10 +199,13 @@ namespace TShockAPI life = br.ReadInt16(); maxLife = br.ReadInt16(); } - if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife) + if (players[ply].syncHP) { - Tools.HandleCheater(ply); + if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife) + Tools.HandleCheater(ply); } + else + players[ply].syncHP = true; } else if (e.MsgID == 0x2a) { @@ -214,10 +217,13 @@ namespace TShockAPI life = br.ReadInt16(); maxLife = br.ReadInt16(); } - if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife) + if (players[ply].syncMP) { - Tools.HandleCheater(ply); + if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife) + Tools.HandleCheater(ply); } + else + players[ply].syncMP = true; } else if (e.MsgID == 0x19) { @@ -257,13 +263,17 @@ namespace TShockAPI } if (type == 29 || type == 28) { - if (ConfigurationManager.kickTnt || ConfigurationManager.banTnt) + if (!players[e.Msg.whoAmI].IsAdmin()) { - int i = e.Msg.whoAmI; - if (ConfigurationManager.banTnt) - FileTools.WriteGrief((int)i); - Tools.Kick((int)i, "Explosives was thrown."); - Tools.Broadcast(Main.player[i].name + " was " + (ConfigurationManager.banBoom ? "banned" : "kicked") + " for throwing an explosive device."); + if (ConfigurationManager.kickTnt || ConfigurationManager.banTnt) + { + int i = e.Msg.whoAmI; + if (ConfigurationManager.banTnt) + FileTools.WriteGrief((int)i); + Tools.Kick((int)i, "Explosives was thrown."); + Tools.Broadcast(Main.player[i].name + " was " + (ConfigurationManager.banBoom ? "banned" : "kicked") + " for throwing an explosive device."); + e.Handled = true; + } } } } @@ -326,7 +336,7 @@ namespace TShockAPI } else if (FileTools.Checkgrief(ip)) { - Tools.Kick(ply, "You were flagged for griefing (either kill tile abuse or explosives)."); + Tools.Kick(ply, "You were flagged for griefing."); } if (!FileTools.OnWhitelist(ip)) {