Ensure IPs are > 0 otherwise the Linq will fail.
This commit is contained in:
parent
8f7b8db2a1
commit
701cfa0591
1 changed files with 10 additions and 8 deletions
|
|
@ -412,17 +412,19 @@ namespace TShockAPI
|
||||||
KnownIps = JsonConvert.DeserializeObject<List<String>>(args.Player.User.KnownIps);
|
KnownIps = JsonConvert.DeserializeObject<List<String>>(args.Player.User.KnownIps);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool last = KnownIps.Last() == args.Player.IP;
|
if (KnownIps.Count > 0)
|
||||||
if (!last)
|
|
||||||
{
|
{
|
||||||
if (KnownIps.Count == 100)
|
bool last = KnownIps.Last() == args.Player.IP;
|
||||||
|
if (!last)
|
||||||
{
|
{
|
||||||
KnownIps.RemoveAt(0);
|
if (KnownIps.Count == 100)
|
||||||
|
{
|
||||||
|
KnownIps.RemoveAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
KnownIps.Add(args.Player.IP);
|
||||||
}
|
}
|
||||||
|
|
||||||
KnownIps.Add(args.Player.IP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
args.Player.User.KnownIps = JsonConvert.SerializeObject(KnownIps, Formatting.Indented);
|
args.Player.User.KnownIps = JsonConvert.SerializeObject(KnownIps, Formatting.Indented);
|
||||||
Users.UpdateLogin(args.Player.User);
|
Users.UpdateLogin(args.Player.User);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue