0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-25 04:35:18 +00:00

move clear task

This commit is contained in:
Jack Baron 2022-07-22 17:53:31 +01:00 committed by Sanae
parent 24a34c35a1
commit e14616030c

View file

@ -127,9 +127,6 @@ server.PacketHandler = (c, p) => {
c.Metadata["speedrun"] = true; c.Metadata["speedrun"] = true;
((ConcurrentBag<int>) (c.Metadata["shineSync"] ??= new ConcurrentBag<int>())).Clear(); ((ConcurrentBag<int>) (c.Metadata["shineSync"] ??= new ConcurrentBag<int>())).Clear();
shineBag.Clear(); shineBag.Clear();
Task.Run(async () => {
await PersistShines();
});
c.Logger.Info("Entered Cap on new save, preventing moon sync until Cascade"); c.Logger.Info("Entered Cap on new save, preventing moon sync until Cascade");
break; break;
case "WaterfallWorldHomeStage": case "WaterfallWorldHomeStage":
@ -573,6 +570,10 @@ CommandHandler.RegisterCommand("shine", args => {
return $"Shines: {string.Join(", ", shineBag)}"; return $"Shines: {string.Join(", ", shineBag)}";
case "clear" when args.Length == 1: case "clear" when args.Length == 1:
shineBag.Clear(); shineBag.Clear();
Task.Run(async () => {
await PersistShines();
});
foreach (ConcurrentBag<int> playerBag in server.Clients.Select(serverClient => foreach (ConcurrentBag<int> playerBag in server.Clients.Select(serverClient =>
(ConcurrentBag<int>)serverClient.Metadata["shineSync"]!)) playerBag?.Clear(); (ConcurrentBag<int>)serverClient.Metadata["shineSync"]!)) playerBag?.Clear();