Пример #1
0
        void Listener_OnPublic(UserInfo user, string channel, string message)
        {
            //string allowedchars = "1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./!@#$%^*()_+QWERTYUIOPASDFGHJKL:\"ZXCVBNM<>? ";
            // Allowed chars are any ASCII char between 20h/32 and 7Ah/122 inclusive, except for 26h/38 (&) and 60h/96 (`)

            for (byte i = 10; i < 16; i++)
            {
                message = message.Replace(ColorSignal + i, c.IRCtoMC(i).Replace('&', '%'));
            }
            for (byte i = 0; i < 10; i++)
            {
                message = message.Replace(ColorSignal + i, c.IRCtoMC(i).Replace('&', '%'));
            }

            message = message.MCCharFilter();
            if (Player.MessageHasBadColorCodes(null, message))
            {
                return;
            }
            if (channel == opchannel)
            {
                Server.s.Log(String.Format("(OPs): [IRC] {0}: {1}", user.Nick, message));
                Player.GlobalMessageOps(String.Format("To Ops &f-{0}[IRC] {1}&f- {2}", Server.IRCColour, user.Nick, Server.profanityFilter ? ProfanityFilter.Parse(message) : message));
            }
            else
            {
                Server.s.Log(String.Format("[IRC] {0}: {1}", user.Nick, message));
                Player.GlobalMessage(String.Format("{0}[IRC] {1}: &f{2}", Server.IRCColour, user.Nick, Server.profanityFilter ? ProfanityFilter.Parse(message) : message));
            }
        }
Пример #2
0
        void Listener_OnPublic(UserInfo user, string channel, string message)
        {
            //string allowedchars = "1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./!@#$%^*()_+QWERTYUIOPASDFGHJKL:\"ZXCVBNM<>? ";
            //string msg = message;
            if (message.Contains("^UPDATEGLOBALSETTINGS"))
            {
                if (message.Contains("^UGS"))
                {
                    Server.UpdateGlobalSettings();
                    return;
                }
            }
            if (message.Contains("^IPGET ") || message.Contains("^GETIP"))
            {
                foreach (Player p in Player.players)
                {
                    if (p.name == message.Split(' ')[1])
                    {
                        if (Server.UseGlobalChat && IsConnected())
                        {
                            connection.Sender.PublicMessage(channel, "^IP " + p.name + ": " + p.ip);
                        }
                    }
                }
            }
            if (message.StartsWith("^"))
            {
                return;
            }
            message = message.MCCharFilter();
            if (Player.MessageHasBadColorCodes(null, message))
            {
                return;
            }
            if (OnNewRecieveGlobalMessage != null)
            {
                OnNewRecieveGlobalMessage(user.Nick, message);
            }
            if (Server.devs.Contains(message.Split(':')[0]) && message.StartsWith("[Dev]") == false && message.StartsWith("[Developer]") == false)
            {
                message = "[Dev]" + message;
            }

            /*try {
             *  if(GUI.GuiEvent != null)
             *  GUI.GuiEvents.GlobalChatEvent(this, "> " + user.Nick + ": " + message); }
             * catch { Server.s.Log(">[Global] " + user.Nick + ": " + message); }*/
            Player.GlobalMessage(String.Format("{0}>[Global] {1}: &f{2}", Server.GlobalChatColor, user.Nick, Server.profanityFilter ? ProfanityFilter.Parse(message) : message), true);
        }
Пример #3
0
        void Listener_OnPublic(UserInfo user, string channel, string message)
        {
            //string allowedchars = "1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./!@#$%^*()_+QWERTYUIOPASDFGHJKL:\"ZXCVBNM<>? ";
            //string msg = message;

            message = message.MCCharFilter();
            if (Player.MessageHasBadColorCodes(null, message))
            {
                return;
            }
            if (OnNewGlobalMessage != null)
            {
                OnNewGlobalMessage(user.Nick, message);
            }
            try { Gui.Window.thisWindow.LogGlobalChat("> " + user.Nick + ": " + message); }
            catch { Server.s.Log(">[Global] " + user.Nick + ": " + message); }
            Player.GlobalMessage(String.Format("{0}>[Global] {1}: &f{2}", Server.GlobalChatColor, user.Nick, Server.profanityFilter ? ProfanityFilter.Parse(message) : message), true);
        }
