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


C# Player.SendMessage方法代码示例

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


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

示例1: Use

 public void Use(Player p, string[] args)
 {
     if (args.Length == 0) { p.SendMessage("You have to specify a message!"); return; }
     string message = null;
     foreach (string s in args) { message += s + " "; }
     Player.UniversalChat(message);
 }
开发者ID:EricKilla,项目名称:MCForge-Vanilla-1,代码行数:7,代码来源:CmdSay.cs

示例2: Use

 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         if (!Server.voting)
         {
             string temp = message.Substring(0, 1) == "%" ? "" : Server.DefaultColor;
             Server.voting = true;
             Server.NoVotes = 0;
             Server.YesVotes = 0;
             Player.GlobalMessage(" " + c.green + "VOTE: " + temp + message + "(" + c.green + "Yes " + Server.DefaultColor + "/" + c.red + "No" + Server.DefaultColor + ")");
             System.Threading.Thread.Sleep(15000);
             Server.voting = false;
             Player.GlobalMessage("The vote is in! " + c.green + "Y: " + Server.YesVotes + c.red + " N: " + Server.NoVotes);
             Player.players.ForEach(delegate(Player winners)
             {
                 winners.voted = false;
             });
         }
         else
         {
             p.SendMessage("A vote is in progress!");
         }
     }
     else
     {
         Help(p);
     }
 }
开发者ID:B00mX0r,项目名称:MCForge-MCLawl,代码行数:29,代码来源:CmdVote.cs

示例3: Use

 public override void Use(Player p, params string[] args)
 {
     if (args.Length == 0) { Help(p); return; }
     else if (args.Length == 1)
     {
         Random rand = new Random();
         int seed = new Random().Next();
         p.SendMessage("Creating world with seed: " + seed);
         double x = 0; double y = 127; double z = 0;
         World temp = new World(x, y, z, args[0], seed);
         //while (Chunk.GetChunk((int)x, (int)z, temp).GetBlock((int)x, (int)(y - 1), (int)z) == 0)
         //	y--;
         temp.SpawnY = y;
         World.worlds.Add(temp);
         p.SendMessage("World " + args[0] + " MADE!");
     }
     else if (args.Length == 2 || args.Length == 3)
     {
         int seed = Convert.ToInt32(args[1]);
         p.SendMessage("Creating world with seed: " + seed);
         double x = 0; double y = 127; double z = 0;
         World temp = new World(x, y, z, args[0], seed);
         if (args.Length == 3)
         {
             int limit = Convert.ToInt32(args[2]);
             if (limit > 2)
                 temp.ChunkLimit = limit;
             else { p.SendMessage("maxchunks cannot be less than 3. creating with maxchunks 3."); temp.ChunkLimit = 3; }
         }
         World.worlds.Add(temp);
         p.SendMessage("World " + args[0] + " MADE!");
     }
 }
开发者ID:TaFinalDestination,项目名称:ForgeCraft,代码行数:33,代码来源:CmdNewLVL.cs

示例4: Help

 public void Help(Player p)
 {
     p.SendMessage("/notify [user] <message> - Sends a message up the top right corner to WoM users.");
     p.SendMessage("If no user is specified the message is sent to yourself.");
     p.SendMessage("Supported users: [all], a specified level, or a specified player.");
     p.SendMessage("Shortcuts: /alert");
 }
开发者ID:nullpic,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdNotify.cs

示例5: Help

 public override void Help(Player p)
 {
     p.SendMessage("/red - joins the red team.");
     p.SendMessage("&cThese require Op+:");
     p.SendMessage("/red spawn - sets the red teams spawn location for that map.");
     p.SendMessage("/red flag - sets the red teams flag location for that map.");
 }
开发者ID:Goodlyay,项目名称:MCForge-Vanilla-Redux,代码行数:7,代码来源:CmdRedTeam.cs

