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 3b7679f9c9)
This commit is contained in:
metalgearsloth
2024-01-26 22:56:29 +01:00
committed by Debug
parent 48ad5ea014
commit 0d64e2878d
@@ -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.