foul-magics/Mage.Server/src/main/java/mage/server/managers/TableManager.java
Oleg Agafonov 960e896903
Network upgrade and new reconnection mode (#11527)
Network upgrade and new reconnection mode:
* users can disconnect or close app without game progress loose now;
* disconnect dialog will show active tables stats and additional options;
* all active tables will be restored on reconnect (tables, tourneys, games, drafts, sideboarding, constructing);
* user must use same server and username on next connection;
* there are few minutes for reconnect until server kick off a disconnected player from all player's tables (concede/loose);
* now you can safety reconnect after IP change (after proxy/vpn/wifi/router restart);

Other improvements and fixes:
* gui: main menu - improved switch panel button, added stats about current tables/panels;
* gui: improved data sync and updates (fixes many use cases with empty battlefield, not started games/drafts/tourneys, not updatable drafts, etc);
* gui: improved stability on game updates (fixes some random errors related to wrong threads);
* server: fixed miss messages about player's disconnection problems for other players in the chat;
* refactor: simplified and improved connection and network related code, deleted outdated code, added docs;
* tests: improved load test to support lands only set for more stable performance/network testing (set TEST_AI_RANDOM_DECK_SETS = PELP and run test_TwoAIPlayGame_Multiple);
2023-12-07 20:56:52 +04:00

88 lines
2.7 KiB
Java

package mage.server.managers;
import mage.MageException;
import mage.cards.decks.DeckCardLists;
import mage.game.GameException;
import mage.game.Table;
import mage.game.draft.Draft;
import mage.game.match.Match;
import mage.game.match.MatchOptions;
import mage.game.tournament.Tournament;
import mage.game.tournament.TournamentOptions;
import mage.game.tournament.TournamentPlayer;
import mage.players.PlayerType;
import mage.server.TableController;
import java.util.Collection;
import java.util.Optional;
import java.util.UUID;
public interface TableManager {
Table createTable(UUID roomId, UUID userId, MatchOptions options);
Table createTable(UUID roomId, MatchOptions options);
Table createTournamentTable(UUID roomId, UUID userId, TournamentOptions options);
Table getTable(UUID tableId);
Optional<Match> getMatch(UUID tableId);
Collection<Table> getTables();
Collection<TableController> getControllers();
Optional<TableController> getController(UUID tableId);
boolean joinTable(UUID userId, UUID tableId, String name, PlayerType playerType, int skill, DeckCardLists deckList, String password) throws MageException;
boolean joinTournament(UUID userId, UUID tableId, String name, PlayerType playerType, int skill, DeckCardLists deckList, String password) throws GameException;
boolean submitDeck(UUID userId, UUID tableId, DeckCardLists deckList) throws MageException;
void updateDeck(UUID userId, UUID tableId, DeckCardLists deckList) throws MageException;
// removeUserFromAllTablesAndChat user from all tournament sub tables
void userQuitTournamentSubTables(UUID userId);
// removeUserFromAllTablesAndChat user from all sub tables of a tournament
void userQuitTournamentSubTables(UUID tournamentId, UUID userId);
boolean isTableOwner(UUID tableId, UUID userId);
boolean removeTable(UUID userId, UUID tableId);
void leaveTable(UUID userId, UUID tableId);
Optional<UUID> getChatId(UUID tableId);
void startMatch(UUID userId, UUID roomId, UUID tableId);
void startTournamentSubMatch(UUID roomId, UUID tableId);
void startTournament(UUID userId, UUID roomId, UUID tableId);
void startDraft(UUID tableId, Draft draft);
boolean watchTable(UUID userId, UUID tableId);
void endGame(UUID tableId);
void endDraft(UUID tableId, Draft draft);
void endTournament(UUID tableId, Tournament tournament);
void swapSeats(UUID tableId, UUID userId, int seatNum1, int seatNum2);
void construct(UUID tableId);
void initTournament(UUID tableId);
void addPlayer(UUID userId, UUID tableId, TournamentPlayer player) throws GameException;
void removeTable(UUID tableId);
void debugServerState();
void checkHealth();
}