示例6: Use

 public override void Use(Player p, string message)
 {
     int number = message.Split(' ').Length;
     if (number > 2) { Help(p); return; }
     if (number == 2)
     {
         Server.s.Log(message);
         string t = message.Split(' ')[0];
         string s = message.Split(' ')[1];
         if (t == "zombie")
         {
             bool asdfasdf = false;
             Player.players.ForEach(delegate(Player player)
             {
                 if (player.name == s)
                 {
                     p.SendMessage(s + " was queued.");
                     Server.queZombie = true;
                     Server.nextZombie = s;
                     asdfasdf = true;
                     return;
                 }
             });
             if (!asdfasdf)
             {
                 p.SendMessage(s + " is not online.");
                 return;
             }
         }
         else if (t == "level")
         {
             bool yes = false;
             DirectoryInfo di = new DirectoryInfo("levels/");
             FileInfo[] fi = di.GetFiles("*.lvl");
             foreach (FileInfo file in fi)
             {
                 if (file.Name.Replace(".lvl", "").ToLower().Equals(s.ToLower()))
                 {
                     yes = true;
                 }
             }
             if (yes)
             {
                 p.SendMessage(s + " was queued.");
                 Server.queLevel = true;
                 Server.nextLevel = s.ToLower();
                 return;
             }
             else
             {
                 p.SendMessage("Level does not exist.");
                 return;
             }
         }
         else
         {
             p.SendMessage("You did not enter a valid option.");
         }
     }
 }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:60,代码来源:CmdQueue.cs

示例7: Use

 public override void Use(Player p, params string[] args)
 {
     p.SendMessage("Relighting all chunks! Please wait...", WrapMethod.Chat);
     foreach (Chunk c in p.level.chunkData.Values.ToArray())
         c.RecalculateLight();
     p.SendMessage("Done!");
     Command.all.Find("reveal").Use(p, "all");
 }
开发者ID:Defuseninja,项目名称:ForgeCraft,代码行数:8,代码来源:CmdRelight.cs

示例8: HandleCommand

        public void HandleCommand(UserManager<User> userManager, string message, Player player)
        {
            try
            {
                string commandText = message.Split(' ')[0];
                message = message.Replace(commandText, "").Trim();
                commandText = commandText.Replace("/", "").Replace(".", "");

                string[] arguments = message.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);

                List<CommandAttribute> foundCommands = new List<CommandAttribute>();
                foreach (var handlerEntry in _pluginCommands)
                {
                    CommandAttribute commandAttribute = handlerEntry.Value;
                    if (!commandText.Equals(commandAttribute.Command, StringComparison.InvariantCultureIgnoreCase)) continue;

                    MethodInfo method = handlerEntry.Key;
                    if (method == null) return;

                    foundCommands.Add(commandAttribute);

                    var authorizationAttributes = method.GetCustomAttributes<AuthorizeAttribute>(true);
                    foreach (AuthorizeAttribute authorizationAttribute in authorizationAttributes)
                    {
                        if (userManager == null)
                        {
                            player.SendMessage($"UserManager not found. You are not permitted to use this command!");
                            return;
                        }

                        User user = userManager.FindByName(player.Username);
                        if (user == null)
                        {
                            player.SendMessage($"No registered user '{player.Username}' found. You are not permitted to use this command!");
                            return;
                        }

                        var userIdentity = userManager.CreateIdentity(user, "none");
                        if (!authorizationAttribute.OnAuthorization(new GenericPrincipal(userIdentity, new string[0])))
                        {
                            player.SendMessage("You are not permitted to use this command!");
                            return;
                        }
                    }

                    if (ExecuteCommand(method, player, arguments)) return;
                }

                foreach (var commandAttribute in foundCommands)
                {
                    player.SendMessage($"Usage: {commandAttribute.Usage}");
                }
            }
            catch (Exception ex)
            {
                Log.Warn(ex);
            }
        }
开发者ID:CRBairdUSA,项目名称:MiNET,代码行数:58,代码来源:PluginManager.cs

