From 2bd9b6a6b6d9d93cd05de6010df7002c85ae0628 Mon Sep 17 00:00:00 2001 From: Scavenger3 Date: Sat, 6 Jul 2013 22:18:26 +1000 Subject: [PATCH] Check for invalid place style --- TShockAPI/ConfigFile.cs | 2 ++ TShockAPI/GetDataHandlers.cs | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 9b5b40c6..ff30e681 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -251,6 +251,8 @@ namespace TShockAPI [Description("The path of the directory where logs should be written into.")] public string LogPath = "tshock"; + [Description("Prevents players from placing tiles with an invalid style.")] public bool PreventInvalidPlaceStyle = true; + /// /// Reads a configuration file from a given path /// diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index f59a5ffe..b17a9b7e 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1807,6 +1807,15 @@ namespace TShockAPI args.Player.SendTileSquare(tileX, tileY); return true; } + if (type == 1 && TShock.Config.PreventInvalidPlaceStyle && ((tiletype == 4 && style > 8) || + (tiletype == 13 && style > 4) || (tiletype == 15 && style > 1) || (tiletype == 21 && style > 6) || + (tiletype == 82 && style > 5) || (tiletype == 91 && style > 3) || (tiletype == 105 && style > 42) || + (tiletype == 135 && style > 3) || (tiletype == 139 && style > 12) || (tiletype == 144 && style > 2) || + (tiletype == 149 && style > 2))) + { + args.Player.SendTileSquare(tileX, tileY); + return true; + } } if (TShock.CheckIgnores(args.Player))