mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 02:52:02 -08:00
refactor: improved and reorganized client-server api, added additional logs, fixed miss admin checks for some commands
This commit is contained in:
parent
e43e918c67
commit
75958e3710
21 changed files with 371 additions and 364 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.interfaces;
|
||||
|
||||
import mage.MageException;
|
||||
|
|
@ -20,99 +19,99 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Network: server side commands to process from a client
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
* @author BetaSteward_at_googlemail.com, JayDi85
|
||||
*/
|
||||
public interface MageServer {
|
||||
|
||||
// registers a user to the user DB.
|
||||
boolean registerUser(String sessionId, String userName, String password, String email) throws MageException;
|
||||
boolean authRegister(String sessionId, String userName, String password, String email) throws MageException;
|
||||
|
||||
boolean emailAuthToken(String sessionId, String email) throws MageException;
|
||||
boolean authSendTokenToEmail(String sessionId, String email) throws MageException;
|
||||
|
||||
boolean resetPassword(String sessionId, String email, String authToken, String password) throws MageException;
|
||||
boolean authResetPassword(String sessionId, String email, String authToken, String password) throws MageException;
|
||||
|
||||
boolean connectUser(String userName, String password, String sessionId, MageVersion version, String userIdStr) throws MageException;
|
||||
|
||||
boolean connectAdmin(String password, String sessionId, MageVersion version) throws MageException;
|
||||
|
||||
// update methods
|
||||
List<ExpansionInfo> getMissingExpansionData(List<String> codes);
|
||||
boolean connectSetUserData(String userName, String sessionId, UserData userData, String clientVersion, String userIdStr) throws MageException;
|
||||
|
||||
List<CardInfo> getMissingCardsData(List<String> classNames);
|
||||
boolean ping(String sessionId, String pingInfo) throws MageException;
|
||||
|
||||
void serverAddFeedbackMessage(String sessionId, String username, String title, String type, String message, String email) throws MageException;
|
||||
|
||||
// user methods
|
||||
boolean setUserData(String userName, String sessionId, UserData userData, String clientVersion, String userIdStr) throws MageException;
|
||||
Object serverGetPromotionMessages(String sessionId) throws MageException;
|
||||
|
||||
void sendFeedbackMessage(String sessionId, String username, String title, String type, String message, String email) throws MageException;
|
||||
// sync cards send sets db
|
||||
// TODO: outdated, no more client/server sync, can be removed?
|
||||
List<ExpansionInfo> syncGetMissingExpansionData(List<String> codes);
|
||||
List<CardInfo> syncGetMissingCardsData(List<String> classNames);
|
||||
|
||||
// server state methods
|
||||
ServerState getServerState() throws MageException;
|
||||
ServerState serverGetState() throws MageException;
|
||||
|
||||
List<RoomUsersView> getRoomUsers(UUID roomId) throws MageException;
|
||||
UUID serverGetMainRoomId() throws MageException;
|
||||
|
||||
List<MatchView> getFinishedMatches(UUID roomId) throws MageException;
|
||||
List<RoomUsersView> roomGetUsers(UUID roomId) throws MageException;
|
||||
|
||||
Object getServerMessagesCompressed(String sessionId) throws MageException; // messages of the day
|
||||
List<MatchView> roomGetFinishedMatches(UUID roomId) throws MageException;
|
||||
|
||||
// ping - extends session
|
||||
boolean ping(String sessionId, String pingInfo) throws MageException;
|
||||
TableView roomCreateTable(String sessionId, UUID roomId, MatchOptions matchOptions) throws MageException;
|
||||
|
||||
//table methods
|
||||
TableView createTable(String sessionId, UUID roomId, MatchOptions matchOptions) throws MageException;
|
||||
TableView roomCreateTournament(String sessionId, UUID roomId, TournamentOptions tournamentOptions) throws MageException;
|
||||
|
||||
TableView createTournamentTable(String sessionId, UUID roomId, TournamentOptions tournamentOptions) throws MageException;
|
||||
boolean roomJoinTable(String sessionId, UUID roomId, UUID tableId, String name, PlayerType playerType, int skill, DeckCardLists deckList, String password) throws MageException, GameException;
|
||||
|
||||
boolean joinTable(String sessionId, UUID roomId, UUID tableId, String name, PlayerType playerType, int skill, DeckCardLists deckList, String password) throws MageException, GameException;
|
||||
boolean roomJoinTournament(String sessionId, UUID roomId, UUID tableId, String name, PlayerType playerType, int skill, DeckCardLists deckList, String password) throws MageException, GameException;
|
||||
|
||||
boolean joinTournamentTable(String sessionId, UUID roomId, UUID tableId, String name, PlayerType playerType, int skill, DeckCardLists deckList, String password) throws MageException, GameException;
|
||||
boolean deckSubmit(String sessionId, UUID tableId, DeckCardLists deckList) throws MageException, GameException;
|
||||
|
||||
boolean submitDeck(String sessionId, UUID tableId, DeckCardLists deckList) throws MageException, GameException;
|
||||
void deckSave(String sessionId, UUID tableId, DeckCardLists deckList) throws MageException, GameException;
|
||||
|
||||
void updateDeck(String sessionId, UUID tableId, DeckCardLists deckList) throws MageException, GameException;
|
||||
boolean roomWatchTable(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
|
||||
boolean watchTable(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
boolean roomWatchTournament(String sessionId, UUID tableId) throws MageException;
|
||||
|
||||
boolean watchTournamentTable(String sessionId, UUID tableId) throws MageException;
|
||||
boolean roomLeaveTableOrTournament(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
|
||||
boolean leaveTable(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
void tableSwapSeats(String sessionId, UUID roomId, UUID tableId, int seatNum1, int seatNum2) throws MageException;
|
||||
|
||||
void swapSeats(String sessionId, UUID roomId, UUID tableId, int seatNum1, int seatNum2) throws MageException;
|
||||
void tableRemove(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
|
||||
void removeTable(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
boolean tableIsOwner(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
|
||||
boolean isTableOwner(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
TableView roomGetTableById(UUID roomId, UUID tableId) throws MageException;
|
||||
|
||||
TableView getTable(UUID roomId, UUID tableId) throws MageException;
|
||||
List<TableView> roomGetAllTables(UUID roomId) throws MageException;
|
||||
|
||||
List<TableView> getTables(UUID roomId) throws MageException;
|
||||
void chatSendMessage(UUID chatId, String userName, String message) throws MageException;
|
||||
|
||||
//chat methods
|
||||
void sendChatMessage(UUID chatId, String userName, String message) throws MageException;
|
||||
void chatJoin(UUID chatId, String sessionId, String userName) throws MageException;
|
||||
|
||||
void joinChat(UUID chatId, String sessionId, String userName) throws MageException;
|
||||
void chatLeave(UUID chatId, String sessionId) throws MageException;
|
||||
|
||||
void leaveChat(UUID chatId, String sessionId) throws MageException;
|
||||
UUID chatFindByGame(UUID gameId) throws MageException;
|
||||
|
||||
UUID getTableChatId(UUID tableId) throws MageException;
|
||||
UUID chatFindByTable(UUID tableId) throws MageException;
|
||||
|
||||
UUID getGameChatId(UUID gameId) throws MageException;
|
||||
UUID chatFindByTournament(UUID tournamentId) throws MageException;
|
||||
|
||||
UUID getRoomChatId(UUID roomId) throws MageException;
|
||||
UUID chatFindByRoom(UUID roomId) throws MageException;
|
||||
|
||||
UUID getTournamentChatId(UUID tournamentId) throws MageException;
|
||||
boolean matchStart(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
|
||||
//room methods
|
||||
UUID getMainRoomId() throws MageException;
|
||||
void matchQuit(UUID gameId, String sessionId) throws MageException;
|
||||
|
||||
//game methods
|
||||
boolean startMatch(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
void gameJoin(UUID gameId, String sessionId) throws MageException;
|
||||
|
||||
void joinGame(UUID gameId, String sessionId) throws MageException;
|
||||
@Deprecated // TODO: implement GameView request on miss client side data, e.g. on reconnect (empty player panels bug)?
|
||||
GameView gameGetView(UUID gameId, String sessionId, UUID playerId) throws MageException;
|
||||
|
||||
boolean watchGame(UUID gameId, String sessionId) throws MageException;
|
||||
boolean gameWatchStart(UUID gameId, String sessionId) throws MageException;
|
||||
|
||||
void stopWatching(UUID gameId, String sessionId) throws MageException;
|
||||
void gameWatchStop(UUID gameId, String sessionId) throws MageException;
|
||||
|
||||
void sendPlayerUUID(UUID gameId, String sessionId, UUID data) throws MageException;
|
||||
|
||||
|
|
@ -124,69 +123,58 @@ public interface MageServer {
|
|||
|
||||
void sendPlayerManaType(UUID gameId, UUID playerId, String sessionId, ManaType data) throws MageException;
|
||||
|
||||
void quitMatch(UUID gameId, String sessionId) throws MageException;
|
||||
|
||||
GameView getGameView(UUID gameId, String sessionId, UUID playerId) throws MageException;
|
||||
|
||||
// priority, undo, concede, mana pool
|
||||
void sendPlayerAction(PlayerAction playerAction, UUID gameId, String sessionId, Object data) throws MageException;
|
||||
|
||||
//tournament methods
|
||||
boolean startTournament(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
DraftPickView sendDraftCardPick(UUID draftId, String sessionId, UUID cardId, Set<UUID> hiddenCards) throws MageException;
|
||||
|
||||
void joinTournament(UUID draftId, String sessionId) throws MageException;
|
||||
void sendDraftCardMark(UUID draftId, String sessionId, UUID cardId) throws MageException;
|
||||
|
||||
void quitTournament(UUID tournamentId, String sessionId) throws MageException;
|
||||
boolean tournamentStart(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
|
||||
TournamentView getTournament(UUID tournamentId) throws MageException;
|
||||
void tournamentJoin(UUID draftId, String sessionId) throws MageException;
|
||||
|
||||
//draft methods
|
||||
void joinDraft(UUID draftId, String sessionId) throws MageException;
|
||||
void tournamentQuit(UUID tournamentId, String sessionId) throws MageException;
|
||||
|
||||
void quitDraft(UUID draftId, String sessionId) throws MageException;
|
||||
TournamentView tournamentFindById(UUID tournamentId) throws MageException;
|
||||
|
||||
DraftPickView sendCardPick(UUID draftId, String sessionId, UUID cardId, Set<UUID> hiddenCards) throws MageException;
|
||||
void draftJoin(UUID draftId, String sessionId) throws MageException;
|
||||
|
||||
void sendCardMark(UUID draftId, String sessionId, UUID cardId) throws MageException;
|
||||
void draftQuit(UUID draftId, String sessionId) throws MageException;
|
||||
|
||||
void setBoosterLoaded(UUID draftId, String sessionId) throws MageException;
|
||||
void draftSetBoosterLoaded(UUID draftId, String sessionId) throws MageException;
|
||||
|
||||
//challenge methods
|
||||
// void startChallenge(String sessionId, UUID roomId, UUID tableId, UUID challengeId) throws MageException;
|
||||
//replay methods
|
||||
void replayGame(UUID gameId, String sessionId) throws MageException;
|
||||
void replayInit(UUID gameId, String sessionId) throws MageException;
|
||||
|
||||
void startReplay(UUID gameId, String sessionId) throws MageException;
|
||||
void replayStart(UUID gameId, String sessionId) throws MageException;
|
||||
|
||||
void stopReplay(UUID gameId, String sessionId) throws MageException;
|
||||
void replayStop(UUID gameId, String sessionId) throws MageException;
|
||||
|
||||
void nextPlay(UUID gameId, String sessionId) throws MageException;
|
||||
void replayNext(UUID gameId, String sessionId) throws MageException;
|
||||
|
||||
void previousPlay(UUID gameId, String sessionId) throws MageException;
|
||||
void replayPrevious(UUID gameId, String sessionId) throws MageException;
|
||||
|
||||
void skipForward(UUID gameId, String sessionId, int moves) throws MageException;
|
||||
void replaySkipForward(UUID gameId, String sessionId, int moves) throws MageException;
|
||||
|
||||
//test methods
|
||||
void cheat(UUID gameId, String sessionId, UUID playerId, DeckCardLists deckList) throws MageException;
|
||||
void cheatMultiple(UUID gameId, String sessionId, UUID playerId, DeckCardLists deckList) throws MageException;
|
||||
|
||||
boolean cheat(UUID gameId, String sessionId, UUID playerId, String cardName) throws MageException;
|
||||
boolean cheatOne(UUID gameId, String sessionId, UUID playerId, String cardName) throws MageException;
|
||||
|
||||
//admin methods
|
||||
List<UserView> getUsers(String sessionId) throws MageException;
|
||||
List<UserView> adminGetUsers(String sessionId) throws MageException;
|
||||
|
||||
void disconnectUser(String sessionId, String userSessionId) throws MageException;
|
||||
void adminDisconnectUser(String sessionId, String userSessionId) throws MageException;
|
||||
|
||||
void endUserSession(String sessionId, String userSessionId) throws MageException;
|
||||
void adminEndUserSession(String sessionId, String userSessionId) throws MageException;
|
||||
|
||||
void muteUser(String sessionId, String userName, long durationMinutes) throws MageException;
|
||||
void adminMuteUser(String sessionId, String userName, long durationMinutes) throws MageException;
|
||||
|
||||
void lockUser(String sessionId, String userName, long durationMinutes) throws MageException;
|
||||
void adminLockUser(String sessionId, String userName, long durationMinutes) throws MageException;
|
||||
|
||||
void setActivation(String sessionId, String userName, boolean active) throws MageException;
|
||||
void adminActivateUser(String sessionId, String userName, boolean active) throws MageException;
|
||||
|
||||
void toggleActivation(String sessionId, String userName) throws MageException;
|
||||
void adminToggleActivateUser(String sessionId, String userName) throws MageException;
|
||||
|
||||
void removeTable(String sessionId, UUID tableId) throws MageException;
|
||||
void adminTableRemove(String sessionId, UUID tableId) throws MageException;
|
||||
|
||||
void sendBroadcastMessage(String sessionId, String message) throws MageException;
|
||||
void adminSendBroadcastMessage(String sessionId, String message) throws MageException;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue