void ChatLoop(string line) { var chat = new ChatMessageClient(line); FromClient(chat); }
public static void ParseClient(Client player, ChatMessageClient chat) { string message = chat.Text; if (message.Contains("§")) { Log.WritePlayer(player, "Illegal chat: " + message); return; } //Flood detection if (player.ChatFloodNextReset < DateTime.Now) { player.ChatFloodCount = 1; player.ChatFloodNextReset = DateTime.Now.AddSeconds(5); } else { player.ChatFloodCount += 1; if (player.ChatFloodCount > 10) { player.ChatFloodCount = 0; player.BanByServer(DateTime.Now.AddMinutes(5), "Chat Flood"); return; } } if (chat.Text.StartsWith("/")) MainCommands.ParseClientCommand(player, message); else ParseClientChat(player, message); }