mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Sonar fixes 19022019
This commit is contained in:
parent
872eea7326
commit
056226d83c
385 changed files with 472 additions and 475 deletions
|
|
@ -1260,7 +1260,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
for (CardView card : stack) {
|
||||
boolean s = card.isSelected() | card.getCardTypes().contains(cardType);
|
||||
boolean s = card.isSelected() || card.getCardTypes().contains(cardType);
|
||||
card.setSelected(s);
|
||||
cardViews.get(card.getId()).update(card);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class MageRoundPane extends JPanel {
|
|||
IMAGE_CACHE = ImageCaches.register(new MapMaker().softValues().makeComputingMap((Function<Key, BufferedImage>) key -> createImage(key)));
|
||||
}
|
||||
|
||||
private final static class ShadowKey {
|
||||
private static final class ShadowKey {
|
||||
|
||||
final int width;
|
||||
final int height;
|
||||
|
|
@ -76,7 +76,7 @@ public class MageRoundPane extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
private final static class Key {
|
||||
private static final class Key {
|
||||
|
||||
final int width;
|
||||
final int height;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import java.util.UUID;
|
|||
public class DialogManager extends JComponent implements MouseListener,
|
||||
MouseMotionListener {
|
||||
|
||||
private final static Map<UUID, DialogManager> dialogManagers = new HashMap<>();
|
||||
private static final Map<UUID, DialogManager> dialogManagers = new HashMap<>();
|
||||
|
||||
public static DialogManager getManager(UUID gameId) {
|
||||
if (!dialogManagers.containsKey(gameId)) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import mage.view.CardsView;
|
|||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
|
@ -26,9 +27,9 @@ public class DlgParams {
|
|||
private int playerID;
|
||||
|
||||
private CardsView cards;
|
||||
private ArrayList<String> stringList;
|
||||
private java.util.List<String> stringList;
|
||||
//private ArrayList<DeckInfo> deckList;
|
||||
private ArrayList<Object> objectList;
|
||||
private java.util.List<Object> objectList;
|
||||
|
||||
private String title;
|
||||
private int opponentID;
|
||||
|
|
@ -38,7 +39,7 @@ public class DlgParams {
|
|||
|
||||
boolean isAI = false;
|
||||
|
||||
public HashSet<String> manaChoices = new HashSet<>();
|
||||
public Set<String> manaChoices = new HashSet<>();
|
||||
|
||||
public int getPlayerID() {
|
||||
return playerID;
|
||||
|
|
@ -74,11 +75,11 @@ public class DlgParams {
|
|||
this.message = message;
|
||||
}
|
||||
|
||||
public HashSet<String> getManaChoices() {
|
||||
public Set<String> getManaChoices() {
|
||||
return manaChoices;
|
||||
}
|
||||
|
||||
public void setManaChoices(HashSet<String> manaChoices) {
|
||||
public void setManaChoices(Set<String> manaChoices) {
|
||||
this.manaChoices = manaChoices;
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +99,7 @@ public class DlgParams {
|
|||
this.isChooseAbility = isChooseAbility;
|
||||
}
|
||||
|
||||
public ArrayList<String> getStringList() {
|
||||
public java.util.List<String> getStringList() {
|
||||
return stringList;
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +115,7 @@ public class DlgParams {
|
|||
this.deckList = deckList;
|
||||
}*/
|
||||
|
||||
public ArrayList<Object> getObjectList() {
|
||||
public java.util.List<Object> getObjectList() {
|
||||
return objectList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import java.awt.*;
|
|||
/**
|
||||
* @author mw, noxx
|
||||
*/
|
||||
abstract public class IDialogPanel extends JXPanel {
|
||||
public abstract class IDialogPanel extends JXPanel {
|
||||
|
||||
private DlgParams params;
|
||||
private Dimension cardDimension;
|
||||
|
|
|
|||
|
|
@ -50,11 +50,12 @@ public class ChoiceDialog extends IDialogPanel {
|
|||
private boolean isCancelStopsPlaying = true;
|
||||
|
||||
private final DlgParams params;
|
||||
|
||||
|
||||
private final String title;
|
||||
|
||||
/**
|
||||
* This is the default constructor
|
||||
*
|
||||
* @param params
|
||||
* @param title
|
||||
*/
|
||||
|
|
@ -130,18 +131,18 @@ public class ChoiceDialog extends IDialogPanel {
|
|||
return;
|
||||
}
|
||||
|
||||
ArrayList<Component> toRemove = new ArrayList<>();
|
||||
java.util.List<Component> toRemove = new ArrayList<>();
|
||||
for (int i = getComponentCount() - 1; i > 0; i--) {
|
||||
Component o = getComponent(i);
|
||||
if (o instanceof MageCard) {
|
||||
toRemove.add(o);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < toRemove.size(); i++) {
|
||||
remove(toRemove.get(i));
|
||||
for (Component aToRemove : toRemove) {
|
||||
remove(aToRemove);
|
||||
}
|
||||
|
||||
ArrayList<CardView> cardList = new ArrayList<>(cards.values());
|
||||
java.util.List<CardView> cardList = new ArrayList<>(cards.values());
|
||||
|
||||
int width = SettingsManager.instance.getCardSize().width;
|
||||
int height = SettingsManager.instance.getCardSize().height;
|
||||
|
|
@ -163,7 +164,7 @@ public class ChoiceDialog extends IDialogPanel {
|
|||
CardView card = cardList.get(i);
|
||||
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);
|
||||
|
||||
dx += (width + 20);
|
||||
|
|
@ -237,11 +238,8 @@ public class ChoiceDialog extends IDialogPanel {
|
|||
int h = getDlgParams().rect.height - 90;
|
||||
jButtonNextPage.setBounds(new Rectangle(w / 2 + 45, h - 50, 60, 60));
|
||||
|
||||
if (maxPages > 1) {
|
||||
jButtonNextPage.setVisible(true);
|
||||
} else {
|
||||
jButtonNextPage.setVisible(false);
|
||||
}
|
||||
jButtonNextPage.setVisible(maxPages > 1);
|
||||
|
||||
|
||||
jButtonNextPage.setObserver(new Command() {
|
||||
private static final long serialVersionUID = -3174360416099554104L;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ public enum MageTray {
|
|||
tray.add(trayIcon);
|
||||
} catch (AWTException e) {
|
||||
log.error("TrayIcon could not be added: ", e);
|
||||
return;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
package mage.client.deck.generator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public enum DeckGeneratorCMC {
|
||||
|
||||
|
|
@ -51,11 +52,11 @@ public enum DeckGeneratorCMC {
|
|||
this.poolCMCs40 = CMCs40;
|
||||
}
|
||||
|
||||
public ArrayList<CMC> get40CardPoolCMC() {
|
||||
public List<CMC> get40CardPoolCMC() {
|
||||
return this.poolCMCs40;
|
||||
}
|
||||
|
||||
public ArrayList<CMC> get60CardPoolCMC() {
|
||||
public List<CMC> get60CardPoolCMC() {
|
||||
return this.poolCMCs60;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ public class RatioAdjustingSliderPanel extends JPanel {
|
|||
|
||||
private static JLabel createChangingPercentageLabel(final JSlider slider) {
|
||||
|
||||
final JLabel label = new JLabel(" " + String.valueOf(slider.getValue()) + '%');
|
||||
final JLabel label = new JLabel(" " + slider.getValue() + '%');
|
||||
|
||||
slider.addChangeListener(e -> {
|
||||
String value = String.valueOf(slider.getValue());
|
||||
|
|
|
|||
|
|
@ -357,9 +357,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
for (int itemIndex : choiseValue) {
|
||||
|
||||
java.util.List<String> listReceived = ConstructedFormats.getSetsByFormat(x.getElementAt(itemIndex).toString());
|
||||
listReceived.stream().filter((item) -> (setCodes.contains(item) == false)).forEachOrdered((item) -> {
|
||||
setCodes.add(item);
|
||||
});
|
||||
listReceived.stream().filter(item -> !setCodes.contains(item)).forEachOrdered(setCodes::add);
|
||||
}
|
||||
criteria.setCodes(setCodes.toArray(new String[0]));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
public int dividerLocationLimited;
|
||||
public int dividerLocationNormal;
|
||||
|
||||
private final static Pattern parser = Pattern.compile("([^|]*)\\|([^|]*)\\|([^|]*)\\|([^|]*)");
|
||||
private static final Pattern parser = Pattern.compile("([^|]*)\\|([^|]*)\\|([^|]*)\\|([^|]*)");
|
||||
|
||||
public static Settings parse(String s) {
|
||||
Matcher m = parser.matcher(s);
|
||||
|
|
|
|||
|
|
@ -1119,12 +1119,12 @@ class ImportFilter extends FileFilter {
|
|||
ext = s.substring(i + 1).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
if (ext != null) {
|
||||
if (ext.toLowerCase(Locale.ENGLISH).equals("dec")
|
||||
|| ext.toLowerCase(Locale.ENGLISH).equals("mwdeck")
|
||||
|| ext.toLowerCase(Locale.ENGLISH).equals("txt")
|
||||
|| ext.toLowerCase(Locale.ENGLISH).equals("dek")
|
||||
|| ext.toLowerCase(Locale.ENGLISH).equals("cod")
|
||||
|| ext.toLowerCase(Locale.ENGLISH).equals("o8d")) {
|
||||
if (ext.equalsIgnoreCase("dec")
|
||||
|| ext.equalsIgnoreCase("mwdeck")
|
||||
|| ext.equalsIgnoreCase("txt")
|
||||
|| ext.equalsIgnoreCase("dek")
|
||||
|| ext.equalsIgnoreCase("cod")
|
||||
|| ext.equalsIgnoreCase("o8d")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import mage.client.dialog.PreferencesDialog;
|
|||
|
||||
public class SortSettingBase extends SortSetting {
|
||||
|
||||
private final static SortSettingBase instance = new SortSettingBase();
|
||||
private static final SortSettingBase instance = new SortSettingBase();
|
||||
|
||||
public static SortSettingBase getInstance() {
|
||||
return instance;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import mage.client.dialog.PreferencesDialog;
|
|||
|
||||
public class SortSettingDeck extends SortSetting {
|
||||
|
||||
private final static SortSettingDeck instance = new SortSettingDeck();
|
||||
private static final SortSettingDeck instance = new SortSettingDeck();
|
||||
|
||||
public static SortSettingDeck getInstance() {
|
||||
return instance;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import mage.client.dialog.PreferencesDialog;
|
|||
*/
|
||||
public class SortSettingDraft extends SortSetting {
|
||||
|
||||
private final static SortSettingDraft instance = new SortSettingDraft();
|
||||
private static final SortSettingDraft instance = new SortSettingDraft();
|
||||
|
||||
public static SortSettingDraft getInstance() {
|
||||
return instance;
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ public class MageBook extends JComponent {
|
|||
public int showTokens() {
|
||||
jLayeredPane.removeAll();
|
||||
List<Token> tokens = getTokens(currentPage, currentSet);
|
||||
if (tokens != null && tokens.size() > 0) {
|
||||
if (tokens != null && !tokens.isEmpty()) {
|
||||
int size = tokens.size();
|
||||
Rectangle rectangle = new Rectangle();
|
||||
rectangle.translate(OFFSET_X, OFFSET_Y);
|
||||
|
|
@ -295,7 +295,7 @@ public class MageBook extends JComponent {
|
|||
public int showEmblems(int numTokens) {
|
||||
List<Emblem> emblems = getEmblems(currentPage, currentSet, numTokens);
|
||||
int numEmblems = 0;
|
||||
if (emblems != null && emblems.size() > 0) {
|
||||
if (emblems != null && !emblems.isEmpty()) {
|
||||
int size = emblems.size();
|
||||
numEmblems = size;
|
||||
Rectangle rectangle = new Rectangle();
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class RandomPacksSelectorDialog extends javax.swing.JDialog {
|
|||
private boolean isRandomDraft;
|
||||
private boolean isRichManDraft;
|
||||
private String title = "";
|
||||
public final static String randomDraftDescription = ("The selected packs will be randomly distributed to players. Each player may open different packs. Duplicates will be avoided.");
|
||||
public static final String randomDraftDescription = ("The selected packs will be randomly distributed to players. Each player may open different packs. Duplicates will be avoided.");
|
||||
|
||||
public RandomPacksSelectorDialog(boolean isRandomDraft, boolean isRichManDraft) {
|
||||
initComponents();
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ import org.mage.card.arcane.CardRenderer;
|
|||
public final class GUISizeHelper {
|
||||
|
||||
// relate the native image card size to a value of the size scale
|
||||
final static int CARD_IMAGE_WIDTH = 312;
|
||||
final static int CARD_IMAGE_HEIGHT = 445;
|
||||
final static int CARD_IMAG_VALUE = 42;
|
||||
static final int CARD_IMAGE_WIDTH = 312;
|
||||
static final int CARD_IMAGE_HEIGHT = 445;
|
||||
static final int CARD_IMAG_VALUE = 42;
|
||||
|
||||
public static String basicSymbolSize = "small";
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import java.util.Map;
|
|||
*/
|
||||
public final class ImageCaches {
|
||||
|
||||
private final static ArrayList<Map> IMAGE_CACHES;
|
||||
private static final ArrayList<Map> IMAGE_CACHES;
|
||||
|
||||
static {
|
||||
IMAGE_CACHES = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import java.util.Map;
|
|||
*/
|
||||
public final class TransformedImageCache {
|
||||
|
||||
private final static class Key {
|
||||
private static final class Key {
|
||||
|
||||
final int width;
|
||||
final int height;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class CardPanelComponentImpl extends CardPanel {
|
|||
private boolean displayTitleAnyway;
|
||||
private boolean displayFullImagePath;
|
||||
|
||||
private final static Map<Key, BufferedImage> IMAGE_CACHE;
|
||||
private static final Map<Key, BufferedImage> IMAGE_CACHE;
|
||||
|
||||
static class Key {
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ public class CardPanelRenderImpl extends CardPanel {
|
|||
}
|
||||
|
||||
// Map of generated images
|
||||
private final static Map<ImageKey, BufferedImage> IMAGE_CACHE = new MapMaker().softValues().makeMap();
|
||||
private static final Map<ImageKey, BufferedImage> IMAGE_CACHE = new MapMaker().softValues().makeMap();
|
||||
|
||||
// The art image for the card, loaded in from the disk
|
||||
private BufferedImage artImage;
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ public class GlowText extends JLabel {
|
|||
private Color glowColor;
|
||||
private boolean wrap;
|
||||
private int lineCount = 0;
|
||||
private final static Map<Key, BufferedImage> IMAGE_CACHE;
|
||||
private static final Map<Key, BufferedImage> IMAGE_CACHE;
|
||||
|
||||
private final static class Key {
|
||||
private static final class Key {
|
||||
|
||||
final int width;
|
||||
final int height;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ import static org.mage.card.arcane.ManaSymbols.getSizedManaSymbol;
|
|||
*/
|
||||
public class ModernCardRenderer extends CardRenderer {
|
||||
|
||||
private final static Logger LOGGER = Logger.getLogger(ModernCardRenderer.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(ModernCardRenderer.class);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Textures for modern frame cards
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue