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


C# Player.SendMessage方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例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 == "")
            {
                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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: Use

        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "" || message.Split(' ').Length != 2)
            {
                Player target = Player.Find(message.Split(' ')[0]);
                string levelName = message.Split(' ')[1];
                bool blnLevelLoaded = false;

                if (target == null)
                {
                    p.SendMessage("FAILED - No such player!");
                }
                else if (target.Rank >= p.Rank)
                {
                    p.SendMessage("You cannnot send a player who is an equal or greater rank than yourself");
                }
                else
                {
                    foreach (Level l in Server.levels)
                    {
                        if (l.name == levelName)
                        {
                            if (target.level.name != levelName)
                            {
                                target.SendMessage(p.name + " has sent you to " + levelName);
                                Command.all.Find("goto").Use(target, levelName);
                                blnLevelLoaded = true;
                                break;
                            }
                            else
                            {
                                p.SendMessage("Player is already on that level!");
                                blnLevelLoaded = true;
                                break;
                            }
                        }
                    }
                    if (!blnLevelLoaded)
                    {
                        DirectoryInfo di = new DirectoryInfo("levels/");
                        FileInfo[] fi = di.GetFiles("*.lvl");
                        foreach (FileInfo file in fi)
                        {
                            if (file.Name.Replace(".lvl", "").ToLower() == levelName.ToLower())
                            {
                                p.SendMessage("That Level is not loaded yet!");
                            }
                        }
                        p.SendMessage("No such level!");
                    }
                }
            }
            else
            {
                Help(p);
            }
        }
开发者ID:TaFinalDestination,项目名称:MCSharp,代码行数:58,代码来源:CmdSendLevel.cs


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