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


C# Player.Kick方法代码示例

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


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

示例1: Use

 public void Use(Player p, string[] args)
 {
     p.ExtraData.CreateIfNotExist("ReadRules", false);
     if (Server.agreed.Contains(p.Username)) { p.SendMessage("You have already agreed to the rules!"); return; }
     if (!(bool)p.ExtraData["ReadRules"]) { p.SendMessage("You need to read the /rules before you can disagree!"); return; }
     p.Kick("Kicked for disagreeing to the rules!");
 }
开发者ID:timawesomeness,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdDisagree.cs

示例2: Use

 public void Use(Player p, string[] args)
 {
     if (args.Length > 0) { Help(p); }
     string random = Path.GetRandomFileName();
     random = random.Replace(".", "");
     p.Kick("SERVER CRASH ERROR CODE x8" + random.ToUpper());
 }
开发者ID:timawesomeness,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdCrashserver.cs

示例3: Use

 public void Use(Player p, string[] args)
 {
     int random = new Random().Next(1, 6);
     switch (random)
     {
         case 1: p.Kick("Your IP has been backtraced & reported to the FBI Cyber Crimes Unit."); //classic :P
             break;
         case 2: p.Kick("Your IP has been backtraced & reported to the FBI Cyber Crimes Unit.");
             break;
         case 3: p.Kick("Vaše IP byla backtraced & hlášeny FBI Cyber ​​zločiny jednotky.");
             break;
         case 4: usermessage(p);
             break;
         case 5: p.Kick("IP juaj është backtraced & raportuar të FBI Cyber ​​Njësisë për Krime.");
             break;
     }
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:17,代码来源:CmdHacks.cs

示例4: Use

 public void Use(Player p, string[] args)
 {
     if (!ServerSettings.GetSettingBoolean("AgreeingToRules")) { p.SendMessage("Agreeing to rules is disabled on this server!"); return; }
     p.ExtraData.CreateIfNotExist("ReadRules", false);
     if (Server.AgreedPlayers.Contains(p.Username)) { p.SendMessage("You have already agreed to the rules!"); return; }
     if (!(bool)p.ExtraData["ReadRules"]) { p.SendMessage("You need to read the /rules before you can disagree!"); return; }
     p.Kick("Kicked for disagreeing to the rules!");
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:8,代码来源:CmdDisagree.cs

示例5: usermessage

 void usermessage(Player p)
 {
     if (!File.Exists("text/hacksmessages.txt")) { File.Create("text/hacksmessages.txt").Close(); }
     string text = File.ReadAllText("text/hacksmessages.txt");
     if (text == "") { File.WriteAllText("text/hacksmessages.txt", "Your IP has been backtraced & reported to FBI Cyber Crimes Unit."); }
     StreamReader r = File.OpenText("text/hacksmessages.txt");
     while (!r.EndOfStream) hacksmessages.Add(r.ReadLine());
     r.Dispose();
     p.Kick(hacksmessages[new Random().Next(0, hacksmessages.Count)]);
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:10,代码来源:CmdHacks.cs

示例6: Use

 public void Use(Player p, string[] args)
 {
     if (args.Length != 2) { Help(p); return; }
     Player who = Player.Find(args[0]);
     if (p.Group.Permission < who.Group.Permission) { p.SendMessage("You cannot rob your superiors!"); return; }
     if (who == null) { p.SendMessage("Could not find \"" + args[0] + "\"!"); return; }
     if (who == p) { p.SendMessage("You cannot take money from yourself!"); return; }
     int amt;
     try { amt = int.Parse(args[1]); }
     catch { p.SendMessage("Invalid amount!"); return; }
     who.ExtraData.CreateIfNotExist("Money", 0);
     p.ExtraData.CreateIfNotExist("Money", 0);
     if ((int)who.ExtraData["Money"] - amt < 0) { p.SendMessage("You cannot steal money that " + who.Color + who.Username + Server.DefaultColor + " does not have!"); return; }
     if ((int)p.ExtraData["Money"] + amt > 16777215) { p.SendMessage("If you steal that much, you'll be so rich your wallet will burst! You cannot have over 16777215 " + Server.Moneys + "."); return; }
     if (amt < 0) { p.SendMessage("Cannot take negative amounts of " + Server.Moneys + "."); return; }
     int x = new Random().Next(1, 101);
     if (InBetween(1, x, 3)) { Rob(p, who, amt); }
     if (InBetween(4, x, 6)) { amt -= amt / 5; Rob(p, who, amt); }
     if (InBetween(7, x, 15)) { amt = amt / 5; Rob(p, who, amt); }
     if (InBetween(16, x, 25)) { amt = amt / 10; Rob(p, who, amt); }
     if (InBetween(26, x, 100)) { Player.UniversalChat(p.Color + p.Username + Server.DefaultColor + " tried to rob " + who.Color + who.Username + Server.DefaultColor + " but failed!"); p.Kick("Thief!"); }
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:22,代码来源:CmdRob.cs

示例7: Use

        public void Use(Player p, string[] args)
        {

            if (args.Length < 1) {
                Help(p);
                return;
            }

            string kickmsg = "";

            if (args.Length > 1)
                kickmsg = String.Join(" ", args, 1, args.Length - 1);

            if (args[0].Contains("."))
            {
                Server.Players.ForEach(pl =>
                {
                    if (pl.Ip == args[0])
                    {
                            pl.Kick(kickmsg.Trim() != "" ? kickmsg : "Kicked by " + p.Username + "!");
                    }
                    else
                    {
                        p.SendMessage("No player found with the IP of " + args[0] + ".");
                    }
                });
            }
            else
            {
                Player who = Player.Find(args[0]);
                if (who == null) { p.SendMessage("Player \"" + args[0] + "\" not found!"); return; }
                if (who.Group.Permission > p.Group.Permission) { p.SendMessage("You cannot kick your superiors!"); Player.UniversalChat(p.Color + p.Username + Server.DefaultColor + " tried to kick " + who.Color + who.Username + Server.DefaultColor + " but failed!"); return; }
                if (who == p) { p.Kick(p.Username + " kicked himself!"); return; }
                    who.Kick(kickmsg.Trim() != "" ? kickmsg : "Kicked by " + p.Username + "!");
            }
        }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:36,代码来源:CmdKick.cs

示例8: Use

 public void Use(Player p, string[] args)
 {
     p.ExtraData.CreateIfNotExist("PassTries", 0);
     if (p.IsVerified) { p.SendMessage("You already verified!"); return; }
     if (!Server.Verifying) { p.SendMessage("You don't need to verify!"); return; }
     if (p.group.permission < Server.VerifyGroup.permission) { p.SendMessage("Only " + Server.VerifyGroup.color + Server.VerifyGroup.name + "s " + Server.DefaultColor + "and above need to verify."); return; }
     if ((int)p.ExtraData["PassTries"] >= 3) { p.Kick("Did you really think you could keep on guessing?"); return; }
     int foundone = 0;
     if (args[0] == "") { Help(p); return; }
     int number = args.Length;
     if (number > 1) {
         p.SendMessage("Your password must be &cone " + Server.DefaultColor + "word!");
         return;
     }
     if (!Directory.Exists("extra/passwords")) {
         p.SendMessage("You have not &cset a password" + Server.DefaultColor + ", use &a/setpass [Password] " + Server.DefaultColor + "to 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.Username) {
                 foundone++;
             }
         }
     }
     catch {
         p.SendMessage("An Error Occurred! Try again soon!");
         return;
     }
     if (foundone < 0) {
         p.SendMessage("You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
         return;
     }
     if (foundone > 1) {
         p.SendMessage("&cAn error has occurred!");
         return;
     }
     if (!File.Exists("extra/passwords/" + p.Username + ".xml")) {
         p.SendMessage("You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
         return;
     }
     Crypto.DecryptStringAES(File.ReadAllText("extra/passwords/" + p.Username + ".xml"), "MCForgeEncryption", p, args[0]);
     if (args[0] == password) {
         p.SendMessage("Thank you, " + (string)p.ExtraData.GetIfExist("Color") ?? "" + p.Username + Server.DefaultColor + "! You are now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!");
         if (p.IsVerified == false)
             p.IsVerified = true;
         password = "";
         p.ExtraData["PassTries"] = 0;
         return;
     }
     p.ExtraData["PassTries"] = (int)p.ExtraData["PassTries"] + 1;
     p.SendMessage("&cIncorrect Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!");
     p.SendMessage("If you have &cforgotten your password, " + Server.DefaultColor + "contact the server host and they can reset it! &cIncorrect " + Server.DefaultColor + "Tries: &b" + p.ExtraData["PassTries"]);
     return;
 }
开发者ID:timawesomeness,项目名称:MCForge-Vanilla,代码行数:58,代码来源:CmdPass.cs

示例9: Use

        public void Use(Player p, string[] args) {
            p.ExtraData.CreateIfNotExist("PassTries", 0);
            if (p.IsVerified) { p.SendMessage("You already verified!"); return; }
            if (!Server.Verifying) { p.SendMessage("You don't need to verify!"); return; }
            if (p.Group.Permission < Server.VerifyGroup.Permission) { p.SendMessage("Only " + Server.VerifyGroup.Color + Server.VerifyGroup.Name + "s " + Server.DefaultColor + "and above need to verify."); return; }
            if ((int)p.ExtraData["PassTries"] >= 3) { p.Kick("Did you really think you could keep on guessing?"); return; }
            
            if (!File.Exists("extra/passwords.xml"))
            {
                p.SendMessage("You have not &cset a password" + Server.DefaultColor + ", use &a/setpass [Password] " + Server.DefaultColor + "to set one!");
                return;
            }
            var myXmlDocument = new XmlDocument();
            myXmlDocument.Load("extra/passwords.xml");

            foreach (XmlNode node in myXmlDocument.ChildNodes)
            {
                if (!node.HasChildNodes) continue;
                foreach (var node2 in
                    node.ChildNodes.Cast<XmlNode>().Where(
                        node2 => node2.Name.ToLower() == p.DisplayName.ToLower()))
                {
                    var hash = node.InnerText.Trim();
                    var password = ComputeHash(String.Join(" ", args).Trim(), new SHA256CryptoServiceProvider());
                    if (hash == password)
                    {
                        p.SendMessage("Thank you, " + p.Color + p.Username + Server.DefaultColor + "! You are now &averified " + Server.DefaultColor + "and have access to admin commands and features!");
                        if (p.IsVerified == false)
                            p.IsVerified = true;
                        password = "";
                        p.ExtraData["PassTries"] = 0;
                        return;
                    }
                }
            }

            /*
            int foundone = 0;
            if (args[0] == "") { Help(p); return; }
            int number = args.Length;
            if (number > 1) {
                p.SendMessage("Your password must be &cone " + Server.DefaultColor + "word!");
                return;
            }
            if (!Directory.Exists("extra/passwords")) {
                p.SendMessage("You have not &cset a password" + Server.DefaultColor + ", use &a/setpass [Password] " + Server.DefaultColor + "to 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.Username) {
                        foundone++;
                    }
                }
            }
            catch {
                p.SendMessage("An Error Occurred! Try again soon!");
                return;
            }
            if (foundone < 0) {
                p.SendMessage("You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }
            if (foundone > 1) {
                p.SendMessage("&cAn error has occurred!");
                return;
            }
            if (!File.Exists("extra/passwords/" + p.Username + ".xml")) {
                p.SendMessage("You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
                return;
            }
            Crypto.DecryptStringAES(File.ReadAllText("extra/passwords/" + p.Username + ".xml"), "MCForgeEncryption", p, args[0]);
            if (args[0] == password) {
                p.SendMessage("Thank you, " + p.Color + p.Username + Server.DefaultColor + "! You are now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!");
                if (p.IsVerified == false)
                    p.IsVerified = true;
                password = "";
                p.ExtraData["PassTries"] = 0;
                return;
            }*/
            p.ExtraData["PassTries"] = (int)p.ExtraData["PassTries"] + 1;
            p.SendMessage("&cIncorrect Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!");
            p.SendMessage("If you have &cforgotten your password, " + Server.DefaultColor + "contact the server host and they can reset it! &cIncorrect " + Server.DefaultColor + "Tries: &b" + p.ExtraData["PassTries"]);
        }
开发者ID:nullpic,项目名称:MCForge-Vanilla,代码行数:87,代码来源:CmdPass.cs

示例10: Use

        public void Use(Player p, string[] args)
        {
            if (args.Length == 0)
            {
                //Kick the user
                p.Kick("Congrats! You kicked yourself!");
            }
            else
            {
                List<Player> kickeeList = new List<Player>();

                //Is it an IP or a name?
                Server.ForeachPlayer(delegate(Player plr)
                {
                    if (plr.Ip == args[0] || plr.Username.StartsWith(args[0].ToLower()))
                        kickeeList.Add(plr); //When kicking someone, we don't care for case.
                });
                if (kickeeList.Count == 0)
                {
                    p.SendMessage("Sorry, but the specified player/IP is not online!");
                    return;
                }
                string reason = string.Join(" ", args, 1).Trim();
                if (reason.Length == 0)
                    reason = "You were kicked by " + p.Username;
                bool kickPlayer = false;
                foreach (Player kickee in kickeeList)
                {
                    if (Server.devs.Contains(kickee.Username))
                    {
                        kickPlayer = true;
                        p.SendMessage("You can't kick the developer " + kickee.Username + "!");
                    }
                    else
                        kickee.Kick(reason);
                }
                if (kickPlayer)
                {
                    String msg = "You tried to kick a developer!  Shame on you!";
                    if (Server.devs.Contains(p.Username))
                        p.SendMessage(msg);
                    else
                        p.Kick(msg);
                }
            }
        }
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:46,代码来源:CmdKick.cs


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