8484import java .time .Instant ;
8585import java .util .Collections ;
8686import java .util .List ;
87+ import java .util .Map ;
8788import java .util .Objects ;
8889import java .util .concurrent .CompletableFuture ;
8990import java .util .concurrent .atomic .AtomicBoolean ;
@@ -245,7 +246,7 @@ public void afterPropertiesSet() throws Exception {
245246 }
246247 });
247248
248- matchmakerPrefs .getAppliedVetoes ().subscribe (()-> {
249+ matchmakerPrefs .getAppliedVetoes ().subscribe (() -> {
249250 if (fafServerAccessor .getConnectionState () == ConnectionState .CONNECTED ) {
250251 sendVetoes ();
251252 }
@@ -279,22 +280,22 @@ public void setTokensForMap(VetoKey vetoKey, Integer vetoTokensApplied) {
279280 }
280281
281282 public void setAllVetoes (List <VetoData > vetoes ) {
282- matchmakerPrefs .getAppliedVetoes ().clear ();
283- vetoes .forEach (v -> matchmakerPrefs .getAppliedVetoes ().put (
284- new VetoKey (v .getMatchmakerQueueMapPoolId (), v .getMapPoolMapVersionId ()),
285- v .getVetoTokensApplied ()
286- ));
283+ Map <VetoKey , Integer > vetosMap = vetoes .stream ()
284+ .collect (Collectors .toMap (
285+ vetoData -> new VetoKey (vetoData .getMatchmakerQueueMapPoolId (),
286+ vetoData .getMapPoolMapVersionId ()),
287+ VetoData ::getVetoTokensApplied ));
288+ matchmakerPrefs .getAppliedVetoes ().putAll (vetosMap );
287289 }
288290
289291 private void onVetoesChanged (VetoesChangedInfo vetoesChangedInfo ) {
290292 setAllVetoes (vetoesChangedInfo .getVetoes ());
291293
292294 if (vetoesChangedInfo .getForced ()) {
293- notificationService .addNotification (
294- new ImmediateNotification (i18n .get ("teammatchmaking.vetoes.forced.title" ),
295- i18n .get ("teammatchmaking.vetoes.forced.message" ),
296- Severity .INFO ,
297- Collections .singletonList (new DismissAction (i18n ))));
295+ notificationService .addNotification (new ImmediateNotification (i18n .get ("teammatchmaking.vetoes.forced.title" ),
296+ i18n .get ("teammatchmaking.vetoes.forced.message" ),
297+ Severity .INFO , Collections .singletonList (
298+ new DismissAction (i18n ))));
298299 }
299300 }
300301
@@ -303,10 +304,8 @@ private List<VetoData> getVetoesAsList() {
303304 .entrySet ()
304305 .stream ()
305306 .filter (entry -> entry .getValue () > 0 )
306- .map (entry -> new VetoData (
307- entry .getKey ().mapPoolMapVersionId (),
308- entry .getValue (),
309- entry .getKey ().matchmakerQueueMapPoolId ()))
307+ .map (entry -> new VetoData (entry .getKey ().mapPoolMapVersionId (), entry .getValue (),
308+ entry .getKey ().matchmakerQueueMapPoolId ()))
310309 .collect (Collectors .toList ());
311310 }
312311
@@ -435,8 +434,7 @@ private Mono<MatchmakerQueueInfo> getQueueFromApi(MatchmakerInfo.MatchmakerQueue
435434 .collection ()
436435 .setFilter (qBuilder ().string ("technicalName" )
437436 .eq (matchmakerQueue .getName ()));
438- return fafApiAccessor .getMany (navigator )
439- .next ().map (matchmakerMapper ::map )
437+ return fafApiAccessor .getMany (navigator ).next ().map (matchmakerMapper ::map )
440438 .map (queue -> matchmakerMapper .update (matchmakerQueue , queue ))
441439 .doOnNext (queue -> queue .setSelected (
442440 !matchmakerPrefs .getUnselectedQueueIds ().contains (queue .getId ())))
@@ -464,20 +462,21 @@ public CompletableFuture<Boolean> joinQueues() {
464462
465463 return featuredModService .updateFeaturedModToLatest (FAF .getTechnicalName (), false )
466464 .thenCompose (aVoid -> validQueues .stream ()
467- .map (this ::joinQueue )
468- .reduce ((future1 , future2 ) -> future1 .thenCombine (future2 ,
469- (result1 , result2 ) -> result1 || result2 ))
470- .orElse (CompletableFuture .completedFuture (false )))
465+ .map (this ::joinQueue )
466+ .reduce ((future1 , future2 ) -> future1 .thenCombine (future2 ,
467+ (result1 , result2 ) -> result1 || result2 ))
468+ .orElse (CompletableFuture .completedFuture (false )))
471469 .exceptionally (throwable -> {
472- throwable = ConcurrentUtil .unwrapIfCompletionException (throwable );
473- log .error ("Unable to join queues" , throwable );
474- if (throwable instanceof NotifiableException notifiableException ) {
475- notificationService .addErrorNotification (notifiableException );
476- } else {
477- notificationService .addImmediateErrorNotification (throwable , "teammatchmaking.couldNotStart" );
478- }
479- return false ;
480- });
470+ throwable = ConcurrentUtil .unwrapIfCompletionException (throwable );
471+ log .error ("Unable to join queues" , throwable );
472+ if (throwable instanceof NotifiableException notifiableException ) {
473+ notificationService .addErrorNotification (notifiableException );
474+ } else {
475+ notificationService .addImmediateErrorNotification (throwable ,
476+ "teammatchmaking.couldNotStart" );
477+ }
478+ return false ;
479+ });
481480 }
482481
483482 public void leaveQueues () {
0 commit comments