Compare commits
1 commit
a1a087338b
...
160dbff816
Author | SHA1 | Date | |
---|---|---|---|
160dbff816 |
1 changed files with 12 additions and 17 deletions
|
@ -12,18 +12,15 @@ public class MatchConfirmationService {
|
|||
|
||||
private final Map<Player, UnconfirmedMatch> unconfirmedMatch = new HashMap<>();
|
||||
|
||||
public UnconfirmedMatch createMatch
|
||||
(Player player1,
|
||||
Player player2,
|
||||
ConfirmationCallbacks player1Callbacks,
|
||||
ConfirmationCallbacks player2callbacks
|
||||
) {
|
||||
public UnconfirmedMatch createMatch(Player player1,
|
||||
Player player2,
|
||||
ConfirmationCallbacks player1Callbacks,
|
||||
ConfirmationCallbacks player2callbacks) {
|
||||
UnconfirmedMatch match = new UnconfirmedMatch(
|
||||
player1,
|
||||
player2,
|
||||
player1Callbacks,
|
||||
player2callbacks
|
||||
);
|
||||
player2callbacks);
|
||||
unconfirmedMatch.put(player1, match);
|
||||
unconfirmedMatch.put(player2, match);
|
||||
return match;
|
||||
|
@ -63,7 +60,7 @@ public class MatchConfirmationService {
|
|||
}
|
||||
|
||||
private void handleMatchConfirmation(UnconfirmedMatch match, UnconfirmedMatchState state) {
|
||||
if (state ==UnconfirmedMatchState.WAITING){
|
||||
if (state == UnconfirmedMatchState.WAITING) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -73,31 +70,29 @@ public class MatchConfirmationService {
|
|||
ConfirmationCallbacks player1Callbacks = match.getPlayer1Callbacks();
|
||||
ConfirmationCallbacks player2Callbacks = match.getPlayer2Callbacks();
|
||||
|
||||
switch (state){
|
||||
switch (state) {
|
||||
case ABORTED -> {
|
||||
if (match.getPlayer1State() == PlayerMatchConfirmState.CONFIRMED){
|
||||
if (match.getPlayer1State() == PlayerMatchConfirmState.CONFIRMED) {
|
||||
player1Callbacks.getRequeueCallback().call(
|
||||
match.getPlayer1(),
|
||||
match.getMatchId(),
|
||||
player1Callbacks.getFoundCallback(),
|
||||
player1Callbacks.getQueuedCallback(),
|
||||
player1Callbacks.getAbortCallback(),
|
||||
player1Callbacks.getEstablishedCallback()
|
||||
);
|
||||
player1Callbacks.getEstablishedCallback());
|
||||
}
|
||||
if (match.getPlayer1State() == PlayerMatchConfirmState.CONFIRMED){
|
||||
if (match.getPlayer2State() == PlayerMatchConfirmState.CONFIRMED) {
|
||||
player2Callbacks.getRequeueCallback().call(
|
||||
match.getPlayer2(),
|
||||
match.getMatchId(),
|
||||
player2Callbacks.getFoundCallback(),
|
||||
player2Callbacks.getQueuedCallback(),
|
||||
player2Callbacks.getAbortCallback(),
|
||||
player2Callbacks.getEstablishedCallback()
|
||||
);
|
||||
player2Callbacks.getEstablishedCallback());
|
||||
}
|
||||
}
|
||||
case CONFIRMED -> {
|
||||
//TODO: Create Match and Send Players the info that the Match is created
|
||||
// TODO: Create Match and Send Players the info that the Match is created
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue