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); }