Don't throw on player spawn for playtime failure (#24148)

Still gets logged but won't abort the entire startup process.

(cherry picked from commit 3b7679f9c94371528aa2f7fc7f9ac8bc6e66eb38)
This commit is contained in:
metalgearsloth 2024-01-16 09:01:41 +01:00 committed by Debug
parent 48ad5ea014
commit 0d64e2878d
No known key found for this signature in database
GPG Key ID: 271270A74EF9C350
1 changed files with 12 additions and 3 deletions

View File

@ -165,7 +165,11 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
!_cfg.GetCVar(CCVars.GameRoleTimers))
return true;
var playTimes = _tracking.GetTrackerTimes(player);
if (!_tracking.TryGetTrackerTimes(player, out var playTimes))
{
Log.Error($"Unable to check playtimes {Environment.StackTrace}");
playTimes = new Dictionary<string, TimeSpan>();
}
var isWhitelisted = player.ContentData()?.Whitelisted ?? false; // DeltaV - Whitelist requirement
@ -178,7 +182,12 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
if (!_cfg.GetCVar(CCVars.GameRoleTimers))
return roles;
var playTimes = _tracking.GetTrackerTimes(player);
if (!_tracking.TryGetTrackerTimes(player, out var playTimes))
{
Log.Error($"Unable to check playtimes {Environment.StackTrace}");
playTimes = new Dictionary<string, TimeSpan>();
}
var isWhitelisted = player.ContentData()?.Whitelisted ?? false; // DeltaV - Whitelist requirement
foreach (var job in _prototypes.EnumeratePrototypes<JobPrototype>())
@ -206,7 +215,7 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
if (!_cfg.GetCVar(CCVars.GameRoleTimers))
return;
var player = _playerManager.GetSessionByUserId(userId);
var player = _playerManager.GetSessionById(userId);
if (!_tracking.TryGetTrackerTimes(player, out var playTimes))
{
// Sorry mate but your playtimes haven't loaded.