forked from External/mage
reconnect to drafts and tournaments
This commit is contained in:
parent
bf2f4e3078
commit
7f312ed453
8 changed files with 132 additions and 42 deletions
|
|
@ -66,22 +66,22 @@ public class TournamentSession {
|
|||
this.tableId = tableId;
|
||||
}
|
||||
|
||||
public boolean init(final TournamentView tournamentView) {
|
||||
public boolean init() {
|
||||
if (!killed) {
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (user != null) {
|
||||
user.fireCallback(new ClientCallback("tournamentInit", tournament.getId(), tournamentView));
|
||||
user.fireCallback(new ClientCallback("tournamentInit", tournament.getId(), getTournamentView()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void update(final TournamentView tournamentView) {
|
||||
public void update() {
|
||||
if (!killed) {
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (user != null) {
|
||||
user.fireCallback(new ClientCallback("tournamentUpdate", tournament.getId(), tournamentView));
|
||||
user.fireCallback(new ClientCallback("tournamentUpdate", tournament.getId(), getTournamentView()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -140,4 +140,22 @@ public class TournamentSession {
|
|||
}
|
||||
}
|
||||
|
||||
public void removeTournament() {
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (user != null)
|
||||
user.removeTournament(playerId);
|
||||
}
|
||||
|
||||
private TournamentView getTournamentView() {
|
||||
return new TournamentView(tournament);
|
||||
}
|
||||
|
||||
public UUID getTournamentId() {
|
||||
return tournament.getId();
|
||||
}
|
||||
|
||||
void tournamentOver() {
|
||||
//TODO: implement this
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue