Ejemplo n.º 1
1
        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);
            }
        }
Ejemplo n.º 2
1
        internal static void BRB(Player player, Command cmd)
        {
            StreamReader streamReader = new StreamReader("plugins/brbMessage.txt");
            string message = streamReader.ReadToEnd();
            streamReader.Close();

            string msg = cmd.NextAll().Trim();
            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }
            if (msg.Length > 0)
            {
                Server.Message("{0}&S &EWill Brb &9({1})",
                                  player.ClassyName, msg);
                player.IsAway = true;
                return;
            }
            else
            {
                Server.Players.Message("&S{0} &EWill Brb &9(" + message + ")", player.ClassyName);
                player.IsAway = true;
            }
        }
Ejemplo n.º 3
0
        internal static void Review(Player player, Command cmd)
        {
            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }
            var recepientList = Server.Players.Can(Permission.StaffChat)
                                .NotIgnoring(player)
                                .Union(player);
            string message = String.Format("{0}&S would like a staff member to review their build.", player.ClassyName);

            recepientList.Message(message);
            var reviewerNames = Server.Players
                                .CanBeSeen(player)
                                .Where(r => r.Can(Permission.Promote, player.Info.Rank));
            var  enumerable = reviewerNames as Player[] ?? reviewerNames.ToArray();
            bool any        = enumerable.Any();

            if (any)
            {
                player.Message("&WStaff members who can review you: {0}",
                               enumerable.JoinToString(r => String.Format("{0}&S", r.ClassyName)));
                return;
            }
            player.Message(
                "&WThere currently are no staff members online who can review you. A member of staff needs to be online.");
        }
Ejemplo n.º 4
0
        internal static void Review(Player player, Command cmd)
        {
            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }
            var recepientList = Server.Players.Can(Permission.ReadStaffChat)
                                .NotIgnoring(player)
                                .Union(player);
            string message = String.Format("{0}&6 would like staff to check their build", player.ClassyName);

            recepientList.Message(message);
            var ReviewerNames = Server.Players
                                .CanBeSeen(player)
                                .Where(r => r.Can(Permission.Promote, player.Info.Rank));

            if (ReviewerNames.Count() > 0)
            {
                player.Message("&WOnline players who can review you: {0}", ReviewerNames.JoinToString(r => String.Format("{0}&S", r.ClassyName)));
                return;
            }
            else
            {
                player.Message("&WThere are no players online who can review you. A member of staff needs to be online.");
            }
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 6
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);
            }
        }
Ejemplo n.º 7
0
        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);
            }
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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 );
            }
        }
Ejemplo n.º 11
0
        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 ) {
                if( player.Can( Permission.UseColorCodes ) && message.Contains( "%" ) ) {
                    message = Color.ReplacePercentCodes( message );
                }
                Chat.SendStaff( player, message );
            }
        }
Ejemplo n.º 12
0
        internal static void Away(Player player, Command cmd)
        {
            string msg = cmd.NextAll().Trim();

            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }
            if (msg.Length > 0)
            {
                Server.Message("{0}&S is away &9({1})",
                               player.ClassyName, msg);
                player.IsAway = true;
                return;
            }
            Server.Players.Message("&S{0} is away &9(Away From Keyboard)", player.ClassyName);
            player.IsAway = true;
        }
Ejemplo n.º 13
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);
            }
        }
Ejemplo n.º 14
0
        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);
            }
        }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
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();
                Chat.SendMe(player, msg);
            }
        }
Ejemplo n.º 17
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 );
            }
        }
Ejemplo n.º 18
0
        internal static void AdminChat(Player player, Command cmd)
        {
            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }
            if (DateTime.UtcNow < player.Info.MutedUntil)
            {
                player.Message("You are muted for another {0:0} seconds.",
                               player.Info.MutedUntil.Subtract(DateTime.UtcNow).TotalSeconds);
                return;
            }
            string message = cmd.NextAll().Trim();

            if (message.Length > 0)
            {
                if (player.Can(Permission.UseColorCodes) && message.Contains("%"))
                {
                    message = Color.ReplacePercentCodes(message);
                }
                Chat.SendAdmin(player, message);
            }
        }
Ejemplo n.º 19
0
        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);
            }
        }
Ejemplo n.º 20
0
        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 );
        }
Ejemplo n.º 21
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 ) {
                Chat.SendMe( player, msg );
            } else {
                CdMe.PrintUsage( player );
            }
        }
Ejemplo n.º 22
0
        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 );
        }
Ejemplo n.º 23
0
 internal static void AdminChat(Player player, Command cmd)
 {
     if (player.Info.IsMuted)
     {
         player.MessageMuted();
         return;
     }
     if (DateTime.UtcNow < player.Info.MutedUntil)
     {
         player.Message("You are muted for another {0:0} seconds.",
                         player.Info.MutedUntil.Subtract(DateTime.UtcNow).TotalSeconds);
         return;
     }
     string message = cmd.NextAll().Trim();
     if (message.Length > 0)
     {
         if (player.Can(Permission.UseColorCodes) && message.Contains("%"))
         {
             message = Color.ReplacePercentCodes(message);
         }
         Chat.SendAdmin(player, message);
     }
 }
Ejemplo n.º 24
0
        static void GHandler(Player player, Command cmd)
        {
            string Msg = cmd.NextAll();
            if (!ConfigKey.GCKey.Enabled())
            {
                player.Message("Global Chat is disabled on this server.");
                return;
            }
            if (!GlobalChat.GlobalThread.GCReady)
            {
                player.Message("Global Chat is not connected.");
                return;
            }
            if (Msg == "reconnect")
            {
                if (player.Can(Permission.ManageGlobalChat))
                {
                    if (GlobalChat.GlobalThread.GCReady)
                    {
                        player.Message("&cThis server is currently connected to global chat.");
                        return;
                    }
                    else
                    {
                        GlobalChat.GlobalThread.GCReady = true;
                        Server.Message("&eAttempting to connect to LegendCraft Global Chat Network. This may take up to two minutes.");
                        GlobalChat.Init();
                        GlobalChat.Start();
                        return;

                    }
                }
            }

            var SendList = Server.Players.Where(p => p.GlobalChatAllowed && !p.IsDeaf);

            if ((!player.GlobalChatAllowed) && (Msg == "rules"))
            {
                player.Message(" &cRules: No spamming and no advertising. All chat rules that apply to your server apply here.\n" +
                    "&eServer staff have the right to kick you.\n" +
                    "&9By using the Global Chat, you accept these conditions.\n" +
                    "&eType &a/Global accept &eto connect");
                return;
            }

            else if ((player.GlobalChatAllowed) && (Msg == "rules"))
            {
                player.Message(" &cRules: No spamming and no advertising. All chat rules that apply to your server apply here.\n" +
                    "&eServer staff have the right to kick you.\n" +
                    "&9By using the Global Chat, you accept these conditions.");
                return;
            }

            else if ((!player.GlobalChatAllowed) && (Msg == "accept"))
            {
                player.GlobalChatAllowed = true;
                player.Message("&wThank you for accepting the global chat rules.\n" +
                    "&cYou now have global chat enabled.");
                GlobalChat.GlobalThread.SendChannelMessage(player.ClassyName + " &Sjoined global chat.");
                SendList.Message(player.ClassyName + " &Sjoined global chat.");
                return;
            }

            else if ((player.GlobalChatAllowed) && (Msg == "accept"))
            {
                player.Message("&You have already accepted the global chat rules.");
                return;
            }

            else if ((!player.GlobalChatIgnore) && (Msg == "ignore"))
            {
                player.GlobalChatIgnore = true;
                player.Message("&cYou have disconnected from global chat.");
                SendList.Message(player.ClassyName + " &Sdisconnected from global chat.");
                GlobalChat.GlobalThread.SendChannelMessage(player.ClassyName + " &Sdisconnected from global chat.");
                return;
            }

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

            if ((!player.GlobalChatAllowed) && ((Msg.Length < 1) || (Msg.Length > 1)))
            {
                player.Message("&WYou must read and accept the global chat rules. Type &a/Global rules.");
                return;
            }

            else if ((player.GlobalChatAllowed) &&((Msg == "") || (Msg == null)))
            {
                player.Message("You must enter a message!");
                return;
            }
            else if (Msg == "help")
            {
                CdGlobal.PrintUsage(player);
                return;
            }

            else if (player.GlobalChatAllowed)
            {
                string pMsg = player.ClassyName + Color.White + ": " + Msg;
                Msg = player.ClassyName + Color.Black + ": " + Msg;
                SendList.Message("&i[Global] " + pMsg); //send the white message to Server
                Msg = Color.MinecraftToIrcColors(Msg);
                Msg = Color.ReplacePercentCodes(Msg);
                GlobalChat.GlobalThread.SendChannelMessage(Msg); //send the black message to GC
            }
        }
