From bc3bd5b0f24c873aba21a0c18d928f11dd69fb9a Mon Sep 17 00:00:00 2001 From: Amos Date: Mon, 22 Jul 2024 20:43:54 +0100 Subject: [PATCH] Using TellAsync instead of Tell to prevent Event flooding. (#332) --- Application/Commands/FindPlayerCommand.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Application/Commands/FindPlayerCommand.cs b/Application/Commands/FindPlayerCommand.cs index 22f5b21a..53691f00 100644 --- a/Application/Commands/FindPlayerCommand.cs +++ b/Application/Commands/FindPlayerCommand.cs @@ -48,12 +48,11 @@ namespace IW4MAdmin.Application.Commands return; } - foreach (var client in players) - { - gameEvent.Origin.Tell(_translationLookup["COMMANDS_FIND_FORMAT_V2"].FormatExt(client.Name, - client.ClientId, Utilities.ConvertLevelToColor((EFClient.Permission) client.LevelInt, client.Level), - client.IPAddress, (DateTime.UtcNow - client.LastConnection).HumanizeForCurrentCulture())); - } + var messages = players.Select(client => _translationLookup["COMMANDS_FIND_FORMAT_V2"].FormatExt(client.Name, + client.ClientId, Utilities.ConvertLevelToColor((EFClient.Permission)client.LevelInt, client.Level), + client.IPAddress, (TimeProvider.System.GetUtcNow() - client.LastConnection).HumanizeForCurrentCulture())); + + await gameEvent.Origin.TellAsync(messages); } } -} \ No newline at end of file +}