Added a new Configuration Flag called "DisableBuild".

This commit is contained in:
Shank 2011-06-12 02:24:46 -06:00
parent 881ddd5543
commit 2fe906744f
3 changed files with 11 additions and 0 deletions

View file

@ -40,5 +40,6 @@ namespace TShockAPI
public int MaxSlots = 8;
public bool RangeChecks = true;
public bool SpamChecks = false;
public bool DisableBuild = false;
}
}

View file

@ -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);

View file

@ -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"))