Universe.Modules.Ban.BanCheck.BlockUser C# (CSharp) Method

BlockUser() protected method

protected BlockUser ( IScene scene, string cmdparams ) : void
scene IScene
cmdparams string
return void
        protected void BlockUser (IScene scene, string [] cmdparams)
        {
            string name = MainConsole.Instance.Prompt ("Name: ");
            UserAccount account = m_accountService.GetUserAccount (null, name);
            if (account == null) {
                MainConsole.Instance.Warn ("Cannot find user.");
                return;
            }

            UUID agentID = account.PrincipalID;
            PresenceInfo info = GetInformation (agentID);
            if (info == null) {
                MainConsole.Instance.Warn ("Cannot find user.");
                return;
            }

            var conn = Framework.Utilities.DataManager.RequestPlugin<IAgentConnector> ();
            IAgentInfo agentInfo = conn.GetAgent (agentID);
            if (
                MainConsole.Instance.Prompt ("Do you want to have this only be a temporary ban?", "no",
                    new List<string> () { "yes", "no" }).ToLower () == "yes") {
                float days = float.Parse (MainConsole.Instance.Prompt ("How long (in days) should this ban last?", "5.0"));

                agentInfo.Flags |= IAgentFlags.TempBan;

                agentInfo.OtherAgentInformation ["TemperaryBanInfo"] = DateTime.Now.ToUniversalTime ().AddDays (days);
            } else {
                info.Flags |= PresenceInfo.PresenceInfoFlags.Banned;
                presenceInfo.UpdatePresenceInfo (info);
                agentInfo.Flags |= IAgentFlags.PermBan;
            }

            conn.UpdateAgent (agentInfo);
            MainConsole.Instance.Fatal ("User blocked from logging in");
        }