From aa3a491dabbcbe9f57d36d34af3c0ab50398c2c8 Mon Sep 17 00:00:00 2001 From: Deathmax Date: Tue, 28 Jun 2011 17:09:58 +0800 Subject: [PATCH] Added null checks for tile destroyed check. --- TShockAPI/TShock.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index c666df6d..66e57eb6 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -199,23 +199,26 @@ namespace TShockAPI { if (player != null && player.Active) { - if (player.TileThreshold >= ConfigurationManager.TileThreshold) + if (player.TilesDestroyed != null) { - if (Tools.HandleTntUser(player, "Kill tile abuse detected.")) + if (player.TileThreshold >= ConfigurationManager.TileThreshold) { - TSPlayer.Server.RevertKillTile(player.TilesDestroyed); + if (Tools.HandleTntUser(player, "Kill tile abuse detected.")) + { + TSPlayer.Server.RevertKillTile(player.TilesDestroyed); + } + else if (player.TileThreshold > 0) + { + player.TileThreshold = 0; + player.TilesDestroyed.Clear(); + } + } else if (player.TileThreshold > 0) { player.TileThreshold = 0; player.TilesDestroyed.Clear(); } - - } - else if (player.TileThreshold > 0) - { - player.TileThreshold = 0; - player.TilesDestroyed.Clear(); } if (!player.Group.HasPermission("usebanneditem"))