private void OnEnable()
 {
     if (U.Settings.Instance.CommunityBans)
     {
         using (RocketWebClient webClient = new RocketWebClient())
         {
             try
             {
                 webClient.DownloadStringCompleted += (object sender, System.Net.DownloadStringCompletedEventArgs e) =>
                 {
                     if (e.Error == null && e.Result != "false")
                     {
                         Logger.Log("[RocketMod Observatory] Player " + Player.CharacterName + " is banned:" + e.Result);
                         webClientResult = e.Result;
                         requested = DateTime.Now;
                     }
                 };
                 webClient.DownloadStringAsync(new Uri(string.Format("http://banlist.observatory.rocketmod.net/?steamid={0}", Player.CSteamID)));
             }
             catch (Exception)
             {
                 //
             }
         }
     }
 }
示例#2
0
 private void OnEnable()
 {
     if (U.Settings.Instance.RocketModObservatory.CommunityBans)
     {
         using (RocketWebClient webClient = new RocketWebClient())
         {
             try
             {
                 webClient.DownloadStringCompleted += (object sender, System.Net.DownloadStringCompletedEventArgs e) =>
                 {
                     if (e.Error == null)
                     {
                         if (e.Result.Contains(","))
                         {
                             string[] result = e.Result.Split(',');
                             long     age;
                             if (result[0] == "true")
                             {
                                 Core.Logging.Logger.Log("[RocketMod Observatory] Kicking Player " + Player.CharacterName + "because he is banned:" + result[1]);
                                 webClientResult = result[1];
                                 requested       = DateTime.Now;
                                 Player.Kick("you are banned from observatory: " + result[1]);
                             }
                             else if (U.Settings.Instance.RocketModObservatory.KickLimitedAccounts && result.Length >= 2 && result[1] == "true")
                             {
                                 Core.Logging.Logger.Log("[RocketMod Observatory] Kicking Player " + Player.CharacterName + " because his account is limited");
                                 Player.Kick("your Steam account is limited");
                             }
                             else if (U.Settings.Instance.RocketModObservatory.KickTooYoungAccounts && result.Length == 3 && long.TryParse(result[2].ToString(), out age))
                             {
                                 long epochTicks = new DateTime(1970, 1, 1).Ticks;
                                 long unixTime   = ((DateTime.UtcNow.Ticks - epochTicks) / TimeSpan.TicksPerSecond);
                                 long d          = (unixTime - age);
                                 if (d < U.Settings.Instance.RocketModObservatory.MinimumAge)
                                 {
                                     Core.Logging.Logger.Log("[RocketMod Observatory] Kicking Player " + Player.CharacterName + " because his account is younger then " + U.Settings.Instance.RocketModObservatory.MinimumAge + " seconds (" + d + " seconds)");
                                     Player.Kick("your Steam account is not old enough");
                                 }
                             }
                         }
                     }
                 };
                 webClient.DownloadStringAsync(new Uri(string.Format("http://banlist.observatory.rocketmod.net/?steamid={0}", Player.CSteamID)));
             }
             catch (Exception)
             {
                 //
             }
         }
     }
 }
 private void OnEnable()
 {
     if (U.Settings.Instance.RocketModObservatory.CommunityBans)
     {
         using (RocketWebClient webClient = new RocketWebClient())
         {
             try
             {
                 webClient.DownloadStringCompleted += (object sender, System.Net.DownloadStringCompletedEventArgs e) =>
                 {
                     if (e.Error == null)
                     {
                         if (e.Result.Contains(",")){
                             string[] result = e.Result.Split(',');
                             long age;
                             if (result[0] == "true")
                             {
                                 Core.Logging.Logger.Log("[RocketMod Observatory] Kicking Player " + Player.CharacterName + "because he is banned:" + result[1]);
                                 webClientResult = result[1];
                                 requested = DateTime.Now;
                                 Player.Kick("you are banned from observatory: " + result[1]);
                             }
                             else if (U.Settings.Instance.RocketModObservatory.KickLimitedAccounts && result.Length >= 2 && result[1] == "true")
                             {
                                 Core.Logging.Logger.Log("[RocketMod Observatory] Kicking Player " + Player.CharacterName + " because his account is limited");
                                 Player.Kick("your Steam account is limited");
                             }
                             else if (U.Settings.Instance.RocketModObservatory.KickTooYoungAccounts && result.Length == 3 && long.TryParse(result[2].ToString(),out age))
                             {
                                 long epochTicks = new DateTime(1970, 1, 1).Ticks;
                                 long unixTime = ((DateTime.UtcNow.Ticks - epochTicks) / TimeSpan.TicksPerSecond);
                                 long d = (unixTime - age);
                                 if (d < U.Settings.Instance.RocketModObservatory.MinimumAge)
                                 {
                                     Core.Logging.Logger.Log("[RocketMod Observatory] Kicking Player " + Player.CharacterName + " because his account is younger then "+ U.Settings.Instance.RocketModObservatory.MinimumAge+" seconds ("+d+" seconds)");
                                     Player.Kick("your Steam account is not old enough");
                                 } 
                             }
                         }
                     }
                 };
                 webClient.DownloadStringAsync(new Uri(string.Format("http://banlist.observatory.rocketmod.net/?steamid={0}", Player.CSteamID)));
             }
             catch (Exception)
             {
                 //
             }
         }
     }
 }