mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
Remove table if a user disconnects only if state is waiting or starting.
This commit is contained in:
parent
d39a581df9
commit
a71285a768
1 changed files with 6 additions and 1 deletions
|
|
@ -33,6 +33,7 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.cards.decks.Deck;
|
import mage.cards.decks.Deck;
|
||||||
|
import mage.constants.TableState;
|
||||||
import mage.game.Table;
|
import mage.game.Table;
|
||||||
import mage.interfaces.callback.ClientCallback;
|
import mage.interfaces.callback.ClientCallback;
|
||||||
import mage.players.net.UserData;
|
import mage.players.net.UserData;
|
||||||
|
|
@ -276,7 +277,11 @@ public class User {
|
||||||
}
|
}
|
||||||
for (Entry<UUID, Table> entry: tables.entrySet()) {
|
for (Entry<UUID, Table> entry: tables.entrySet()) {
|
||||||
entry.getValue().leaveTable(entry.getKey());
|
entry.getValue().leaveTable(entry.getKey());
|
||||||
if (TableManager.getInstance().isTableOwner(entry.getValue().getId(), userId)) {
|
// remove tables here only, if the match or tournament did not start yet (states waiting/starting).
|
||||||
|
// all other situations have to lead to a fnished match / tournament where players left / conceded for which reasons ever
|
||||||
|
if (TableManager.getInstance().isTableOwner(entry.getValue().getId(), userId)
|
||||||
|
&& (entry.getValue().getState().equals(TableState.WAITING)
|
||||||
|
|| entry.getValue().getState().equals(TableState.STARTING))) {
|
||||||
TableManager.getInstance().removeTable(userId, entry.getValue().getId());
|
TableManager.getInstance().removeTable(userId, entry.getValue().getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue