[refactoring][minor] Replaced all tabs with four spaces.

This commit is contained in:
North 2012-06-19 23:50:20 +03:00
parent e646e4768d
commit 239a4fb100
2891 changed files with 79411 additions and 79411 deletions

View file

@ -50,186 +50,186 @@ import mage.server.game.GamesRoomManager;
*/
public class TableManager {
private final static TableManager INSTANCE = new TableManager();
//private final static Logger logger = Logger.getLogger(TableManager.class);
private final static TableManager INSTANCE = new TableManager();
//private final static Logger logger = Logger.getLogger(TableManager.class);
private ConcurrentHashMap<UUID, TableController> controllers = new ConcurrentHashMap<UUID, TableController>();
private ConcurrentHashMap<UUID, Table> tables = new ConcurrentHashMap<UUID, Table>();
private ConcurrentHashMap<UUID, TableController> controllers = new ConcurrentHashMap<UUID, TableController>();
private ConcurrentHashMap<UUID, Table> tables = new ConcurrentHashMap<UUID, Table>();
public static TableManager getInstance() {
return INSTANCE;
}
public static TableManager getInstance() {
return INSTANCE;
}
public Table createTable(UUID roomId, UUID userId, MatchOptions options) {
TableController tableController = new TableController(roomId, userId, options);
controllers.put(tableController.getTable().getId(), tableController);
tables.put(tableController.getTable().getId(), tableController.getTable());
return tableController.getTable();
}
public Table createTable(UUID roomId, UUID userId, MatchOptions options) {
TableController tableController = new TableController(roomId, userId, options);
controllers.put(tableController.getTable().getId(), tableController);
tables.put(tableController.getTable().getId(), tableController.getTable());
return tableController.getTable();
}
public Table createTable(UUID roomId, MatchOptions options) {
TableController tableController = new TableController(roomId, null, options);
controllers.put(tableController.getTable().getId(), tableController);
tables.put(tableController.getTable().getId(), tableController.getTable());
return tableController.getTable();
}
public Table createTable(UUID roomId, MatchOptions options) {
TableController tableController = new TableController(roomId, null, options);
controllers.put(tableController.getTable().getId(), tableController);
tables.put(tableController.getTable().getId(), tableController.getTable());
return tableController.getTable();
}
public Table createTournamentTable(UUID roomId, UUID userId, TournamentOptions options) {
TableController tableController = new TableController(roomId, userId, options);
controllers.put(tableController.getTable().getId(), tableController);
tables.put(tableController.getTable().getId(), tableController.getTable());
return tableController.getTable();
}
public Table createTournamentTable(UUID roomId, UUID userId, TournamentOptions options) {
TableController tableController = new TableController(roomId, userId, options);
controllers.put(tableController.getTable().getId(), tableController);
tables.put(tableController.getTable().getId(), tableController.getTable());
return tableController.getTable();
}
public Table getTable(UUID tableId) {
return tables.get(tableId);
}
public Table getTable(UUID tableId) {
return tables.get(tableId);
}
public Match getMatch(UUID tableId) {
if (controllers.containsKey(tableId))
return controllers.get(tableId).getMatch();
return null;
}
public Match getMatch(UUID tableId) {
if (controllers.containsKey(tableId))
return controllers.get(tableId).getMatch();
return null;
}
public Collection<Table> getTables() {
return tables.values();
}
public Collection<Table> getTables() {
return tables.values();
}
public TableController getController(UUID tableId) {
return controllers.get(tableId);
}
public boolean joinTable(UUID userId, UUID tableId, String name, String playerType, int skill, DeckCardLists deckList) throws MageException {
if (controllers.containsKey(tableId))
return controllers.get(tableId).joinTable(userId, name, playerType, skill, deckList);
return false;
}
public boolean joinTournament(UUID userId, UUID tableId, String name, String playerType, int skill) throws GameException {
if (controllers.containsKey(tableId))
return controllers.get(tableId).joinTournament(userId, name, playerType, skill);
return false;
}
public boolean joinTable(UUID userId, UUID tableId, String name, String playerType, int skill, DeckCardLists deckList) throws MageException {
if (controllers.containsKey(tableId))
return controllers.get(tableId).joinTable(userId, name, playerType, skill, deckList);
return false;
}
public boolean submitDeck(UUID userId, UUID tableId, DeckCardLists deckList) throws MageException {
if (controllers.containsKey(tableId))
return controllers.get(tableId).submitDeck(userId, deckList);
return false;
}
public boolean joinTournament(UUID userId, UUID tableId, String name, String playerType, int skill) throws GameException {
if (controllers.containsKey(tableId))
return controllers.get(tableId).joinTournament(userId, name, playerType, skill);
return false;
}
public void updateDeck(UUID userId, UUID tableId, DeckCardLists deckList) throws MageException {
if (controllers.containsKey(tableId))
controllers.get(tableId).updateDeck(userId, deckList);
}
public boolean submitDeck(UUID userId, UUID tableId, DeckCardLists deckList) throws MageException {
if (controllers.containsKey(tableId))
return controllers.get(tableId).submitDeck(userId, deckList);
return false;
}
public void updateDeck(UUID userId, UUID tableId, DeckCardLists deckList) throws MageException {
if (controllers.containsKey(tableId))
controllers.get(tableId).updateDeck(userId, deckList);
}
public void removeSession(UUID userId) {
for (TableController controller: controllers.values()) {
controller.kill(userId);
}
}
for (TableController controller: controllers.values()) {
controller.kill(userId);
}
}
public boolean isTableOwner(UUID tableId, UUID userId) {
if (controllers.containsKey(tableId))
return controllers.get(tableId).isOwner(userId);
return false;
}
public boolean isTableOwner(UUID tableId, UUID userId) {
if (controllers.containsKey(tableId))
return controllers.get(tableId).isOwner(userId);
return false;
}
public boolean removeTable(UUID userId, UUID tableId) {
if (isTableOwner(tableId, userId) || UserManager.getInstance().isAdmin(userId)) {
removeTable(tableId);
return true;
}
return false;
}
public boolean removeTable(UUID userId, UUID tableId) {
if (isTableOwner(tableId, userId) || UserManager.getInstance().isAdmin(userId)) {
removeTable(tableId);
return true;
}
return false;
}
public void leaveTable(UUID userId, UUID tableId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).leaveTable(userId);
}
public void leaveTable(UUID userId, UUID tableId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).leaveTable(userId);
}
public UUID getChatId(UUID tableId) {
if (controllers.containsKey(tableId))
return controllers.get(tableId).getChatId();
return null;
}
public UUID getChatId(UUID tableId) {
if (controllers.containsKey(tableId))
return controllers.get(tableId).getChatId();
return null;
}
public void startMatch(UUID userId, UUID roomId, UUID tableId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).startMatch(userId);
}
public void startMatch(UUID userId, UUID roomId, UUID tableId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).startMatch(userId);
}
public void startMatch(UUID roomId, UUID tableId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).startMatch();
}
public void startMatch(UUID roomId, UUID tableId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).startMatch();
}
public void startChallenge(UUID userId, UUID roomId, UUID tableId, UUID challengeId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).startChallenge(userId, challengeId);
}
public void startChallenge(UUID userId, UUID roomId, UUID tableId, UUID challengeId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).startChallenge(userId, challengeId);
}
public void startTournament(UUID userId, UUID roomId, UUID tableId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).startTournament(userId);
}
public void startTournament(UUID userId, UUID roomId, UUID tableId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).startTournament(userId);
}
public void startDraft(UUID tableId, Draft draft) {
if (controllers.containsKey(tableId))
controllers.get(tableId).startDraft(draft);
}
public void startDraft(UUID tableId, Draft draft) {
if (controllers.containsKey(tableId))
controllers.get(tableId).startDraft(draft);
}
public boolean watchTable(UUID userId, UUID tableId) {
if (controllers.containsKey(tableId))
return controllers.get(tableId).watchTable(userId);
return false;
}
public boolean watchTable(UUID userId, UUID tableId) {
if (controllers.containsKey(tableId))
return controllers.get(tableId).watchTable(userId);
return false;
}
public boolean replayTable(UUID userId, UUID tableId) {
if (controllers.containsKey(tableId))
return controllers.get(tableId).replayTable(userId);
return false;
}
public boolean replayTable(UUID userId, UUID tableId) {
if (controllers.containsKey(tableId))
return controllers.get(tableId).replayTable(userId);
return false;
}
public void endGame(UUID tableId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).endGame();
}
public void endGame(UUID tableId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).endGame();
}
public void endDraft(UUID tableId, Draft draft) {
if (controllers.containsKey(tableId))
controllers.get(tableId).endDraft(draft);
}
public void endDraft(UUID tableId, Draft draft) {
if (controllers.containsKey(tableId))
controllers.get(tableId).endDraft(draft);
}
public void endTournament(UUID tableId, Tournament tournament) {
if (controllers.containsKey(tableId))
controllers.get(tableId).endTournament(tournament);
}
public void endTournament(UUID tableId, Tournament tournament) {
if (controllers.containsKey(tableId))
controllers.get(tableId).endTournament(tournament);
}
public void swapSeats(UUID tableId, UUID userId, int seatNum1, int seatNum2) {
if (controllers.containsKey(tableId) && isTableOwner(tableId, userId)) {
controllers.get(tableId).swapSeats(seatNum1, seatNum2);
}
}
public void swapSeats(UUID tableId, UUID userId, int seatNum1, int seatNum2) {
if (controllers.containsKey(tableId) && isTableOwner(tableId, userId)) {
controllers.get(tableId).swapSeats(seatNum1, seatNum2);
}
}
public void construct(UUID tableId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).construct();
}
public void construct(UUID tableId) {
if (controllers.containsKey(tableId))
controllers.get(tableId).construct();
}
public void addPlayer(UUID userId, UUID tableId, Player player, String playerType, Deck deck) throws GameException {
if (controllers.containsKey(tableId))
controllers.get(tableId).addPlayer(userId, player, playerType, deck);
}
public void addPlayer(UUID userId, UUID tableId, Player player, String playerType, Deck deck) throws GameException {
if (controllers.containsKey(tableId))
controllers.get(tableId).addPlayer(userId, player, playerType, deck);
}
public void removeTable(UUID tableId) {
if (tables.containsKey(tableId)) {
Table table = tables.get(tableId);
controllers.remove(tableId);
tables.remove(tableId);
GamesRoomManager.getInstance().removeTable(tableId);
if (table.getMatch() != null && table.getMatch().getGame() != null)
table.getMatch().getGame().end();
}
}
public void removeTable(UUID tableId) {
if (tables.containsKey(tableId)) {
Table table = tables.get(tableId);
controllers.remove(tableId);
tables.remove(tableId);
GamesRoomManager.getInstance().removeTable(tableId);
if (table.getMatch() != null && table.getMatch().getGame() != null)
table.getMatch().getGame().end();
}
}
}