• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MCSharp.Player类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Use

 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target != null)
         {
             if (!target.hidden)
             {
                 if (p.level != target.level)
                 {
                     target.ChangeLevel(p.level.name);
                 }
                 unchecked
                 {
                     target.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0);
                 }
                 target.SendMessage("You were summoned by " + p.color + p.name + "&e.");
             }
             else
             {
                 p.SendMessage("There is no player \"" + message + "\"!");
             }
         }
         else
         {
             p.SendMessage("There is no player \"" + message + "\"!");
         }
     }
     else
     {
         Help(p);
     }
 }
开发者ID:pazuzu156,项目名称:MCSharp,代码行数:34,代码来源:CmdSummon.cs


示例2: Use

        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                playerList = "";
                foreach (var pl in Player.players)
                {
                    if (pl.hidden && p.Rank >= pl.Rank)
                    {
                        playerList += pl.color + pl.name + "&e, ";
                    }
                }

                if (playerList == "")
                {
                    p.SendMessage("No one is currently hidden.");
                }
                else
                {
                    p.SendMessage("Hidden Players: " + playerList.Trim(trimmings));
                }
            }
            else
            {
                Help(p);
            }
        }
开发者ID:duaneking,项目名称:MCSharp,代码行数:28,代码来源:CmdHidden.cs


示例3: Use

        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "") // Exempt or remove from exempt
            {

                // Seperate message string
                //int pos = message.IndexOf(' ');
                string tempName = message.ToLower();

                // If the name is in the file, remove it
                if (Server.griefExempted.Contains(tempName))
                {
                    Server.griefExempted.Remove(tempName);
                    p.SendMessage(tempName + " was " + c.red + "removed" + c.yellow + " from anti-grief exemption");
                }
                else
                {
                    Server.griefExempted.Add(tempName);
                    p.SendMessage(tempName + " was " + c.green + "added" + c.yellow + " to anti-grief exemption");
                }

            }
            else // Return usage
            {
                Help(p);
            }
        }
开发者ID:TaFinalDestination,项目名称:MCSharp,代码行数:28,代码来源:CmdExempt.cs


示例4: Use

 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     string strPlayers;
     foreach (Map level in Server.levels)
     {
         strPlayers = "";
         foreach (Player pl in Player.players)
         {
             if (!p.hidden || p.Rank > pl.Rank)
             {
                 if (pl.level == level)
                 {
                     strPlayers += pl.color + pl.name + "&e, ";
                 }
             }
         }
         if (strPlayers != "")
         {
             strPlayers = strPlayers.Remove(strPlayers.Length - 4);
         }
         else
         {
             strPlayers = "No players on this level";
         }
         p.SendMessage(player.level.name + ": " + strPlayers);
     }
 }
开发者ID:ZakAmirz,项目名称:MCSharp,代码行数:28,代码来源:CmdPLevels.cs


示例5: Use

 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message == "")
     {
         if (p.isWhisperChat)
         {
             p.SendMessage("Disable whisper chat before using /opchat"); // Think of maybe disabling it automatically?
         }
         else
         {
             p.isOpChat = !p.isOpChat;
             if (p.isOpChat)
             {
                 p.SendMessage("Operator chat: &aON&e.");
             }
             else
             {
                 p.SendMessage("Operator chat: &cOFF&e.");
             }
         }
     }
     else
     {
         Help(p);
     }
 }
开发者ID:pazuzu156,项目名称:MCSharp,代码行数:27,代码来源:CmdOpChat.cs


示例6: Use

 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message == "") // blank name, disable whispering
     {
         if (p.isWhisperChat)
         {
             p.SendMessage("No longer whispering: " + p.whisperTarget + ".");
             p.isWhisperChat = false;
         }
         else
         {
             p.SendMessage("Whisper chat is already disabled.");
         }
     }
     else if (p.isOpChat)
     {
         p.SendMessage("Disable opchat before using /whisper");
     }
     else
     {
         p.isWhisperChat = false;
         Player target = Player.Find(message);
         if (target != null)
         {
             p.whisperTarget = target.name;
             p.isWhisperChat = true;
             p.SendMessage("Now whispering: " + target.color + target.name + "&e.");
         }
         else
         {
             p.SendMessage(LanguageString.NoSuchPlayer);
         }
     }
 }
开发者ID:duaneking,项目名称:MCSharp,代码行数:35,代码来源:CmdWhisperChat.cs


示例7: Use

        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                string strModerators = "";
                foreach (var pl in Player.players)
                {
                    if (pl.Rank == GroupEnum.Operator && (!pl.hidden || p.Rank >= pl.Rank))
                    {
                        strModerators += pl.color + pl.name + ", ";
                    }
                }
                if (strModerators == "")
                {
                    strModerators = "No moderators currently online";
                }
                else
                {
                    strModerators = strModerators.Remove(strModerators.Length - 2);
                }

                p.SendMessage("Online Moderators: " + strModerators);
            }
            else
            {
                Help(p);
            }
        }
开发者ID:ZakAmirz,项目名称:MCSharp,代码行数:29,代码来源:CmdMods.cs


示例8: Use

        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            Regex regex = new Regex(@"^([0-9]{1,3}\.){3}[0-9]{1,3}$");
            if (message == "") { if (p != null)Help(p); return; }
            Player who = null;
            who = Player.Find(message);
            if (who != null) { message = who.ip; }
            if (message.Equals("127.0.0.1")) { if (p != null) { p.SendMessage("You can't ip-ban the server!"); } return; }
            if (!regex.IsMatch(message)) { if (p != null)p.SendMessage("Not a valid ip!"); return; }
            if (p != null) { if (p.ip == message) { p.SendMessage("You can't ip-ban yourself.!"); return; } }
            if (Server.bannedIP.Contains(message)) { if (p != null)p.SendMessage(message + " is already ip-banned."); return; }
            Player.GlobalMessage(message + " got &8ip-banned&e!");
            if (p != null)
            { IRCBot.Say("IP-BANNED: " + message.ToLower() + " by " + p.name); }
            else
            { IRCBot.Say("IP-BANNED: " + message.ToLower() + " by console"); }
            Server.bannedIP.Add(message);
            Logger.Log("IP-BANNED: " + message.ToLower());

            List<Player> kickList = new List<Player>();
            foreach (Player pl in Player.players)
            {
                if (message.Equals(pl.ip)) { kickList.Add(pl); }       //Kicks anyone off with matching ip for convinience
            }
            foreach (Player pl in kickList)
            {
                pl.Kick("Kicked by ipban");
            }
        }
开发者ID:pazuzu156,项目名称:MCSharp,代码行数:30,代码来源:CmdBanip.cs


示例9: Use

 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target == null || (target.hidden && p.Rank < target.Rank))
         {
             if (Player.left.ContainsKey(message.ToLower()))
             {
                 string playerName = message.ToLower();
                 string ip = Player.left[playerName];
                 message = "&e" + playerName + " is " + Player.GetColor(playerName) + Player.GetGroup(playerName).Name + "&e.";
                 if (p.Rank >= GroupEnum.Operator)
                 {
                     message += " IP: " + ip + ".";
                 }
                 p.SendChat(p, message);
             }
             else
             {
                 p.SendMessage("No entry found for \"" + message + "\".");
             }
         }
         else
         {
             p.SendMessage(target.color + target.name + "&e is online, use /whois instead.");
         }
     }
     else
     {
         Help(p);
     }
 }
开发者ID:ZakAmirz,项目名称:MCSharp,代码行数:34,代码来源:CmdWhowas.cs


示例10: Use

 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target == null)
         {
             if (Player.lastSeen.ContainsKey(message.ToLower()))
             {
                 string lastOnline = message + " was last seen on: " + Player.lastSeen[message.ToLower()].ToLongDateString() + " at: " + Player.lastSeen[message.ToLower()].ToShortTimeString() + TimeZone.CurrentTimeZone.ToString();
                 p.SendMessage(lastOnline);
             }
             else
             {
                 p.SendMessage("Player not found!");
             }
         }
         else
         {
             if (target.hidden && p.Rank < target.Rank)
             {
                 p.SendMessage("Player not found!");
             }
             else
             {
                 p.SendMessage(target.name + " is currently playing!");
             }
         }
     }
     else
     {
         Help(p);
     }
 }
开发者ID:ZakAmirz,项目名称:MCSharp,代码行数:35,代码来源:CmdLastSeen.cs


示例11: Use

        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                try
                {
                    if (File.Exists("news.txt"))
                    {
                        List<string> news = new List<string>();
                        StreamReader wm = File.OpenText("news.txt");
                        while (!wm.EndOfStream)
                            news.Add(wm.ReadLine());

                        wm.Close();

                        foreach (string w in news)
                            p.SendMessage(w);
                    }
                    else
                    {
                        p.SendMessage("No news today!");
                    }
                }
                catch
                {
                    Logger.Log("Error reading news.txt");
                }
            }
            else
            {
                Help(p);
            }
        }
开发者ID:ZakAmirz,项目名称:MCSharp,代码行数:34,代码来源:CmdNews.cs


