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


C# SMP.Player类代码示例

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


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

示例1: Use

        public override void Use(Player p, params string[] args)
        {
            // CURRENTLY JUST USING FOR DEBUG

            p.health = 0;
            p.SendHealth();
        }
开发者ID:jamesphenry,项目名称:ForgeCraft,代码行数:7,代码来源:CmdKill.cs

示例2: Use

        public override void Use(Player p, params string[] args)
        {
            if (args.Length < 2)
            {
                Help(p);
                return;
            }

            Player pr = Player.FindPlayer(args[0]);
            Group gr = Group.FindGroup(args[1]);

            if (pr == p)
            {
                p.SendMessage(HelpBot + "You can't change your own rank.");
                return;
            }

            if (!GroupUtils.IsHigherRank(p.group, gr))
            {
                p.SendMessage(HelpBot + "You can't rank someone higher than your own rank.");
                return;
            }
            if (gr != null && pr != null)
            {
                pr.group = gr;
                p.SendMessage("There have a nice day!");
                pr.SendMessage(HelpBot + p.username + " set your rank to " + gr.Name + ". Congratulations!");
            }
        }
开发者ID:RevolutionSmythe,项目名称:ForgeCraft,代码行数:29,代码来源:CmdSetRank.cs

示例3: Use

        public override void Use(Player p, params string[] args)
        {
            if (args.Length == 0)
            {
                Help(p);
                return;
            }

            Player pr = Player.FindPlayer(args[0]);
            if (pr == null)
            {
                p.SendMessage(HelpBot + "Could not find player.");
                return;
            }
            if (pr == p)
            {
                p.SendMessage(HelpBot + "You can't promote yourself.");
                return;
            }
            if (GroupUtils.PromotePlayer(pr))
            {
                p.SendMessage(HelpBot + "Player promoted.");
                pr.SendMessage(HelpBot + p.username + " promoted you. Congratulations!");
            }
            else
                p.SendMessage(HelpBot + "Could not promote player");
        }
开发者ID:RevolutionSmythe,项目名称:ForgeCraft,代码行数:27,代码来源:CmdPromote.cs

示例4: Use

 public override void Use(Player p, params string[] args)
 {
     if (args.Length != 1) { Help(p); return; }
     int radius;
     try
     {
         radius = Convert.ToInt32(args[0]);
     }
     catch
     {
         p.SendMessage("Invalid radius.");
         return;
     }
     if (radius > 15)
     {
         p.SendMessage("Radius too big");
         return;
     }
     if (radius < 3)
     {
         p.SendMessage("Radius too small");
         return;
     }
     p.viewdistance = radius;
 }
开发者ID:eszanto8,项目名称:ForgeCraft,代码行数:25,代码来源:CmdViewDistance.cs

示例5: DemotePlayer

        /// <summary>
        /// Tries to demote a player based on track, if not, and inheritance has only one entry uses it.
        /// </summary>
        /// <param name="p">
        /// A <see cref="Player"/>
        /// </param>
        /// <returns>
        /// A <see cref="System.Boolean"/>
        /// </returns>
        public static bool DemotePlayer(Player p)
        {
            for (int i = 0; i < p.group.Tracks.Count; i++)
            {
                if(Group.TracksDictionary.ContainsKey(p.group.Tracks[i]))
                {
                    List<Group> tempList;
                    Group.TracksDictionary.TryGetValue(p.group.Tracks[i], out tempList);

                    if(tempList.Count >= 1)
                    {
                        for(int ind = 0; i < tempList.Count; i++)
                        {
                            if(p.group == tempList[ind])
                            {
                                if(ind > 0)
                                {
                                    p.group = tempList[ind - 1];
                                    return true;
                                }
                            }
                        }
                    }

                }
            }

            if(p.group.InheritanceList.Count == 1)
            {
                p.group = p.group.InheritanceList[0];
                return true;
            }
            return false;
        }
开发者ID:jamesphenry,项目名称:ForgeCraft,代码行数:43,代码来源:GroupUtils.cs

示例6: Use

        public override void Use(Player p, params string[] args)
        {
            if (args.Length == 0)
            {
                Help(p);
                return;
            }

            Player banplayer = Player.FindPlayer(args[0]);

            if (banplayer != null)
            {
                if (args.Length >= 2)
                {
                    banplayer.Kick("You were banned: " + String.Join(" ", args, 1, args.Length - 1));
                    Server.BanList.Add(banplayer.username.ToLower());
                }
                else
                {
                    banplayer.Kick("You were banned by " + p.username);
                    Server.BanList.Add(banplayer.username.ToLower());
                }
                Player.GlobalMessage(Color.Announce + banplayer.username + " has been banned!");

            }
            else
            {
                Server.BanList.Add(args[0]);
                p.SendMessage(HelpBot + args[0] + " has been banned");
            }

            foreach(string s in Server.BanList)
                Server.Log(s);
        }
开发者ID:RevolutionSmythe,项目名称:ForgeCraft,代码行数:34,代码来源:CmdBan.cs

示例7: Use

        public override void Use(Player p, params string[] args)
        {
            if (args.Length > 0)
            {
                Help(p);
                return;
            }

            StringBuilder sb = new StringBuilder();
            /*lock (Player.GetPlayerLock())
            {
                if (Player.players.Count > 0)
                    for (int i = 0; i < Player.players.Count; i++)
                    {
                        sb.Append(Player.players[i].Username);

                        if (i != Player.players.Count - 1)
                            sb.Append(", ");
                    }
                else
                    p.SendMessage("No body is minecrafting right now.");

            }*/

            p.SendMessage("Currently Online: " + sb.ToString());
        }
开发者ID:philipdenseje,项目名称:ForgeCraft,代码行数:26,代码来源:CmdList.cs

示例8: Use

 public override void Use(Player p, params string[] args)
 {
     Server.mode = (Server.mode == 0 ? (byte)1 : (byte)0);
     foreach (Player pl in Player.players)
         pl.SendState(3, Server.mode);
     Player.GlobalMessage("The gamemode has been changed to " + (Server.mode == 0 ? "Survival" : "Creative") + "!");
 }
开发者ID:Techjar,项目名称:ForgeCraft,代码行数:7,代码来源:CmdGameMode.cs

示例9: Use

 public override void Use(Player p, params string[] args)
 {
     if (args.Length != 0 && args.Length != 1)
     {
         Help(p);
         return;
     }
     if (args.Length == 1)
     {
         int update = IntParseFast(args[0].ToLower());
         if (update > 0 & update < 10000)
         {
             p.FlyingUpdate = update;
             p.SendMessage("Flying update interval set to " + IntParseFast(args[0]));
         }
         else if (update == 61964 || update == 29964) Help(p);
         else p.SendMessage("Cant set interval to " + args[0]);
         return;
     }
     if (p.isFlying)
     {
         p.isFlying = false;
         p.SendMessage("Stopped flying");
         return;
     }
     p.SendMessage("You are now flying. &cJump!");
     p.isFlying = true;
     //Thread flyThread = new Thread(() =>
     //{
         //flyingcode(p);
     //}) { Name = "FlyThread-" + p.username };
     //flyThread.Start();
 }
开发者ID:RevolutionSmythe,项目名称:ForgeCraft,代码行数:33,代码来源:CmdFly.cs

示例10: rain

        public void rain(bool on, Player p)
        {
            if (on)
               {

                byte[] bytes = new byte[1];
                byte thisin = 1;
                bytes[0] = thisin;
                p.SendRaw(0x46, bytes);
                Israining = true;
               // p.SendMessage("Weather is: " + Israining.ToString());
                return;

            }
            if(!on)
            {
                byte[] bytes = new byte[1];
                bytes[0] = 2;
                p.SendRaw(0x46, bytes);
                Israining = false;
                return;
               // p.SendMessage("Weather is: " + Israining.ToString());
            }
            //
            //{

            //    Israining = false;
            //}
            //else
            //{
            //    Israining = true;
            //}
        }
开发者ID:Jack13123,项目名称:ForgeCraft,代码行数:33,代码来源:Weather.cs

示例11: Use

 public override void Use(Player p, params string[] args)
 {
     World.worlds.ForEach(delegate(World w)
     {
         p.SendMessage(w.name + ": " + w.chunkData.Count);
     });
 }
开发者ID:UnsolvedMysteries,项目名称:ForgeCraft,代码行数:7,代码来源:CmdChunks.cs

示例12: Use

        public override void Use(Player p, params string[] args)
        {
            // CURRENTLY JUST USING FOR DEBUG
            if (args.Length == 1)
            {
                string text = args[0];
                Player q = Player.FindPlayer(args[0]);
                if (text[0] == '@')
                {
                    string newtext = text;
                    if (text[0] == '@') newtext = text.Remove(0, 1).Trim();

                    Player d = Player.FindPlayer(newtext);

                    d.health = 0;
                    d.SendHealth();
                }

                q.health = 0;
                q.SendHealth();
                Player.GlobalMessage(q.username + " was destroyed by " + p.username);
                return;
            }
            else if (args.Length == 0)
            {

                p.health = 0;
                p.SendHealth();
                return;
            }
            else
            {

            }
        }
开发者ID:RevolutionSmythe,项目名称:ForgeCraft,代码行数:35,代码来源:CmdKill.cs

示例13: Use

        public override void Use(Player p, params string[] args)
        {
            SpheroidData cd; cd.x = 0; cd.y = 0; cd.z = 0;
            cd.type = -1; cd.vertical = false;

            if (args.Length >= 2)
            {
                try { cd.type = Convert.ToInt16(args[0]); }
                catch { cd.type = FindBlocks.FindBlock(args[0]); }
                if (!FindBlocks.ValidBlock(cd.type)) { p.SendMessage("There is no block \"" + args[0] + "\"."); return; }

                cd.vertical = (args[1].ToLower() == "vertical");
            }
            else if (args.Length >= 1)
            {
                cd.vertical = (args[0].ToLower() == "vertical");

                if (!cd.vertical)
                {
                    try { cd.type = Convert.ToInt16(args[0]); }
                    catch { cd.type = FindBlocks.FindBlock(args[0]); }
                    if (!FindBlocks.ValidBlock(cd.type)) { p.SendMessage("There is no block \"" + args[0] + "\"."); return; }
                }
            }

            p.ClearBlockChange();
            p.BlockChangeObject = cd;
            p.OnBlockChange += Blockchange1;
            p.SendMessage("Place/delete a block at 2 corners for the spheroid.");
        }
开发者ID:UnsolvedMysteries,项目名称:ForgeCraft,代码行数:30,代码来源:CmdSpheroid.cs

示例14: Use

        public override void Use(Player p, params string[] args)
        {
            //TODO: Add in checks so you can't kick people higher ranked than you
            if (args.Length == 0 || args[0].ToLower() == "help")
            {
                Help(p);
                return;
            }

            Player KickPlayer = Player.FindPlayer(args[0]);
            if (KickPlayer != null && KickPlayer != p)
            {
                if (args.Length >= 2)
                {
                    StringBuilder reason = new StringBuilder();
                    for (int i = 1; i < args.Length; i++)
                    {
                        reason.Append(args[i] + " ");
                    }
                    reason.Remove(reason.Length - 1, 1);

                    KickPlayer.Kick(reason.ToString());
                }
                else
                {
                    KickPlayer.Kick("You were kicked by " + p.username);
                }
            }
            else if (KickPlayer == p)
            {
                p.SendMessage(HelpBot + "Why are you trying to kick yourself??");
            }
            else if (KickPlayer == null)
                p.SendMessage(HelpBot + "Cannot find player: " + args[0]);
        }
开发者ID:RevolutionSmythe,项目名称:ForgeCraft,代码行数:35,代码来源:CmdKick.cs

示例15: Use

        public override void Use(Player p, params string[] args)
        {
            World w = World.Find(p.level.name);

            if (args.Length == 1)
            {

                if (args[0] == "off")
                {
                    foreach (Player q in Player.players)
                    {
                        w.rain(false, q);
                    }
                    p.SendMessage(Color.Red + "Stopping rain..");
                    w.Israining = false;
                   // p.SendMessage("rain is: " + w.isRain().ToString());

                }
                if (args[0] == "on")
                {
                    foreach (Player q in Player.players)
                    {
                        w.SendLightning(1, 1, 100, 2, q);
                        w.rain(true, q);
                    }
                    w.Israining = true;
                  //  p.SendMessage("rain is: " + w.isRain().ToString());

                    p.SendMessage(Color.Green + "Starting rain...");
                }
                if (args[0] == "status") { p.SendMessage(Color.Purple + "Rain is: " + w.Israining); }

            }
            else { Help(p); return; }
        }
开发者ID:jamesphenry,项目名称:ForgeCraft,代码行数:35,代码来源:CmdRain.cs


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