Ejemplo n.º 1
0
        public override void OnDisabled()
        {
            base.OnDisabled();

            Handlers.Player.Joined            -= PlayerEvents.OnPlayerConnect;
            Handlers.Player.Left              -= PlayerEvents.OnPlayerDisconnect;
            Handlers.Player.Hurting           -= PlayerEvents.OnPlayerHurt;
            Handlers.Player.Banned            -= PlayerEvents.OnPlayerBanned;
            Handlers.Player.PreAuthenticating -= PlayerEvents.OnPreAuth;

            Handlers.Server.RoundStarted              -= ServerEvents.OnRoundStart;
            Handlers.Server.RoundEnded                -= ServerEvents.OnRoundEnd;
            Handlers.Server.WaitingForPlayers         -= ServerEvents.WaitingForPlayers;
            Handlers.Server.RespawningTeam            -= ServerEvents.OnTeamRespawn;
            Handlers.Server.SendingRemoteAdminCommand -= PlayerEvents.OnCommand;
            Handlers.Server.SendingConsoleCommand     -= PlayerEvents.OnConsoleCommand;

            PlayerEvents = null;
            ServerEvents = null;
        }
Ejemplo n.º 2
0
        public static async Task IsBannedDetail(string APIKey, string userID, bool ipcheck)
        {
            using (HttpClient client = new HttpClient())
            {
                string ipcheckstatus = "UID";
                if (ipcheck)
                {
                    ipcheckstatus = "IP";
                }
                var webRequest = await client.GetAsync("https://bans.kingsplayground.fun/bancheckdetail.php?KEY=" + APIKey + "&STEAMID=" + userID + "&TYPE=" + ipcheckstatus);

                if (!webRequest.IsSuccessStatusCode)
                {
                    Exiled.API.Features.Log.Error("Web API connection error in IsBannedDetail(): " + webRequest.StatusCode + " - " + webRequest.Content.ReadAsStringAsync());
                }

                string apiResponse = await webRequest.Content.ReadAsStringAsync();

                Exiled.API.Features.Log.Info($"BAN API RESPONSE: {apiResponse}");

                JObject json = JObject.Parse(apiResponse);

                bool banned = json.Value <bool>("banned");
                if (banned)
                {
                    if (!ipcheck)
                    {
                        string userid = json.Value <string>("authid");
                        string name   = json.Value <string>("name");
                        string ends   = json.Value <string>("ends");
                        string reason = json.Value <string>("reason");
                        PlayerEvents.DisplayBannedInfo(userid, name, ends, reason);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public void OnRoundEnd(RoundEndedEventArgs ev)
 {
     PlayerEvents.OnRoundEnd();
 }