Ejemplo n.º 25
0
        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!");
            }
        }
Ejemplo n.º 26
0
        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);
            }
        }
Ejemplo n.º 27
0
        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);
        }
Ejemplo n.º 28
0
        static void TrollHandler(Player player, Command cmd)
        {
            string options = cmd.Next();
            switch (options)
            {
                case "pm":

                    string pName = cmd.Next();
                    string msg = cmd.NextAll().Trim();

                    if (pName == null)
                    {
                        player.Message("Player not found. Please specify valid name.");
                        return;
                    }

                    Player target = Server.FindPlayerOrPrintMatches(player, pName, true, true);

                    if (target == null)
                        return;

                    if (!Player.IsValidName(pName))
                    {
                        player.Message("Player not found. Please specify valid name.");
                        return;
                    }

                    if (msg.Length < 1)
                    {
                        player.Message("Error: Please enter a message for {0}.", target.ClassyName);
                        return;
                    }

                    else
                    {
                        if (player.Can(Permission.UseColorCodes) && msg.Contains("%"))
                        {
                            msg = Color.ReplacePercentCodes(msg);
                        }
                        Server.Players.Message("&Pfrom {0}: {1}", target.Name, msg);
                    }
                    break;
                case "ac":
                    string aName = cmd.Next();
                    string msgAc = cmd.NextAll().Trim();

                    Player target2 = Server.FindPlayerOrPrintMatches(player, aName, true, true);
                    if (target2 == null)
                    {
                        player.Message("Please enter a valid name.");
                        return;
                    }
                    if (Player.IsInValidName(aName) || aName == null)
                    {
                        player.Message("Player not found. Please specify valid name.");
                        return;
                    }

                    if (msgAc.Length < 1)
                    {
                        player.Message("Error: Please enter a message for {0}.", target2.ClassyName);
                        return;
                    }
                    else
                    {
                        Chat.SendAdmin(target2, msgAc);
                    }
                    break;

                case "st":
                case "staff":
                    string SName = cmd.Next();
                    string msgSc = cmd.NextAll().Trim();

                    if (Player.IsInValidName(SName) || msgSc == null)
                    {
                        player.Message("Player not found. Please specify valid name.");
                        return;
                    }
                    Player target4 = Server.FindPlayerOrPrintMatches(player, SName, true, true);

                    if (target4 == null)
                    {
                        player.Message("Please enter a valid name.");
                        return;
                    }
                    if (msgSc.Length < 1)
                    {
                        player.Message("Error: Please enter a message for {0}.", target4.ClassyName);
                        return;
                    }
                    else
                    {
                        Chat.SendStaff(target4, msgSc);
                    }
                    break;
                case "i":
                case "impersonate":
                case "msg":
                case "message":
                case "m":
                    string name = cmd.Next();
                    if (player.Info.IsMuted)
                    {
                        player.MessageMuted();
                        return;
                    }

                    if (Player.IsInValidName(name) || name == null)
                    {
                        player.Message("Player not found. Please specify valid name.");
                        return;
                    }

                    if (player.Can(Permission.Chat))
                    {
                        string msg2 = cmd.NextAll().Trim();

                        Player target5 = Server.FindPlayerOrPrintMatches(player, name, true, true);
                        if (target5 == null)
                        {
                            player.Message("Please enter a valid name.");
                            return;
                        }

                        if (msg2.Length > 0)
                        {
                            Server.Message("{0}&S&F: {1}",
                                              target5.ClassyName, msg2);
                            return;
                        }

                        else
                        {
                            player.Message("&SYou need to enter a message");
                            return;
                        }

                    } break;
                case "leave":
                case "disconnect":
                case "gtfo":
                    string elol = cmd.Next();
                    if (elol == null)
                    { player.Message("Nope"); return; }

                    if (Player.IsInValidName(elol))
                    {
                        player.Message("Player not found. Please specify valid name.");
                        return;
                    }
                    else
                    {
                        Player target6 = Server.FindPlayerOrPrintMatches(player, elol, true, true);
                        if (target6 == null)
                        {
                            player.Message("Please enter a valid name.");
                            return;
                        }
                        Server.Players.Message("&SPlayer {0}&S left the server.", target6.ClassyName);

                    }
                    break;
                default: player.Message("Invalid option. Please choose st, ac, pm, message or leave");
                    break;
            }
        }
