Remove offline players from rooms

This commit is contained in:
jvyden 2022-02-17 12:36:53 -05:00
commit fcdbd46c98
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -7,6 +7,7 @@ using LBPUnion.ProjectLighthouse.Logging;
using LBPUnion.ProjectLighthouse.Types;
using LBPUnion.ProjectLighthouse.Types.Levels;
using LBPUnion.ProjectLighthouse.Types.Match;
using LBPUnion.ProjectLighthouse.Types.Profiles;
namespace LBPUnion.ProjectLighthouse.Helpers;
@ -166,6 +167,15 @@ public class RoomHelper
{
lock(Rooms)
{
// Remove offline players from rooms
foreach (Room room in Rooms)
{
foreach (User player in room.Players.Where(player => player.Status.StatusType == StatusType.Offline))
{
room.Players.Remove(player);
}
}
// Delete old rooms based on host
if (host != null)
try