From 8037fd67dbffae278f1930e9e6c2367789da2caf Mon Sep 17 00:00:00 2001 From: Deathmax Date: Thu, 23 Jun 2011 17:36:19 +0800 Subject: [PATCH] Tile threshold can now be set in config. --- TShockAPI/ConfigFile.cs | 1 + TShockAPI/ConfigurationManager.cs | 3 +++ TShockAPI/TShock.cs | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 36427e32..cb89c576 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -41,6 +41,7 @@ namespace TShockAPI public bool RangeChecks = true; public bool SpamChecks = false; public bool DisableBuild = false; + public int TileThreshold = 20; public float[] AdminChatRGB = {255, 0, 0}; public string AdminChatPrefix = "(Admin) "; diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs index d95fc3bd..6038bad8 100644 --- a/TShockAPI/ConfigurationManager.cs +++ b/TShockAPI/ConfigurationManager.cs @@ -55,6 +55,7 @@ namespace TShockAPI public static float[] AdminChatRGB = {255, 0, 0}; public static string AdminChatPrefix = "(Admin) "; public static bool RememberLeavePos = false; + public static int TileThreshold = 20; /// /// Don't allow pvp changing for x seconds. @@ -103,6 +104,7 @@ namespace TShockAPI RangeChecks = cfg.RangeChecks; SpamChecks = cfg.SpamChecks; DisableBuild = cfg.DisableBuild; + TileThreshold = cfg.TileThreshold; NPC.maxSpawns = DefaultMaxSpawns; NPC.defaultSpawnRate = DefaultSpawnRate; AdminChatRGB = cfg.AdminChatRGB; @@ -140,6 +142,7 @@ namespace TShockAPI cfg.RangeChecks = RangeChecks; cfg.SpamChecks = SpamChecks; cfg.DisableBuild = DisableBuild; + cfg.TileThreshold = TileThreshold; cfg.AdminChatRGB = AdminChatRGB; cfg.AdminChatPrefix = AdminChatPrefix; cfg.PvpThrottle = PvpThrottle; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 029d6c0e..0d58d4e6 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -195,7 +195,7 @@ namespace TShockAPI { if (player != null && player.Active) { - if (player.TileThreshold >= 20) + if (player.TileThreshold >= ConfigurationManager.TileThreshold) { if (Tools.HandleTntUser(player, "Kill tile abuse detected.")) { @@ -379,7 +379,7 @@ namespace TShockAPI Debug.WriteLine("{0:X} ({2}): {3} ({1:XX})", player.Index, (byte)type, player.TPlayer.dead ? "dead " : "alive", type.ToString()); // Stop accepting updates from player as this player is going to be kicked/banned during OnUpdate (different thread so can produce race conditions) - if ((ConfigurationManager.BanTnt || ConfigurationManager.KickTnt) && player.TileThreshold >= 20 && !player.Group.HasPermission("ignoregriefdetection")) + if ((ConfigurationManager.BanTnt || ConfigurationManager.KickTnt) && player.TileThreshold >= ConfigurationManager.TileThreshold && !player.Group.HasPermission("ignoregriefdetection")) { Log.Debug("Rejecting " + type + " from " + player.Name + " as this player is about to be kicked"); e.Handled = true;