Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion apps/player-management-css/src/PlayerManagementPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
});

RegisterListener<Listeners.OnMapEnd>(() => _roster.MapEnded(DateTimeOffset.UtcNow));
RegisterListener<Listeners.OnMapStart>(_ => _roster.MapStarted(DateTimeOffset.UtcNow));
RegisterListener<Listeners.OnMapStart>(map =>
_roster.MapStarted(DateTimeOffset.UtcNow, map)
);

RegisterListener<Listeners.OnServerHibernationUpdate>(hibernating =>
{
Expand Down Expand Up @@ -144,6 +146,20 @@
Logger.LogDebug(error, "unable to read the players present on load");
}

// A hot reload has missed the map's load, and a cold boot has no map to
// ask about yet: it arrives with OnMapStart.
if (hotReload)
{
try
{
_roster.MapIs(Server.MapName);
}
catch (Exception error)
{
Logger.LogDebug(error, "unable to read the map on load");
}
}

_loop.Start();

// Queued onto a world update by a thread timer: an empty server
Expand Down Expand Up @@ -426,7 +442,7 @@
{
try
{
return ConVar.Find("mp_teammates_are_enemies")?.GetPrimitiveValue<bool>() ?? false;

Check warning on line 445 in apps/player-management-css/src/PlayerManagementPlugin.cs

View workflow job for this annotation

GitHub Actions / player-management-build (player-management-css)

'ConVar' is obsolete: 'Use ConVar<T> instead for type-safe access to ConVars.'

Check warning on line 445 in apps/player-management-css/src/PlayerManagementPlugin.cs

View workflow job for this annotation

GitHub Actions / player-management-build (player-management-css)

'ConVar' is obsolete: 'Use ConVar<T> instead for type-safe access to ConVars.'
}
catch (Exception)
{
Expand Down
16 changes: 15 additions & 1 deletion apps/player-management-sw/src/PlayerManagementPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public override void Load(bool hotReload)
_mapUnloadHandler = _ => _roster.MapEnded(DateTimeOffset.UtcNow);
Core.Event.OnMapUnload += _mapUnloadHandler;

_mapLoadHandler = _ => _roster.MapStarted(DateTimeOffset.UtcNow);
_mapLoadHandler = @event => _roster.MapStarted(DateTimeOffset.UtcNow, @event.MapName);
Core.Event.OnMapLoad += _mapLoadHandler;

_worldUpdateHandler = OnWorldUpdate;
Expand Down Expand Up @@ -174,6 +174,20 @@ public override void Load(bool hotReload)
_logger.LogDebug(error, "unable to read the players present on load");
}

// A hot reload has missed the map's load, and a cold boot has no map to
// ask about yet: it arrives with OnMapLoad.
if (hotReload)
{
try
{
_roster.MapIs(Core.Engine.GlobalVars.MapName.ToString());
}
catch (Exception error)
{
_logger.LogDebug(error, "unable to read the map on load");
}
}

_loop.Start();
}

Expand Down
Loading
Loading