diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 04cca268..cd37dda2 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -40,5 +40,6 @@ namespace TShockAPI public int MaxSlots = 8; public bool RangeChecks = true; public bool SpamChecks = false; + public bool DisableBuild = false; } } \ No newline at end of file diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs index ab11c6cf..2b8bbb4e 100644 --- a/TShockAPI/ConfigurationManager.cs +++ b/TShockAPI/ConfigurationManager.cs @@ -49,6 +49,7 @@ namespace TShockAPI public static int authToken; public static int maxSlots = 8; public static bool spamChecks = false; + public static bool disableBuild = false; public enum NPCList { @@ -84,6 +85,7 @@ namespace TShockAPI maxSlots = cfg.MaxSlots; rangeChecks = cfg.RangeChecks; spamChecks = cfg.SpamChecks; + disableBuild = cfg.DisableBuild; NPC.maxSpawns = defaultMaxSpawns; NPC.defaultSpawnRate = defaultSpawnRate; } @@ -120,6 +122,7 @@ namespace TShockAPI cfg.MaxSlots = maxSlots; cfg.RangeChecks = rangeChecks; cfg.SpamChecks = spamChecks; + cfg.DisableBuild = disableBuild; string json = JsonConvert.SerializeObject(cfg, Formatting.Indented); TextWriter tr = new StreamWriter(FileTools.SaveDir + "config.json"); tr.Write(json); diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 9cff2a20..a73df744 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -336,6 +336,13 @@ namespace TShockAPI } if (type == 0 || type == 1) { + if (ConfigurationManager.disableBuild) + { + if (!players[e.Msg.whoAmI].group.HasPermission("editspawn")) + { + return true; + } + } if (ConfigurationManager.spawnProtect) { if (!players[e.Msg.whoAmI].group.HasPermission("editspawn"))