示例9: Use

        public override void Use(Player p, string message)
        {
            if (!SharpControl.teleporting)
            {

                if (message == null || message == "") { Help(p); return; }

                if (message == "stop")
                {
                    if (!SharpControl.walkbool)
                    {
                        p.SendMessage(SharpControl.p.UserName + " isn't walking! You can't stop it."); return;
                    }
                    SharpControl.walkbool = false;
                }
                else
                {
                    if (SharpControl.walkbool) { p.SendMessage(SharpControl.p.UserName + " is already walking. Stop with !walk stop."); return; }
                    int speedvar;
                    try { speedvar = Convert.ToInt32(message); }
                    catch { Help(p); return; }
                    if (speedvar < 1 || speedvar > 5) { p.SendMessage("Speed must be in between 1 and 5"); return; }
                    SharpControl.walkbool = true;
                    switch (speedvar)
                    {
                        case 1:
                            Thread walkinf500 = new Thread(new ThreadStart(() => WalkInf(500)));
                            walkinf500.IsBackground = true;
                            walkinf500.Start();
                            break;
                        case 2:
                            Thread walkinf400 = new Thread(new ThreadStart(() => WalkInf(400)));
                            walkinf400.IsBackground = true;
                            walkinf400.Start();
                            break;
                        case 3:
                            Thread walkinf300 = new Thread(new ThreadStart(() => WalkInf(300)));
                            walkinf300.IsBackground = true;
                            walkinf300.Start();
                            break;
                        case 4:
                            Thread walkinf200 = new Thread(new ThreadStart(() => WalkInf(200)));
                            walkinf200.IsBackground = true;
                            walkinf200.Start();
                            break;
                        case 5:
                            Thread walkinf100 = new Thread(new ThreadStart(() => WalkInf(100)));
                            walkinf100.IsBackground = true;
                            walkinf100.Start();
                            break;
                    }
                }
            }
            else
            {
                p.SendMessage("Can't move while teleporting!");
            }
        }
开发者ID:setty,项目名称:ForgeCommander,代码行数:58,代码来源:CmdWalk.cs

示例10: BC1

 public void BC1(Player p, BlockChangeEventArgs args)
 {
     p.ExtraData["Mark1"] = new Vector3S(args.X, args.Z, args.Y);
     p.SendMessage("First coordinate marked. (" + args.X + ", " + args.Z + ", " + args.Y + ")");
     args.Unregister();
     args.Cancel();
     p.SendMessage("Break or place a block to select the second point.");
     p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(BC2);
 }
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:9,代码来源:CmdSelect.cs

示例11: Use

        public override void Use(Player p, string message)
        {
            p.flipHead = !p.flipHead;

            if (p.flipHead)
                p.SendMessage("Your head was broken!");
            else
                p.SendMessage("Your head was healed!");
        }
开发者ID:hirsty,项目名称:MCForge-Vanilla,代码行数:9,代码来源:CmdFliphead.cs

示例12: Blockchange

 public void Blockchange(Player p, ushort x, ushort y, ushort z, byte type)
 {
     p.ClearBlockchange();
     Block b = Program.mainLevel.GetTile(x, y, z);
     p.SendBlockchange(x, y, z, b.type);
     if (b == null) { p.SendMessage("No edits found for (" + x + "," + y + "," + z + ")."); return; }
     //if (b.lastaction.Count == 0) { p.SendMessage("No edits found for (" + x + "," + y + "," + z + ")."); return; }
     p.SendMessage("Last edits of (" + x + "," + y + "," + z + "):");
     //b.lastaction.ForEach(delegate(Edit e) { p.SendMessage("> " + Player.GetColor(e.from) + e.from + ":&e " + e.before + " => " + e.after); });
 }
开发者ID:Balthizar01,项目名称:MCForge-Vanilla-Redux,代码行数:10,代码来源:CmdWhodid.cs

示例13: Blockchange1

        void Blockchange1(Player p, int x, int y, int z, short type)
        {
            p.ClearBlockChange();
            p.SendBlockChange(x, (byte)y, z, p.level.GetBlock(x, y, z), p.level.GetMeta(x, y, z));

            p.SendMessage("Position: " + x + "," + y + "," + z);
            p.SendMessage("Type: " + p.level.GetBlock(x, y, z));
            p.SendMessage("Meta: " + p.level.GetMeta(x, y, z));
            p.SendMessage("Extra: " + p.level.GetExtra(x, y, z));
        }
开发者ID:TaFinalDestination,项目名称:ForgeCraft,代码行数:10,代码来源:CmdAbout.cs

示例14: Use

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

示例15: SendChatMessage

 public void SendChatMessage(Player player, string name, string message = null)
 {
     if (message != null)
         player.SendMessage($"{name}: {message}");
     else
     {
         message = name;
         player.SendMessage(message);
     }
 }
开发者ID:romgerman,项目名称:Oxide,代码行数:10,代码来源:ReignOfKings.cs


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