示例12: Use

        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                // Toggle OFF
                if (p.BlockAction == 8)
                {
                    p.BlockAction = 0;
                    p.SendMessage("BuildOp mode: &cOFF&e.");
                }
                else // Toggle ON
                {
                    // Disable painting
                    p.painting = false;

                    // Clear all bindings, creates faulty blocks otherwise
                    int bindCount = p.ClearBindings();

                    // Set the block action to buildop
                    p.BlockAction = 8;

                    if (bindCount > 0)
                    {
                        p.SendMessage("Cleared " + bindCount + " block bind(s).");
                    }

                    p.SendMessage("BuildOp Mode: &aON&e. Now Placing op_materials");
                }
            }
            else
            {
                Help(p);
            }
        }
开发者ID:ZakAmirz,项目名称:MCSharp,代码行数:35,代码来源:CmdBuildOp.cs


示例13: SendRules

        /// <summary>
        /// Sends the rules to a target player
        /// </summary>
        /// <param name="target">Target player that rules are being sent to.</param>
        private void SendRules(Player target)
        {
            try
            {
                if (target.level == Server.mainLevel && Server.mainLevel.permissionbuild == LevelPermission.Guest)
                {
                    target.SendMessage("You are currently on the guest map where anyone can build");
                }

                List<string> rules = new List<string>();

                // Read in rules
                StreamReader r = File.OpenText("rules.txt");
                while (!r.EndOfStream)
                    rules.Add(r.ReadLine());
                r.Close();

                // Send the user the rules
                target.SendMessage("Server Rules:");
                foreach (string rule in rules)
                    target.SendMessage(rule);

            }
            catch
            {
                Logger.Log("Error reading rules.txt in SendRules()", LogType.Error);
            }
        }
开发者ID:ZakAmirz,项目名称:MCSharp,代码行数:32,代码来源:CmdRules.cs


示例14: Use

        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                string strOperators = "";
                Player.players.ForEach(delegate(Player pl)
                {
                    if (pl.Rank == GroupEnum.Operator && (!pl.hidden || p.Rank >= pl.Rank))
                    {
                        strOperators += pl.color + pl.name + ", ";
                    }
                });
                if (strOperators == "")
                {
                    strOperators = "No operators currently online";
                }
                else
                {
                    strOperators = strOperators.Remove(strOperators.Length - 2);
                }

                p.SendMessage("Online Operators: " + strOperators);
            }
            else
            {
                Help(p);
            }
        }
开发者ID:TaFinalDestination,项目名称:MCSharp,代码行数:29,代码来源:CmdOps.cs


示例15: Use

        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                p.SendMessage("Currently on &b" + p.level.name + "&e X:" + p.level.width.ToString() + " Y:" + p.level.depth.ToString() + " Z:" + p.level.height.ToString());
                switch (p.level.Physics)
                {
                    case Physics.Off:
                        p.SendMessage("Physics is &cOFF&e.");
                        break;

                    case Physics.Normal:
                        p.SendMessage("Physics is &aNormal&e.");
                        break;

                    case Physics.Advanced:
                        p.SendMessage("Physics is &aAdvanced&e.");
                        break;
                }

                p.SendMessage("Build rank = " + Map.PermissionToName(p.level.permissionbuild) + " : Visit rank = " + Map.PermissionToName(p.level.permissionvisit) + ".");
            }
            else
            {
                Help(p);
            }
        }
开发者ID:duaneking,项目名称:MCSharp,代码行数:28,代码来源:CmdMapInfo.cs


示例16: Use

 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "list")
     {
         if (Server.afkset.Contains(p.name))
         {
             Server.afkset.Remove(p.name);
             Player.GlobalMessage("-" + p.group.Color + p.name + "&e- is no longer AFK");
             IRCBot.Say(p.name + " is no longer AFK");
         }
         else
         {
             Server.afkset.Add(p.name);
             Player.GlobalMessage("-" + p.group.Color + p.name + "&e- is AFK " + message);
             IRCBot.Say(p.name + " is AFK " + message);
         }
     }
     else
     {
         // Send list of afk players
         foreach (string s in Server.afkset)
         {
             p.SendMessage(s);
         }
     }
 }
开发者ID:Voziv,项目名称:MCSharp,代码行数:27,代码来源:CmdAfk.cs


示例17: Use

 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target != null)
         {
             if (target.placedBlocks > 0 && target.deletedBlocks > 0)
             {
                 double ratio = ((double)target.placedBlocks / (double)target.deletedBlocks);
                 p.SendMessage(target.name + ": (" + formatRatio(target) + ") (" + target.placedBlocks + "/" + target.deletedBlocks + ")" + " (" + ratio.ToString("N4") + ")");
             }
             else
             {
                 p.SendMessage(target.name + " has not placed/deleted any bricks!");
             }
         }
         else
         {
             p.SendMessage(LanguageString.NoSuchPlayer);
         }
     }
     else
     {
         Help(p);
     }
 }
