0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-22 03:05:16 +00:00

fix: tag seeking command send new state to all players

This commit is contained in:
Robin C. Ladiges 2024-06-21 22:10:52 +02:00 committed by Aubrey
parent 7a055be9cf
commit 3affb59eb9

View file

@ -483,12 +483,17 @@ CommandHandler.RegisterCommand("tag", args => {
if (!bool.TryParse(args[2], out bool seeking)) return $"Usage: tag seeking {args[1]} <true/false>";
TagPacket tagPacket = new TagPacket {
UpdateType = TagPacket.TagUpdate.State,
IsIt = seeking
IsIt = seeking,
};
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 {(args[1] == "*" ? "everyone" : args[1])} to {(seeking ? "seeker" : "hider")}";
}
case "start" when args.Length > 2: {