added some missing session references

This commit is contained in:
ingmargoudt 2016-09-16 08:58:02 +02:00
parent 1b5d697b33
commit 71398d6d83
7 changed files with 28 additions and 16 deletions

View file

@ -313,4 +313,23 @@ public class SessionHandler {
return session.sendPlayerManaType(gameId, playerId, data);
}
public static TableView getTable(UUID roomId, UUID tableId) {
return session.getTable(roomId, tableId);
}
public static void updateDeck(UUID tableId, DeckCardLists deckCardLists) {
session.updateDeck(tableId, deckCardLists);
}
public static boolean emailAuthToken(Connection connection) {
return session.emailAuthToken(connection);
}
public static boolean resetPassword(Connection connection) {
return session.resetPassword(connection);
}
public static boolean register(Connection connection) {
return session.register(connection);
}
}

View file

@ -149,7 +149,7 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
int numColumns = maxWidth / cardDimension.width;
int curColumn = 0;
int curRow = 0;
if (cards.size() > 0) {
if (!cards.isEmpty()) {
Rectangle rectangle = new Rectangle(cardDimension.width, cardDimension.height);
List<MageCard> sortedCards = new ArrayList<>(cards.values());
switch (sortSetting.getSortBy()) {

View file

@ -958,7 +958,7 @@ class UpdateDeckTask extends SwingWorker<Void, Void> {
@Override
protected Void doInBackground() throws Exception {
while (!isCancelled()) {
session.updateDeck(tableId, deck.getDeckCardLists());
SessionHandler.updateDeck(tableId, deck.getDeckCardLists());
Thread.sleep(5000);
}
return null;

View file

@ -6,10 +6,9 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.swing.SwingWorker;
import mage.client.MageFrame;
import mage.client.SessionHandler;
import mage.client.preference.MagePreferences;
import mage.remote.Connection;
import mage.remote.Session;
import mage.remote.SessionImpl;
import org.apache.log4j.Logger;
public class RegisterUserDialog extends MageDialog {
@ -18,7 +17,6 @@ public class RegisterUserDialog extends MageDialog {
private ConnectDialog connectDialog;
private Connection connection;
private ConnectTask task;
private Session session;
/**
* Creates new form RegisterUserDialog
@ -226,8 +224,7 @@ public class RegisterUserDialog extends MageDialog {
protected Boolean doInBackground() throws Exception {
lblStatus.setText("Connecting...");
btnRegister.setEnabled(false);
session = new SessionImpl(MageFrame.getInstance());
result = session.register(connection);
result = SessionHandler.register(connection);
return result;
}

View file

@ -6,10 +6,9 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.swing.SwingWorker;
import mage.client.MageFrame;
import mage.client.SessionHandler;
import mage.client.preference.MagePreferences;
import mage.remote.Connection;
import mage.remote.Session;
import mage.remote.SessionImpl;
import org.apache.log4j.Logger;
public class ResetPasswordDialog extends MageDialog {
@ -17,7 +16,6 @@ public class ResetPasswordDialog extends MageDialog {
private static final Logger logger = Logger.getLogger(ResetPasswordDialog.class);
private ConnectDialog connectDialog;
private Connection connection;
private Session session;
private GetAuthTokenTask getAuthTokenTask;
private ResetPasswordTask resetPasswordTask;
@ -328,8 +326,7 @@ public class ResetPasswordDialog extends MageDialog {
protected Boolean doInBackground() throws Exception {
lblStatus.setText("Connecting...");
disableButtons();
session = new SessionImpl(MageFrame.getInstance());
result = session.emailAuthToken(connection);
result = SessionHandler.emailAuthToken(connection);
return result;
}
@ -371,8 +368,7 @@ public class ResetPasswordDialog extends MageDialog {
protected Boolean doInBackground() throws Exception {
lblStatus.setText("Connecting...");
disableButtons();
session = new SessionImpl(MageFrame.getInstance());
result = session.resetPassword(connection);
result = SessionHandler.resetPassword(connection);
return result;
}

View file

@ -432,7 +432,7 @@ class UpdateSeatsTask extends SwingWorker<Void, TableView> {
@Override
protected Void doInBackground() throws Exception {
while (!isCancelled()) {
this.publish(session.getTable(roomId, tableId));
this.publish(SessionHandler.getTable(roomId, tableId));
Thread.sleep(1000);
}
return null;

View file

@ -746,7 +746,7 @@ class UpdateTournamentTask extends SwingWorker<Void, TournamentView> {
@Override
protected void process(List<TournamentView> view) {
if (view != null && view.size() > 0) { // if user disconnects, view can be null for a short time
if (view != null && !view.isEmpty()) { // if user disconnects, view can be null for a short time
panel.update(view.get(0));
}
}