Fix playtime on player tab getting set to Unknown (#28876)
Update play time on admin panel player tab after db loads
This commit is contained in:
@@ -4,7 +4,6 @@ using Content.Server.Chat.Managers;
|
|||||||
using Content.Server.Forensics;
|
using Content.Server.Forensics;
|
||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.Hands.Systems;
|
using Content.Server.Hands.Systems;
|
||||||
using Content.Server.IdentityManagement;
|
|
||||||
using Content.Server.Mind;
|
using Content.Server.Mind;
|
||||||
using Content.Server.Players.PlayTimeTracking;
|
using Content.Server.Players.PlayTimeTracking;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
@@ -70,6 +69,7 @@ namespace Content.Server.Administration.Systems
|
|||||||
|
|
||||||
_playerManager.PlayerStatusChanged += OnPlayerStatusChanged;
|
_playerManager.PlayerStatusChanged += OnPlayerStatusChanged;
|
||||||
_adminManager.OnPermsChanged += OnAdminPermsChanged;
|
_adminManager.OnPermsChanged += OnAdminPermsChanged;
|
||||||
|
_playTime.SessionPlayTimeUpdated += OnSessionPlayTimeUpdated;
|
||||||
|
|
||||||
// Panic Bunker Settings
|
// Panic Bunker Settings
|
||||||
Subs.CVar(_config, CCVars.PanicBunkerEnabled, OnPanicBunkerChanged, true);
|
Subs.CVar(_config, CCVars.PanicBunkerEnabled, OnPanicBunkerChanged, true);
|
||||||
@@ -200,6 +200,7 @@ namespace Content.Server.Administration.Systems
|
|||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
_playerManager.PlayerStatusChanged -= OnPlayerStatusChanged;
|
_playerManager.PlayerStatusChanged -= OnPlayerStatusChanged;
|
||||||
_adminManager.OnPermsChanged -= OnAdminPermsChanged;
|
_adminManager.OnPermsChanged -= OnAdminPermsChanged;
|
||||||
|
_playTime.SessionPlayTimeUpdated -= OnSessionPlayTimeUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs e)
|
private void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs e)
|
||||||
@@ -446,5 +447,10 @@ namespace Content.Server.Administration.Systems
|
|||||||
|
|
||||||
_gameTicker.SpawnObserver(player);
|
_gameTicker.SpawnObserver(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnSessionPlayTimeUpdated(ICommonSession session)
|
||||||
|
{
|
||||||
|
UpdatePlayerList(session);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ public sealed class PlayTimeTrackingManager : ISharedPlaytimeManager, IPostInjec
|
|||||||
|
|
||||||
public event CalcPlayTimeTrackersCallback? CalcTrackers;
|
public event CalcPlayTimeTrackersCallback? CalcTrackers;
|
||||||
|
|
||||||
|
public event Action<ICommonSession>? SessionPlayTimeUpdated;
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
_sawmill = Logger.GetSawmill("play_time");
|
_sawmill = Logger.GetSawmill("play_time");
|
||||||
@@ -217,6 +219,7 @@ public sealed class PlayTimeTrackingManager : ISharedPlaytimeManager, IPostInjec
|
|||||||
};
|
};
|
||||||
|
|
||||||
_net.ServerSendMessage(msg, pSession.Channel);
|
_net.ServerSendMessage(msg, pSession.Channel);
|
||||||
|
SessionPlayTimeUpdated?.Invoke(pSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user