server: fixed wrong cheater detection in some tourney sideboardings (closes #11877)

This commit is contained in:
Oleg Agafonov 2024-06-11 00:30:00 +04:00
parent 72cf60085c
commit e209ce1c97
17 changed files with 146 additions and 55 deletions

View file

@ -503,15 +503,18 @@ public class TableController {
}
private void updateDeck(UUID userId, UUID playerId, Deck deck) {
// strict mode - players can't add any lands while sideboarding in single game
// ignore mode - players can add any lands while construction/sideboarding in draft tourney
boolean ignoreMainBasicLands = table.isTournament() || table.isTournamentSubTable();
if (table.isTournament()) {
if (tournament != null) {
// TODO: is it possible to update from direct call command in game?!
managerFactory.tournamentManager().updateDeck(tournament.getId(), playerId, deck);
managerFactory.tournamentManager().updateDeck(tournament.getId(), playerId, deck, ignoreMainBasicLands);
} else {
logger.fatal("Tournament == null table: " + table.getId() + " userId: " + userId);
}
} else if (table.getState() == TableState.SIDEBOARDING) {
match.updateDeck(playerId, deck);
match.updateDeck(playerId, deck, ignoreMainBasicLands);
} else {
// deck was meanwhile submitted so the autoupdate can be ignored
// TODO: need research

View file

@ -22,7 +22,7 @@ public interface TournamentManager {
void submitDeck(UUID tournamentId, UUID playerId, Deck deck);
void updateDeck(UUID tournamentId, UUID playerId, Deck deck);
void updateDeck(UUID tournamentId, UUID playerId, Deck deck, boolean ignoreMainBasicLands);
TournamentView getTournamentView(UUID tournamentId);

View file

@ -326,13 +326,13 @@ public class TournamentController {
}
}
public void updateDeck(UUID playerId, Deck deck) {
public void updateDeck(UUID playerId, Deck deck, boolean ignoreMainBasicLands) {
TournamentSession session = tournamentSessions.getOrDefault(playerId, null);
if (session == null) {
return;
}
session.updateDeck(deck);
session.updateDeck(deck, ignoreMainBasicLands);
}
public void timeout(UUID userId) {

View file

@ -62,8 +62,8 @@ public class TournamentManagerImpl implements TournamentManager {
}
@Override
public void updateDeck(UUID tournamentId, UUID playerId, Deck deck) {
controllers.get(tournamentId).updateDeck(playerId, deck);
public void updateDeck(UUID tournamentId, UUID playerId, Deck deck, boolean ignoreMainBasicLands) {
controllers.get(tournamentId).updateDeck(playerId, deck, ignoreMainBasicLands);
}
@Override

View file

@ -83,8 +83,8 @@ public class TournamentSession {
tournament.submitDeck(playerId, deck);
}
public void updateDeck(Deck deck) {
tournament.updateDeck(playerId, deck);
public void updateDeck(Deck deck, boolean ignoreMainBasicLands) {
tournament.updateDeck(playerId, deck, ignoreMainBasicLands);
}
public void setKilled() {