コード例 #1
1
ファイル: ChatCommands.cs プロジェクト: Magi1053/ProCraft
        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);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        private 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)
            {
                return;
            }
            if (player.Can(Permission.UseColorCodes) && message.Contains("%"))
            {
                message = Color.ReplacePercentCodes(message);
            }
            Chat.SendCustom(player, message);
        }
コード例 #5
0
ファイル: ChatCommands.cs プロジェクト: TheDireMaster/fCraft
        static void SayHandler([NotNull] Player player, [NotNull] 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);
            }
        }
コード例 #6
0
ファイル: ChatCommands.cs プロジェクト: TheDireMaster/fCraft
        static void RollHandler([NotNull] Player player, [NotNull] CommandReader 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;
            }
            if (max == Int32.MaxValue - 1)
            {
                player.Message("Roll: Given values must be between {0} and {1}",
                               Int32.MinValue,
                               Int32.MaxValue - 1);
                return;
            }

            int num = rand.Next(min, max + 1);

            Server.Message(player,
                           "{0}{1} rolled {2} ({3}...{4})",
                           player.ClassyName,
                           ChatColor.Silver,
                           num,
                           min,
                           max);
            player.Message("{0}You rolled {1} ({2}...{3})",
                           ChatColor.Silver,
                           num,
                           min,
                           max);
        }
コード例 #7
0
        private 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);
            }
        }
コード例 #8
0
ファイル: ChatCommands.cs プロジェクト: TheDireMaster/fCraft
        static void StaffHandler([NotNull] Player player, [NotNull] CommandReader 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);
            }
        }
コード例 #9
0
ファイル: ChatCommands.cs プロジェクト: TheDireMaster/fCraft
        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);
        }
コード例 #10
0
ファイル: ChatCommands.cs プロジェクト: TheDireMaster/fCraft
        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();
                Chat.SendMe(player, msg);
            }
        }
コード例 #11
0
ファイル: ChatCommands.cs プロジェクト: fragmer/fCraft
        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 );
            }
        }
コード例 #12
0
ファイル: ChatCommands.cs プロジェクト: TheDireMaster/fCraft
        static void MeHandler([NotNull] Player player, [NotNull] CommandReader 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);
            }
        }
コード例 #13
0
ファイル: ChatCommands.cs プロジェクト: fragmer/fCraft
        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 );
            }
        }
コード例 #14
0
ファイル: ChatCommands.cs プロジェクト: fragmer/fCraft
        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 );
        }
コード例 #15
0
ファイル: ChatCommands.cs プロジェクト: fragmer/fCraft
        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 );
        }
コード例 #16
0
ファイル: ChatCommands.cs プロジェクト: fragmer/fCraft
        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 );
            }
        }
コード例 #17
0
ファイル: ChatCommands.cs プロジェクト: venofox/AtomicCraft
        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);
            }
        }
コード例 #18
0
ファイル: ChatCommands.cs プロジェクト: Magi1053/ProCraft
        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");
                }
            }
        }
コード例 #19
0
ファイル: ChatCommands.cs プロジェクト: Magi1053/ProCraft
        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);
            }

        }
コード例 #20
0
ファイル: ChatCommands.cs プロジェクト: fragmer/fCraft
        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 );
            }
        }
コード例 #21
0
ファイル: ChatCommands.cs プロジェクト: Magi1053/ProCraft
        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();
            if (String.IsNullOrEmpty(message))
            {
                sayMessage = String.Format("&2[&7CountDown Started&2][&7{1}&2] &2-&7{0}",
                                            player.Name,
                                            duration.ToMiniString());
                ircMessage = String.Format( "\u212C&2[&7{1} CountDown Started&2] -\u211C{0}",
                                            player.Name,
                                            duration.ToMiniString());
            }
            else
            {
                sayMessage = String.Format("&2[&7Timer Started&2][&7{1}&2] &7{2} &2-&7{0}",
                                            player.Name,
                                            duration.ToMiniString(),
                                            message);
                ircMessage = String.Format( "\u212C&2[&7{1} Timer Started&2][&7{0}&2] \u211C{2}",
                                            player.Name,
                                            duration.ToMiniString(),
                                            message);
            }
            Server.Players.Message(sayMessage);
            IRC.SendChannelMessage(ircMessage);
            ChatTimer.Start(duration, message, player.Name);
        }
コード例 #22
0
ファイル: ChatCommands.cs プロジェクト: Magi1053/ProCraft
 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);
     }
 }
コード例 #23
0
ファイル: ChatCommands.cs プロジェクト: Magi1053/ProCraft
        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);
            }
        }
コード例 #24
0
ファイル: ChatCommands.cs プロジェクト: Magi1053/ProCraft
        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!");
            }
        }
コード例 #25
0
ファイル: ChatCommands.cs プロジェクト: TheDireMaster/fCraft
        static void TimerHandler([NotNull] Player player, [NotNull] 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)
                    {
                        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.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.IsNullOrWhiteSpace(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);
        }
コード例 #26
0
ファイル: ChatCommands.cs プロジェクト: Desertive/800craft
        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);
            }
        }