diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index 4502e3d92b..972db79760 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -581,6 +581,16 @@ public final class GamePanel extends javax.swing.JPanel { this.repaint(); } + /** + * Set the same state for menu selections to all player areas. + * @param manaPoolAutomatic + */ + public void setMenuStates(boolean manaPoolAutomatic) { + for(PlayAreaPanel playAreaPanel: players.values()) { + playAreaPanel.setMenuStates(manaPoolAutomatic); + } + } + private void displayStack(GameView game, BigCard bigCard, FeedbackPanel feedbackPanel, UUID gameId) { this.stack.loadCards(game.getStack(), bigCard, gameId, null); } diff --git a/Mage.Client/src/main/java/mage/client/game/PlayAreaPanel.java b/Mage.Client/src/main/java/mage/client/game/PlayAreaPanel.java index b0ddfa6b3c..e08067e967 100644 --- a/Mage.Client/src/main/java/mage/client/game/PlayAreaPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/PlayAreaPanel.java @@ -65,6 +65,8 @@ public class PlayAreaPanel extends javax.swing.JPanel { private boolean playingMode = true; private GamePanel gamePanel; + private JCheckBoxMenuItem manaPoolMenuItem; + public static final int PANEL_HEIGHT = 242; public static final int PANEL_HEIGHT_SMALL = 190; @@ -177,16 +179,18 @@ public class PlayAreaPanel extends javax.swing.JPanel { popupMenu.addSeparator(); - menuItem = new JCheckBoxMenuItem("Use mana from pool automatically", true); - menuItem.setMnemonic(KeyEvent.VK_M); - menuItem.setToolTipText("If not active, you have to click the type of mana you want to pay in the player panel."); - popupMenu.add(menuItem); + manaPoolMenuItem = new JCheckBoxMenuItem("Use mana from pool automatically", true); + manaPoolMenuItem.setMnemonic(KeyEvent.VK_M); + manaPoolMenuItem.setToolTipText("If not active, you have to click the type of mana you want to pay in the player panel."); + popupMenu.add(manaPoolMenuItem); // Auto pay mana from mana pool - menuItem.addActionListener(new ActionListener() { + manaPoolMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - gamePanel.getSession().setManaPoolMode(((JCheckBoxMenuItem)e.getSource()).getState(), gameId); + boolean manaPoolAutomatic = ((JCheckBoxMenuItem)e.getSource()).getState(); + gamePanel.setMenuStates(manaPoolAutomatic); + gamePanel.getSession().setManaPoolMode(manaPoolAutomatic, gameId); } }); @@ -367,6 +371,10 @@ public class PlayAreaPanel extends javax.swing.JPanel { this.playingMode = playingMode; } + public void setMenuStates(boolean manaPoolAutomatic) { + manaPoolMenuItem.setSelected(manaPoolAutomatic); + } + private mage.client.game.BattlefieldPanel battlefieldPanel; private javax.swing.JButton btnCheat; //private javax.swing.JScrollPane jScrollPane1; diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index af0bfda490..2b258a1b40 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -968,10 +968,10 @@ public class HumanPlayer extends PlayerImpl { } @Override - public void setResponseManaType(UUID playerId, ManaType manaType) { + public void setResponseManaType(UUID manaTypePlayerId, ManaType manaType) { synchronized(response) { response.setManaType(manaType); - response.setResponseManaTypePlayerId(playerId); + response.setResponseManaTypePlayerId(manaTypePlayerId); response.notify(); log.debug("Got response mana type from player: " + getId()); } diff --git a/Mage.Server/src/main/java/mage/server/game/GameController.java b/Mage.Server/src/main/java/mage/server/game/GameController.java index 3d27682edc..f15aeab748 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameController.java +++ b/Mage.Server/src/main/java/mage/server/game/GameController.java @@ -475,11 +475,11 @@ public class GameController implements GameCallback { }); } - public void sendPlayerManaType(UUID userId, UUID playerId, final ManaType data) { + public void sendPlayerManaType(UUID userId, final UUID manaTypePlayerId, final ManaType data) { sendMessage(userId, new Command() { @Override public void execute(UUID playerId) { - getGameSession(playerId).sendPlayerManaType(data, playerId); + getGameSession(playerId).sendPlayerManaType(data, manaTypePlayerId); } }); } diff --git a/Mage.Server/src/main/java/mage/server/game/GameSession.java b/Mage.Server/src/main/java/mage/server/game/GameSession.java index dc9e82d693..36529e30dc 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameSession.java +++ b/Mage.Server/src/main/java/mage/server/game/GameSession.java @@ -221,9 +221,9 @@ public class GameSession extends GameWatcher { game.getPlayer(playerId).setResponseString(data); } - public void sendPlayerManaType(ManaType manaType, UUID playerId) { + public void sendPlayerManaType(ManaType manaType, UUID manaTypePlayerId) { cancelTimeout(); - game.getPlayer(playerId).setResponseManaType(playerId, manaType); + game.getPlayer(playerId).setResponseManaType(manaTypePlayerId, manaType); } public void sendPlayerBoolean(Boolean data) { diff --git a/Mage/src/mage/players/Player.java b/Mage/src/mage/players/Player.java index 649e0a541f..fc822b4200 100644 --- a/Mage/src/mage/players/Player.java +++ b/Mage/src/mage/players/Player.java @@ -278,7 +278,7 @@ public interface Player extends MageItem, Copyable { void setResponseUUID(UUID responseUUID); void setResponseBoolean(Boolean responseBoolean); void setResponseInteger(Integer data); - void setResponseManaType(UUID playerId, ManaType responseManaType); + void setResponseManaType(UUID manaTypePlayerId, ManaType responseManaType); boolean priority(Game game); boolean choose(Outcome outcome, Target target, UUID sourceId, Game game); diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index 6f93c04782..013565a6f2 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -1473,7 +1473,7 @@ public abstract class PlayerImpl> implements Player, Ser public void setResponseString(String responseString) {} @Override - public void setResponseManaType(UUID playerId, ManaType responseManaType) {} + public void setResponseManaType(UUID manaTypePlayerId, ManaType responseManaType) {} @Override public void setResponseUUID(UUID responseUUID) {}