From 892ef0c7700486972ad1aa7937074c167d0c1fda Mon Sep 17 00:00:00 2001 From: Maverick Motherfucker Date: Thu, 2 Jun 2011 21:28:47 -0700 Subject: [PATCH] Moved the admin check for cheating into HandleCheater instead of cheat detection --- TShockAPI/TShock.cs | 2 +- TShockAPI/Tools.cs | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index cca584a0..18b679ae 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -189,7 +189,7 @@ namespace TShockAPI if (Main.netMode != 2) { return; } int plr = who; //legacy support Tools.ShowMOTD(who); - if ((Main.player[plr].statLifeMax > 400 || Main.player[plr].statManaMax > 200 || Main.player[plr].statLife > 400 || Main.player[plr].statMana > 200 || CheckInventory(plr)) && !Tools.IsAdmin(plr)) + if (Main.player[plr].statLifeMax > 400 || Main.player[plr].statManaMax > 200 || Main.player[plr].statLife > 400 || Main.player[plr].statMana > 200 || CheckInventory(plr)) { Tools.HandleCheater(plr); } diff --git a/TShockAPI/Tools.cs b/TShockAPI/Tools.cs index 3f0ef0ab..6de0ce20 100644 --- a/TShockAPI/Tools.cs +++ b/TShockAPI/Tools.cs @@ -224,16 +224,19 @@ namespace TShockAPI /// int player public static void HandleCheater(int ply) { - string cheater = Tools.FindPlayer(ply); - string ip = Tools.GetRealIP(Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)); + if (!Tools.IsAdmin(ply)) + { + string cheater = Tools.FindPlayer(ply); + string ip = Tools.GetRealIP(Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)); - FileTools.WriteGrief(ply); - FileTools.WriteCheater(ply); - if (!ConfigurationManager.kickCheater) { return; } - Netplay.serverSock[ply].kill = true; - Netplay.serverSock[ply].Reset(); - NetMessage.syncPlayers(); - Tools.Broadcast(cheater + " was " + (ConfigurationManager.banCheater ? "banned " : "kicked ") + "for cheating."); + FileTools.WriteGrief(ply); + FileTools.WriteCheater(ply); + if (!ConfigurationManager.kickCheater) { return; } + Netplay.serverSock[ply].kill = true; + Netplay.serverSock[ply].Reset(); + NetMessage.syncPlayers(); + Tools.Broadcast(cheater + " was " + (ConfigurationManager.banCheater ? "banned " : "kicked ") + "for cheating."); + } } /// /// Shows a MOTD to the player