Improvements player cancels or leaves match or tournament. Draft can replace human player by draft bot if human leaves.

This commit is contained in:
LevelX2 2013-10-03 22:42:16 +02:00
parent 089fbf15b1
commit e2532a9b11
18 changed files with 300 additions and 102 deletions

View file

@ -166,9 +166,12 @@ public class TableManager {
}
}
public void removeSession(UUID userId) {
// remove user from all tournament sub tables
public void userQuitTournamentSubTables(UUID userId) {
for (TableController controller: controllers.values()) {
controller.kill(userId);
if (controller.getTable().isTournamentSubTable()) {
controller.leaveTable(userId);
}
}
}
@ -190,6 +193,13 @@ public class TableManager {
public void leaveTable(UUID userId, UUID tableId) {
if (controllers.containsKey(tableId)) {
controllers.get(tableId).leaveTable(userId);
// table not started yet and user is he owner, remove the table
if (isTableOwner(tableId, userId)) {
if (getTable(tableId).getState().equals(TableState.WAITING)
|| getTable(tableId).getState().equals(TableState.STARTING)) {
removeTable(tableId);
}
}
}
}