Tile threshold can now be set in config.

This commit is contained in:
Deathmax 2011-06-23 17:36:19 +08:00
parent df1cbab1f5
commit 8037fd67db
3 changed files with 6 additions and 2 deletions

View file

@ -41,6 +41,7 @@ namespace TShockAPI
public bool RangeChecks = true; public bool RangeChecks = true;
public bool SpamChecks = false; public bool SpamChecks = false;
public bool DisableBuild = false; public bool DisableBuild = false;
public int TileThreshold = 20;
public float[] AdminChatRGB = {255, 0, 0}; public float[] AdminChatRGB = {255, 0, 0};
public string AdminChatPrefix = "(Admin) "; public string AdminChatPrefix = "(Admin) ";

View file

@ -55,6 +55,7 @@ namespace TShockAPI
public static float[] AdminChatRGB = {255, 0, 0}; public static float[] AdminChatRGB = {255, 0, 0};
public static string AdminChatPrefix = "(Admin) "; public static string AdminChatPrefix = "(Admin) ";
public static bool RememberLeavePos = false; public static bool RememberLeavePos = false;
public static int TileThreshold = 20;
/// <summary> /// <summary>
/// Don't allow pvp changing for x seconds. /// Don't allow pvp changing for x seconds.
@ -103,6 +104,7 @@ namespace TShockAPI
RangeChecks = cfg.RangeChecks; RangeChecks = cfg.RangeChecks;
SpamChecks = cfg.SpamChecks; SpamChecks = cfg.SpamChecks;
DisableBuild = cfg.DisableBuild; DisableBuild = cfg.DisableBuild;
TileThreshold = cfg.TileThreshold;
NPC.maxSpawns = DefaultMaxSpawns; NPC.maxSpawns = DefaultMaxSpawns;
NPC.defaultSpawnRate = DefaultSpawnRate; NPC.defaultSpawnRate = DefaultSpawnRate;
AdminChatRGB = cfg.AdminChatRGB; AdminChatRGB = cfg.AdminChatRGB;
@ -140,6 +142,7 @@ namespace TShockAPI
cfg.RangeChecks = RangeChecks; cfg.RangeChecks = RangeChecks;
cfg.SpamChecks = SpamChecks; cfg.SpamChecks = SpamChecks;
cfg.DisableBuild = DisableBuild; cfg.DisableBuild = DisableBuild;
cfg.TileThreshold = TileThreshold;
cfg.AdminChatRGB = AdminChatRGB; cfg.AdminChatRGB = AdminChatRGB;
cfg.AdminChatPrefix = AdminChatPrefix; cfg.AdminChatPrefix = AdminChatPrefix;
cfg.PvpThrottle = PvpThrottle; cfg.PvpThrottle = PvpThrottle;

View file

@ -195,7 +195,7 @@ namespace TShockAPI
{ {
if (player != null && player.Active) if (player != null && player.Active)
{ {
if (player.TileThreshold >= 20) if (player.TileThreshold >= ConfigurationManager.TileThreshold)
{ {
if (Tools.HandleTntUser(player, "Kill tile abuse detected.")) 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()); 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) // 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"); Log.Debug("Rejecting " + type + " from " + player.Name + " as this player is about to be kicked");
e.Handled = true; e.Handled = true;