* Added option to start matches with password protection.

This commit is contained in:
LevelX2 2014-10-11 16:29:37 +02:00
parent 36ef4c3bcf
commit 8f690f7e02
19 changed files with 151 additions and 42 deletions

View file

@ -81,7 +81,7 @@ public interface MageServer {
//table methods
TableView createTable(String sessionId, UUID roomId, MatchOptions matchOptions) throws MageException;
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) throws MageException, GameException;
boolean joinTable(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, String playerType, int skill) throws MageException, GameException;
boolean submitDeck(String sessionId, UUID tableId, DeckCardLists deckList) throws MageException, GameException;
void updateDeck(String sessionId, UUID tableId, DeckCardLists deckList) throws MageException, GameException;

View file

@ -570,10 +570,10 @@ public class SessionImpl implements Session {
}
@Override
public boolean joinTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList) {
public boolean joinTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList, String password) {
try {
if (isConnected()) {
return server.joinTable(sessionId, roomId, tableId, playerName, playerType, skill, deckList);
return server.joinTable(sessionId, roomId, tableId, playerName, playerType, skill, deckList, password);
}
} catch (InvalidDeckException iex) {
handleInvalidDeckException(iex);

View file

@ -69,7 +69,7 @@ public interface PlayerActions {
boolean watchTournamentTable(UUID tableId);
boolean joinTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList);
boolean joinTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList, String password);
TableView getTable(UUID roomId, UUID tableId);

View file

@ -106,11 +106,16 @@ public class TableView implements Serializable {
}
this.controllerName += sb.toString();
this.deckType = table.getDeckType();
StringBuilder addInfo = new StringBuilder();
if (table.getMatch().getGames().isEmpty()) {
this.additionalInfo = new StringBuilder("Timer: ").append(table.getMatch().getOptions().getMatchTimeLimit().toString()).toString();
if (!table.getMatch().getOptions().getPassword().isEmpty()) {
addInfo.append("PW -");
}
addInfo.append("Timer: ").append(table.getMatch().getOptions().getMatchTimeLimit().toString());
} else {
this.additionalInfo = sbScore.toString();
addInfo.append(sbScore.toString());
}
this.additionalInfo = addInfo.toString();
} else {
this.wins = table.getTournament().getOptions().getMatchOptions().getWinsNeeded();
if (table.getTournament().getOptions().getNumberRounds() > 0) {