Ejemplo n.º 29
0
 static void GHandler(Player player, Command cmd)
 {
     string Msg = cmd.NextAll();
     if (!ConfigKey.GCKey.Enabled()){
         player.Message("Global Chat is disabled on this server");
         return;
     }
     if (!GlobalChat.GlobalThread.GCReady){
         player.Message("Global Chat is not connected for this server");
         return;
     }
     var SendList = Server.Players.Where(p => p.GlobalChat && !p.IsDeaf);
     if (Msg.Length < 1){
         if (player.GlobalChat){
             player.GlobalChat = false;
             GlobalChat.GlobalThread.SendChannelMessage(player.ClassyName + " &Shas disabled the Global Chat (Left)");
             SendList.Message(player.ClassyName + " &Shas disabled the Global Chat (Left)");
             player.Message("&SYou left the 800Craft Global Chat");
             return;
         }
         if (!player.GlobalChat){
             player.GlobalChat = true;
             player.Message(" &WRules: No spamming, no advertising. Your Servers chat rules apply here (staff will mute / kick you)\n" +
                 "&9By using the Global Chat, you automatically accept these conditions.");
             GlobalChat.GlobalThread.SendChannelMessage(player.ClassyName + " &Shas enabled the Global Chat (Joined)");
             SendList.Message(player.ClassyName + " &Shas enabled the Global Chat (Joined)");
             return;
         }
     }
     if (!player.GlobalChat)
     {
         player.Message("&WGlobal chat is disabled for you. Type /Global to enable it");
         return;
     }
     if (player.Info.IsMuted)
     {
         player.MessageMuted();
         return;
     }
     string pMsg = player.ClassyName + Color.White + ": " + Msg;
     Msg = player.ClassyName + Color.Black + ": " + Msg;
     SendList.Message("&i(Global) " + pMsg); //send the white message to Server
     Msg = Color.ToIRCColorCodes(Msg);
     Msg = Color.ReplacePercentCodes(Msg);
     GlobalChat.GlobalThread.SendChannelMessage(Msg); //send the black message to GC
 }
Ejemplo n.º 30
0
 private static void SwearHandler(Player player, CommandReader cmd) {
     string param = cmd.Next();
     if (param == null) {
         CdSwear.PrintUsage(player);
         return;
     }
     switch (param.ToLower()) {
         case "r":
         case "d":
         case "remove":
         case "delete":
             int fId;
             bool removed = false;
             Filter fRemove = null;
             if (cmd.NextInt(out fId)) {
                 foreach (Filter f in Chat.Filters) {
                     if (f.Id == fId) {
                         Server.Message("&Y[Filters] {0}&Y removed the filter \"{1}\" -> \"{2}\"",
                             player.ClassyName, f.Word, f.Replacement);
                         fRemove = f;
                         removed = true;
                     }
                 }
                 if (fRemove != null) {
                     fRemove.removeFilter();
                 }
                 if (!removed) {
                     player.Message("Given filter (#{0}) does not exist.", fId);
                 }
             } else {
                 CdSwear.PrintUsage(player);
             }
             break;
         case "a":
         case "add":
         case "create":
             Filter fCreate = new Filter();
             if (player.Info.IsMuted) {
                 player.MessageMuted();
                 return;
             }
             string word = cmd.Next();
             string replacement = cmd.NextAll();
             if ("".Equals(word) || "".Equals(replacement)) {
                 CdSwear.PrintUsage(player);
                 break;
             }
             bool exists = false;
             foreach (Filter f in Chat.Filters) {
                 if (f.Word.ToLower().Equals(word.ToLower())) {
                     exists = true;
                 }
             }
             if (!exists) {
                 Server.Message("&Y[Filters] \"{0}\" is now replaced by \"{1}\"", word, replacement);
                 fCreate.addFilter(getNewFilterId(), word, replacement);
             } else {
                 player.Message("A filter with that world already exists!");
             }
             break;
         default:
             CdSwear.PrintUsage(player);
             break;
     }
 }
Ejemplo n.º 31
0
        static void GHandler(Player player, Command cmd)
        {
            string message = cmd.NextAll();
            if (message == "connect")
            {
                if (player.Can(Permission.ReadAdminChat))
                {
                    if (GlobalChat.GlobalThread.isConnected)
                    {
                        player.Message("&c{0}&c is already connected to the LegendCraft Global Chat Network!", ConfigKey.ServerName.GetString());
                        return;
                    }
                    GlobalChat.GlobalThread.GCReady = true;
                    Server.Message("&eAttempting to connect to LegendCraft Global Chat Network. This may take up to two minutes.");
                    GlobalChat.Init();
                    GlobalChat.Start();
                    return;
                }
                else
                {
                    player.Message("&eYou don't have the required permissions to do that!");
                    return;
                }
            }
            if (!GlobalChat.GlobalThread.GCReady)
            {
                player.Message("&cGlobal Chat is not connected.");
                return;
            }

            var SendList = Server.Players.Where(p => p.GlobalChatAllowed && !p.IsDeaf);

            if (message == "disconnect")
            {
                if (player.Can(Permission.ReadAdminChat))
                {
                    Server.Message("&e{0}&e disconnected {1}&e from the LegendCraft Global Chat Network.", player.ClassyName, ConfigKey.ServerName.GetString());
                    GlobalChat.GlobalThread.SendChannelMessage("&i" + ConfigKey.ServerName.GetString() + "&i has disconnected from the LegendCraft Global Chat Network.");
                    GlobalChat.GlobalThread global = new GlobalChat.GlobalThread();
                    global.DisconnectThread();
                    return;
                }
                else
                {
                    player.Message("&eYou don't have the required permissions to do that!");
                    return;
                }
            }
            if (message == "ignore")
            {
                if (player.GlobalChatIgnore)
                {
                    player.Message("You are already ignoring global chat!");
                    return;
                }
                else
                {
                    player.Message("&eYou are now ignoring global chat. To return to global chat, type /global unignore.");
                    player.GlobalChatIgnore = true;
                    return;
                }
            }
            if (message == "unignore")
            {
                if (player.GlobalChatIgnore)
                {
                    player.Message("You are no longer ignoring global chat.");
                    player.GlobalChatIgnore = false;
                    return;
                }
                else
                {
                    player.Message("&cYou are not currently ignoring global chat!");
                    return;
                }
            }
            else if (message == "help")
            {
                player.Message("_LegendCraft GlobalChat Network Help_\n" +
                    "Ignore: Usage is '/global ignore'. Allows a user to ignore and stop using global chat. Type /global unignore to return to global chat. \n" +
                    "Unignore: Usage is '/global unignore.' Allows a user to return to global chat. \n" +
                    "Connect: For admins only. Usage is /global connect. Connects your server to the LegendCraft GlobalChat Network. \n" +
                    "Disconnect: For admins only. Usage is /global disconnect. Disconnects your server from the LegendCraft GlobalChat Network. \n" +
                    "Message: Usage is '/global <your message here>'. Will send your message to the rest of the servers connected to GlobalChat.");
                return;
            }

            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }
            else if (!player.GlobalChatAllowed)
            {
                player.Message("Global Chat Rules: By using global chat, you automatically agree to these terms and conditions. Failure to agree may result in a global chat kick or ban. \n" +
                    "1) No Spamming or deliberate insulting. \n" +
                    "2) No advertising of any server or other minecraft related/unrelated service or product. \n" +
                    "3) No discussion of illegal or partially illegal tasks is permitted. \n" +
                    "4) Connecting bots to the Global Chat Network is not permitted, unless approved by the LegendCraft Team. \n" +
                    "&aYou are now permitted to use /global on this server.");
                player.GlobalChatAllowed = true;
            }

            else if (message == null)
            {
                player.Message("&eYou must enter a message!");
                return;
            }

            else if (player.GlobalChatAllowed)
            {
                string rawMessage = player.ClassyName + Color.White + ": " + message;
                message = player.ClassyName + Color.Black + ": " + message;
                SendList.Message("&i[Global] " + rawMessage);
                GlobalChat.GlobalThread.SendChannelMessage(Color.ReplacePercentCodes(Color.MinecraftToIrcColors(message)));
            }
        }
Ejemplo n.º 32
0
 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);
     }
 }
Ejemplo n.º 33
0
 static void GHandler(Player player, Command cmd)
 {
     string Msg = cmd.NextAll();
     var SendList = Server.Players.Where(p => p.GlobalChat && !p.IsDeaf);
     if (Msg.Length < 1)
     {
         if (player.GlobalChat)
         {
             player.GlobalChat = false;
             GlobalChat.GlobalThread.SendChannelMessage(player.ClassyName + " &Shas disabled the Global Chat (Left)");
             player.Message("&SYou left the 800Craft Global Chat");
             return;
         }
         if (!player.GlobalChat)
         {
             player.GlobalChat = true;
             GlobalChat.GlobalThread.SendChannelMessage(player.ClassyName + " &Shas enabled the Global Chat (Joined)");
             player.Message(player.ClassyName + " &Shas enabled the Global Chat (Joined)");
             return;
         }
     }
     if (!player.GlobalChat)
     {
         player.Message("&WGlobal chat is disabled for you. Type /Global to enable it");
         return;
     }
     if (player.Info.IsMuted)
     {
         player.MessageMuted();
         return;
     }
     Msg = player.ClassyName + Color.White + ": " + Msg;
     Msg = Color.ReplacePercentCodes(Msg);
     SendList.Message("&i(Global) " + Msg);
     Msg = Color.ToIRCColorCodes(Msg);
     GlobalChat.GlobalThread.SendChannelMessage(Msg);
 }
Ejemplo n.º 34
0
        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");
                }
            }
        }
Ejemplo n.º 35
0
 internal static void Away(Player player, Command cmd)
 {
     string msg = cmd.NextAll().Trim();
     if (player.Info.IsMuted)
     {
         player.MessageMuted();
         return;
     }
     if (msg.Length > 0)
     {
         Server.Message("{0}&S &Eis away &9({1})",
                           player.ClassyName, msg);
         player.IsAway = true;
         return;
     }
     else
     {
         Server.Players.Message("&S{0} &Eis away &9(Away From Keyboard)", player.ClassyName);
         player.IsAway = true;
     }
 }
Ejemplo n.º 36
0
 private static void AFKHandler(Player player, CommandReader cmd) {
     string msg = cmd.NextAll();
     if (player.Info.IsMuted) {
         player.MessageMuted();
         return;
     }
     Server.Players.CanSee(player)
         .Message("&S{0} is {1} AFK{2}", player.Name, player.Info.IsAFK ? "no longer" : "now",
         msg.Length > 0 ? " (" + (msg.Length > 32 ? msg.Remove(32) : msg) + ")" : "");
     player.Message("&SYou are {0} AFK {1}", player.Info.IsAFK ? "no longer" : "now",
         msg.Length > 0 ? " (" + (msg.Length > 32 ? msg.Remove(32) : msg) + ")" : "");
     player.Info.IsAFK = !player.Info.IsAFK;
     player.Info.oldafkMob = player.Info.afkMob;
     player.Info.afkMob = player.Info.IsAFK ? player.AFKModel : player.Info.Mob;
     Server.UpdateTabList();
     player.ResetIdBotTimer();
 }
Ejemplo n.º 37
0
 internal static void Review(Player player, Command cmd)
 {
     if (player.Info.IsMuted)
     {
         player.MessageMuted();
         return;
     }
     var recepientList = Server.Players.Can(Permission.ReadStaffChat)
                                       .NotIgnoring(player)
                                       .Union(player);
     string message = String.Format("{0}&6 would like staff to check their build", player.ClassyName);
     recepientList.Message(message);
     var ReviewerNames = Server.Players
                                  .CanBeSeen(player)
                                  .Where(r => r.Can(Permission.Promote, player.Info.Rank));
     if (ReviewerNames.Count() > 0)
     {
         player.Message("&WOnline players who can review you: {0}", ReviewerNames.JoinToString(r => String.Format("{0}&S", r.ClassyName)));
         return;
     }
     else
         player.Message("&WThere are no players online who can review you. A member of staff needs to be online.");
 }
Ejemplo n.º 38
0
        private static void GlobalHandler(Player player, Command cmd)
        {
            var    sendList = Server.Players.Where(p => p.GlobalChatAllowed && !p.IsDeaf);
            string msg      = cmd.NextAll();

            if (!ConfigKey.GlobalChat.Enabled())
            {
                player.Message("&WGlobal Chat is disabled on this server.");
                return;
            }
            if (!GlobalChat.GlobalThread.GcReady)
            {
                player.Message("&WGlobal Chat is not connected.");
                return;
            }
            string reason;

            if (Server.GlobalChatBans.TryGetValue(player.Name.ToLower(), out reason))
            {
                player.Message("You were &cbanned &efrom &gglobal chat&e by &h{0}&e", reason);
                player.Message("You can appeal your ban at &9http://atomiccraft.net");
                return;
            }
            switch (msg)
            {
            case "reconnect":
                if (player.Can(Permission.ManageGlobalChat))
                {
                    if (GlobalChat.GlobalThread.GcReady)
                    {
                        player.Message("&WThis server is currently connected to global chat.");
                        return;
                    }
                    GlobalChat.GlobalThread.GcReady = true;
                    Server.Message(
                        "&WAttempting to connect to AtomicCraft Global Chat Network. This may take a few seconds.");
                    GlobalChat.Init();
                    GlobalChat.Start();
                    return;
                }
                break;

            case "rules":
                if (!player.GlobalChatAllowed)
                {
                    player.Message(
                        "&RRules: No spamming and no advertising. All chat rules that apply to your server apply here.\n" +
                        "&WServer staff have the right to kick you.\n" +
                        "&SBy using the Global Chat, you accept these conditions.\n" +
                        "&SType &H/global accept &Sto connect");
                    return;
                }

                if (player.GlobalChatAllowed)
                {
                    player.Message(
                        "&RRules: No spamming and no advertising. All chat rules that apply to your server apply here.\n" +
                        "&WServer staff have the right to kick you.\n" +
                        "&SBy using the Global Chat, you accept these conditions.");
                    return;
                }
                break;

            case "accept":

                if (!player.GlobalChatAllowed)
                {
                    player.GlobalChatAllowed = true;
                    player.Message("&SThank you for accepting the global chat rules.\n" +
                                   "&WYou now have global chat enabled.");
                    GlobalChat.GlobalThread.SendChannelMessage(player.ClassyName + " &Sjoined global chat.");
                    sendList.Message(player.ClassyName + " &Sjoined global chat.");
                    return;
                }

                if (player.GlobalChatAllowed)
                {
                    player.Message("&WYou have already accepted the global chat rules.");
                    return;
                }
                break;

            case "ignore":
                if (!player.GlobalChatIgnore)
                {
                    player.GlobalChatIgnore = true;
                    player.Message("&WYou have disconnected from global chat.");
                    sendList.Message(player.ClassyName + " &Sdisconnected from global chat.");
                    GlobalChat.GlobalThread.SendChannelMessage(player.ClassyName +
                                                               " &Sdisconnected from global chat.");
                    return;
                }
                break;

            case "help":
                CdGlobal.PrintUsage(player);
                break;
            }
            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }

            if ((!player.GlobalChatAllowed) && ((msg.Length < 1) || (msg.Length > 1)))
            {
                player.Message("&WYou must read and accept the global chat rules. Type &H/global rules");
                return;
            }

            if ((player.GlobalChatAllowed) && string.IsNullOrEmpty(msg))
            {
                player.Message("&WYou must enter a message!");
                return;
            }
            if (!player.GlobalChatAllowed)
            {
                return;
            }
            string pMsg = player.ClassyName + Color.White + ": " + msg;

            msg = player.ClassyName + Color.Black + ": " + msg;
            sendList.Message("&g[Global] " + pMsg); //send the white message to Server
            msg = Color.MinecraftToIrcColors(msg);
            msg = Color.ReplacePercentCodes(msg);
            GlobalChat.GlobalThread.SendChannelMessage(msg); //send the black message to GC
        }
Ejemplo n.º 39
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 );
            }
        }
Ejemplo n.º 40
0
        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);
        }
Ejemplo n.º 41
0
        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);
            }
        }