From ed6aa9c07b886886365880c0b996c47fada2095a Mon Sep 17 00:00:00 2001 From: Deathmax Date: Sun, 18 Dec 2011 09:16:13 +0800 Subject: [PATCH] Enable kicking proxy users as identified by the MaxMind GeoIP database. --- TShockAPI/ConfigFile.cs | 3 +++ TShockAPI/TShock.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index c4ad5de8..00588364 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -214,6 +214,9 @@ namespace TShockAPI [Description("Disabling this prevents players from being banned or kicked based on item stacks.")] public bool EnableItemStackChecks = true; + [Description("Kicks users using a proxy as identified with the GeoIP database")] + public bool KickProxyUsers = true; + public static ConfigFile Read(string path) { if (!File.Exists(path)) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 3939eb72..70e01184 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -726,6 +726,9 @@ namespace TShockAPI { var code = Geo.TryGetCountryCode(IPAddress.Parse(player.IP)); player.Country = code == null ? "N/A" : MaxMind.GeoIPCountry.GetCountryNameByCode(code); + if (code == "A1") + if (TShock.Config.KickProxyUsers) + TShock.Utils.Kick(player, "Proxies are not allowed"); Log.Info(string.Format("{0} ({1}) from '{2}' group from '{3}' joined.", player.Name, player.IP, player.Group.Name, player.Country)); TShock.Utils.Broadcast(player.Name + " is from the " + player.Country, Color.Yellow); }