mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-02 01:58:40 +00:00
Fix RoomHelper duplicate key errors
This commit is contained in:
parent
a2d2337dc3
commit
d18bad9f05
1 changed files with 11 additions and 10 deletions
|
@ -70,7 +70,7 @@ public class RoomHelper
|
||||||
{
|
{
|
||||||
bool gotValue = MatchHelper.UserLocations.TryGetValue(p, out string? value);
|
bool gotValue = MatchHelper.UserLocations.TryGetValue(p, out string? value);
|
||||||
|
|
||||||
if (gotValue && value != null) relevantUserLocations.Add(p, value);
|
if (gotValue && value != null) relevantUserLocations.TryAdd(p, value);
|
||||||
return gotValue;
|
return gotValue;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -80,11 +80,13 @@ public class RoomHelper
|
||||||
|
|
||||||
// If we got here then it should be a valid room.
|
// If we got here then it should be a valid room.
|
||||||
|
|
||||||
FindBestRoomResponse response = new();
|
FindBestRoomResponse response = new()
|
||||||
response.RoomId = room.RoomId;
|
{
|
||||||
|
RoomId = room.RoomId,
|
||||||
|
Players = new List<Player>(),
|
||||||
|
Locations = new List<string>(),
|
||||||
|
};
|
||||||
|
|
||||||
response.Players = new List<Player>();
|
|
||||||
response.Locations = new List<string>();
|
|
||||||
foreach (User player in room.GetPlayers(new DatabaseContext()))
|
foreach (User player in room.GetPlayers(new DatabaseContext()))
|
||||||
{
|
{
|
||||||
response.Players.Add
|
response.Players.Add
|
||||||
|
@ -125,11 +127,10 @@ public class RoomHelper
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user != null)
|
if (user == null) return null;
|
||||||
{
|
|
||||||
MatchHelper.ClearUserRecentDiveIns(user.UserId);
|
MatchHelper.ClearUserRecentDiveIns(user.UserId);
|
||||||
Logger.Info($"Cleared {user.Username} (id: {user.UserId})'s recent dive-ins", LogArea.Match);
|
Logger.Info($"Cleared {user.Username} (id: {user.UserId})'s recent dive-ins", LogArea.Match);
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue