Added MaximumLoginAttempts to configuration system.

This commit is contained in:
Lucas Nicodemus 2011-07-01 03:07:06 -06:00
parent 53c3fdf276
commit c6b77970c8
3 changed files with 7 additions and 2 deletions

View file

@ -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.");
}

View file

@ -59,5 +59,7 @@ namespace TShockAPI
public bool BanOnHardcoreOnlyDeath = false;
public bool AutoSave = true;
public int MaximumLoginAttempts = 3;
}
}

View file

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