mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
playertype, enum singleton
This commit is contained in:
parent
b19170f34f
commit
211d433ea9
50 changed files with 642 additions and 675 deletions
|
|
@ -27,10 +27,6 @@
|
|||
*/
|
||||
package mage.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageException;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.cards.repository.CardInfo;
|
||||
|
|
@ -40,15 +36,15 @@ import mage.constants.PlayerAction;
|
|||
import mage.game.GameException;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.game.tournament.TournamentOptions;
|
||||
import mage.players.PlayerType;
|
||||
import mage.players.net.UserData;
|
||||
import mage.utils.MageVersion;
|
||||
import mage.view.DraftPickView;
|
||||
import mage.view.GameView;
|
||||
import mage.view.MatchView;
|
||||
import mage.view.RoomUsersView;
|
||||
import mage.view.TableView;
|
||||
import mage.view.TournamentView;
|
||||
import mage.view.UserView;
|
||||
import mage.view.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -94,9 +90,9 @@ public interface MageServer {
|
|||
|
||||
TableView createTournamentTable(String sessionId, UUID roomId, TournamentOptions tournamentOptions) throws MageException;
|
||||
|
||||
boolean joinTable(String sessionId, UUID roomId, UUID tableId, String name, String 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 joinTournamentTable(String sessionId, UUID roomId, UUID tableId, String name, String 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 submitDeck(String sessionId, UUID tableId, DeckCardLists deckList) throws MageException, GameException;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,15 +28,15 @@
|
|||
|
||||
package mage.interfaces;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import mage.players.PlayerType;
|
||||
import mage.utils.MageVersion;
|
||||
import mage.view.GameTypeView;
|
||||
import mage.view.TournamentTypeView;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -44,7 +44,7 @@ public class ServerState implements Serializable {
|
|||
|
||||
private final List<GameTypeView> gameTypes;
|
||||
private final List<TournamentTypeView> tournamentTypes;
|
||||
private final String[] playerTypes;
|
||||
private final PlayerType[] playerTypes;
|
||||
private final String[] deckTypes;
|
||||
private final String[] draftCubes;
|
||||
private final boolean testMode;
|
||||
|
|
@ -53,7 +53,7 @@ public class ServerState implements Serializable {
|
|||
private final long expansionsContentVersion;
|
||||
|
||||
public ServerState(List<GameTypeView> gameTypes, List<TournamentTypeView> tournamentTypes,
|
||||
String[] playerTypes, String[] deckTypes, String[] draftCubes, boolean testMode,
|
||||
PlayerType[] playerTypes, String[] deckTypes, String[] draftCubes, boolean testMode,
|
||||
MageVersion version, long cardsContentVersion, long expansionsContentVersion) {
|
||||
this.gameTypes = gameTypes;
|
||||
this.tournamentTypes = tournamentTypes;
|
||||
|
|
@ -81,7 +81,7 @@ public class ServerState implements Serializable {
|
|||
return tournamentTypes;
|
||||
}
|
||||
|
||||
public String[] getPlayerTypes() {
|
||||
public PlayerType[] getPlayerTypes() {
|
||||
return playerTypes;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,13 +27,6 @@
|
|||
*/
|
||||
package mage.remote;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.UndeclaredThrowableException;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import mage.MageException;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.cards.decks.InvalidDeckException;
|
||||
|
|
@ -50,6 +43,7 @@ import mage.interfaces.MageClient;
|
|||
import mage.interfaces.MageServer;
|
||||
import mage.interfaces.ServerState;
|
||||
import mage.interfaces.callback.ClientCallback;
|
||||
import mage.players.PlayerType;
|
||||
import mage.players.net.UserData;
|
||||
import mage.utils.CompressUtil;
|
||||
import mage.view.*;
|
||||
|
|
@ -62,6 +56,13 @@ import org.jboss.remoting.transport.bisocket.Bisocket;
|
|||
import org.jboss.remoting.transport.socket.SocketWrapper;
|
||||
import org.jboss.remoting.transporter.TransporterClient;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.UndeclaredThrowableException;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -550,7 +551,7 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerTypes() {
|
||||
public PlayerType[] getPlayerTypes() {
|
||||
return serverState.getPlayerTypes();
|
||||
}
|
||||
|
||||
|
|
@ -680,7 +681,7 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean joinTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList, String password) {
|
||||
public boolean joinTable(UUID roomId, UUID tableId, String playerName, PlayerType playerType, int skill, DeckCardLists deckList, String password) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
// Workaround to fix Can't join table problem
|
||||
|
|
@ -703,7 +704,7 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean joinTournamentTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList, String password) {
|
||||
public boolean joinTournamentTable(UUID roomId, UUID tableId, String playerName, PlayerType playerType, int skill, DeckCardLists deckList, String password) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
// Workaround to fix Can't join table problem
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
package mage.remote.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mage.players.PlayerType;
|
||||
import mage.view.GameTypeView;
|
||||
import mage.view.TournamentTypeView;
|
||||
|
||||
|
|
@ -36,7 +38,7 @@ import mage.view.TournamentTypeView;
|
|||
*/
|
||||
public interface GameTypes {
|
||||
|
||||
String[] getPlayerTypes();
|
||||
PlayerType[] getPlayerTypes();
|
||||
|
||||
List<GameTypeView> getGameTypes();
|
||||
List<GameTypeView> getTournamentGameTypes();
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ package mage.remote.interfaces;
|
|||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.game.tournament.TournamentOptions;
|
||||
import mage.players.PlayerType;
|
||||
import mage.remote.MageRemoteException;
|
||||
import mage.view.TableView;
|
||||
import mage.view.TournamentView;
|
||||
|
|
@ -64,13 +65,13 @@ public interface PlayerActions {
|
|||
|
||||
// boolean startChallenge(UUID roomId, UUID tableId, UUID challengeId);
|
||||
|
||||
boolean joinTournamentTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList, String password);
|
||||
boolean joinTournamentTable(UUID roomId, UUID tableId, String playerName, PlayerType playerType, int skill, DeckCardLists deckList, String password);
|
||||
|
||||
boolean watchTable(UUID roomId, UUID tableId);
|
||||
|
||||
boolean watchTournamentTable(UUID tableId);
|
||||
|
||||
boolean joinTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList, String password);
|
||||
boolean joinTable(UUID roomId, UUID tableId, String playerName, PlayerType playerType, int skill, DeckCardLists deckList, String password);
|
||||
|
||||
Optional<TableView> getTable(UUID roomId, UUID tableId);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,12 @@
|
|||
*/
|
||||
package mage.view;
|
||||
|
||||
import mage.game.Seat;
|
||||
import mage.players.PlayerType;
|
||||
import mage.players.net.UserData;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
import mage.game.Seat;
|
||||
import mage.players.net.UserData;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -43,7 +45,7 @@ public class SeatView implements Serializable {
|
|||
private final String flagName;
|
||||
private UUID playerId;
|
||||
private final String playerName;
|
||||
private final String playerType;
|
||||
private final PlayerType playerType;
|
||||
private final String history;
|
||||
private final int generalRating;
|
||||
private final int constructedRating;
|
||||
|
|
@ -86,7 +88,7 @@ public class SeatView implements Serializable {
|
|||
return playerName;
|
||||
}
|
||||
|
||||
public String getPlayerType() {
|
||||
public PlayerType getPlayerType() {
|
||||
return playerType;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue