File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,9 @@ public static LootLockerPlayerData GetStateForPlayerOrDefaultStateOrEmpty(string
195195 }
196196 string playerULIDToGetDataFor = string . IsNullOrEmpty ( playerULID ) ? ActiveMetaData . DefaultPlayer : playerULID ;
197197
198+ // Make this player the default for requests if there is no default yet or if the current default is not currently active
199+ bool shouldBeMadeDefault = ! playerULID . Equals ( ActiveMetaData . DefaultPlayer , StringComparison . OrdinalIgnoreCase ) && ActivePlayerData . Count == 0 ;
200+
198201 if ( ActivePlayerData . TryGetValue ( playerULIDToGetDataFor , out var data ) )
199202 {
200203 return data ;
@@ -204,6 +207,10 @@ public static LootLockerPlayerData GetStateForPlayerOrDefaultStateOrEmpty(string
204207 {
205208 if ( ActivePlayerData . TryGetValue ( playerULIDToGetDataFor , out var data2 ) )
206209 {
210+ if ( shouldBeMadeDefault )
211+ {
212+ SetDefaultPlayerULID ( data2 . ULID ) ;
213+ }
207214 return data2 ;
208215 }
209216 }
@@ -264,7 +271,7 @@ public static bool SetPlayerData(LootLockerPlayerData updatedPlayerData)
264271 {
265272 ActiveMetaData . WhiteLabelEmailToPlayerUlidMap [ updatedPlayerData . WhiteLabelEmail ] = updatedPlayerData . ULID ;
266273 }
267- if ( string . IsNullOrEmpty ( ActiveMetaData . DefaultPlayer ) )
274+ if ( string . IsNullOrEmpty ( ActiveMetaData . DefaultPlayer ) || ! ActivePlayerData . ContainsKey ( ActiveMetaData . DefaultPlayer ) )
268275 {
269276 SetDefaultPlayerULID ( updatedPlayerData . ULID ) ;
270277 }
You can’t perform that action at this time.
0 commit comments