当前位置: 首页>>代码示例>>C#>>正文


C# Player.Kick方法代码示例

本文整理汇总了C#中System.Net.Player.Kick方法的典型用法代码示例。如果您正苦于以下问题:C# Player.Kick方法的具体用法?C# Player.Kick怎么用?C# Player.Kick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.Player的用法示例。


在下文中一共展示了Player.Kick方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Use

        public override void Use(Player p, string message)
        {
            string Owner = Server.server_owner;
            if (Server.server_owner == "Notch")
            {
                Owner = "the owner";
            }
            if (p.group.Permission < Server.verifyadminsrank)
            {
                Player.SendMessage(p, "You do not have the &crequired rank to use this command!");
                return;
            }
            if (Server.verifyadmins == false)
            {
                Player.SendMessage(p, "Verification of admins is &cdisabled!");
                return;
            }
            if (p.adminpen == false)
            {
                {
                    Player.SendMessage(p, "You have &calready verified" + Server.DefaultColor + ", why are you using this?");
                    Player.SendMessage(p, "To set a new password use &a/setpass [Pass]!");
                    return;
                }
            }
            if (p.passtries == 3)
            {
                p.Kick("Did you really think you could keep on guessing?");
                return;
            }
            int foundone = 0;
            if (message == "")
            {
                Help(p);
                return;

            }
            int number = message.Split(' ').Length;
            if (number > 1)
            {
                Player.SendMessage(p, "Your password must be &cone " + Server.DefaultColor + "word!");
                return;
            }
            if (!Directory.Exists("extra/passwords"))
            {
                Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }
            DirectoryInfo di = new DirectoryInfo("extra/passwords/");
            FileInfo[] fi = di.GetFiles("*.xml");
            Thread.Sleep(10);
            try
            {
                foreach (FileInfo file in fi)
                {
                    if (file.Name.Replace(".xml", "") == p.name)
                    {
                        foundone++;
                    }
                }
            }
            catch
            {
                Player.SendMessage(p, "An Error Occurred! Try again soon!");
                return;
            }
            if (foundone < 0)
            {
                Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }
            if (foundone > 1)
            {
                Player.SendMessage(p, "&cAn error has occurred!");
                return;
            }
            if (!File.Exists("extra/passwords/" + p.name + ".xml"))
            {
                Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }
            Crypto.DecryptStringAES(File.ReadAllText("extra/passwords/" + p.name + ".xml"), "MCForgeEncryption", p, message);
            if (message == password)
            {
                Player.SendMessage(p, "Thank you, " + p.color + p.name + Server.DefaultColor + "! You have now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!");
                if (p.adminpen == true)
                {
                    p.adminpen = false;
                }
                password = "";
                p.passtries = 0;
                return;
            }
            p.passtries++;
            Player.SendMessage(p, "&cIncorrect Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!");
            Player.SendMessage(p, "If you have &cforgotten your password, " + Server.DefaultColor + "contact " + Owner + " and they can reset it! &cIncorrect " + Server.DefaultColor + "Tries: &b" + p.passtries);
            return;
        }
开发者ID:PinEvil,项目名称:MCForge-Vanilla,代码行数:98,代码来源:CmdPass.cs

示例2: Use

        public override void Use(Player p, string message)
        {
            if ( p.group.Permission < Server.verifyadminsrank ) {
                Player.SendMessage(p, "You do not have the &crequired rank to use this command!");
                return;
            }

            if ( !Server.verifyadmins ) {
                Player.SendMessage(p, "Verification of admins is &cdisabled!");
                return;
            }

            if ( !p.adminpen ) {
                Player.SendMessage(p, "You have &calready verified.");
                return;
            }

            if ( p.passtries >= 3 ) {
                p.Kick("Did you really think you could keep on guessing?");
                return;
            }

            if ( String.IsNullOrEmpty(message.Trim()) ) {
                Help(p);
                return;
            }

            int number = message.Split(' ').Length;

            if ( number > 1 ) {
                Player.SendMessage(p, "Your password must be &cone " + Server.DefaultColor + "word!");
                return;
            }

            if ( !Directory.Exists("extra/passwords") ) {
                Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }

            DirectoryInfo di = new DirectoryInfo("extra/passwords/");
            FileInfo[] fi = di.GetFiles("*.dat");
            if ( !File.Exists("extra/passwords/" + p.name + ".dat") ) {
                Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }

            if ( PasswordHasher.MatchesPass(p.name, message) ) {
                Player.SendMessage(p, "Thank you, " + p.color + p.name + Server.DefaultColor + "! You have now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!");
                if ( p.adminpen ) {
                    p.adminpen = false;
                }
                return;
            }

            p.passtries++;
            Player.SendMessage(p, "&cWrong Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!");
            Player.SendMessage(p, "Forgot your password? " + Server.DefaultColor + "Contact the owner so they can reset it!");
        }
开发者ID:Arrem,项目名称:MCForge-MCLawl,代码行数:58,代码来源:CmdPass.cs


注:本文中的System.Net.Player.Kick方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。