diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 862dcd34..0990f5bd 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -15,8 +15,10 @@ namespace TShockAPI public bool EnableWhitelist = false; public bool InfiniteInvasion = false; public bool AlwaysPvP = false; - public bool KickSaveEditors = true; - public bool BanSaveEditors = true; + public bool KickCheaters = true; + public bool BanCheaters = true; + public bool KickGriefers = true; + public bool BanGriefers = true; public bool BanKillTileAbusers = false; public bool KickKillTileAbusers = false; } diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs index b2a85497..1a447e87 100644 --- a/TShockAPI/ConfigurationManager.cs +++ b/TShockAPI/ConfigurationManager.cs @@ -23,6 +23,8 @@ namespace TShockAPI public static bool startedInvasion = false; public static bool kickCheater = true; public static bool banCheater = true; + public static bool kickGriefer = true; + public static bool banGriefer = true; public static bool banTnt = false; public static bool kickTnt = false; public enum NPCList : int @@ -45,8 +47,10 @@ namespace TShockAPI enableWhitelist = cfg.EnableWhitelist; infiniteInvasion = cfg.InfiniteInvasion; permaPvp = cfg.AlwaysPvP; - kickCheater = cfg.KickSaveEditors; - banCheater = cfg.BanSaveEditors; + kickCheater = cfg.KickCheaters; + banCheater = cfg.BanCheaters; + kickGriefer = cfg.KickGriefers; + banGriefer = cfg.BanGriefers; banTnt = cfg.BanKillTileAbusers; kickTnt = cfg.KickKillTileAbusers; } @@ -70,8 +74,10 @@ namespace TShockAPI cfg.EnableWhitelist = false; cfg.InfiniteInvasion = false; cfg.AlwaysPvP = false; - cfg.KickSaveEditors = false; - cfg.BanSaveEditors = false; + cfg.KickCheaters = kickCheater; + cfg.BanCheaters = banCheater; + cfg.KickGriefers = kickGriefer; + cfg.BanGriefers = banGriefer; cfg.BanKillTileAbusers = true; cfg.KickKillTileAbusers = true; diff --git a/TShockAPI/Tools.cs b/TShockAPI/Tools.cs index c906e7df..619affed 100644 --- a/TShockAPI/Tools.cs +++ b/TShockAPI/Tools.cs @@ -219,7 +219,7 @@ namespace TShockAPI } /// - /// Determines what to do with someone listed in cheaters.txt + /// Adds someone to cheaters.txt /// /// int player public static void HandleCheater(int ply) @@ -229,7 +229,6 @@ namespace TShockAPI 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; @@ -238,6 +237,26 @@ namespace TShockAPI Tools.Broadcast(cheater + " was " + (ConfigurationManager.banCheater ? "banned " : "kicked ") + "for cheating."); } } + + /// + /// Adds someone to greifers.txt + /// + /// int player + public static void HandleGreifer(int ply) + { + if (!TShock.players[ply].IsAdmin()) + { + string cheater = Tools.FindPlayer(ply); + string ip = Tools.GetRealIP(Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)); + + FileTools.WriteGrief(ply); + if (!ConfigurationManager.kickGriefer) { return; } + Netplay.serverSock[ply].kill = true; + Netplay.serverSock[ply].Reset(); + NetMessage.syncPlayers(); + Tools.Broadcast(cheater + " was " + (ConfigurationManager.banCheater ? "banned " : "kicked ") + "for greifing."); + } + } /// /// Shows a MOTD to the player ///