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


C# Player.SendMessage方法代码示例

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


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

示例1: CommandHasBadColourCodes

        public static bool CommandHasBadColourCodes(Player who, string message) {
            string[] checkmessagesplit = message.Split(' ');
            bool lastendwithcolour = false;
            foreach ( string s in checkmessagesplit ) {
                s.Trim();
                if ( s.StartsWith("%") ) {
                    if ( lastendwithcolour ) {
                        if ( who != null ) {
                            who.SendMessage("Sorry, Your colour codes in this command were invalid (You cannot use 2 colour codes next to each other");
                            who.SendMessage("Command failed.");
                            Server.s.Log(who.name + " attempted to send a command with invalid colours codes (2 colour codes were next to each other)!");
                            Chat.GlobalMessageOps(who.color + who.DisplayName + " " + Server.DefaultColor + " attempted to send a command with invalid colours codes (2 colour codes were next to each other)!");
                        }
                        return true;
                    }
                    else if ( s.Length == 2 ) {
                        lastendwithcolour = true;
                    }
                }
                if ( s.TrimEnd(Server.ColourCodesNoPercent).EndsWith("%") ) {
                    lastendwithcolour = true;
                }
                else {
                    lastendwithcolour = false;
                }

            }
            return false;
        }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:29,代码来源:Player.cs

示例2: GlobalChat

        public static void GlobalChat(Player from, string message, bool showname) {
            if ( from == null ) return; // So we don't fucking derp the hell out!

            if ( Server.lava.HasPlayer(from) && Server.lava.HasVote(message.ToLower()) ) {
                if ( Server.lava.AddVote(from, message.ToLower()) ) {
                    SendMessage(from, "Your vote for &5" + message.ToLower().Capitalize() + Server.DefaultColor + " has been placed. Thanks!");
                    Server.lava.map.ChatLevelOps(from.name + " voted for &5" + message.ToLower().Capitalize() + Server.DefaultColor + ".");
                    return;
                }
                else {
                    SendMessage(from, "&cYou already voted!");
                    return;
                }
            }

            if ( Server.voting ) {
                if ( message.ToLower() == "yes" || message.ToLower() == "ye" || message.ToLower() == "y" ) {
                    if ( !from.voted ) {
                        Server.YesVotes++;
                        SendMessage(from, c.red + "Thanks For Voting!");
                        from.voted = true;
                        return;
                    }
                    else if ( !from.voice ) {
                        from.SendMessage("Chat moderation is on while voting is on!");
                        return;
                    }
                }
                else if ( message.ToLower() == "no" || message.ToLower() == "n" ) {
                    if ( !from.voted ) {
                        Server.NoVotes++;
                        SendMessage(from, c.red + "Thanks For Voting!");
                        from.voted = true;
                        return;
                    }
                    else if ( !from.voice ) {
                        from.SendMessage("Chat moderation is on while voting is on!");
                        return;
                    }
                }
            }

            if ( Server.votingforlevel ) {
                if ( message.ToLower() == "1" || message.ToLower() == "one" ) {
                    if ( !from.voted ) {
                        Server.Level1Vote++;
                        SendMessage(from, c.red + "Thanks For Voting!");
                        from.voted = true;
                        return;
                    }
                    else if ( !from.voice ) {
                        from.SendMessage("Chat moderation is on while voting is on!");
                        return;
                    }
                }
                else if ( message.ToLower() == "2" || message.ToLower() == "two" ) {
                    if ( !from.voted ) {
                        Server.Level2Vote++;
                        SendMessage(from, c.red + "Thanks For Voting!");
                        from.voted = true;
                        return;
                    }
                    else if ( !from.voice ) {
                        from.SendMessage("Chat moderation is on while voting is on!");
                        return;
                    }
                }
                else if ( message.ToLower() == "3" || message.ToLower() == "random" || message.ToLower() == "rand" ) {
                    if ( !from.voted ) {
                        Server.Level3Vote++;
                        SendMessage(from, c.red + "Thanks For Voting!");
                        from.voted = true;
                        return;
                    }
                    else if ( !from.voice ) {
                        from.SendMessage("Chat moderation is on while voting is on!");
                        return;
                    }
                }
                else if ( !from.voice ) {
                    from.SendMessage("Chat moderation is on while voting is on!");
                    return;
                }
            }
            if (Last50Chat.Count() == 50)
                Last50Chat.RemoveAt(0);
            var chatmessage = new ChatMessage();
            chatmessage.text = message;
            chatmessage.username = from.color + from.name;
            chatmessage.time = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss");


            Last50Chat.Add(chatmessage);
            if ( showname ) {
                String referee = "";
                if ( from.referee ) {
                    referee = c.green + "[Referee] ";
                }
                message = referee + from.color + from.voicestring + from.color + from.prefix + from.DisplayName + ": %r&f" + message;
            }
//.........这里部分代码省略.........
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:101,代码来源:Player.cs

示例3: Reset


//.........这里部分代码省略.........
                        { //green on map
                            PopulateSquaresLeft();
                            while (squaresleft.Count > 0)
                            {
                                Random number = new Random();
                                int randnum = number.Next(squaresleft.Count);
                                string nextsquare = squaresleft.ElementAt(randnum);
                                squaresleft.Remove(nextsquare);
                                {
                                    int column = int.Parse(nextsquare.Split(':')[0]);
                                    int row = int.Parse(nextsquare.Split(':')[1]);
                                    ushort x1 = (ushort)(27 - (row * 3));
                                    ushort x2 = (ushort)(28 - (row * 3));
                                    ushort y = 4;
                                    ushort z1 = (ushort)(27 - (column * 3));
                                    ushort z2 = (ushort)(28 - (column * 3));
                                    {
                                        {
                                            mapon.Blockchange(x1, y, z1, Block.green);
                                            mapon.Blockchange(x2, y, z1, Block.green);
                                            mapon.Blockchange(x2, y, z2, Block.green);
                                            mapon.Blockchange(x1, y, z2, Block.green);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (all == false)
                {
                    if (p != null)
                    {
                        p.SendMessage("The Countdown map has been reset");
                        if (gamestatus == CountdownGameStatus.Finished)
                        {
                            p.SendMessage("You do not need to re-enable it");
                        }
                    }
                    gamestatus = CountdownGameStatus.Enabled;
                    foreach (Player pl in Player.players)
                    {
                        if (pl.playerofcountdown == true)
                        {
                            if (pl.level == mapon)
                            {
                                Command.all.Find("countdown").Use(pl, "join");
                                Player.SendMessage(pl, "You've rejoined countdown!!");
                            }
                            else
                            {
                                Player.SendMessage(pl, "You've been removed from countdown because you aren't on the map");
                                pl.playerofcountdown = false;
                                players.Remove(pl);
                            }
                        }
                    }
                }
                else if (all == true)
                {
                    if (p != null)
                    {
                        p.SendMessage("Countdown has been reset");
                        if (gamestatus == CountdownGameStatus.Finished)
                        {
                            p.SendMessage("You do not need to re-enable it");
开发者ID:Fire200055,项目名称:MCGalaxy,代码行数:67,代码来源:CountdownGame.cs

示例4: End

 public static void End(Player winner)
 {
     CountdownGame.squaresleft.Clear();
     if (winner != null)
     {
         winner.SendMessage("Congratulations!! You won!!!");
     }
     gamestatus = CountdownGameStatus.Finished;
     if (winner != null)
     {
         Command.all.Find("spawn").Use(winner, "");
     }
     CountdownGame.playersleftlist.Clear();
     if (winner != null)
     {
         winner.incountdown = false;
     }
     if (winner == null)
     {
         foreach (Player pl in CountdownGame.players)
         {
             Player.SendMessage(pl, "The countdown game was canceled!");
             Command.all.Find("spawn").Use(pl, "");
         }
         Player.GlobalMessage("The countdown game was canceled!!");
         CountdownGame.gamestatus = CountdownGameStatus.Enabled;
         CountdownGame.playersleft = 0;
         CountdownGame.playersleftlist.Clear();
         CountdownGame.players.Clear();
         CountdownGame.squaresleft.Clear();
         CountdownGame.Reset(null, true);
         CountdownGame.cancel = false;
         return;
     }
 }
开发者ID:Fire200055,项目名称:MCGalaxy,代码行数:35,代码来源:CountdownGame.cs

示例5: SendMessage

 public static void SendMessage(Player p, string message, bool colorParse) {
     if ( p == null ) {
         if ( storeHelp ) {
             storedHelp += message + "\r\n";
         }
         else {
             if ( !Server.irc || String.IsNullOrEmpty(Server.IRC.usedCmd) )
                 Server.s.Log(message);
             else
                 Server.IRC.Pm(Server.IRC.usedCmd, message);
             //IRCBot.Say(message, true);
         }
         return;
     }
     
     p.SendMessage(0, Server.DefaultColor + message, colorParse);
 }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:17,代码来源:Player.Networking.cs

示例6: InfectedPlayerLogin

 public bool InfectedPlayerLogin(Player p)
 {
     if (Server.gameStatus == 0) return false;
     if (p == null) return false;
     if (p.level.name != Server.zombie.currentLevelName) return false;
     p.SendMessage("You have joined in the middle of a round. You are now infected!");
     p.blockCount = 50;
     try
     {
         Server.zombie.InfectPlayer(p);
     }
     catch { }
     return true;
 }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:14,代码来源:ZombieGame.cs


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