Skip to content

Commit

Permalink
Send match_ready to server immediatley on match_found (#1783)
Browse files Browse the repository at this point in the history
  • Loading branch information
Katharsas committed Aug 11, 2021
1 parent bba6b50 commit e7a40dc
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public interface FafServerAccessor {

void gameMatchmaking(MatchmakingQueue queue, MatchmakingState state);

void gameMatchmakingReady();

void inviteToParty(Player recipient);

void acceptPartyInvite(Player sender);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import com.faforever.client.remote.domain.outbound.faf.ListPersonalAvatarsMessage;
import com.faforever.client.remote.domain.outbound.faf.LoginOauthClientMessage;
import com.faforever.client.remote.domain.outbound.faf.MakeBroadcastMessage;
import com.faforever.client.remote.domain.outbound.faf.MatchReadyMessage;
import com.faforever.client.remote.domain.outbound.faf.MatchmakerInfoOutboundMessage;
import com.faforever.client.remote.domain.outbound.faf.PingMessage;
import com.faforever.client.remote.domain.outbound.faf.PongMessage;
Expand Down Expand Up @@ -558,6 +559,9 @@ public void gameMatchmaking(MatchmakingQueue queue, MatchmakingState state) {
writeToServer(new GameMatchmakingMessage(queue.getTechnicalName(), state));
}

@Override
public void gameMatchmakingReady() { writeToServer(new MatchReadyMessage()); }

@Override
public void inviteToParty(Player recipient) {
writeToServer(new InviteToPartyMessage(recipient.getId()));
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/faforever/client/remote/FafService.java
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,8 @@ public void updateMatchmakerState(MatchmakingQueue queue, MatchmakingState state
fafServerAccessor.gameMatchmaking(queue, state);
}

public void readyForMatchLaunch() { fafServerAccessor.gameMatchmakingReady(); }

@Async
public CompletableFuture<Optional<Clan>> getClanByTag(String tag) {
return CompletableFuture.completedFuture(fafApiAccessor.getClanByTag(tag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ public void gameMatchmaking(MatchmakingQueue queue, MatchmakingState state) {

}

@Override
public void gameMatchmakingReady() {

}

@Override
public void inviteToParty(com.faforever.client.player.Player recipient) {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.faforever.client.remote.domain.inbound.faf;

public class MatchInfoMessage {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.faforever.client.remote.domain.outbound.faf;


public class MatchReadyMessage extends FafOutboundMessage {
public static final String COMMAND = "match_ready";
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ protected void onMatchFoundMessage(MatchFoundMessage message) {
i18n.get("teammatchmaking.notification.matchFound.title"),
i18n.get("teammatchmaking.notification.matchFound.message")
));
fafService.readyForMatchLaunch(); // remove when implementing full match ready UI

matchmakingQueues.stream()
.filter(matchmakingQueue -> Objects.equals(matchmakingQueue.getTechnicalName(), message.getQueueName()))
.forEach(matchmakingQueue -> matchmakingQueue.setTimedOutMatchingStatus(MatchingStatus.MATCH_FOUND, Duration.ofSeconds(60), taskScheduler));
Expand Down

0 comments on commit e7a40dc

Please sign in to comment.