diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index d4ee08f8..6fe33846 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -290,9 +290,9 @@ namespace TShockAPI public static void AttemptLogin(CommandArgs args) { - if (args.Player.LoginAttempts > 3) + if (args.Player.LoginAttempts > ConfigurationManager.MaximumLoginAttempts) { - Log.Warn(args.Player.IP + "(" + args.Player.Name + ") had 3 or more invalid login attempts and was kicked automatically."); + Log.Warn(args.Player.IP + "(" + args.Player.Name + ") had " + ConfigurationManager.MaximumLoginAttempts + " or more invalid login attempts and was kicked automatically."); Tools.Kick(args.Player, "Too many invalid login attempts."); } diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index eff333b1..ec5cc17b 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -59,5 +59,7 @@ namespace TShockAPI public bool BanOnHardcoreOnlyDeath = false; public bool AutoSave = true; + + public int MaximumLoginAttempts = 3; } } \ No newline at end of file diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs index fa89dc4b..400f30d6 100644 --- a/TShockAPI/ConfigurationManager.cs +++ b/TShockAPI/ConfigurationManager.cs @@ -57,6 +57,7 @@ namespace TShockAPI public static string AdminChatPrefix = "(Admin) "; public static bool RememberLeavePos = false; public static int TileThreshold = 20; + public static int MaximumLoginAttempts = 3; /// /// Don't allow pvp changing for x seconds. @@ -120,6 +121,7 @@ namespace TShockAPI KickOnHardcoreDeath = cfg.KickOnHardcoreOnlyDeath; BanOnHardcoreDeath = cfg.BanOnHardcoreOnlyDeath; AutoSave = cfg.AutoSave; + MaximumLoginAttempts = cfg.MaximumLoginAttempts; } public static void WriteJsonConfiguration() @@ -158,6 +160,7 @@ namespace TShockAPI cfg.BanOnHardcoreOnlyDeath = BanOnHardcoreDeath; cfg.KickOnHardcoreOnlyDeath = KickOnHardcoreDeath; cfg.AutoSave = AutoSave; + cfg.MaximumLoginAttempts = MaximumLoginAttempts; string json = JsonConvert.SerializeObject(cfg, Formatting.Indented); TextWriter tr = new StreamWriter(FileTools.ConfigPath); tr.Write(json);