fixing some additional singleton classes

This commit is contained in:
ingmargoudt 2017-03-16 09:46:22 +01:00
parent 894c575d34
commit 2b91b88551
41 changed files with 148 additions and 166 deletions

View file

@ -229,14 +229,14 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
} }
ManaSymbols.loadImages(); ManaSymbols.loadImages();
Plugins.getInstance().loadPlugins(); Plugins.instance.loadPlugins();
initComponents(); initComponents();
desktopPane.setDesktopManager(new MageDesktopManager()); desktopPane.setDesktopManager(new MageDesktopManager());
setSize(1024, 768); setSize(1024, 768);
SettingsManager.getInstance().setScreenWidthAndHeight(1024, 768); SettingsManager.instance.setScreenWidthAndHeight(1024, 768);
DialogManager.updateParams(768, 1024, false); DialogManager.updateParams(768, 1024, false);
this.setExtendedState(JFrame.MAXIMIZED_BOTH); this.setExtendedState(JFrame.MAXIMIZED_BOTH);
@ -265,7 +265,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
setBackground(); setBackground();
addMageLabel(); addMageLabel();
setAppIcon(); setAppIcon();
MageTray.getInstance().install(); MageTray.instance.install();
desktopPane.add(ArrowBuilder.getBuilder().getArrowsManagerPanel(), JLayeredPane.DRAG_LAYER); desktopPane.add(ArrowBuilder.getBuilder().getArrowsManagerPanel(), JLayeredPane.DRAG_LAYER);
@ -274,7 +274,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
int width = ((JComponent) e.getSource()).getWidth(); int width = ((JComponent) e.getSource()).getWidth();
int height = ((JComponent) e.getSource()).getHeight(); int height = ((JComponent) e.getSource()).getHeight();
SettingsManager.getInstance().setScreenWidthAndHeight(width, height); SettingsManager.instance.setScreenWidthAndHeight(width, height);
if (!liteMode && !grayMode) { if (!liteMode && !grayMode) {
backgroundPane.setSize(width, height); backgroundPane.setSize(width, height);
} }
@ -295,8 +295,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
mageToolbar.add(createSwitchPanelsButton(), 0); mageToolbar.add(createSwitchPanelsButton(), 0);
mageToolbar.add(new javax.swing.JToolBar.Separator(), 1); mageToolbar.add(new javax.swing.JToolBar.Separator(), 1);
if (Plugins.getInstance().isCounterPluginLoaded()) { if (Plugins.instance.isCounterPluginLoaded()) {
int i = Plugins.getInstance().getGamesPlayed(); int i = Plugins.instance.getGamesPlayed();
JLabel label = new JLabel(" Games played: " + String.valueOf(i)); JLabel label = new JLabel(" Games played: " + String.valueOf(i));
desktopPane.add(label, JLayeredPane.DEFAULT_LAYER + 1); desktopPane.add(label, JLayeredPane.DEFAULT_LAYER + 1);
label.setVisible(true); label.setVisible(true);
@ -338,7 +338,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
} }
private void addTooltipContainer() { private void addTooltipContainer() {
final JEditorPane cardInfoPane = (JEditorPane) Plugins.getInstance().getCardInfoPane(); final JEditorPane cardInfoPane = (JEditorPane) Plugins.instance.getCardInfoPane();
if (cardInfoPane == null) { if (cardInfoPane == null) {
return; return;
} }
@ -422,8 +422,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
} }
String filename = "/background.jpg"; String filename = "/background.jpg";
try { try {
if (Plugins.getInstance().isThemePluginLoaded()) { if (Plugins.instance.isThemePluginLoaded()) {
backgroundPane = (ImagePanel) Plugins.getInstance().updateTablePanel(new HashMap<>()); backgroundPane = (ImagePanel) Plugins.instance.updateTablePanel(new HashMap<>());
} else { } else {
InputStream is = this.getClass().getResourceAsStream(filename); InputStream is = this.getClass().getResourceAsStream(filename);
BufferedImage background = ImageIO.read(is); BufferedImage background = ImageIO.read(is);
@ -460,7 +460,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
} }
private void setAppIcon() { private void setAppIcon() {
Image image = ImageManagerImpl.getInstance().getAppImage(); Image image = ImageManagerImpl.instance.getAppImage();
setIconImage(image); setIconImage(image);
} }
@ -1323,7 +1323,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
public void sendUserReplay(PlayerAction playerAction, UserRequestMessage userRequestMessage) { public void sendUserReplay(PlayerAction playerAction, UserRequestMessage userRequestMessage) {
switch (playerAction) { switch (playerAction) {
case CLIENT_DOWNLOAD_SYMBOLS: case CLIENT_DOWNLOAD_SYMBOLS:
Plugins.getInstance().downloadSymbols(); Plugins.instance.downloadSymbols();
break; break;
case CLIENT_DOWNLOAD_CARD_IMAGES: case CLIENT_DOWNLOAD_CARD_IMAGES:
DownloadPictures.startDownload(null, missingCards); DownloadPictures.startDownload(null, missingCards);
@ -1361,7 +1361,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
} }
CardRepository.instance.closeDB(); CardRepository.instance.closeDB();
tablesPane.cleanUp(); tablesPane.cleanUp();
Plugins.getInstance().shutdown(); Plugins.instance.shutdown();
dispose(); dispose();
System.exit(0); System.exit(0);
break; break;
@ -1390,7 +1390,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
setGUISizeTooltipContainer(); setGUISizeTooltipContainer();
Plugins.getInstance().changeGUISize(); Plugins.instance.changeGUISize();
CountryUtil.changeGUISize(); CountryUtil.changeGUISize();
for (Component component : desktopPane.getComponents()) { for (Component component : desktopPane.getComponents()) {
if (component instanceof MageDialog) { if (component instanceof MageDialog) {
@ -1410,7 +1410,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
} }
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace();
} }
this.revalidate(); this.revalidate();

View file

@ -81,7 +81,7 @@ public class BigCard extends JComponent {
public BigCard(boolean rotated) { public BigCard(boolean rotated) {
initComponents(); initComponents();
if (!Plugins.getInstance().isCardPluginLoaded()) { if (!Plugins.instance.isCardPluginLoaded()) {
initBounds(rotated); initBounds(rotated);
} }
setDoubleBuffered(true); setDoubleBuffered(true);

View file

@ -148,7 +148,7 @@ public class CardArea extends JPanel implements MouseListener {
tmp.setAbility(card); // cross-reference, required for ability picker tmp.setAbility(card); // cross-reference, required for ability picker
card = tmp; card = tmp;
} }
MageCard cardPanel = Plugins.getInstance().getMageCard(card, bigCard, cardDimension, gameId, true, true); MageCard cardPanel = Plugins.instance.getMageCard(card, bigCard, cardDimension, gameId, true, true);
cardPanel.setBounds(rectangle); cardPanel.setBounds(rectangle);
cardPanel.addMouseListener(this); cardPanel.addMouseListener(this);

View file

@ -57,7 +57,7 @@ public class CardDraggerGlassPane implements MouseListener, MouseMotionListener
currentCards = new ArrayList<>(source.dragCardList()); currentCards = new ArrayList<>(source.dragCardList());
// Make a view for the first one and add it to us // Make a view for the first one and add it to us
dragView = Plugins.getInstance().getMageCard(currentCards.get(0), null, new Dimension(100, 140), null, true, false); dragView = Plugins.instance.getMageCard(currentCards.get(0), null, new Dimension(100, 140), null, true, false);
for (MouseListener l: dragView.getMouseListeners()) { for (MouseListener l: dragView.getMouseListeners()) {
dragView.removeMouseListener(l); dragView.removeMouseListener(l);
} }

View file

@ -133,7 +133,7 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
} }
private void addCard(CardView card, BigCard bigCard, UUID gameId, boolean drawImage) { private void addCard(CardView card, BigCard bigCard, UUID gameId, boolean drawImage) {
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, cardDimension, gameId, drawImage, true); MageCard cardImg = Plugins.instance.getMageCard(card, bigCard, cardDimension, gameId, drawImage, true);
cards.put(card.getId(), cardImg); cards.put(card.getId(), cardImg);
cardImg.addMouseListener(this); cardImg.addMouseListener(this);
add(cardImg); add(cardImg);

View file

@ -98,7 +98,7 @@ public class Cards extends javax.swing.JPanel {
jScrollPane1.getViewport().setOpaque(false); jScrollPane1.getViewport().setOpaque(false);
jScrollPane1.setBorder(EMPTY_BORDER); jScrollPane1.setBorder(EMPTY_BORDER);
} }
if (Plugins.getInstance().isCardPluginLoaded()) { if (Plugins.instance.isCardPluginLoaded()) {
cardArea.setLayout(null); cardArea.setLayout(null);
} }
cardArea.setBorder(EMPTY_BORDER); cardArea.setBorder(EMPTY_BORDER);
@ -263,7 +263,7 @@ public class Cards extends javax.swing.JPanel {
} }
private void addCard(CardView card, BigCard bigCard, UUID gameId) { private void addCard(CardView card, BigCard bigCard, UUID gameId) {
MageCard mageCard = Plugins.getInstance().getMageCard(card, bigCard, getCardDimension(), gameId, true, true); MageCard mageCard = Plugins.instance.getMageCard(card, bigCard, getCardDimension(), gameId, true, true);
if (zone != null) { if (zone != null) {
mageCard.setZone(zone); mageCard.setZone(zone);
} }

View file

@ -425,7 +425,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
} }
private MageCard addCard(CardView card, BigCard bigCard, UUID gameId) { private MageCard addCard(CardView card, BigCard bigCard, UUID gameId) {
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, cardDimension, gameId, true, true); MageCard cardImg = Plugins.instance.getMageCard(card, bigCard, cardDimension, gameId, true, true);
cardArea.add(cardImg); cardArea.add(cardImg);
cardImg.update(card); cardImg.update(card);
cardImg.addMouseListener(this); cardImg.addMouseListener(this);

View file

@ -127,7 +127,7 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
List<CardView> sortedCards = new ArrayList<>(booster.values()); List<CardView> sortedCards = new ArrayList<>(booster.values());
sortedCards.sort(new CardViewRarityComparator()); sortedCards.sort(new CardViewRarityComparator());
for (CardView card: sortedCards) { for (CardView card: sortedCards) {
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, dimension, null, true, true); MageCard cardImg = Plugins.instance.getMageCard(card, bigCard, dimension, null, true, true);
cardImg.addMouseListener(this); cardImg.addMouseListener(this);
add(cardImg); add(cardImg);
cardImg.update(card); cardImg.update(card);
@ -156,7 +156,7 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
} }
private void hidePopup() { private void hidePopup() {
Plugins.getInstance().getActionCallback().mouseExited(null, null); Plugins.instance.getActionCallback().mouseExited(null, null);
} }
/** This method is called from within the constructor to /** This method is called from within the constructor to

View file

@ -1767,7 +1767,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
updateCounts(); updateCounts();
// Create the card view // Create the card view
final MageCard cardPanel = Plugins.getInstance().getMageCard(card, lastBigCard, new Dimension(getCardWidth(), getCardHeight()), null, true, true); final MageCard cardPanel = Plugins.instance.getMageCard(card, lastBigCard, new Dimension(getCardWidth(), getCardHeight()), null, true, true);
cardPanel.update(card); cardPanel.update(card);
cardPanel.setTextOffset(0); cardPanel.setTextOffset(0);

View file

@ -118,10 +118,10 @@ public class CombatManager {
blockerPoint.translate(-parentPoint.x, -parentPoint.y); blockerPoint.translate(-parentPoint.x, -parentPoint.y);
Point attackerPoint = attackerCard.getLocationOnScreen(); Point attackerPoint = attackerCard.getLocationOnScreen();
attackerPoint.translate(-parentPoint.x, -parentPoint.y); attackerPoint.translate(-parentPoint.x, -parentPoint.y);
double yRateA = (attackerCard.getSize().height / SettingsManager.getInstance().getCardSize().height); double yRateA = (attackerCard.getSize().height / SettingsManager.instance.getCardSize().height);
double xRateA = (attackerCard.getSize().width / SettingsManager.getInstance().getCardSize().width); double xRateA = (attackerCard.getSize().width / SettingsManager.instance.getCardSize().width);
double yRateB = (blockerCard.getSize().height / SettingsManager.getInstance().getCardSize().height); double yRateB = (blockerCard.getSize().height / SettingsManager.instance.getCardSize().height);
double xRateB = (blockerCard.getSize().width / SettingsManager.getInstance().getCardSize().width); double xRateB = (blockerCard.getSize().width / SettingsManager.instance.getCardSize().width);
ArrowBuilder.getBuilder().addArrow(gameId, (int) blockerPoint.getX() + (int) (55 * xRateB), (int) blockerPoint.getY() + (int) (25 * xRateB), ArrowBuilder.getBuilder().addArrow(gameId, (int) blockerPoint.getX() + (int) (55 * xRateB), (int) blockerPoint.getY() + (int) (25 * xRateB),
(int) attackerPoint.getX() + (int) (70 * xRateA), (int) attackerPoint.getY() + (int) (25 * yRateA), Color.blue, ArrowBuilder.Type.COMBAT); (int) attackerPoint.getX() + (int) (70 * xRateA), (int) attackerPoint.getY() + (int) (25 * yRateA), Color.blue, ArrowBuilder.Type.COMBAT);
globalBlockersCount++; globalBlockersCount++;

View file

@ -112,7 +112,7 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
this.selected = false; // back to false - waiting for selection this.selected = false; // back to false - waiting for selection
setVisible(true); setVisible(true);
Point centered = SettingsManager.getInstance().getComponentPosition(DIALOG_WIDTH, DIALOG_HEIGHT); Point centered = SettingsManager.instance.getComponentPosition(DIALOG_WIDTH, DIALOG_HEIGHT);
this.setLocation(centered.x, centered.y); this.setLocation(centered.x, centered.y);
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this); GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this);

View file

@ -130,7 +130,7 @@ public class ChoiceDialog extends IDialogPanel {
return; return;
} }
java.util.List<Component> toRemove = new ArrayList<>(); ArrayList<Component> toRemove = new ArrayList<>();
for (int i = getComponentCount() - 1; i > 0; i--) { for (int i = getComponentCount() - 1; i > 0; i--) {
Component o = getComponent(i); Component o = getComponent(i);
if (o instanceof MageCard) { if (o instanceof MageCard) {
@ -141,10 +141,10 @@ public class ChoiceDialog extends IDialogPanel {
remove(toRemove.get(i)); remove(toRemove.get(i));
} }
java.util.List<CardView> cardList = new ArrayList<>(cards.values()); ArrayList<CardView> cardList = new ArrayList<>(cards.values());
int width = SettingsManager.getInstance().getCardSize().width; int width = SettingsManager.instance.getCardSize().width;
int height = SettingsManager.getInstance().getCardSize().height; int height = SettingsManager.instance.getCardSize().height;
int dx = 0; int dx = 0;
int dy = 30; int dy = 30;
@ -161,7 +161,7 @@ public class ChoiceDialog extends IDialogPanel {
} }
CardView card = cardList.get(i); CardView card = cardList.get(i);
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, getCardDimension(), gameId, true, true); MageCard cardImg = Plugins.instance.getMageCard(card, bigCard, getCardDimension(), gameId, true, true);
cardImg.setLocation(dx, dy + j*(height + 30)); cardImg.setLocation(dx, dy + j*(height + 30));
add(cardImg); add(cardImg);
@ -174,9 +174,9 @@ public class ChoiceDialog extends IDialogPanel {
private HoverButton getJButtonOK() { private HoverButton getJButtonOK() {
if (jButtonOK == null) { if (jButtonOK == null) {
jButtonOK = new HoverButton("", ImageManagerImpl.getInstance().getDlgAcceptButtonImage(), jButtonOK = new HoverButton("", ImageManagerImpl.instance.getDlgAcceptButtonImage(),
ImageManagerImpl.getInstance().getDlgActiveAcceptButtonImage(), ImageManagerImpl.instance.getDlgActiveAcceptButtonImage(),
ImageManagerImpl.getInstance().getDlgAcceptButtonImage(), ImageManagerImpl.instance.getDlgAcceptButtonImage(),
new Rectangle(60, 60)); new Rectangle(60, 60));
int w = getDlgParams().rect.width - 75; int w = getDlgParams().rect.width - 75;
int h = getDlgParams().rect.height - 90; int h = getDlgParams().rect.height - 90;
@ -190,9 +190,9 @@ public class ChoiceDialog extends IDialogPanel {
private HoverButton getJButtonPrevPage() { private HoverButton getJButtonPrevPage() {
if (jButtonPrevPage == null) { if (jButtonPrevPage == null) {
jButtonPrevPage = new HoverButton("", ImageManagerImpl.getInstance().getDlgPrevButtonImage(), jButtonPrevPage = new HoverButton("", ImageManagerImpl.instance.getDlgPrevButtonImage(),
ImageManagerImpl.getInstance().getDlgActivePrevButtonImage(), ImageManagerImpl.instance.getDlgActivePrevButtonImage(),
ImageManagerImpl.getInstance().getDlgPrevButtonImage(), ImageManagerImpl.instance.getDlgPrevButtonImage(),
new Rectangle(60, 60)); new Rectangle(60, 60));
int w = getDlgParams().rect.width - 75; int w = getDlgParams().rect.width - 75;
int h = getDlgParams().rect.height - 90; int h = getDlgParams().rect.height - 90;
@ -229,9 +229,9 @@ public class ChoiceDialog extends IDialogPanel {
*/ */
private HoverButton getJButtonNextPage() { private HoverButton getJButtonNextPage() {
if (jButtonNextPage == null) { if (jButtonNextPage == null) {
jButtonNextPage = new HoverButton("", ImageManagerImpl.getInstance().getDlgNextButtonImage(), jButtonNextPage = new HoverButton("", ImageManagerImpl.instance.getDlgNextButtonImage(),
ImageManagerImpl.getInstance().getDlgActiveNextButtonImage(), ImageManagerImpl.instance.getDlgActiveNextButtonImage(),
ImageManagerImpl.getInstance().getDlgNextButtonImage(), ImageManagerImpl.instance.getDlgNextButtonImage(),
new Rectangle(60, 60)); new Rectangle(60, 60));
int w = getDlgParams().rect.width - 75; int w = getDlgParams().rect.width - 75;
int h = getDlgParams().rect.height - 90; int h = getDlgParams().rect.height - 90;
@ -317,9 +317,9 @@ public class ChoiceDialog extends IDialogPanel {
*/ */
private HoverButton getJButtonCancel() { private HoverButton getJButtonCancel() {
if (jButtonCancel == null) { if (jButtonCancel == null) {
jButtonCancel = new HoverButton("", ImageManagerImpl.getInstance().getDlgCancelButtonImage(), jButtonCancel = new HoverButton("", ImageManagerImpl.instance.getDlgCancelButtonImage(),
ImageManagerImpl.getInstance().getDlgActiveCancelButtonImage(), ImageManagerImpl.instance.getDlgActiveCancelButtonImage(),
ImageManagerImpl.getInstance().getDlgCancelButtonImage(), ImageManagerImpl.instance.getDlgCancelButtonImage(),
new Rectangle(60, 60)); new Rectangle(60, 60));
int w = getDlgParams().rect.width - 75; int w = getDlgParams().rect.width - 75;
int h = getDlgParams().rect.height - 90; int h = getDlgParams().rect.height - 90;

View file

@ -110,7 +110,7 @@ public class StackDialog extends IDialogPanel {
/** /**
* Display spells and theis targets above them * Display spells and theis targets above them
*/ */
int dx = (SettingsManager.getInstance().getCardSize().width + 15) * (cards.size() - 1); int dx = (SettingsManager.instance.getCardSize().width + 15) * (cards.size() - 1);
int dy = 30; int dy = 30;
for (CardView card : cards.values()) { for (CardView card : cards.values()) {
@ -124,21 +124,21 @@ public class StackDialog extends IDialogPanel {
card = tmp; card = tmp;
} }
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, getCardDimension(), gameId, true, true); MageCard cardImg = Plugins.instance.getMageCard(card, bigCard, getCardDimension(), gameId, true, true);
//cardImg.setBorder(BorderFactory.createLineBorder(Color.red)); //cardImg.setBorder(BorderFactory.createLineBorder(Color.red));
cardImg.setLocation(dx, dy); cardImg.setLocation(dx, dy);
jLayeredPane.add(cardImg, JLayeredPane.DEFAULT_LAYER, 1); jLayeredPane.add(cardImg, JLayeredPane.DEFAULT_LAYER, 1);
dx -= (SettingsManager.getInstance().getCardSize().width + 15); dx -= (SettingsManager.instance.getCardSize().width + 15);
} }
} }
private HoverButton getJButtonAccept() { private HoverButton getJButtonAccept() {
if (jButtonAccept == null) { if (jButtonAccept == null) {
jButtonAccept = new HoverButton("", ImageManagerImpl.getInstance().getDlgAcceptButtonImage(), jButtonAccept = new HoverButton("", ImageManagerImpl.instance.getDlgAcceptButtonImage(),
ImageManagerImpl.getInstance().getDlgActiveAcceptButtonImage(), ImageManagerImpl.instance.getDlgActiveAcceptButtonImage(),
ImageManagerImpl.getInstance().getDlgAcceptButtonImage(), ImageManagerImpl.instance.getDlgAcceptButtonImage(),
new Rectangle(60, 60)); new Rectangle(60, 60));
int w = getDlgParams().rect.width - 90; int w = getDlgParams().rect.width - 90;
int h = getDlgParams().rect.height - 90; int h = getDlgParams().rect.height - 90;
@ -160,9 +160,9 @@ public class StackDialog extends IDialogPanel {
private HoverButton getJButtonResponse() { private HoverButton getJButtonResponse() {
if (jButtonResponse == null) { if (jButtonResponse == null) {
jButtonResponse = new HoverButton("", ImageManagerImpl.getInstance().getDlgCancelButtonImage(), jButtonResponse = new HoverButton("", ImageManagerImpl.instance.getDlgCancelButtonImage(),
ImageManagerImpl.getInstance().getDlgActiveCancelButtonImage(), ImageManagerImpl.instance.getDlgActiveCancelButtonImage(),
ImageManagerImpl.getInstance().getDlgCancelButtonImage(), ImageManagerImpl.instance.getDlgCancelButtonImage(),
new Rectangle(60, 60)); new Rectangle(60, 60));
int w = getDlgParams().rect.width - 90; int w = getDlgParams().rect.width - 90;
int h = getDlgParams().rect.height - 90; int h = getDlgParams().rect.height - 90;

View file

@ -9,9 +9,9 @@ import org.mage.plugins.card.utils.impl.ImageManagerImpl;
/** /**
* @author noxx * @author noxx
*/ */
public class MageTray { public enum MageTray {
private static final MageTray instance = new MageTray(); instance;
private static final Logger log = Logger.getLogger(MageTray.class); private static final Logger log = Logger.getLogger(MageTray.class);
@ -19,11 +19,8 @@ public class MageTray {
private Image flashedImage; private Image flashedImage;
private TrayIcon trayIcon; private TrayIcon trayIcon;
private static int state = 0; private int state = 0;
public static MageTray getInstance() {
return instance;
}
public void install() { public void install() {
if (!SystemTray.isSupported()) { if (!SystemTray.isSupported()) {
@ -32,8 +29,8 @@ public class MageTray {
} }
try { try {
mainImage = ImageManagerImpl.getInstance().getAppSmallImage(); mainImage = ImageManagerImpl.instance.getAppSmallImage();
flashedImage = ImageManagerImpl.getInstance().getAppFlashedImage(); flashedImage = ImageManagerImpl.instance.getAppFlashedImage();
trayIcon = new TrayIcon(mainImage); trayIcon = new TrayIcon(mainImage);
trayIcon.setImageAutoSize(true); trayIcon.setImageAutoSize(true);

View file

@ -55,9 +55,9 @@ public class DeckEditorPane extends MagePane {
public DeckEditorPane() { public DeckEditorPane() {
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
boolean initialized = false; boolean initialized = false;
if (Plugins.getInstance().isThemePluginLoaded()) { if (Plugins.instance.isThemePluginLoaded()) {
Map<String, JComponent> uiMap = new HashMap<>(); Map<String, JComponent> uiMap = new HashMap<>();
JComponent container = Plugins.getInstance().updateTablePanel(uiMap); JComponent container = Plugins.instance.updateTablePanel(uiMap);
if (container != null) { if (container != null) {
deckEditorPanel1 = new mage.client.deckeditor.DeckEditorPanel(); deckEditorPanel1 = new mage.client.deckeditor.DeckEditorPanel();
initComponents(container); initComponents(container);

View file

@ -541,7 +541,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
} }
private void hidePopup() { private void hidePopup() {
Plugins.getInstance().getActionCallback().mouseExited(null, null); Plugins.instance.getActionCallback().mouseExited(null, null);
} }
public void removeDeckEditor() { public void removeDeckEditor() {
@ -631,7 +631,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
bigCard.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); bigCard.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
cardInfoPane = Plugins.getInstance().getCardInfoPane(); cardInfoPane = Plugins.instance.getCardInfoPane();
if (cardInfoPane != null && System.getProperty("testCardInfo") != null) { if (cardInfoPane != null && System.getProperty("testCardInfo") != null) {
cardInfoPane.setPreferredSize(new Dimension(170, 150)); cardInfoPane.setPreferredSize(new Dimension(170, 150));
cardInfoPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(200, 0, 0))); cardInfoPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(200, 0, 0)));

View file

@ -46,9 +46,9 @@ public class CollectionViewerPane extends MagePane {
public CollectionViewerPane() { public CollectionViewerPane() {
boolean initialized = false; boolean initialized = false;
this.setTitle("Collection Viewer"); this.setTitle("Collection Viewer");
if (Plugins.getInstance().isThemePluginLoaded()) { if (Plugins.instance.isThemePluginLoaded()) {
Map<String, JComponent> uiComponents = new HashMap<>(); Map<String, JComponent> uiComponents = new HashMap<>();
JComponent container = Plugins.getInstance().updateTablePanel(uiComponents); JComponent container = Plugins.instance.updateTablePanel(uiComponents);
if (container != null) { if (container != null) {
collectionViewerPanel = new CollectionViewerPanel(); collectionViewerPanel = new CollectionViewerPanel();
initComponents(container); initComponents(container);

View file

@ -185,7 +185,7 @@ public final class CollectionViewerPanel extends JPanel {
} }
private void hidePopup() { private void hidePopup() {
Plugins.getInstance().getActionCallback().mouseExited(null, null); Plugins.instance.getActionCallback().mouseExited(null, null);
} }
public void removeCollectionViewer() { public void removeCollectionViewer() {

View file

@ -236,7 +236,7 @@ public class MageBook extends JComponent {
if (cardDimension == null) { if (cardDimension == null) {
cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight); cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
} }
final MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, cardDimension, gameId, true, true); final MageCard cardImg = Plugins.instance.getMageCard(card, bigCard, cardDimension, gameId, true, true);
cardImg.setBounds(rectangle); cardImg.setBounds(rectangle);
jLayeredPane.add(cardImg, JLayeredPane.DEFAULT_LAYER, 10); jLayeredPane.add(cardImg, JLayeredPane.DEFAULT_LAYER, 10);
cardImg.update(card); cardImg.update(card);

View file

@ -11,7 +11,7 @@ import org.mage.card.arcane.ManaSymbols;
*/ */
public class TestMageBook extends JFrame { public class TestMageBook extends JFrame {
public static void main(String[] args) { public static void main(String[] args) {
Plugins.getInstance().loadPlugins(); Plugins.instance.loadPlugins();
ManaSymbols.loadImages(); ManaSymbols.loadImages();
CardScanner.scan(); CardScanner.scan();
JFrame frame = new TestMageBook(); JFrame frame = new TestMageBook();

View file

@ -406,7 +406,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
CardView card = view.get(row); CardView card = view.get(row);
if (!card.getId().equals(bigCard.getCardId())) { if (!card.getId().equals(bigCard.getCardId())) {
if (!MageFrame.isLite()) { if (!MageFrame.isLite()) {
Image image = Plugins.getInstance().getOriginalImage(card); Image image = Plugins.instance.getOriginalImage(card);
if (image != null && image instanceof BufferedImage) { if (image != null && image instanceof BufferedImage) {
// XXX: scaled to fit width // XXX: scaled to fit width
bigCard.setCard(card.getId(), EnlargeMode.NORMAL, image, new ArrayList<>(), false); bigCard.setCard(card.getId(), EnlargeMode.NORMAL, image, new ArrayList<>(), false);

View file

@ -83,11 +83,11 @@ public class CardInfoWindowDialog extends MageDialog {
this.setModal(false); this.setModal(false);
switch (this.showType) { switch (this.showType) {
case LOOKED_AT: case LOOKED_AT:
this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getLookedAtImage())); this.setFrameIcon(new ImageIcon(ImageManagerImpl.instance.getLookedAtImage()));
this.setClosable(true); this.setClosable(true);
break; break;
case REVEAL: case REVEAL:
this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getRevealedImage())); this.setFrameIcon(new ImageIcon(ImageManagerImpl.instance.getRevealedImage()));
this.setClosable(true); this.setClosable(true);
break; break;
case REVEAL_TOP_LIBRARY: case REVEAL_TOP_LIBRARY:
@ -106,7 +106,7 @@ public class CardInfoWindowDialog extends MageDialog {
}); });
break; break;
case EXILE: case EXILE:
this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getExileImage())); this.setFrameIcon(new ImageIcon(ImageManagerImpl.instance.getExileImage()));
break; break;
default: default:
// no icon yet // no icon yet
@ -189,7 +189,7 @@ public class CardInfoWindowDialog extends MageDialog {
int width = CardInfoWindowDialog.this.getWidth(); int width = CardInfoWindowDialog.this.getWidth();
int height = CardInfoWindowDialog.this.getHeight(); int height = CardInfoWindowDialog.this.getHeight();
if (width > 0 && height > 0) { if (width > 0 && height > 0) {
Point centered = SettingsManager.getInstance().getComponentPosition(width, height); Point centered = SettingsManager.instance.getComponentPosition(width, height);
if (!positioned) { if (!positioned) {
int xPos = centered.x / 2; int xPos = centered.x / 2;
int yPos = centered.y / 2; int yPos = centered.y / 2;

View file

@ -82,7 +82,7 @@ public class PickChoiceDialog extends MageDialog {
mageDialogState.setStateToDialog(this); mageDialogState.setStateToDialog(this);
} else { } else {
Point centered = SettingsManager.getInstance().getComponentPosition(getWidth(), getHeight()); Point centered = SettingsManager.instance.getComponentPosition(getWidth(), getHeight());
this.setLocation(centered.x, centered.y); this.setLocation(centered.x, centered.y);
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this); GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this);
} }

View file

@ -60,7 +60,7 @@ public class PickNumberDialog extends MageDialog {
this.btnCancel.setVisible(false); this.btnCancel.setVisible(false);
this.pack(); this.pack();
Point centered = SettingsManager.getInstance().getComponentPosition(getWidth(), getHeight()); Point centered = SettingsManager.instance.getComponentPosition(getWidth(), getHeight());
this.setLocation(centered.x, centered.y); this.setLocation(centered.x, centered.y);
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this); GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this);

View file

@ -107,7 +107,7 @@ public class PickPileDialog extends MageDialog {
} }
pack(); pack();
Point centered = SettingsManager.getInstance().getComponentPosition(getWidth(), getHeight()); Point centered = SettingsManager.instance.getComponentPosition(getWidth(), getHeight());
this.setLocation(centered.x, centered.y); this.setLocation(centered.x, centered.y);
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this); GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this);

View file

@ -134,7 +134,7 @@ public class ShowCardsDialog extends MageDialog {
int width = ShowCardsDialog.this.getWidth(); int width = ShowCardsDialog.this.getWidth();
int height = ShowCardsDialog.this.getHeight(); int height = ShowCardsDialog.this.getHeight();
if (width > 0 && height > 0) { if (width > 0 && height > 0) {
Point centered = SettingsManager.getInstance().getComponentPosition(width, height); Point centered = SettingsManager.instance.getComponentPosition(width, height);
ShowCardsDialog.this.setLocation(centered.x, centered.y); ShowCardsDialog.this.setLocation(centered.x, centered.y);
positioned = true; positioned = true;
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, ShowCardsDialog.this); GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, ShowCardsDialog.this);

View file

@ -432,12 +432,12 @@ class UpdateSeatsTask extends SwingWorker<Void, TableView> {
if (current != count) { if (current != count) {
if (count > 0) { if (count > 0) {
if (current > count) { if (current > count) {
MageTray.getInstance().displayMessage("New player joined your game."); MageTray.instance.displayMessage("New player joined your game.");
AudioManager.playPlayerJoinedTable(); AudioManager.playPlayerJoinedTable();
} else { } else {
MageTray.getInstance().displayMessage("A player left your game."); MageTray.instance.displayMessage("A player left your game.");
} }
MageTray.getInstance().blink(); MageTray.instance.blink();
} }
count = current; count = current;
} }

View file

@ -52,9 +52,9 @@ public class DraftPane extends MagePane {
*/ */
public DraftPane() { public DraftPane() {
boolean initialized = false; boolean initialized = false;
if (Plugins.getInstance().isThemePluginLoaded()) { if (Plugins.instance.isThemePluginLoaded()) {
Map<String, JComponent> uiComponents = new HashMap<>(); Map<String, JComponent> uiComponents = new HashMap<>();
JComponent container = Plugins.getInstance().updateTablePanel(uiComponents); JComponent container = Plugins.instance.updateTablePanel(uiComponents);
if (container != null) { if (container != null) {
draftPanel1 = new mage.client.draft.DraftPanel(); draftPanel1 = new mage.client.draft.DraftPanel();
initComponents(container); initComponents(container);

View file

@ -328,7 +328,7 @@ public class DraftPanel extends javax.swing.JPanel {
if (view != null) { if (view != null) {
loadCardsToPickedCardsArea(view.getPicks()); loadCardsToPickedCardsArea(view.getPicks());
draftBooster.loadBooster(EMPTY_VIEW, bigCard); draftBooster.loadBooster(EMPTY_VIEW, bigCard);
Plugins.getInstance().getActionCallback().hideOpenComponents(); Plugins.instance.getActionCallback().hideOpenComponents();
setMessage("Waiting for other players"); setMessage("Waiting for other players");
} }
} }
@ -340,8 +340,8 @@ public class DraftPanel extends javax.swing.JPanel {
); );
setMessage("Pick a card"); setMessage("Pick a card");
if (!MageFrame.getInstance().isActive()) { if (!MageFrame.getInstance().isActive()) {
MageTray.getInstance().displayMessage("Pick the next card."); MageTray.instance.displayMessage("Pick the next card.");
MageTray.getInstance().blink(); MageTray.instance.blink();
} }
countdown.stop(); countdown.stop();
this.timeout = draftPickView.getTimeout(); this.timeout = draftPickView.getTimeout();

View file

@ -252,8 +252,8 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
if (cardDimension == null) { if (cardDimension == null) {
cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight); cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
} }
final MagePermanent perm = Plugins.getInstance().getMagePermanent(permanent, bigCard, cardDimension, gameId, true); final MagePermanent perm = Plugins.instance.getMagePermanent(permanent, bigCard, cardDimension, gameId, true);
if (!Plugins.getInstance().isCardPluginLoaded()) { if (!Plugins.instance.isCardPluginLoaded()) {
//perm.setBounds(findEmptySpace(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight))); //perm.setBounds(findEmptySpace(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight)));
} else { } else {
//perm.setAlpha(0); //perm.setAlpha(0);
@ -262,12 +262,12 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
BattlefieldPanel.this.jPanel.add(perm, 10); BattlefieldPanel.this.jPanel.add(perm, 10);
//this.jPanel.add(perm); //this.jPanel.add(perm);
if (!Plugins.getInstance().isCardPluginLoaded()) { if (!Plugins.instance.isCardPluginLoaded()) {
moveToFront(perm); moveToFront(perm);
perm.update(permanent); perm.update(permanent);
} else { } else {
moveToFront(jPanel); moveToFront(jPanel);
Plugins.getInstance().onAddCard(perm, 1); Plugins.instance.onAddCard(perm, 1);
/*Thread t = new Thread(new Runnable() { /*Thread t = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -299,7 +299,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
} else if (comp instanceof MagePermanent) { } else if (comp instanceof MagePermanent) {
if (((MagePermanent) comp).getOriginal().getId().equals(permanentId)) { if (((MagePermanent) comp).getOriginal().getId().equals(permanentId)) {
Thread t = new Thread(() -> { Thread t = new Thread(() -> {
Plugins.getInstance().onRemoveCard((MagePermanent) comp, count); Plugins.instance.onRemoveCard((MagePermanent) comp, count);
comp.setVisible(false); comp.setVisible(false);
BattlefieldPanel.this.jPanel.remove(comp); BattlefieldPanel.this.jPanel.remove(comp);
}); });

View file

@ -219,7 +219,7 @@ public final class GamePanel extends javax.swing.JPanel {
jLayeredBackgroundPane.add(jSplitPane0, JLayeredPane.DEFAULT_LAYER); jLayeredBackgroundPane.add(jSplitPane0, JLayeredPane.DEFAULT_LAYER);
Map<String, JComponent> myUi = getUIComponents(jLayeredBackgroundPane); Map<String, JComponent> myUi = getUIComponents(jLayeredBackgroundPane);
Plugins.getInstance().updateGamePanel(myUi); Plugins.instance.updateGamePanel(myUi);
// Enlarge jlayeredpane on resize of game panel // Enlarge jlayeredpane on resize of game panel
addComponentListener(new ComponentAdapter() { addComponentListener(new ComponentAdapter() {
@ -332,7 +332,7 @@ public final class GamePanel extends javax.swing.JPanel {
pickTargetDialog.cleanUp(); pickTargetDialog.cleanUp();
pickTargetDialog.removeDialog(); pickTargetDialog.removeDialog();
} }
Plugins.getInstance().getActionCallback().hideOpenComponents(); Plugins.instance.getActionCallback().hideOpenComponents();
try { try {
Component popupContainer = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER); Component popupContainer = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER);
popupContainer.setVisible(false); popupContainer.setVisible(false);
@ -839,7 +839,7 @@ public final class GamePanel extends javax.swing.JPanel {
gamePane.setTitle(sb.toString()); gamePane.setTitle(sb.toString());
} }
GameManager.getInstance().setStackSize(game.getStack().size()); GameManager.instance.setStackSize(game.getStack().size());
displayStack(game, bigCard, feedbackPanel, gameId); displayStack(game, bigCard, feedbackPanel, gameId);
for (ExileView exile : game.getExile()) { for (ExileView exile : game.getExile()) {
@ -902,7 +902,7 @@ public final class GamePanel extends javax.swing.JPanel {
this.repaint(); this.repaint();
} }
static final int BORDER_SIZE = 2; private static final int BORDER_SIZE = 2;
private void updateSkipButtons(boolean turn, boolean endOfTurn, boolean nextMain, boolean allTurns, boolean stack, boolean endStepBeforeYourStep) { private void updateSkipButtons(boolean turn, boolean endOfTurn, boolean nextMain, boolean allTurns, boolean stack, boolean endStepBeforeYourStep) {
if (turn) { //F4 if (turn) { //F4
@ -1249,7 +1249,7 @@ public final class GamePanel extends javax.swing.JPanel {
} }
private void hideAll() { private void hideAll() {
ActionCallback callback = Plugins.getInstance().getActionCallback(); ActionCallback callback = Plugins.instance.getActionCallback();
((MageActionCallback) callback).hideGameUpdate(gameId); ((MageActionCallback) callback).hideGameUpdate(gameId);
} }
@ -1442,7 +1442,7 @@ public final class GamePanel extends javax.swing.JPanel {
btnCancelSkip.setContentAreaFilled(false); btnCancelSkip.setContentAreaFilled(false);
btnCancelSkip.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnCancelSkip.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
btnCancelSkip.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getCancelSkipButtonImage())); btnCancelSkip.setIcon(new ImageIcon(ImageManagerImpl.instance.getCancelSkipButtonImage()));
btnCancelSkip.setToolTipText("Cancel all skip actions (" btnCancelSkip.setToolTipText("Cancel all skip actions ("
+ getCachedKeyText(KEY_CONTROL_CANCEL_SKIP) + ")."); + getCachedKeyText(KEY_CONTROL_CANCEL_SKIP) + ").");
btnCancelSkip.setFocusable(false); btnCancelSkip.setFocusable(false);
@ -1457,7 +1457,7 @@ public final class GamePanel extends javax.swing.JPanel {
btnSkipToNextTurn.setContentAreaFilled(false); btnSkipToNextTurn.setContentAreaFilled(false);
btnSkipToNextTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipToNextTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
btnSkipToNextTurn.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipNextTurnButtonImage())); btnSkipToNextTurn.setIcon(new ImageIcon(ImageManagerImpl.instance.getSkipNextTurnButtonImage()));
btnSkipToNextTurn.setToolTipText("Skip to next turn (" btnSkipToNextTurn.setToolTipText("Skip to next turn ("
+ getCachedKeyText(KEY_CONTROL_NEXT_TURN) + ")."); + getCachedKeyText(KEY_CONTROL_NEXT_TURN) + ").");
btnSkipToNextTurn.setFocusable(false); btnSkipToNextTurn.setFocusable(false);
@ -1481,7 +1481,7 @@ public final class GamePanel extends javax.swing.JPanel {
btnSkipToEndTurn.setContentAreaFilled(false); btnSkipToEndTurn.setContentAreaFilled(false);
btnSkipToEndTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipToEndTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
btnSkipToEndTurn.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipEndTurnButtonImage())); btnSkipToEndTurn.setIcon(new ImageIcon(ImageManagerImpl.instance.getSkipEndTurnButtonImage()));
btnSkipToEndTurn.setToolTipText("Skip to (opponents/next) end of turn step (" btnSkipToEndTurn.setToolTipText("Skip to (opponents/next) end of turn step ("
+ getCachedKeyText(KEY_CONTROL_END_STEP) + ") - adjust using preferences."); + getCachedKeyText(KEY_CONTROL_END_STEP) + ") - adjust using preferences.");
btnSkipToEndTurn.setFocusable(false); btnSkipToEndTurn.setFocusable(false);
@ -1514,7 +1514,7 @@ public final class GamePanel extends javax.swing.JPanel {
btnSkipToNextMain.setContentAreaFilled(false); btnSkipToNextMain.setContentAreaFilled(false);
btnSkipToNextMain.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipToNextMain.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
btnSkipToNextMain.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipMainButtonImage())); btnSkipToNextMain.setIcon(new ImageIcon(ImageManagerImpl.instance.getSkipMainButtonImage()));
btnSkipToNextMain.setToolTipText("Skip to (your) next main phase (" btnSkipToNextMain.setToolTipText("Skip to (your) next main phase ("
+ getCachedKeyText(KEY_CONTROL_MAIN_STEP) + ") - adjust using preferences."); + getCachedKeyText(KEY_CONTROL_MAIN_STEP) + ") - adjust using preferences.");
btnSkipToNextMain.setFocusable(false); btnSkipToNextMain.setFocusable(false);
@ -1538,7 +1538,7 @@ public final class GamePanel extends javax.swing.JPanel {
btnSkipToYourTurn.setContentAreaFilled(false); btnSkipToYourTurn.setContentAreaFilled(false);
btnSkipToYourTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipToYourTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
btnSkipToYourTurn.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipYourNextTurnButtonImage())); btnSkipToYourTurn.setIcon(new ImageIcon(ImageManagerImpl.instance.getSkipYourNextTurnButtonImage()));
btnSkipToYourTurn.setToolTipText("Skip to your next turn (" btnSkipToYourTurn.setToolTipText("Skip to your next turn ("
+ getCachedKeyText(KEY_CONTROL_YOUR_TURN) + ")."); + getCachedKeyText(KEY_CONTROL_YOUR_TURN) + ").");
btnSkipToYourTurn.setFocusable(false); btnSkipToYourTurn.setFocusable(false);
@ -1562,7 +1562,7 @@ public final class GamePanel extends javax.swing.JPanel {
btnSkipToEndStepBeforeYourTurn.setContentAreaFilled(false); btnSkipToEndStepBeforeYourTurn.setContentAreaFilled(false);
btnSkipToEndStepBeforeYourTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipToEndStepBeforeYourTurn.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
btnSkipToEndStepBeforeYourTurn.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipEndStepBeforeYourTurnButtonImage())); btnSkipToEndStepBeforeYourTurn.setIcon(new ImageIcon(ImageManagerImpl.instance.getSkipEndStepBeforeYourTurnButtonImage()));
btnSkipToEndStepBeforeYourTurn.setToolTipText("Skip to the end step before your turn (" btnSkipToEndStepBeforeYourTurn.setToolTipText("Skip to the end step before your turn ("
+ getCachedKeyText(KEY_CONTROL_PRIOR_END) + ") - adjust using preferences."); + getCachedKeyText(KEY_CONTROL_PRIOR_END) + ") - adjust using preferences.");
btnSkipToEndStepBeforeYourTurn.setFocusable(false); btnSkipToEndStepBeforeYourTurn.setFocusable(false);
@ -1586,7 +1586,7 @@ public final class GamePanel extends javax.swing.JPanel {
btnSkipStack.setContentAreaFilled(false); btnSkipStack.setContentAreaFilled(false);
btnSkipStack.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnSkipStack.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
btnSkipStack.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipStackButtonImage())); btnSkipStack.setIcon(new ImageIcon(ImageManagerImpl.instance.getSkipStackButtonImage()));
btnSkipStack.setToolTipText("Skip until stack is resolved (" btnSkipStack.setToolTipText("Skip until stack is resolved ("
+ getCachedKeyText(KEY_CONTROL_SKIP_STACK) + ")."); + getCachedKeyText(KEY_CONTROL_SKIP_STACK) + ").");
btnSkipStack.setFocusable(false); btnSkipStack.setFocusable(false);
@ -1610,7 +1610,7 @@ public final class GamePanel extends javax.swing.JPanel {
btnConcede.setContentAreaFilled(false); btnConcede.setContentAreaFilled(false);
btnConcede.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); btnConcede.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
btnConcede.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getConcedeButtonImage())); btnConcede.setIcon(new ImageIcon(ImageManagerImpl.instance.getConcedeButtonImage()));
btnConcede.setToolTipText("Concede the current game."); btnConcede.setToolTipText("Concede the current game.");
btnConcede.setFocusable(false); btnConcede.setFocusable(false);
btnConcede.addMouseListener(new MouseAdapter() { btnConcede.addMouseListener(new MouseAdapter() {
@ -1638,7 +1638,7 @@ public final class GamePanel extends javax.swing.JPanel {
this.getActionMap().put("ENLARGE", new AbstractAction() { this.getActionMap().put("ENLARGE", new AbstractAction() {
@Override @Override
public void actionPerformed(ActionEvent actionEvent) { public void actionPerformed(ActionEvent actionEvent) {
ActionCallback callback = Plugins.getInstance().getActionCallback(); ActionCallback callback = Plugins.instance.getActionCallback();
((MageActionCallback) callback).enlargeCard(EnlargeMode.NORMAL); ((MageActionCallback) callback).enlargeCard(EnlargeMode.NORMAL);
} }
}); });
@ -1648,7 +1648,7 @@ public final class GamePanel extends javax.swing.JPanel {
this.getActionMap().put("ENLARGE_SOURCE", new AbstractAction() { this.getActionMap().put("ENLARGE_SOURCE", new AbstractAction() {
@Override @Override
public void actionPerformed(ActionEvent actionEvent) { public void actionPerformed(ActionEvent actionEvent) {
ActionCallback callback = Plugins.getInstance().getActionCallback(); ActionCallback callback = Plugins.instance.getActionCallback();
((MageActionCallback) callback).enlargeCard(EnlargeMode.ALTERNATE); ((MageActionCallback) callback).enlargeCard(EnlargeMode.ALTERNATE);
} }
}); });
@ -1697,7 +1697,7 @@ public final class GamePanel extends javax.swing.JPanel {
this.getActionMap().put("ENLARGE_RELEASE", new AbstractAction() { this.getActionMap().put("ENLARGE_RELEASE", new AbstractAction() {
@Override @Override
public void actionPerformed(ActionEvent actionEvent) { public void actionPerformed(ActionEvent actionEvent) {
ActionCallback callback = Plugins.getInstance().getActionCallback(); ActionCallback callback = Plugins.instance.getActionCallback();
((MageActionCallback) callback).hideEnlargedCard(); ((MageActionCallback) callback).hideEnlargedCard();
} }
}); });
@ -1718,7 +1718,7 @@ public final class GamePanel extends javax.swing.JPanel {
btnSwitchHands.setContentAreaFilled(false); btnSwitchHands.setContentAreaFilled(false);
btnSwitchHands.setBorder(new EmptyBorder(0, 0, 0, 0)); btnSwitchHands.setBorder(new EmptyBorder(0, 0, 0, 0));
btnSwitchHands.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSwitchHandsButtonImage())); btnSwitchHands.setIcon(new ImageIcon(ImageManagerImpl.instance.getSwitchHandsButtonImage()));
btnSwitchHands.setFocusable(false); btnSwitchHands.setFocusable(false);
btnSwitchHands.setToolTipText("Switch between your hand cards and hand cards of controlled players."); btnSwitchHands.setToolTipText("Switch between your hand cards and hand cards of controlled players.");
btnSwitchHands.addMouseListener(new MouseAdapter() { btnSwitchHands.addMouseListener(new MouseAdapter() {
@ -1732,7 +1732,7 @@ public final class GamePanel extends javax.swing.JPanel {
btnStopWatching.setContentAreaFilled(false); btnStopWatching.setContentAreaFilled(false);
btnStopWatching.setBorder(new EmptyBorder(0, 0, 0, 0)); btnStopWatching.setBorder(new EmptyBorder(0, 0, 0, 0));
btnStopWatching.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getStopWatchButtonImage())); btnStopWatching.setIcon(new ImageIcon(ImageManagerImpl.instance.getStopWatchButtonImage()));
btnStopWatching.setFocusable(false); btnStopWatching.setFocusable(false);
btnStopWatching.setToolTipText("Stop watching this game."); btnStopWatching.setToolTipText("Stop watching this game.");
btnStopWatching.addMouseListener(new MouseAdapter() { btnStopWatching.addMouseListener(new MouseAdapter() {
@ -2192,7 +2192,7 @@ public final class GamePanel extends javax.swing.JPanel {
hoverButtons = new LinkedHashMap<>(); hoverButtons = new LinkedHashMap<>();
} }
Rectangle rect = new Rectangle(36, 36); Rectangle rect = new Rectangle(36, 36);
HoverButton button = new HoverButton("", ImageManagerImpl.getInstance().getPhaseImage(name), rect); HoverButton button = new HoverButton("", ImageManagerImpl.instance.getPhaseImage(name), rect);
button.setToolTipText(name.replaceAll("_", " ")); button.setToolTipText(name.replaceAll("_", " "));
button.setPreferredSize(new Dimension(36, 36)); button.setPreferredSize(new Dimension(36, 36));
button.addMouseListener(mouseAdapter); button.addMouseListener(mouseAdapter);

View file

@ -106,7 +106,7 @@ public class MageActionCallback implements ActionCallback {
public synchronized void refreshSession() { public synchronized void refreshSession() {
if (cardInfoPane == null) { if (cardInfoPane == null) {
cardInfoPane = Plugins.getInstance().getCardInfoPane(); cardInfoPane = Plugins.instance.getCardInfoPane();
} }
} }
@ -268,7 +268,7 @@ public class MageActionCallback implements ActionCallback {
@Override @Override
public void mouseMoved(MouseEvent e, TransferData transferData) { public void mouseMoved(MouseEvent e, TransferData transferData) {
if (!Plugins.getInstance().isCardPluginLoaded()) { if (!Plugins.instance.isCardPluginLoaded()) {
return; return;
} }
if (!popupData.card.equals(transferData.card)) { if (!popupData.card.equals(transferData.card)) {

View file

@ -8,6 +8,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import javax.swing.JComponent; import javax.swing.JComponent;
import mage.cards.MageCard; import mage.cards.MageCard;
import mage.cards.MagePermanent; import mage.cards.MagePermanent;
import mage.cards.action.ActionCallback; import mage.cards.action.ActionCallback;
@ -31,11 +32,10 @@ import org.apache.log4j.Logger;
import org.mage.plugins.card.CardPluginImpl; import org.mage.plugins.card.CardPluginImpl;
import org.mage.plugins.theme.ThemePluginImpl; import org.mage.plugins.theme.ThemePluginImpl;
public class Plugins implements MagePlugins { public enum Plugins implements MagePlugins {
instance;
public static final String PLUGINS_DIRECTORY = "plugins/"; public static final String PLUGINS_DIRECTORY = "plugins/";
private static final MagePlugins instance = new Plugins();
private static final Logger LOGGER = Logger.getLogger(Plugins.class); private static final Logger LOGGER = Logger.getLogger(Plugins.class);
private static PluginManager pm; private static PluginManager pm;
@ -45,9 +45,6 @@ public class Plugins implements MagePlugins {
private static final MageActionCallback mageActionCallback = new MageActionCallback(); private static final MageActionCallback mageActionCallback = new MageActionCallback();
private final Map<String, String> sortingOptions = new HashMap<>(); private final Map<String, String> sortingOptions = new HashMap<>();
public static MagePlugins getInstance() {
return instance;
}
@Override @Override
public void loadPlugins() { public void loadPlugins() {

View file

@ -87,7 +87,7 @@ public class CallbackClientImpl implements CallbackClient {
switch (callback.getMethod()) { switch (callback.getMethod()) {
case "startGame": { case "startGame": {
TableClientMessage message = (TableClientMessage) callback.getData(); TableClientMessage message = (TableClientMessage) callback.getData();
GameManager.getInstance().setCurrentPlayerUUID(message.getPlayerId()); GameManager.instance.setCurrentPlayerUUID(message.getPlayerId());
gameStarted(message.getGameId(), message.getPlayerId()); gameStarted(message.getGameId(), message.getPlayerId());
break; break;
} }
@ -457,8 +457,8 @@ public class CallbackClientImpl implements CallbackClient {
handleException(ex); handleException(ex);
} }
if (Plugins.getInstance().isCounterPluginLoaded()) { if (Plugins.instance.isCounterPluginLoaded()) {
Plugins.getInstance().addGamesPlayed(); Plugins.instance.addGamesPlayed();
} }
} }

View file

@ -45,9 +45,9 @@ public class TablesPane extends MagePane {
*/ */
public TablesPane() { public TablesPane() {
boolean initialized = false; boolean initialized = false;
if (Plugins.getInstance().isThemePluginLoaded()) { if (Plugins.instance.isThemePluginLoaded()) {
tablesPanel = new mage.client.table.TablesPanel(); tablesPanel = new mage.client.table.TablesPanel();
JComponent container = Plugins.getInstance().updateTablePanel(tablesPanel.getUIComponents()); JComponent container = Plugins.instance.updateTablePanel(tablesPanel.getUIComponents());
if (container != null) { if (container != null) {
initComponents(container); initComponents(container);
container.add(tablesPanel); container.add(tablesPanel);

View file

@ -7,12 +7,8 @@ import java.util.UUID;
* *
* @author nantuko * @author nantuko
*/ */
public class GameManager { public enum GameManager {
private static final GameManager instance = new GameManager(); instance;
public static GameManager getInstance() {
return instance;
}
public void setStackSize(int stackSize) { public void setStackSize(int stackSize) {
this.stackSize = stackSize; this.stackSize = stackSize;

View file

@ -9,12 +9,8 @@ import org.mage.card.arcane.CardPanel;
* *
* @author nantuko * @author nantuko
*/ */
public class SettingsManager { public enum SettingsManager {
private static final SettingsManager instance = new SettingsManager(); instance;
public static SettingsManager getInstance() {
return instance;
}
public int getScreenWidth() { public int getScreenWidth() {
return screenWidth; return screenWidth;

View file

@ -35,7 +35,7 @@ public class OldCardLayoutStrategy implements CardLayoutStrategy {
Map<UUID, MagePermanent> permanents = battlefieldPanel.getPermanents(); Map<UUID, MagePermanent> permanents = battlefieldPanel.getPermanents();
JLayeredPane jPanel = battlefieldPanel.getMainPanel(); JLayeredPane jPanel = battlefieldPanel.getMainPanel();
int height = Plugins.getInstance().sortPermanents(battlefieldPanel.getUiComponentsList(), permanents.values(), battlefieldPanel.isTopPanelBattlefield()); int height = Plugins.instance.sortPermanents(battlefieldPanel.getUiComponentsList(), permanents.values(), battlefieldPanel.isTopPanelBattlefield());
jPanel.setPreferredSize(new Dimension(width - 30, height)); jPanel.setPreferredSize(new Dimension(width - 30, height));
for (PermanentView permanent : battlefieldPanel.getBattlefield().values()) { for (PermanentView permanent : battlefieldPanel.getBattlefield().values()) {
@ -54,7 +54,7 @@ public class OldCardLayoutStrategy implements CardLayoutStrategy {
int position = jLayeredPane.getPosition(perm); int position = jLayeredPane.getPosition(perm);
perm.getLinks().clear(); perm.getLinks().clear();
Rectangle rectangleBaseCard = perm.getBounds(); Rectangle rectangleBaseCard = perm.getBounds();
if (!Plugins.getInstance().isCardPluginLoaded()) { if (!Plugins.instance.isCardPluginLoaded()) {
for (UUID attachmentId : permanent.getAttachments()) { for (UUID attachmentId : permanent.getAttachments()) {
MagePermanent link = permanents.get(attachmentId); MagePermanent link = permanents.get(attachmentId);
if (link != null) { if (link != null) {

View file

@ -136,7 +136,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
dayNightButton = new JButton(""); dayNightButton = new JButton("");
dayNightButton.setSize(32, 32); dayNightButton.setSize(32, 32);
dayNightButton.setToolTipText("This permanent is a double faced card. To see the back face card, push this button or turn mouse wheel down while hovering with the mouse pointer over the permanent."); dayNightButton.setToolTipText("This permanent is a double faced card. To see the back face card, push this button or turn mouse wheel down while hovering with the mouse pointer over the permanent.");
BufferedImage day = ImageManagerImpl.getInstance().getDayImage(); BufferedImage day = ImageManagerImpl.instance.getDayImage();
dayNightButton.setIcon(new ImageIcon(day)); dayNightButton.setIcon(new ImageIcon(day));
dayNightButton.addActionListener(e -> { dayNightButton.addActionListener(e -> {
// if card is being rotated, ignore action performed // if card is being rotated, ignore action performed
@ -159,9 +159,9 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
showCopySourceButton.setSize(32, 32); showCopySourceButton.setSize(32, 32);
showCopySourceButton.setToolTipText("This permanent is copying a target. To see original card, push this button or turn mouse wheel down while hovering with the mouse pointer over the permanent."); showCopySourceButton.setToolTipText("This permanent is copying a target. To see original card, push this button or turn mouse wheel down while hovering with the mouse pointer over the permanent.");
showCopySourceButton.setVisible(((PermanentView) this.gameCard).isCopy()); showCopySourceButton.setVisible(((PermanentView) this.gameCard).isCopy());
showCopySourceButton.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getCopyInformIconImage())); showCopySourceButton.setIcon(new ImageIcon(ImageManagerImpl.instance.getCopyInformIconImage()));
showCopySourceButton.addActionListener(e -> { showCopySourceButton.addActionListener(e -> {
ActionCallback callback1 = Plugins.getInstance().getActionCallback(); ActionCallback callback1 = Plugins.instance.getActionCallback();
((MageActionCallback) callback1).enlargeCard(EnlargeMode.COPY); ((MageActionCallback) callback1).enlargeCard(EnlargeMode.COPY);
}); });
@ -553,9 +553,9 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
if (card.canTransform()) { if (card.canTransform()) {
BufferedImage transformIcon; BufferedImage transformIcon;
if (isTransformed() || card.isTransformed()) { if (isTransformed() || card.isTransformed()) {
transformIcon = ImageManagerImpl.getInstance().getNightImage(); transformIcon = ImageManagerImpl.instance.getNightImage();
} else { } else {
transformIcon = ImageManagerImpl.getInstance().getDayImage(); transformIcon = ImageManagerImpl.instance.getDayImage();
} }
if (dayNightButton != null) { if (dayNightButton != null) {
dayNightButton.setVisible(!isPermanent); dayNightButton.setVisible(!isPermanent);
@ -763,7 +763,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
this.transformed = !this.transformed; this.transformed = !this.transformed;
if (transformed) { if (transformed) {
if (dayNightButton != null) { // if transformbable card is copied, button can be null if (dayNightButton != null) { // if transformbable card is copied, button can be null
BufferedImage night = ImageManagerImpl.getInstance().getNightImage(); BufferedImage night = ImageManagerImpl.instance.getNightImage();
dayNightButton.setIcon(new ImageIcon(night)); dayNightButton.setIcon(new ImageIcon(night));
} }
if (this.gameCard.getSecondCardFace() == null) { if (this.gameCard.getSecondCardFace() == null) {
@ -776,7 +776,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
} }
} else { } else {
if (dayNightButton != null) { // if transformbable card is copied, button can be null if (dayNightButton != null) { // if transformbable card is copied, button can be null
BufferedImage day = ImageManagerImpl.getInstance().getDayImage(); BufferedImage day = ImageManagerImpl.instance.getDayImage();
dayNightButton.setIcon(new ImageIcon(day)); dayNightButton.setIcon(new ImageIcon(day));
} }
if (!isPermanent) { // use only for custom transformation (when pressing day-night button) if (!isPermanent) { // use only for custom transformation (when pressing day-night button)

View file

@ -207,15 +207,15 @@ public class CardPanelComponentImpl extends CardPanel {
// Ability icon // Ability icon
if (newGameCard.isAbility()) { if (newGameCard.isAbility()) {
if (newGameCard.getAbilityType() == AbilityType.TRIGGERED) { if (newGameCard.getAbilityType() == AbilityType.TRIGGERED) {
setTypeIcon(ImageManagerImpl.getInstance().getTriggeredAbilityImage(), "Triggered Ability"); setTypeIcon(ImageManagerImpl.instance.getTriggeredAbilityImage(), "Triggered Ability");
} else if (newGameCard.getAbilityType() == AbilityType.ACTIVATED) { } else if (newGameCard.getAbilityType() == AbilityType.ACTIVATED) {
setTypeIcon(ImageManagerImpl.getInstance().getActivatedAbilityImage(), "Activated Ability"); setTypeIcon(ImageManagerImpl.instance.getActivatedAbilityImage(), "Activated Ability");
} }
} }
// Token icon // Token icon
if (this.gameCard.isToken()) { if (this.gameCard.isToken()) {
setTypeIcon(ImageManagerImpl.getInstance().getTokenIconImage(), "Token Permanent"); setTypeIcon(ImageManagerImpl.instance.getTokenIconImage(), "Token Permanent");
} }
displayTitleAnyway = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_CARD_NAMES, "true").equals("true"); displayTitleAnyway = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_CARD_NAMES, "true").equals("true");
@ -243,7 +243,7 @@ public class CardPanelComponentImpl extends CardPanel {
add(ptText); add(ptText);
// Sickness overlay // Sickness overlay
BufferedImage sickness = ImageManagerImpl.getInstance().getSicknessImage(); BufferedImage sickness = ImageManagerImpl.instance.getSicknessImage();
overlayPanel = new ImagePanel(sickness, ImagePanelStyle.SCALED); overlayPanel = new ImagePanel(sickness, ImagePanelStyle.SCALED);
overlayPanel.setOpaque(false); overlayPanel.setOpaque(false);
add(overlayPanel); add(overlayPanel);
@ -620,21 +620,21 @@ public class CardPanelComponentImpl extends CardPanel {
case "+1/+1": case "+1/+1":
if (counterView.getCount() != plusCounter) { if (counterView.getCount() != plusCounter) {
plusCounter = counterView.getCount(); plusCounter = counterView.getCount();
plusCounterLabel.setIcon(getCounterImageWithAmount(plusCounter, ImageManagerImpl.getInstance().getCounterImageGreen(), getCardWidth())); plusCounterLabel.setIcon(getCounterImageWithAmount(plusCounter, ImageManagerImpl.instance.getCounterImageGreen(), getCardWidth()));
} }
plusCounterLabel.setVisible(true); plusCounterLabel.setVisible(true);
break; break;
case "-1/-1": case "-1/-1":
if (counterView.getCount() != minusCounter) { if (counterView.getCount() != minusCounter) {
minusCounter = counterView.getCount(); minusCounter = counterView.getCount();
minusCounterLabel.setIcon(getCounterImageWithAmount(minusCounter, ImageManagerImpl.getInstance().getCounterImageRed(), getCardWidth())); minusCounterLabel.setIcon(getCounterImageWithAmount(minusCounter, ImageManagerImpl.instance.getCounterImageRed(), getCardWidth()));
} }
minusCounterLabel.setVisible(true); minusCounterLabel.setVisible(true);
break; break;
case "loyalty": case "loyalty":
if (counterView.getCount() != loyaltyCounter) { if (counterView.getCount() != loyaltyCounter) {
loyaltyCounter = counterView.getCount(); loyaltyCounter = counterView.getCount();
loyaltyCounterLabel.setIcon(getCounterImageWithAmount(loyaltyCounter, ImageManagerImpl.getInstance().getCounterImageViolet(), getCardWidth())); loyaltyCounterLabel.setIcon(getCounterImageWithAmount(loyaltyCounter, ImageManagerImpl.instance.getCounterImageViolet(), getCardWidth()));
} }
loyaltyCounterLabel.setVisible(true); loyaltyCounterLabel.setVisible(true);
break; break;
@ -643,7 +643,7 @@ public class CardPanelComponentImpl extends CardPanel {
name = counterView.getName(); name = counterView.getName();
otherCounter = counterView.getCount(); otherCounter = counterView.getCount();
otherCounterLabel.setToolTipText(name); otherCounterLabel.setToolTipText(name);
otherCounterLabel.setIcon(getCounterImageWithAmount(otherCounter, ImageManagerImpl.getInstance().getCounterImageGrey(), getCardWidth())); otherCounterLabel.setIcon(getCounterImageWithAmount(otherCounter, ImageManagerImpl.instance.getCounterImageGrey(), getCardWidth()));
otherCounterLabel.setVisible(true); otherCounterLabel.setVisible(true);
} }
} }

View file

@ -17,15 +17,11 @@ import mage.client.util.gui.BufferedImageBuilder;
import org.mage.plugins.card.utils.ImageManager; import org.mage.plugins.card.utils.ImageManager;
import org.mage.plugins.card.utils.Transparency; import org.mage.plugins.card.utils.Transparency;
public class ImageManagerImpl implements ImageManager { public enum ImageManagerImpl implements ImageManager {
instance;
private static final ImageManagerImpl instance = new ImageManagerImpl();
public static ImageManagerImpl getInstance() { ImageManagerImpl() {
return instance;
}
public ImageManagerImpl() {
init(); init();
} }