Skip to content

Commit

Permalink
move clear task
Browse files Browse the repository at this point in the history
  • Loading branch information
luludotdev authored and Sanae6 committed Sep 6, 2022
1 parent 24a34c3 commit e146160
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ async void SyncShineBag() {
c.Metadata["speedrun"] = true;
((ConcurrentBag<int>) (c.Metadata["shineSync"] ??= new ConcurrentBag<int>())).Clear();
shineBag.Clear();
Task.Run(async () => {
await PersistShines();
});
c.Logger.Info("Entered Cap on new save, preventing moon sync until Cascade");
break;
case "WaterfallWorldHomeStage":
Expand Down Expand Up @@ -573,6 +570,10 @@ await server.Broadcast(new TagPacket {
return $"Shines: {string.Join(", ", shineBag)}";
case "clear" when args.Length == 1:
shineBag.Clear();
Task.Run(async () => {
await PersistShines();
});

foreach (ConcurrentBag<int> playerBag in server.Clients.Select(serverClient =>
(ConcurrentBag<int>)serverClient.Metadata["shineSync"]!)) playerBag?.Clear();

Expand Down

0 comments on commit e146160

Please sign in to comment.