mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 12:52:06 -08:00
commit
ec3a8c9d37
35 changed files with 77 additions and 127 deletions
|
|
@ -384,7 +384,7 @@
|
|||
|
||||
@Override
|
||||
public int compare(MageCard o1, MageCard o2) {
|
||||
int val = Integer.valueOf(o1.getOriginal().getConvertedManaCost()).compareTo(o2.getOriginal().getConvertedManaCost());
|
||||
int val = Integer.compare(o1.getOriginal().getConvertedManaCost(), o2.getOriginal().getConvertedManaCost());
|
||||
if (val == 0) {
|
||||
return o1.getOriginal().getName().compareTo(o2.getOriginal().getName());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@
|
|||
}
|
||||
}
|
||||
// sort the cards
|
||||
cardsToLayout.sort((cp1, cp2) -> Integer.valueOf(cp1.getLocation().x).compareTo(cp2.getLocation().x));
|
||||
cardsToLayout.sort(Comparator.comparingInt(cp -> cp.getLocation().x));
|
||||
// relocate the cards
|
||||
int dx = 0;
|
||||
for (Component component : cardsToLayout) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import javax.swing.JComponent;
|
|||
|
||||
public class ManaBarChart extends JComponent {
|
||||
|
||||
Map<String, Integer> pips_at_cmcs = new HashMap<String, Integer>();
|
||||
Map<String, Integer> pips_at_cmcs = new HashMap<>();
|
||||
|
||||
ManaBarChart() {
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ public class ManaBarChart extends JComponent {
|
|||
|
||||
void drawBar(Graphics2D g, Rectangle area) {
|
||||
Pattern regex = Pattern.compile("^([0-9]+)##(.)}");
|
||||
Map<Integer, Integer> totals_at_cmcs = new HashMap<Integer, Integer>();
|
||||
Map<Integer, Integer> totals_at_cmcs = new HashMap<>();
|
||||
int max_num_pips = 0;
|
||||
int max_cmc = 0;
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ public class ManaBarChart extends JComponent {
|
|||
|
||||
}
|
||||
|
||||
Map<Integer, Integer> running_totals_at_cmcs = new HashMap<Integer, Integer>();
|
||||
Map<Integer, Integer> running_totals_at_cmcs = new HashMap<>();
|
||||
for (String key : pips_at_cmcs.keySet()) {
|
||||
Matcher regexMatcher = regex.matcher(key);
|
||||
int num_pips = pips_at_cmcs.get(key);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public final class LocalCommands {
|
|||
return false;
|
||||
}
|
||||
|
||||
final String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
||||
final String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||
Optional<String> response = Optional.empty();
|
||||
|
||||
String command = st.nextToken();
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class MageDesktopManager extends DefaultDesktopManager {
|
|||
}
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
public static void main(String[] args) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JFrame frame = new JFrame();
|
||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
|
|
|
|||
|
|
@ -311,8 +311,7 @@ public class DeckGeneratorPool
|
|||
*/
|
||||
public Deck getDeck() {
|
||||
Set<Card> actualDeck = deck.getCards();
|
||||
for(Card card : deckCards)
|
||||
actualDeck.add(card);
|
||||
actualDeck.addAll(deckCards);
|
||||
return deck;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,9 +205,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
this.btnExpansionSearch.setVisible(false);
|
||||
this.limited = true;
|
||||
this.cards.clear();
|
||||
for (Card card : sideboard) {
|
||||
this.cards.add(card);
|
||||
}
|
||||
this.cards.addAll(sideboard);
|
||||
filterCards();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -616,19 +616,7 @@ public class MageBook extends JComponent {
|
|||
|
||||
emblems.add((Emblem) newEmblem);
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
// Swallow exception
|
||||
} catch (NoSuchMethodException ex) {
|
||||
// Swallow exception
|
||||
} catch (SecurityException ex) {
|
||||
// Swallow exception
|
||||
} catch (InstantiationException ex) {
|
||||
// Swallow exception
|
||||
} catch (IllegalAccessException ex) {
|
||||
// Swallow exception
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// Swallow exception
|
||||
} catch (InvocationTargetException ex) {
|
||||
} catch (ClassNotFoundException | InvocationTargetException | IllegalArgumentException | IllegalAccessException | InstantiationException | SecurityException | NoSuchMethodException ex) {
|
||||
// Swallow exception
|
||||
}
|
||||
}
|
||||
|
|
@ -677,19 +665,7 @@ public class MageBook extends JComponent {
|
|||
|
||||
planes.add((Plane) newPlane);
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
// Swallow exception
|
||||
} catch (NoSuchMethodException ex) {
|
||||
// Swallow exception
|
||||
} catch (SecurityException ex) {
|
||||
// Swallow exception
|
||||
} catch (InstantiationException ex) {
|
||||
// Swallow exception
|
||||
} catch (IllegalAccessException ex) {
|
||||
// Swallow exception
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// Swallow exception
|
||||
} catch (InvocationTargetException ex) {
|
||||
} catch (ClassNotFoundException | InvocationTargetException | IllegalArgumentException | IllegalAccessException | InstantiationException | SecurityException | NoSuchMethodException ex) {
|
||||
// Swallow exception
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -644,7 +644,7 @@ public class CheckBoxList extends JList {
|
|||
int i;
|
||||
|
||||
// traverse over model
|
||||
list = new Vector<Integer>();
|
||||
list = new Vector<>();
|
||||
for (i = 0; i < getModel().getSize(); i++) {
|
||||
if (getChecked(i)) {
|
||||
list.add(new Integer(i));
|
||||
|
|
|
|||
|
|
@ -703,9 +703,7 @@ public class ConnectDialog extends MageDialog {
|
|||
} else {
|
||||
lblStatus.setText("Could not connect: " + lastConnectError);
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
logger.fatal("Update Players Task error", ex);
|
||||
} catch (ExecutionException ex) {
|
||||
} catch (InterruptedException | ExecutionException ex) {
|
||||
logger.fatal("Update Players Task error", ex);
|
||||
} catch (CancellationException ex) {
|
||||
logger.info("Connect: canceled");
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ public class FeedbackDialog extends javax.swing.JDialog {
|
|||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
public static void main(String[] args) {
|
||||
java.awt.EventQueue.invokeLater(() -> {
|
||||
if (!dialog.isVisible()) {
|
||||
dialog.setLocation(300, 200);
|
||||
|
|
|
|||
|
|
@ -540,11 +540,7 @@ public class NewTableDialog extends MageDialog {
|
|||
this.hideDialog();
|
||||
return;
|
||||
}
|
||||
} catch (FileNotFoundException ex) {
|
||||
handleError(ex);
|
||||
} catch (IOException ex) {
|
||||
handleError(ex);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
} catch (ClassNotFoundException | IOException ex) {
|
||||
handleError(ex);
|
||||
}
|
||||
// JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error joining table.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
|
|
@ -618,7 +614,7 @@ public class NewTableDialog extends MageDialog {
|
|||
options.setMinimumRating((Integer) this.spnMinimumRating.getValue());
|
||||
options.setEdhPowerLevel((Integer) this.spnEdhPowerLevel.getValue());
|
||||
options.setMullgianType((MulliganType) this.cbMulligan.getSelectedItem());
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||
options.setBannedUsers(IgnoreList.getIgnoredUsers(serverAddress));
|
||||
|
||||
return options;
|
||||
|
|
|
|||
|
|
@ -1256,7 +1256,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
tOptions.getMatchOptions().setLimited(false);
|
||||
}
|
||||
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||
tOptions.getMatchOptions().setBannedUsers(IgnoreList.getIgnoredUsers(serverAddress));
|
||||
|
||||
tOptions.getMatchOptions().setMatchTimeLimit((MatchTimeLimit) this.cbTimeLimit.getSelectedItem());
|
||||
|
|
|
|||
|
|
@ -96,13 +96,10 @@ public class PickCheckBoxDialog extends MageDialog {
|
|||
|
||||
// sorting
|
||||
if (choice.isSortEnabled()) {
|
||||
Collections.sort(this.allItems, new Comparator<KeyValueItem>() {
|
||||
@Override
|
||||
public int compare(KeyValueItem o1, KeyValueItem o2) {
|
||||
Integer n1 = choice.getSortData().get(o1.getKey());
|
||||
Integer n2 = choice.getSortData().get(o2.getKey());
|
||||
return n1.compareTo(n2);
|
||||
}
|
||||
this.allItems.sort((o1, o2) -> {
|
||||
Integer n1 = choice.getSortData().get(o1.getKey());
|
||||
Integer n2 = choice.getSortData().get(o2.getKey());
|
||||
return n1.compareTo(n2);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,13 +57,10 @@ public class PickChoiceDialog extends MageDialog {
|
|||
|
||||
// sorting
|
||||
if (choice.isSortEnabled()) {
|
||||
Collections.sort(this.allItems, new Comparator<KeyValueItem>() {
|
||||
@Override
|
||||
public int compare(KeyValueItem o1, KeyValueItem o2) {
|
||||
Integer n1 = choice.getSortData().get(o1.Key);
|
||||
Integer n2 = choice.getSortData().get(o2.Key);
|
||||
return n1.compareTo(n2);
|
||||
}
|
||||
this.allItems.sort((o1, o2) -> {
|
||||
Integer n1 = choice.getSortData().get(o1.Key);
|
||||
Integer n2 = choice.getSortData().get(o2.Key);
|
||||
return n1.compareTo(n2);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -399,7 +396,7 @@ public class PickChoiceDialog extends MageDialog {
|
|||
.addContainerGap())
|
||||
);
|
||||
|
||||
panelCommandsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btCancel, btOK});
|
||||
panelCommandsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, btCancel, btOK);
|
||||
|
||||
panelCommandsLayout.setVerticalGroup(
|
||||
panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
|
|
|||
|
|
@ -456,9 +456,7 @@ class UpdateSeatsTask extends SwingWorker<Void, TableView> {
|
|||
protected void done() {
|
||||
try {
|
||||
get();
|
||||
} catch (InterruptedException ex) {
|
||||
logger.fatal("Update Seats Task error", ex);
|
||||
} catch (ExecutionException ex) {
|
||||
} catch (InterruptedException | ExecutionException ex) {
|
||||
logger.fatal("Update Seats Task error", ex);
|
||||
} catch (CancellationException ex) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2782,9 +2782,7 @@ class ReplayTask extends SwingWorker<Void, Collection<MatchView>> {
|
|||
protected void done() {
|
||||
try {
|
||||
get();
|
||||
} catch (InterruptedException ex) {
|
||||
logger.fatal("Replay Match Task error", ex);
|
||||
} catch (ExecutionException ex) {
|
||||
} catch (InterruptedException | ExecutionException ex) {
|
||||
logger.fatal("Replay Match Task error", ex);
|
||||
} catch (CancellationException ex) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
if (this.startedDragging && prevCardPanel != null && card != null) {
|
||||
for (Component component : card.getCardArea().getComponents()) {
|
||||
if (component instanceof CardPanel) {
|
||||
if (cardPanels.contains((CardPanel) component)) {
|
||||
if (cardPanels.contains(component)) {
|
||||
component.setLocation(component.getLocation().x, component.getLocation().y - GO_DOWN_ON_DRAG_Y_OFFSET);
|
||||
}
|
||||
}
|
||||
|
|
@ -316,7 +316,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
for (Component component : container.getComponents()) {
|
||||
if (component instanceof CardPanel) {
|
||||
if (!component.equals(card)) {
|
||||
if (!cardPanels.contains((CardPanel) component)) {
|
||||
if (!cardPanels.contains(component)) {
|
||||
component.setLocation(component.getLocation().x, component.getLocation().y + GO_DOWN_ON_DRAG_Y_OFFSET);
|
||||
}
|
||||
cardPanels.add((CardPanel) component);
|
||||
|
|
@ -332,7 +332,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
private void sortLayout(List<CardPanel> cards, CardPanel source, boolean includeSource) {
|
||||
source.getLocation().x -= COMPARE_GAP_X; // this creates nice effect
|
||||
|
||||
cards.sort((cp1, cp2) -> Integer.valueOf(cp1.getLocation().x).compareTo(cp2.getLocation().x));
|
||||
cards.sort(Comparator.comparingInt(cp -> cp.getLocation().x));
|
||||
|
||||
int dx = 0;
|
||||
boolean createdGapForSource = false;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
ChatMessage message = (ChatMessage) callback.getData();
|
||||
// Drop messages from ignored users
|
||||
if (message.getUsername() != null && IgnoreList.IGNORED_MESSAGE_TYPES.contains(message.getMessageType())) {
|
||||
final String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
||||
final String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||
if (IgnoreList.userIsIgnored(serverAddress, message.getUsername())) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -451,7 +451,7 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
null, null, MessageType.USER_INFO, ChatMessage.MessageColor.BLUE);
|
||||
break;
|
||||
case TABLES:
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||
usedPanel.receiveMessage("", new StringBuilder("Download card images by using the \"Images\" main menu.")
|
||||
.append("<br/>Download icons and symbols by using the \"Symbols\" main menu.")
|
||||
.append("<br/>\\list - show a list of available chat commands.")
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
// special sort for created and seat column
|
||||
if (column == TablesTableModel.COLUMN_CREATED || column == TablesTableModel.COLUMN_SEATS) {
|
||||
List<? extends SortKey> sortKeys = getSortKeys();
|
||||
if (!sortKeys.isEmpty() && sortKeys.size() == 2) {
|
||||
if (sortKeys.size() == 2) {
|
||||
// clear sort on second click
|
||||
setSortKeys(null);
|
||||
} else {
|
||||
|
|
@ -936,7 +936,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
|
||||
// Hide games of ignored players
|
||||
java.util.List<RowFilter<Object, Object>> ignoreListFilterList = new ArrayList<>();
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||
final Set<String> ignoreListCopy = IgnoreList.getIgnoredUsers(serverAddress);
|
||||
if (!ignoreListCopy.isEmpty()) {
|
||||
ignoreListFilterList.add(new RowFilter<Object, Object>() {
|
||||
|
|
@ -1707,7 +1707,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
options.setRollbackTurnsAllowed(true);
|
||||
options.setQuitRatio(100);
|
||||
options.setMinimumRating(0);
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||
options.setBannedUsers(IgnoreList.getIgnoredUsers(serverAddress));
|
||||
table = SessionHandler.createTable(roomId, options);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,9 +22,7 @@ public class TournamentMatchesTableModel extends AbstractTableModel {
|
|||
List<TournamentGameView> views = new ArrayList<>();
|
||||
watchingAllowed = tournament.isWatchingAllowed();
|
||||
for (RoundView round : tournament.getRounds()) {
|
||||
for (TournamentGameView game : round.getGames()) {
|
||||
views.add(game);
|
||||
}
|
||||
views.addAll(round.getGames());
|
||||
}
|
||||
games = views.toArray(new TournamentGameView[0]);
|
||||
this.fireTableDataChanged();
|
||||
|
|
|
|||
|
|
@ -626,9 +626,7 @@ class UpdateTournamentTask extends SwingWorker<Void, TournamentView> {
|
|||
protected void done() {
|
||||
try {
|
||||
get();
|
||||
} catch (InterruptedException ex) {
|
||||
logger.fatal("Update Tournament Task error", ex);
|
||||
} catch (ExecutionException ex) {
|
||||
} catch (InterruptedException | ExecutionException ex) {
|
||||
logger.fatal("Update Tournament Task error", ex);
|
||||
} catch (CancellationException ex) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class CardViewCostComparator implements Comparator<CardView> {
|
|||
|
||||
@Override
|
||||
public int compare(CardView o1, CardView o2) {
|
||||
return Integer.valueOf(o1.getConvertedManaCost()).compareTo(o2.getConvertedManaCost());
|
||||
return Integer.compare(o1.getConvertedManaCost(), o2.getConvertedManaCost());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public final class SystemUtil {
|
|||
Method method = clazz.getMethod(methodName);
|
||||
Object appInstance = method.invoke(clazz);
|
||||
|
||||
Class params[] = new Class[]{Window.class};
|
||||
Class[] params = new Class[]{Window.class};
|
||||
method = clazz.getMethod(methodName2, params);
|
||||
method.invoke(appInstance, window);
|
||||
} catch (Throwable t) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class MageClip {
|
|||
|
||||
private final AudioGroup audioGroup;
|
||||
private final String filename;
|
||||
private final byte buf[];
|
||||
private final byte[] buf;
|
||||
|
||||
public MageClip(String filename, AudioGroup audioGroup) {
|
||||
this.filename = filename;
|
||||
|
|
|
|||
|
|
@ -741,10 +741,8 @@ public class CardPanelComponentImpl extends CardPanel {
|
|||
setImage(srcImage);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
} catch (Exception | Error e) {
|
||||
e.printStackTrace();
|
||||
} catch (Error err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,10 +369,8 @@ public class CardPanelRenderImpl extends CardPanel {
|
|||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
} catch (Exception | Error e) {
|
||||
e.printStackTrace();
|
||||
} catch (Error err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ public class DownloadJob extends AbstractLaternaBean {
|
|||
* Prepare code to override in custom download tasks (it's calls before work start)
|
||||
*/
|
||||
public void onPreparing() throws Exception {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,22 +29,22 @@ public abstract class AbstractProperties implements Properties {
|
|||
|
||||
@Override
|
||||
public <T> Property<T> property(String name) {
|
||||
return property(name, new BasicProperty<T>());
|
||||
return property(name, new BasicProperty<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E> List<E> list(String name) {
|
||||
return list(name, new ArrayList<E>());
|
||||
return list(name, new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E> Set<E> set(String name) {
|
||||
return set(name, new HashSet<E>());
|
||||
return set(name, new HashSet<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> Map<K, V> map(String name) {
|
||||
return map(name, new HashMap<K, V>());
|
||||
return map(name, new HashMap<>());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
package org.mage.plugins.card.dl.beans.properties;
|
||||
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static java.lang.String.*;
|
||||
|
||||
|
||||
|
|
@ -28,7 +30,7 @@ public abstract class AbstractProperty<T> implements Property<T> {
|
|||
if(!(obj instanceof Property<?>)) return false;
|
||||
Object value = getValue();
|
||||
Object other = ((Property<?>) obj).getValue();
|
||||
return value == other || (value != null && value.equals(other));
|
||||
return Objects.equals(value, other);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ public enum CopyPasteImageSource implements CardImageSource {
|
|||
|
||||
instance;
|
||||
|
||||
private final Set<String> supportedSets = new LinkedHashSet<String>();
|
||||
private final Set<String> missingCards = new LinkedHashSet<String>();
|
||||
private final Set<String> supportedSets = new LinkedHashSet<>();
|
||||
private final Set<String> missingCards = new LinkedHashSet<>();
|
||||
Map<String, String> singleLinks = null;
|
||||
boolean loadedFromDialog = false;
|
||||
boolean viewMissingCards = true;
|
||||
|
|
@ -232,12 +232,11 @@ public enum CopyPasteImageSource implements CardImageSource {
|
|||
@Override
|
||||
public List<String> getSupportedSets() {
|
||||
setupLinks();
|
||||
List<String> supportedSetsCopy = new ArrayList<>();
|
||||
if (supportedSets.isEmpty()) {
|
||||
supportedSets.addAll(Sets.getInstance().keySet());
|
||||
}
|
||||
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
List<String> supportedSetsCopy = new ArrayList<>(supportedSets);
|
||||
return supportedSetsCopy;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public enum TokensMtgImageSource implements CardImageSource {
|
|||
|
||||
// [[EXP/Name, TokenData>
|
||||
private HashMap<String, List<TokenData>> tokensData;
|
||||
private static final Set<String> supportedSets = new LinkedHashSet<String>();
|
||||
private static final Set<String> supportedSets = new LinkedHashSet<>();
|
||||
|
||||
private final Object tokensDataSync = new Object();
|
||||
|
||||
|
|
|
|||
|
|
@ -88,10 +88,10 @@ public class CardDownloadData {
|
|||
return false;
|
||||
}
|
||||
final CardDownloadData other = (CardDownloadData) obj;
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
if (!Objects.equals(this.name, other.name)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.set == null) ? (other.set != null) : !this.set.equals(other.set)) {
|
||||
if (!Objects.equals(this.set, other.set)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.collectorId, other.collectorId) && (this.collectorId == null || !this.collectorId.equals(other.collectorId))) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import java.util.Date;
|
|||
import java.util.GregorianCalendar;
|
||||
|
||||
import static mage.client.MageFrame.isChrismasTime;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ChrismasTest {
|
||||
|
||||
|
|
@ -20,24 +22,24 @@ public class ChrismasTest {
|
|||
@Test
|
||||
public void testChrismasDays() throws Exception {
|
||||
// chrismas from 15 december to 15 january
|
||||
Assert.assertEquals(false, isChrismasTime(getDate(2017, 11, 1)));
|
||||
Assert.assertEquals(false, isChrismasTime(getDate(2017, 11, 15)));
|
||||
Assert.assertEquals(false, isChrismasTime(getDate(2017, 11, 30)));
|
||||
Assert.assertEquals(false, isChrismasTime(getDate(2017, 12, 1)));
|
||||
Assert.assertEquals(false, isChrismasTime(getDate(2017, 12, 14)));
|
||||
Assert.assertEquals(true, isChrismasTime(getDate(2017, 12, 15)));
|
||||
Assert.assertEquals(true, isChrismasTime(getDate(2017, 12, 16)));
|
||||
Assert.assertEquals(true, isChrismasTime(getDate(2017, 12, 31)));
|
||||
Assert.assertEquals(true, isChrismasTime(getDate(2018, 1, 1)));
|
||||
Assert.assertEquals(true, isChrismasTime(getDate(2018, 1, 14)));
|
||||
Assert.assertEquals(true, isChrismasTime(getDate(2018, 1, 15)));
|
||||
Assert.assertEquals(false, isChrismasTime(getDate(2018, 1, 16)));
|
||||
Assert.assertEquals(false, isChrismasTime(getDate(2018, 1, 31)));
|
||||
Assert.assertEquals(false, isChrismasTime(getDate(2018, 2, 1)));
|
||||
Assert.assertEquals(false, isChrismasTime(getDate(2018, 12, 1)));
|
||||
Assert.assertEquals(true, isChrismasTime(getDate(2018, 12, 20)));
|
||||
Assert.assertEquals(true, isChrismasTime(getDate(2019, 1, 10)));
|
||||
Assert.assertEquals(false, isChrismasTime(getDate(2019, 1, 25)));
|
||||
assertFalse(isChrismasTime(getDate(2017, 11, 1)));
|
||||
assertFalse(isChrismasTime(getDate(2017, 11, 15)));
|
||||
assertFalse(isChrismasTime(getDate(2017, 11, 30)));
|
||||
assertFalse(isChrismasTime(getDate(2017, 12, 1)));
|
||||
assertFalse(isChrismasTime(getDate(2017, 12, 14)));
|
||||
assertTrue(isChrismasTime(getDate(2017, 12, 15)));
|
||||
assertTrue(isChrismasTime(getDate(2017, 12, 16)));
|
||||
assertTrue(isChrismasTime(getDate(2017, 12, 31)));
|
||||
assertTrue(isChrismasTime(getDate(2018, 1, 1)));
|
||||
assertTrue(isChrismasTime(getDate(2018, 1, 14)));
|
||||
assertTrue(isChrismasTime(getDate(2018, 1, 15)));
|
||||
assertFalse(isChrismasTime(getDate(2018, 1, 16)));
|
||||
assertFalse(isChrismasTime(getDate(2018, 1, 31)));
|
||||
assertFalse(isChrismasTime(getDate(2018, 2, 1)));
|
||||
assertFalse(isChrismasTime(getDate(2018, 12, 1)));
|
||||
assertTrue(isChrismasTime(getDate(2018, 12, 20)));
|
||||
assertTrue(isChrismasTime(getDate(2019, 1, 10)));
|
||||
assertFalse(isChrismasTime(getDate(2019, 1, 25)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,8 +58,7 @@ public enum ServerMessagesUtil {
|
|||
private void reloadMessages() {
|
||||
LOGGER.debug("Reading server messages...");
|
||||
List<String> motdMessages = readFromFile();
|
||||
List<String> newMessages = new ArrayList<>();
|
||||
newMessages.addAll(motdMessages);
|
||||
List<String> newMessages = new ArrayList<>(motdMessages);
|
||||
newMessages.add(getServerStatistics());
|
||||
newMessages.add(getServerStatistics2());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue