forked from External/mage
rewrote singleton to enum where applicable
This commit is contained in:
parent
3b62489ef5
commit
234cfe9519
872 changed files with 1796 additions and 2135 deletions
|
|
@ -67,7 +67,7 @@ public class TournamentSession {
|
|||
|
||||
public boolean init() {
|
||||
if (!killed) {
|
||||
Optional<User> user = UserManager.getInstance().getUser(userId);
|
||||
Optional<User> user = UserManager.instance.getUser(userId);
|
||||
if (user.isPresent()) {
|
||||
user.get().fireCallback(new ClientCallback("tournamentInit", tournament.getId(), getTournamentView()));
|
||||
return true;
|
||||
|
|
@ -78,7 +78,7 @@ public class TournamentSession {
|
|||
|
||||
public void update() {
|
||||
if (!killed) {
|
||||
UserManager.getInstance().getUser(userId).ifPresent(user ->
|
||||
UserManager.instance.getUser(userId).ifPresent(user ->
|
||||
user.fireCallback(new ClientCallback("tournamentUpdate", tournament.getId(), getTournamentView())));
|
||||
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ public class TournamentSession {
|
|||
|
||||
public void gameOver(final String message) {
|
||||
if (!killed) {
|
||||
UserManager.getInstance().getUser(userId).ifPresent(user ->
|
||||
UserManager.instance.getUser(userId).ifPresent(user ->
|
||||
user.fireCallback(new ClientCallback("tournamentOver", tournament.getId(), message)));
|
||||
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ public class TournamentSession {
|
|||
public void construct(int timeout) {
|
||||
if (!killed) {
|
||||
setupTimeout(timeout);
|
||||
UserManager.getInstance().getUser(userId).ifPresent(user -> {
|
||||
UserManager.instance.getUser(userId).ifPresent(user -> {
|
||||
int remaining = (int) futureTimeout.getDelay(TimeUnit.SECONDS);
|
||||
user.ccConstruct(tournament.getPlayer(playerId).getDeck(), tableId, remaining);
|
||||
});
|
||||
|
|
@ -128,7 +128,7 @@ public class TournamentSession {
|
|||
futureTimeout = timeoutExecutor.schedule(
|
||||
() -> {
|
||||
try {
|
||||
TournamentManager.getInstance().timeout(tournament.getId(), userId);
|
||||
TournamentManager.instance.timeout(tournament.getId(), userId);
|
||||
} catch (Exception e) {
|
||||
logger.fatal("TournamentSession error - userId " + userId + " tId " + tournament.getId(), e);
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ public class TournamentSession {
|
|||
}
|
||||
|
||||
private void removeTournamentForUser() {
|
||||
UserManager.getInstance().getUser(userId).ifPresent(user ->
|
||||
UserManager.instance.getUser(userId).ifPresent(user ->
|
||||
user.removeTournament(playerId));
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue