Skip to content

Commit

Permalink
I fixed it!
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepyyapril committed Dec 25, 2024
1 parent 197b065 commit 670feb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions Content.Server/Database/UserDbDataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ private async Task Load(ICommonSession session, CancellationToken cancel)
// As such, this task must NOT throw a non-cancellation error!
try
{
await Task.WhenAll(
_prefs.LoadData(session, cancel),
_playTimeTracking.LoadData(session, cancel));
var tasks = new List<Task>();
foreach (var action in _onLoadPlayer)
tasks.Add(action(session, cancel));

await Task.WhenAll(tasks);
cancel.ThrowIfCancellationRequested();
_prefs.SanitizeData(session);

foreach (var action in _onFinishLoad)
action(session);
_prefs.SanitizeData(session);
_sawmill.Verbose($"Load complete for user {session}");
}
catch (OperationCanceledException)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private async void HandleSelectCharacterMessage(MsgSelectCharacter message)

if (!_cachedPlayerPrefs.TryGetValue(userId, out var prefsData) || !prefsData.PrefsLoaded)
{
Logger.WarningS("prefs", $"User {userId} tried to modify preferences before they loaded.");
_sawmill.Error($"User {userId} tried to modify preferences before they loaded.");
return;
}

Expand Down Expand Up @@ -231,6 +231,7 @@ public void SanitizeData(ICommonSession session)
var data = _cachedPlayerPrefs[session.UserId];
DebugTools.Assert(data.Prefs != null);
data.Prefs = SanitizePreferences(session, data.Prefs, _dependencies);
_sawmill.Debug("here");
}

public void OnClientDisconnected(ICommonSession session)
Expand Down

0 comments on commit 670feb4

Please sign in to comment.