开发者ID:ZakAmirz,项目名称:MCSharp,代码行数:28,代码来源:CmdRatio.cs


示例18: Blockchange2

        public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            byte b = p.level.GetTile(x, y, z);
            p.SendBlockchange(x, y, z, b);
            CatchPos cpos = (CatchPos)p.blockchangeObject;
            unchecked { if (cpos.type != (byte)-1) { type = cpos.type; } }
            List<Pos> buffer = new List<Pos>();
            switch (cpos.solid)
            {
                case SolidType.solid:
                    if (!Server.operators.Contains(p.name))
                    {
                        int attemptedLimit = (Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z));
                        if (attemptedLimit > p.group.CuboidLimit && p.group.CuboidLimit != 0) //OPERATOR door LIMIT, same as cuboid
                        {
                            p.SendMessage("You're trying to convert " + attemptedLimit + " blocks.");
                            p.SendMessage("Your block limit is " + p.group.CuboidLimit.ToString() + " blocks. Build in stages.");
                            return;
                        }
                    }
                    buffer.Capacity = Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z);
                    for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
                        for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
                            for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
                                /*if (p.level.GetTile(xx, yy, zz) != type) {*/
                                BufferAdd(buffer, xx, yy, zz); //}
                    break;
            }

            p.SendMessage("Converting " + buffer.Count.ToString() + " blocks into door_material.");

            // Disable physics before changing the blocks
            Physics physicsSetting = p.level.Physics;
            p.level.Physics = Physics.Off;
            p.level.ClearPhysics();

            // Because we are calling ClearPhysics() we do not need to account for doorair_material. These materials will be
            // converted back into door_material automatically.

            buffer.ForEach(delegate(Pos pos)
            {
                byte oldBlock = p.level.GetTile(pos.x, pos.y, pos.z); //Get the block that is there at the moment
                byte newBlock = Block.convertDoor(oldBlock);
                if (newBlock != oldBlock)  // if the block is doorifiable
                {
                    if (!opMats.doorBlocks.Contains(oldBlock)) // if the block is not already a door
                    {
                        if (!ignoreList.Contains(newBlock)) // if the new block is not being ignored
                        {
                            p.level.Blockchange(p, pos.x, pos.y, pos.z, newBlock); // send converted reg_material
                        }
                    }
                }
            });

            p.level.Physics = physicsSetting;
            p.SendMessage("Conversion complete.");
        }
开发者ID:Postremus,项目名称:MCSharp,代码行数:59,代码来源:CmdDoor.cs


示例19: Use

        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "")
            {
                string[] parameters = message.Split(' '); // Grab the parameters from the player's message
                if (parameters.Length == 5) // make sure there are 5 params
                {
                    switch (parameters[4])
                    {
                        case "flat":
                        case "pixel":
                        case "island":
                        case "mountains":
                        case "ocean":
                        case "forest":

                            break;

                        default:
                            p.SendMessage("Valid types: island, mountains, forest, ocean, flat, pixel"); return;
                    }

                    string name = parameters[0];
                    // create a new level...
                    try
                    {
                        Map lvl = new Map(name,
                                              Convert.ToUInt16(parameters[1]),
                                              Convert.ToUInt16(parameters[2]),
                                              Convert.ToUInt16(parameters[3]),
                                              parameters[4]);
                        lvl.changed = true;
                    }
                    finally
                    {
                        GC.Collect();
                        GC.WaitForPendingFinalizers();

                    }
                    Player.GlobalMessage("Map " + name + " created");
                }
                else
                {
                    p.SendMessage("Not enough parameters! <name> <x> <y> <z> <type>");
                }
            }
            else
            {
                Help(p);
            }
            if (Properties.ValidString(message, " "))
            {

            }
            else
            {
                p.SendMessage("Please use an alphanumerical characters only!");
            }
        }
开发者ID:Postremus,项目名称:MCSharp,代码行数:60,代码来源:CmdNewLvl.cs


示例20: Blockchange1

 public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
 {
     p.ClearBlockchange();
     byte b = p.level.GetTile(x, y, z);
     p.SendBlockchange(x, y, z, b);
     CatchPos bp = (CatchPos)p.blockchangeObject;
     bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
     p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
 }
开发者ID:duaneking,项目名称:MCSharp,代码行数:9,代码来源:CmdReplace.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MCSong.Player类代码示例发布时间:2022-05-26
下一篇:
C# MCS.MCS类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap