From c4033af6f24f482ce384f3bd0779f967a5f11a4d Mon Sep 17 00:00:00 2001 From: high Date: Fri, 10 Jun 2011 19:47:09 -0400 Subject: [PATCH] Added SpamChecks config option which is false by default. This disables redigit's shitty anti grief. --- TShockAPI/ConfigFile.cs | 1 + TShockAPI/ConfigurationManager.cs | 4 +++- TShockAPI/TShock.cs | 12 +----------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index e9a9ef3e..b062506d 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -22,5 +22,6 @@ public string DistributationAgent = "facepunch"; public int MaxSlots = 8; public bool RangeChecks = true; + public bool SpamChecks = false; } } \ No newline at end of file diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs index 6e3fd578..6fed039d 100644 --- a/TShockAPI/ConfigurationManager.cs +++ b/TShockAPI/ConfigurationManager.cs @@ -31,6 +31,7 @@ namespace TShockAPI public static string distributationAgent = "facepunch"; public static int authToken; public static int maxSlots = 8; + public static bool spamChecks = false; public enum NPCList { @@ -65,6 +66,7 @@ namespace TShockAPI distributationAgent = cfg.DistributationAgent; maxSlots = cfg.MaxSlots; rangeChecks = cfg.RangeChecks; + spamChecks = cfg.SpamChecks; NPC.maxSpawns = defaultMaxSpawns; NPC.defaultSpawnRate = defaultSpawnRate; } @@ -100,7 +102,7 @@ namespace TShockAPI cfg.SpawnProtectionRadius = 5; cfg.MaxSlots = maxSlots; cfg.RangeChecks = rangeChecks; - + cfg.SpamChecks = spamChecks; 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 7c61da1f..90ac8734 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -140,10 +140,8 @@ namespace TShockAPI Log.Info(version); Log.Info("Starting..."); - GameHooks.Initialize += OnPreInit; GameHooks.PostInitialize += OnPostInit; GameHooks.Update += OnUpdate; - GameHooks.LoadContent += OnLoadContent; ServerHooks.Chat += OnChat; ServerHooks.Join += OnJoin; NetHooks.GetData += GetData; @@ -192,10 +190,8 @@ namespace TShockAPI { Bans.SaveBans(); - GameHooks.Initialize -= OnPreInit; GameHooks.PostInitialize -= OnPostInit; GameHooks.Update -= OnUpdate; - GameHooks.LoadContent -= OnLoadContent; ServerHooks.Chat -= OnChat; ServerHooks.Join -= OnJoin; ServerHooks.Command -= ServerHooks_OnCommand; @@ -657,14 +653,8 @@ namespace TShockAPI handler.Handled = true; } } - } - private void OnLoadContent(ContentManager obj) - { - } - - private void OnPreInit() - { + Netplay.serverSock[ply].spamCheck = ConfigurationManager.spamChecks; } private void OnPostInit()