From f8a5388582d08c77545f56ab42f9f52ec7ce7515 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 24 Oct 2016 10:47:07 -0600 Subject: [PATCH] Revert "Ensure IPs are > 0 otherwise the Linq will fail." --- TShockAPI/TShock.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 7100aaca..9a6aac10 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -409,19 +409,17 @@ namespace TShockAPI KnownIps = JsonConvert.DeserializeObject>(args.Player.User.KnownIps); } - if (KnownIps.Count > 0) + bool last = KnownIps.Last() == args.Player.IP; + if (!last) { - bool last = KnownIps.Last() == args.Player.IP; - if (!last) + if (KnownIps.Count == 100) { - if (KnownIps.Count == 100) - { - KnownIps.RemoveAt(0); - } - - KnownIps.Add(args.Player.IP); + KnownIps.RemoveAt(0); } + + KnownIps.Add(args.Player.IP); } + args.Player.User.KnownIps = JsonConvert.SerializeObject(KnownIps, Formatting.Indented); Users.UpdateLogin(args.Player.User); } @@ -1174,7 +1172,7 @@ namespace TShockAPI { if (args.Handled) return; - + if (!Config.AllowCrimsonCreep && (args.Type == TileID.Dirt || args.Type == TileID.FleshWeeds || TileID.Sets.Crimson[args.Type])) {