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


C# Player.DetectChatSpam方法代码示例

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


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

示例1: SayHandler

        static void SayHandler(Player player, CommandReader cmd)
        {
            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }

            if (player.DetectChatSpam()) return;

            if (player.Can(Permission.Say))
            {
                string msg = cmd.NextAll().Trim();
                if (msg.Length > 0)
                {
                    Chat.SendSay(player, msg);
                }
                else
                {
                    CdSay.PrintUsage(player);
                }
            }
            else
            {
                player.MessageNoAccess(Permission.Say);
            }
        }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:27,代码来源:ChatCommands.cs

示例2: SayHandler

        static void SayHandler( Player player, Command cmd ) {
            if( player.Info.IsMuted ) {
                player.MessageMuted();
                return;
            }

            if( player.DetectChatSpam() ) return;

            if( player.Can( Permission.Say ) ) {
                string msg = cmd.NextAll().Trim();
                if( player.Can( Permission.UseColorCodes ) && msg.Contains( "%" ) ) {
                    msg = Color.ReplacePercentCodes( msg );
                }
                if( msg.Length > 0 ) {
                    Chat.SendSay( player, msg );
                } else {
                    CdSay.PrintUsage( player );
                }
            } else {
                player.MessageNoAccess( Permission.Say );
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:22,代码来源:ChatCommands.cs

示例3: StaffHandler

        static void StaffHandler( Player player, Command cmd ) {
            if( player.Info.IsMuted ) {
                player.MessageMuted();
                return;
            }

            if( player.DetectChatSpam() ) return;

            string message = cmd.NextAll().Trim();
            if( message.Length > 0 ) {
                Chat.SendStaff( player, message );
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:13,代码来源:ChatCommands.cs

示例4: TimerHandler

        static void TimerHandler( Player player, Command cmd ) {
            string param = cmd.Next();

            // List timers
            if( param == null ) {
                ChatTimer[] list = ChatTimer.TimerList.OrderBy( timer => timer.TimeLeft ).ToArray();
                if( list.Length == 0 ) {
                    player.Message( "No timers running." );
                } else {
                    player.Message( "There are {0} timers running:", list.Length );
                    foreach( ChatTimer timer in list ) {
                        player.Message( "  #{0} \"{1}&S\" (started by {2}, {3} left)",
                                        timer.Id, timer.Message, timer.StartedBy, timer.TimeLeft.ToMiniString() );
                    }
                }
                return;
            }

            // Abort a timer
            if( param.Equals( "abort", StringComparison.OrdinalIgnoreCase ) ) {
                int timerId;
                if( cmd.NextInt( out timerId ) ) {
                    ChatTimer timer = ChatTimer.FindTimerById( timerId );
                    if( timer == null || !timer.IsRunning ) {
                        player.Message( "Given timer (#{0}) does not exist.", timerId );
                    } else {
                        timer.Stop();
                        string abortMsg = String.Format( "&Y(Timer) {0}&Y aborted a timer with {1} left: {2}",
                                                         player.ClassyName, timer.TimeLeft.ToMiniString(), timer.Message );
                        Chat.SendSay( player, abortMsg );
                    }
                } else {
                    CdTimer.PrintUsage( player );
                }
                return;
            }

            // Start a timer
            if( player.Info.IsMuted ) {
                player.MessageMuted();
                return;
            }
            if( player.DetectChatSpam() ) return;
            TimeSpan duration;
            if( !param.TryParseMiniTimespan( out duration ) ) {
                CdTimer.PrintUsage( player );
                return;
            }
            if( duration > DateTimeUtil.MaxTimeSpan ) {
                player.MessageMaxTimeSpan();
                return;
            }
            if( duration < ChatTimer.MinDuration ) {
                player.Message( "Timer: Must be at least 1 second." );
                return;
            }

            string sayMessage;
            string message = cmd.NextAll();
            if( String.IsNullOrEmpty( message ) ) {
                sayMessage = String.Format( "&Y(Timer) {0}&Y started a {1} timer",
                                            player.ClassyName,
                                            duration.ToMiniString() );
            } else {
                sayMessage = String.Format( "&Y(Timer) {0}&Y started a {1} timer: {2}",
                                            player.ClassyName,
                                            duration.ToMiniString(),
                                            message );
            }
            Chat.SendSay( player, sayMessage );
            ChatTimer.Start( duration, message, player.Name );
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:72,代码来源:ChatCommands.cs

示例5: RollHandler

        static void RollHandler( Player player, Command cmd ) {
            if( player.Info.IsMuted ) {
                player.MessageMuted();
                return;
            }

            if( player.DetectChatSpam() ) return;

            Random rand = new Random();
            int n1;
            int min, max;
            if( cmd.NextInt( out n1 ) ) {
                int n2;
                if( !cmd.NextInt( out n2 ) ) {
                    n2 = 1;
                }
                min = Math.Min( n1, n2 );
                max = Math.Max( n1, n2 );
            } else {
                min = 1;
                max = 100;
            }

            int num = rand.Next( min, max + 1 );
            Server.Message( player,
                            "{0}{1} rolled {2} ({3}...{4})",
                            player.ClassyName, Color.Silver, num, min, max );
            player.Message( "{0}You rolled {1} ({2}...{3})",
                            Color.Silver, num, min, max );
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:30,代码来源:ChatCommands.cs

示例6: MeHandler

        static void MeHandler( Player player, Command cmd ) {
            if( player.Info.IsMuted ) {
                player.MessageMuted();
                return;
            }

            if( player.DetectChatSpam() ) return;

            string msg = cmd.NextAll().Trim();
            if( msg.Length > 0 ) {
                Chat.SendMe( player, msg );
            } else {
                CdMe.PrintUsage( player );
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:15,代码来源:ChatCommands.cs

示例7: CustomChatHandler

        static void CustomChatHandler(Player player, Command cmd)
        {
            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }

            if (player.DetectChatSpam()) return;

            string message = cmd.NextAll().Trim();
            if (message.Length > 0)
            {
                if (player.Can(Permission.UseColorCodes) && message.Contains("%"))
                {
                    message = Color.ReplacePercentCodes(message);
                }
                Chat.SendCustom(player, message);
            }
        }
开发者ID:venofox,项目名称:AtomicCraft,代码行数:20,代码来源:ChatCommands.cs

示例8: MeHandler

        static void MeHandler( Player player, Command cmd ) {
            if( player.Info.IsMuted ) {
                player.MessageMuted();
                return;
            }

            if( player.DetectChatSpam() ) return;

            string msg = cmd.NextAll().Trim();
            if( msg.Length > 0 ) {
                player.Info.ProcessMessageWritten();
                if( player.Can( Permission.UseColorCodes ) && msg.Contains( "%" ) ) {
                    msg = Color.ReplacePercentCodes( msg );
                }
                Chat.SendMe( player, msg );
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:17,代码来源:ChatCommands.cs

示例9: TimerHandler

        static void TimerHandler(Player player, CommandReader cmd)
        {
            string param = cmd.Next();

            // List timers
            if (param == null)
            {
                ChatTimer[] list = ChatTimer.TimerList.OrderBy(timer => timer.TimeLeft).ToArray();
                if (list.Length == 0)
                {
                    player.Message("No timers running.");
                }
                else
                {
                    player.Message("There are {0} timers running:", list.Length);
                    foreach (ChatTimer timer in list)
                    {
                        if (timer.Message.Equals(""))
                        {
                            player.Message("  #{0} \"&7*CountDown*&s\" (started by {2}, {3} left)",
                                            timer.ID, timer.Message, timer.StartedBy, timer.TimeLeft.ToMiniString());
                        }
                        else
                        {
                            player.Message("  #{0} \"{1}&s\" (started by {2}, {3} left)",
                                            timer.ID, timer.Message, timer.StartedBy, timer.TimeLeft.ToMiniString());
                        }
                    }
                }
                return;
            }

            // Abort a timer
            if (param.Equals("abort", StringComparison.OrdinalIgnoreCase))
            {
                int timerId;
                if (cmd.NextInt(out timerId))
                {
                    ChatTimer timer = ChatTimer.FindTimerById(timerId);
                    if (timer == null || !timer.IsRunning)
                    {
                        player.Message("Given timer (#{0}) does not exist.", timerId);
                    }
                    else
                    {
                        timer.Abort();
                        string abortMsg = "";
                        string abortircMsg = "";
                        if (timer.Message.Equals(""))
                        {
                            abortMsg = String.Format("&S{0}&S aborted a &7CountDown&S with {1} left",
                                                             player.ClassyName, timer.TimeLeft.ToMiniString());
                            abortircMsg = String.Format("\u212C&S{0}&S aborted a &7CountDown&S with {1} left",
                                                             player.ClassyName, timer.TimeLeft.ToMiniString());
                        }
                        else
                        {
                            abortMsg = String.Format("&S{0}&S aborted a &7Timer&S with {1} left: &7{2}",
                                                             player.ClassyName, timer.TimeLeft.ToMiniString(), timer.Message);
                            abortircMsg = String.Format( "\u212C&S{0}&S aborted a &7Timer&S with {1} left: \u211C{2}",
                                                             player.ClassyName, timer.TimeLeft.ToMiniString(), timer.Message);
                        }
                        Server.Players.Message(abortMsg);
                        IRC.SendChannelMessage(abortircMsg);
                    }
                }
                else
                {
                    CdTimer.PrintUsage(player);
                }
                return;
            }

            // Start a timer
            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }
            if (player.DetectChatSpam()) return;
            TimeSpan duration;
            if (!param.TryParseMiniTimespan(out duration))
            {
                CdTimer.PrintUsage(player);
                return;
            }
            if (duration > DateTimeUtil.MaxTimeSpan)
            {
                player.MessageMaxTimeSpan();
                return;
            }
            if (duration < ChatTimer.MinDuration)
            {
                player.Message("Timer: Must be at least 1 second.");
                return;
            }

            string sayMessage;
            string ircMessage;
            string message = cmd.NextAll();
//.........这里部分代码省略.........
开发者ID:Magi1053,项目名称:ProCraft,代码行数:101,代码来源:ChatCommands.cs

示例10: reportHandler

        private static void reportHandler(Player player, CommandReader cmd) {
            if (player.DetectChatSpam()) return;
            string message = cmd.NextAll();
            Report rCreate = new Report();
            if (cmd.IsConfirmed) {
                rCreate.addReport(getNewReportId(), player.Name, DateTime.Now, message);
                player.Message("Report sent!");
				foreach (Player p in Server.Players.Where(q => q.Info.Rank == RankManager.HighestRank)) {
					if (p.Supports(CpeExtension.MessageType)) {
						p.Send(Packet.Message((byte)MessageType.Announcement, String.Format("Player {0} has sent in a report!", player.Name)));
					}
					p.Message("Player {0} has sent in a report!", player.Name);
				}
                return;
            }
            if (message.Length < 1) {
                CdReport.PrintUsage(player);
            } else {
                player.Confirm(cmd,
                    "&sYour message will show up like this: &n" + "&s[&1Report&s]&n" + "  &sFrom:&f {0}&n" +
                    "  &sDate: &7{1} at {2}&n" + "  &sMessage:&f {3}", player.Name, DateTime.Now.ToShortDateString(),
                    DateTime.Now.ToLongTimeString(), message);
            }

        }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:25,代码来源:ChatCommands.cs

示例11: RollHandler

        static void RollHandler(Player player, CommandReader cmd)
        {
            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }
            if (player.Info.TimeSinceLastServerMessage.TotalSeconds < 5) {
                player.Info.getLeftOverTime(5, cmd);
                return;
            }

            if (player.DetectChatSpam()) return;

            Random rand = new Random();
            int n1;
            int min, max;
            if (cmd.NextInt(out n1))
            {
                int n2;
                if (!cmd.NextInt(out n2))
                {
                    n2 = 1;
                }
                min = Math.Min(n1, n2);
                max = Math.Max(n1, n2);
            }
            else
            {
                min = 1;
                max = 100;
            }

            int num = rand.Next(min, max + 1);
            Server.Message(player,
                            "{0}{1} rolled {2} ({3}...{4})",
                            player.ClassyName, Color.Silver, num, min, max);            
            player.Message("{0}You rolled {1} ({2}...{3})",
                            Color.Silver, num, min, max);
            player.Info.LastServerMessageDate = DateTime.Now;
            if (min == 1 && max == 100)
            {
                if (num == 69)
                {
                    Server.BotMessage("Tehe....69");
                }
                if (num == Server.CountPlayers(false))
                {
                    Server.BotMessage("That's how many players are online :D");
                }
            }
        }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:52,代码来源:ChatCommands.cs

示例12: ReviewHandler

        static void ReviewHandler(Player player, CommandReader cmd)
        {
            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }

            if (player.DetectChatSpam()) return;
            var staff = Server.Players.Where(p => p.IsStaff);
            if (staff != null && staff.Any()) {
                player.Message("&SYour review request has been sent to the Moderators. They will be with you shortly");
                Server.Players.Where(p => p.IsStaff).Message("&SPlayer " + player.ClassyName + " &Srequests a building review.");
            } else {
                player.Message("&SThere are no staff on! Sorry!");
            }
        }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:17,代码来源:ChatCommands.cs

示例13: WarningHandler

 private static void WarningHandler(Player player, CommandReader cmd) {
     if (player.Info.IsMuted) {
         player.MessageMuted();
         return;
     }
     if (player.DetectChatSpam())
         return;
     string searchplayer = cmd.Next();
     string warning = cmd.NextAll().Trim();
     Player other = Server.FindPlayerOrPrintMatches(player, searchplayer, SearchOptions.Default);
     if (other == player) {
         player.Message("Cannot warn yourself");
         return;
     }
     if (!(cmd.Count <= 2) && cmd.IsConfirmed) {
         Server.Players.Message("&f{0} &chas warned &f{1} &cto &4{2}", player.ClassyName, other.ClassyName, warning);
         return;
     }
     if (other != null) {
         player.Confirm(cmd, "Your warning will display as: \"&f{0} &chas warned &f{1} &cto &4{2}\"", player.ClassyName, other.ClassyName, warning);
     }
 }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:22,代码来源:ChatCommands.cs

示例14: ActionHandler

        private static void ActionHandler(Player player, CommandReader cmd) {
            if (player.Info.IsMuted) {
                player.MessageMuted();
                return;
            }
            if (player.DetectChatSpam())
                return;
            string searchplayer = cmd.Next();
            string action = cmd.NextAll().Trim();
			if ("".Equals(searchplayer) || "".Equals(action)) {
				CdAction.PrintUsage(player);
				return;
			}
            Player other = Server.FindPlayerOrPrintMatches(player, searchplayer, SearchOptions.Default);
            if (other == player) {
                player.Message("Cannot action yourself");
                return;
            }
            if (!(cmd.Count <= 2) && cmd.IsConfirmed) {
                Server.Players.Message("{0} &s{1} {2}", player.ClassyName, action, other.ClassyName);
                return;
            }
            if (other != null) {
                player.Confirm(cmd, "Your messege will show up as: {0} &s{1} {2}", player.ClassyName, action,
                    other.ClassyName);
            }
        }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:27,代码来源:ChatCommands.cs

示例15: StaffHandler

        static void StaffHandler(Player player, Command cmd)
        {
            string message = cmd.NextAll().Trim();

            if(message == "static")
            {
                if (player.IsStaticStaff)
                {
                    player.IsStaticStaff = false;
                    player.Message("&W(Staff): Static mode is now OFF.");
                    return;
                }

                if (!player.IsStaticStaff)
                {
                    player.IsStaticStaff = true;
                    player.Message("&W(Staff): Static mode is now ON. Use /Staff to turn OFF");
                    return;
                }
            }

            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }

            if (player.DetectChatSpam()) return;

            if (message.Length > 0)
            {
                if (player.Can(Permission.UseColorCodes) && message.Contains("%"))
                {
                    message = Color.ReplacePercentCodes(message);
                }
                Chat.SendStaff(player, message);
            }
        }
开发者ID:Desertive,项目名称:800craft,代码行数:38,代码来源:ChatCommands.cs


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