Fixed a bug that while a match or tournament was just starting a player could still leave the table, setting the table / tournament / match to an undefined state. Now the player can only leave the Match / Tournament if it has started properly.

This commit is contained in:
LevelX2 2014-09-03 01:02:10 +02:00
parent 3f5f6a6166
commit fec0744315
10 changed files with 159 additions and 100 deletions

View file

@ -219,15 +219,15 @@ class TableListSorter implements Comparator<Table> {
@Override
public int compare(Table one, Table two) {
// priority 1 - Not started yet
if (one.getState().equals(TableState.STARTING) || one.getState().equals(TableState.WAITING)) {
if (two.getState().equals(TableState.STARTING) || two.getState().equals(TableState.WAITING)) {
if (one.getState().equals(TableState.READY_TO_START) || one.getState().equals(TableState.WAITING)) {
if (two.getState().equals(TableState.READY_TO_START) || two.getState().equals(TableState.WAITING)) {
return two.getCreateTime().compareTo(one.getCreateTime());
} else {
return -1; // one has higher priority
}
}
// priority 2 - Not finished yet -> Sorted by time started
if (two.getState().equals(TableState.STARTING) || two.getState().equals(TableState.WAITING)) {
if (two.getState().equals(TableState.READY_TO_START) || two.getState().equals(TableState.WAITING)) {
return 1; // two has higher priority
} else if (one.getEndTime() == null) {
if (two.getEndTime() == null) {