diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index cb89c576..e5508afd 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -34,6 +34,7 @@ namespace TShockAPI public bool KickKillTileAbusers = true; public bool BanExplosives = true; public bool KickExplosives = true; + public bool DisableExplosives = true; public bool SpawnProtection = true; public int SpawnProtectionRadius = 5; public string DistributationAgent = "facepunch"; diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs index 6038bad8..d8660687 100644 --- a/TShockAPI/ConfigurationManager.cs +++ b/TShockAPI/ConfigurationManager.cs @@ -44,6 +44,7 @@ namespace TShockAPI public static bool KickTnt = true; public static bool BanBoom = true; public static bool KickBoom = true; + public static bool DisableBoom = true; public static bool SpawnProtect = true; public static bool RangeChecks = true; public static int SpawnProtectRadius = 5; @@ -97,6 +98,7 @@ namespace TShockAPI KickTnt = cfg.KickKillTileAbusers; BanBoom = cfg.BanExplosives; KickBoom = cfg.KickExplosives; + DisableBoom = cfg.DisableExplosives; SpawnProtect = cfg.SpawnProtection; SpawnProtectRadius = cfg.SpawnProtectionRadius; DistributationAgent = cfg.DistributationAgent; @@ -136,6 +138,7 @@ namespace TShockAPI cfg.KickKillTileAbusers = KickTnt; cfg.BanExplosives = BanBoom; cfg.KickExplosives = KickBoom; + cfg.DisableExplosives = DisableBoom; cfg.SpawnProtection = SpawnProtect; cfg.SpawnProtectionRadius = SpawnProtectRadius; cfg.MaxSlots = MaxSlots; diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 2728edae..c03fbeaa 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -318,7 +318,17 @@ namespace TShockAPI if (type == 29 || type == 28 || type == 37) { Log.Debug(string.Format("Explosive(PlyXY:{0}_{1}, Type:{2})", args.Player.TileX, args.Player.TileY, type)); - return Tools.HandleExplosivesUser(args.Player, "Throwing an explosive device."); + if (ConfigurationManager.DisableBoom && (!args.Player.Group.HasPermission("useexplosives") || !args.Player.Group.HasPermission("ignoregriefdetection"))) + { + //Lag will still allow the projectile to detonate. + //TODO: Stop KillTile for x period of time after projectile packet is received. + Main.projectile[ident].type = 0; + NetMessage.SendData((int)PacketTypes.ProjectileNew, args.Player.Index, -1, "", ident); + args.Player.SendMessage("Explosives are disabled!", Color.Red); + //return true; + } + else + return Tools.HandleExplosivesUser(args.Player, "Throwing an explosive device."); } return false; }