Skip to content

Commit d895354

Browse files
committed
Geoip update
Accuracy is no longer included, also fixes geoip message from showing up when not needed.
1 parent 5bb930f commit d895354

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

fCraft/Commands/InfoCommands.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,7 +1787,7 @@ static void IPInfoHandler( Player player, CommandReader cmd ) {
17871787
info = FindPlayerInfo(player, cmd);
17881788
}
17891789
if (info == null) return;
1790-
if (info.GeoIP != info.LastIP.ToString() || info.Accuracy == 0) {
1790+
if (info.GeoIP != info.LastIP.ToString()) {
17911791
GetGeoip(info);
17921792
}
17931793

@@ -1799,7 +1799,6 @@ static void IPInfoHandler( Player player, CommandReader cmd ) {
17991799
player.Message(" Longitude: &f{0}", info.Longitude ?? "N/A");
18001800
player.Message(" Time Zone: &f{0}", info.TimeZone ?? "N/A");
18011801
player.Message(" Hostname: &f{0}", info.Hostname ?? "N/A");
1802-
player.Message(" Accuracy: &f{0}", info.Accuracy);
18031802
player.Message("Geoip information by: &9http://geoip.pw/");
18041803
}
18051804

@@ -1854,7 +1853,7 @@ public static void GetGeoip(PlayerInfo info) {
18541853
if (IPAddress.Parse(ip).IsLocal() && Server.ExternalIP != null) {
18551854
ip = Server.ExternalIP.ToString();
18561855
}
1857-
if (ip == info.GeoIP && info.Accuracy != 0) {
1856+
if (ip == info.GeoIP) {
18581857
return;
18591858
}
18601859
JsonObject result = null;
@@ -1870,7 +1869,6 @@ public static void GetGeoip(PlayerInfo info) {
18701869
info.Latitude = result.Get("latitude") ?? "N/A";
18711870
info.Longitude = result.Get("longitude") ?? "N/A";
18721871
info.TimeZone = result.Get("timezone") ?? "N/A";
1873-
byte.TryParse(result.Get("accuracy"), out info.Accuracy);
18741872
info.Hostname = result.Get("host") ?? "N/A";
18751873
info.GeoIP = result.Get("ip") ?? "N/A";
18761874
return;

fCraft/Network/IRC.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,9 +1072,9 @@ static void PlayerReadyHandler([CanBeNull] object sender, [NotNull] IPlayerEvent
10721072
string ip = e.Player.Info.LastIP.ToString();
10731073
if (IPAddress.Parse(ip).IsLocal() && Server.ExternalIP != null)
10741074
ip = Server.ExternalIP.ToString();
1075-
e.Player.Info.TimesVisited == 1 ? " for the first time" : (ip != e.Player.Info.GeoIP || e.Player.Info.Accuracy == 0) ? "" : " from " + e.Player.Info.CountryName);
10761075

10771076
string message = string.Format("&2{0}&2(&A{1}&2) Connected{2}.", Bold, e.Player.ClassyName,
1077+
e.Player.Info.TimesVisited == 1 ? " for the first time" : (ip != e.Player.Info.GeoIP) ? "" : " from " + e.Player.Info.CountryName);
10781078
SendChannelMessage(message);
10791079
}
10801080
}

fCraft/Player/PlayerInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void GeoipLogin() {
107107
ip = Server.ExternalIP.ToString();
108108
}
109109

110-
if (ip != GeoIP || Accuracy == 0) {
110+
if (ip != GeoIP) {
111111
Scheduler.NewBackgroundTask(GeoipLoginCallback).RunOnce(this, TimeSpan.Zero);
112112
} else {
113113
DisplayGeoIp(false);

fCraft/System/Server.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ public static string MakePlayerConnectedMessage([NotNull] Player player, bool fi
12631263
ip = ExternalIP.ToString();
12641264
return string.Format("&2(&A{0}&2) Connected{1}." + "{2}", player.ClassyName,
12651265
player.Info.TimesVisited == 1 ? " for the first time" :
1266-
(ip != player.Info.GeoIP || player.Info.Accuracy == 0 || string.IsNullOrEmpty(player.Info.CountryName)) ? "" :
1266+
(ip != player.Info.GeoIP || string.IsNullOrEmpty(player.Info.CountryName)) ? "" :
12671267
" from " + player.Info.CountryName, string.IsNullOrEmpty(player.ClientName) ? "" :
12681268
"&N&BUsing: " + player.ClientName);
12691269
}

0 commit comments

Comments
 (0)