From db553ccf4abfa07d0a5e7c37d6fc24d05e03aba1 Mon Sep 17 00:00:00 2001 From: "Robin C. Ladiges" Date: Fri, 21 Jun 2024 22:10:13 +0200 Subject: [PATCH] fix: `tag time` command send new time to all players --- Server/Program.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Server/Program.cs b/Server/Program.cs index 3facbc1..d9bf846 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -456,13 +456,18 @@ await c.Send(new ChangeStagePacket { return $"Invalid time for seconds {args[3]} (range: 0-59)"; TagPacket tagPacket = new TagPacket { UpdateType = TagPacket.TagUpdate.Time, - Minutes = minutes, - Seconds = seconds + Minutes = minutes, + Seconds = seconds, }; - if (args[1] == "*") - server.Broadcast(tagPacket); - else - client?.Send(tagPacket); + if (args[1] == "*") { + Parallel.ForEachAsync(server.Clients, async (client, _) => { + await server.Broadcast(tagPacket, client); + await client.Send(tagPacket); + }); + } else if (client != null) { + server.Broadcast(tagPacket, client); + client.Send(tagPacket); + } return $"Set time for {(args[1] == "*" ? "everyone" : args[1])} to {minutes}:{seconds}"; } case "seeking" when args.Length == 3: {