Merge pull request #3086 from ingmargoudt/play_match_human_fix

fixed two lines to allow playing human-human tables
This commit is contained in:
ingmargoudt 2017-04-11 08:06:15 +02:00 committed by GitHub
commit 5dfc0392f9
2 changed files with 183 additions and 184 deletions

View file

@ -53,7 +53,6 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class NewTableDialog extends MageDialog { public class NewTableDialog extends MageDialog {
@ -408,7 +407,7 @@ public class NewTableDialog extends MageDialog {
DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()), DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()),
this.txtPassword.getText())) { this.txtPassword.getText())) {
for (TablePlayerPanel player : players) { for (TablePlayerPanel player : players) {
if (!player.getPlayerType().equals("Human")) { if (player.getPlayerType() != PlayerType.HUMAN) {
if (!player.joinTable(roomId, table.getTableId())) { if (!player.joinTable(roomId, table.getTableId())) {
// error message must be send by the server // error message must be send by the server
SessionHandler.removeTable(roomId, table.getTableId()); SessionHandler.removeTable(roomId, table.getTableId());

View file

@ -46,7 +46,6 @@ import java.io.IOException;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class TablePlayerPanel extends javax.swing.JPanel { public class TablePlayerPanel extends javax.swing.JPanel {
@ -54,7 +53,9 @@ public class TablePlayerPanel extends javax.swing.JPanel {
protected final PlayerTypeEventSource playerTypeEventSource = new PlayerTypeEventSource(); protected final PlayerTypeEventSource playerTypeEventSource = new PlayerTypeEventSource();
/** Creates new form TablePlayerPanel */ /**
* Creates new form TablePlayerPanel
*/
public TablePlayerPanel() { public TablePlayerPanel() {
initComponents(); initComponents();
this.newPlayerPanel.setVisible(false); this.newPlayerPanel.setVisible(false);
@ -66,8 +67,7 @@ public class TablePlayerPanel extends javax.swing.JPanel {
if (Config.defaultOtherPlayerIndex != null) { if (Config.defaultOtherPlayerIndex != null) {
if (Integer.valueOf(Config.defaultOtherPlayerIndex) >= cbPlayerType.getItemCount()) { if (Integer.valueOf(Config.defaultOtherPlayerIndex) >= cbPlayerType.getItemCount()) {
cbPlayerType.setSelectedIndex(cbPlayerType.getItemCount() - 1); cbPlayerType.setSelectedIndex(cbPlayerType.getItemCount() - 1);
} } else {
else {
Integer index = Integer.parseInt(Config.defaultOtherPlayerIndex); Integer index = Integer.parseInt(Config.defaultOtherPlayerIndex);
cbPlayerType.setSelectedIndex(index); cbPlayerType.setSelectedIndex(index);
} }
@ -97,7 +97,8 @@ public class TablePlayerPanel extends javax.swing.JPanel {
} }
/** This method is called from within the constructor to /**
* This method is called from within the constructor to
* initialize the form. * initialize the form.
* WARNING: Do NOT modify this code. The content of this method is * WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor. * always regenerated by the Form Editor.
@ -149,10 +150,9 @@ public class TablePlayerPanel extends javax.swing.JPanel {
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void cbPlayerTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbPlayerTypeActionPerformed private void cbPlayerTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbPlayerTypeActionPerformed
if (!this.cbPlayerType.getSelectedItem().equals("Human")) { if (getPlayerType() != PlayerType.HUMAN) {
this.newPlayerPanel.setVisible(true); this.newPlayerPanel.setVisible(true);
} } else {
else {
this.newPlayerPanel.setVisible(false); this.newPlayerPanel.setVisible(false);
} }
this.revalidate(); this.revalidate();