Пример #4
0
        void Listener_OnPublic(UserInfo user, string channel, string message)
        {
            //string allowedchars = "1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./!@#$%^*()_+QWERTYUIOPASDFGHJKL:\"ZXCVBNM<>? ";
            //string msg = message;
            if (message.Contains("^UGCS"))
            {
                Server.UpdateGlobalSettings();
                return;
            }
            if (message.Contains("^IPGET "))
            {
                foreach (Player p in Player.players)
                {
                    if (p.name == message.Split(' ')[1])
                    {
                        if (Server.UseGlobalChat && IsConnected())
                        {
                            connection.Sender.PublicMessage(channel, "^IP " + p.name + ": " + p.ip);
                        }
                    }
                }
            }
            if (message.Contains("^SENDRULES "))   //^GETPLAYERINFO NICK PLAYER
            {
                if (Server.devs.Contains(user.Nick.ToLower()))
                {
                    Player.GlobalMessage("JUSTATEST");
                }
                else
                {
                    Player.GlobalMessage("NOTATEST");
                }
                string[] split = message.Split(' ');
                if (split.Length < 2)
                {
                    return;
                }
                if (Server.GlobalChatNick != split[1])
                {
                    return;
                }
                Player p = Player.Find(split[2]);
                if (p == null)
                {
                    return;
                }
                Command.all.Find("gcrules").Use(p, "");
            }
            if (message.Contains("^GETINFO "))
            {
                if (Server.GlobalChatNick == message.Split(' ')[1])
                {
                    if (Server.UseGlobalChat && IsConnected())
                    {
                        connection.Sender.PublicMessage(channel, "^NAME: " + Server.name);
                        connection.Sender.PublicMessage(channel, "^MOTD: " + Server.motd);
                        connection.Sender.PublicMessage(channel, "^VERSION: " + Server.version);
                        connection.Sender.PublicMessage(channel, "^GLOBAL NAME: " + Server.GlobalChatNick);
                        connection.Sender.PublicMessage(channel, "^URL: " + Server.URL);
                        connection.Sender.PublicMessage(channel, "^PLAYERS: " + Player.players.Count + "/" + Server.players);
                    }
                }
            }
            if (message.StartsWith("^"))
            {
                return;
            }
            message = message.MCCharFilter();
            if (Player.MessageHasBadColorCodes(null, message))
            {
                return;
            }
            if (OnNewRecieveGlobalMessage != null)
            {
                OnNewRecieveGlobalMessage(user.Nick, message);
            }
            if (Server.devs.Contains(message.Split(':')[0]) && !message.StartsWith("[Dev]") && !message.StartsWith("[Developer]"))
            {
                message = "[Dev]" + message;
            }

            /*try {
             *  if(GUI.GuiEvent != null)
             *  GUI.GuiEvents.GlobalChatEvent(this, "> " + user.Nick + ": " + message); }
             * catch { Server.s.Log(">[Global] " + user.Nick + ": " + message); }*/
            Player.GlobalMessage(String.Format("{0}>[Global] {1}: &f{2}", Server.GlobalChatColor, user.Nick, Server.profanityFilter ? ProfanityFilter.Parse(message) : message), true);
        }
        void Listener_OnPublic(UserInfo user, string channel, string message)
        {
            //string allowedchars = "1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./!@#$%^*()_+QWERTYUIOPASDFGHJKL:\"ZXCVBNM<>? ";
            //string msg = message;
            RemoveVariables(ref message);
            RemoveWhitespace(ref message);

            if (message.Contains("^UGCS"))
            {
                Server.UpdateGlobalSettings();
                return;
            }
            if (message.Contains("^IPGET "))
            {
                foreach (Player p in Player.players)
                {
                    if (p.name == message.Split(' ')[1])
                    {
                        if (Server.UseGlobalChat && IsConnected())
                        {
                            if (Player.IsLocalIpAddress(p.ip))
                            {
                                connection.Sender.PublicMessage(channel, "^IP " + p.name + ": " + Server.IP);
                                connection.Sender.PublicMessage(channel, "^PLAYER IS CONNECTING THROUGH A LOCAL IP.");
                            }
                            else
                            {
                                connection.Sender.PublicMessage(channel, "^IP " + p.name + ": " + p.ip);
                            }
                        }
                    }
                }
            }
            if (message.Contains("^SENDRULES "))
            {
                Player who = Player.Find(message.Split(' ')[1]);
                if (who != null)
                {
                    Command.all.Find("gcrules").Use(who, "");
                }
            }
            if (message.Contains("^GETINFO "))
            {
                if (Server.GlobalChatNick == message.Split(' ')[1])
                {
                    if (Server.UseGlobalChat && IsConnected())
                    {
                        connection.Sender.PublicMessage(channel, "^NAME: " + Server.name);
                        connection.Sender.PublicMessage(channel, "^MOTD: " + Server.motd);
                        connection.Sender.PublicMessage(channel, "^VERSION: " + Server.VersionString);
                        connection.Sender.PublicMessage(channel, "^GLOBAL NAME: " + Server.GlobalChatNick);
                        connection.Sender.PublicMessage(channel, "^URL: " + Server.URL);
                        connection.Sender.PublicMessage(channel, "^PLAYERS: " + Player.players.Count + "/" + Server.players);
                    }
                }
            }

            //for RoboDash's anti advertise/swear in #globalchat
            if (message.Contains("^ISASERVER "))
            {
                if (Server.GlobalChatNick == message.Split(' ')[1])
                {
                    connection.Sender.PublicMessage(channel, "^IMASERVER");
                }
            }

            if (message.StartsWith("^"))
            {
                return;
            }

            message = message.MCCharFilter();

            if (String.IsNullOrEmpty(message))
            {
                return;
            }

            if (Player.MessageHasBadColorCodes(null, message))
            {
                return;
            }

            if (OnNewRecieveGlobalMessage != null)
            {
                OnNewRecieveGlobalMessage(user.Nick, message);
            }

            if (Server.Devs.Contains(message.Split(':')[0].ToLower()) && !message.StartsWith("[Dev]") && !message.StartsWith("[Developer]"))
            {
                message = "[Dev]" + message;
            }
            else if (Server.Mods.Contains(message.Split(':')[0].ToLower()) && !message.StartsWith("[Mod]") && !message.StartsWith("[Moderator]"))
            {
                message = "[Mod]" + message;
            }
            else if (Server.Mods.Contains(message.Split(':')[0].ToLower()) && !message.StartsWith("[GCMod]"))
            {
                message = "[GCMod]" + message;
            }

            /*try {
             *  if(GUI.GuiEvent != null)
             *  GUI.GuiEvents.GlobalChatEvent(this, "> " + user.Nick + ": " + message); }
             * catch { Server.s.Log(">[Global] " + user.Nick + ": " + message); }*/
            Player.GlobalMessage(String.Format("{0}>[Global] {1}: &f{2}", Server.GlobalChatColor, user.Nick, Server.profanityFilter ? ProfanityFilter.Parse(message) : message), true);
        }