mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
excessive lambda usage
This commit is contained in:
parent
8b31333d9d
commit
b3dc0f5eca
9 changed files with 31 additions and 30 deletions
|
@ -37,7 +37,7 @@ public final class LocalCommands {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
final String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||||
Optional<String> response = Optional.empty();
|
Optional<String> response = Optional.empty();
|
||||||
|
|
||||||
String command = st.nextToken();
|
String command = st.nextToken();
|
||||||
|
|
|
@ -614,7 +614,7 @@ public class NewTableDialog extends MageDialog {
|
||||||
options.setMinimumRating((Integer) this.spnMinimumRating.getValue());
|
options.setMinimumRating((Integer) this.spnMinimumRating.getValue());
|
||||||
options.setEdhPowerLevel((Integer) this.spnEdhPowerLevel.getValue());
|
options.setEdhPowerLevel((Integer) this.spnEdhPowerLevel.getValue());
|
||||||
options.setMullgianType((MulliganType) this.cbMulligan.getSelectedItem());
|
options.setMullgianType((MulliganType) this.cbMulligan.getSelectedItem());
|
||||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||||
options.setBannedUsers(IgnoreList.getIgnoredUsers(serverAddress));
|
options.setBannedUsers(IgnoreList.getIgnoredUsers(serverAddress));
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
|
|
|
@ -1256,7 +1256,7 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
tOptions.getMatchOptions().setLimited(false);
|
tOptions.getMatchOptions().setLimited(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||||
tOptions.getMatchOptions().setBannedUsers(IgnoreList.getIgnoredUsers(serverAddress));
|
tOptions.getMatchOptions().setBannedUsers(IgnoreList.getIgnoredUsers(serverAddress));
|
||||||
|
|
||||||
tOptions.getMatchOptions().setMatchTimeLimit((MatchTimeLimit) this.cbTimeLimit.getSelectedItem());
|
tOptions.getMatchOptions().setMatchTimeLimit((MatchTimeLimit) this.cbTimeLimit.getSelectedItem());
|
||||||
|
|
|
@ -396,7 +396,7 @@ public class PickChoiceDialog extends MageDialog {
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
|
|
||||||
panelCommandsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btCancel, btOK});
|
panelCommandsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, btCancel, btOK);
|
||||||
|
|
||||||
panelCommandsLayout.setVerticalGroup(
|
panelCommandsLayout.setVerticalGroup(
|
||||||
panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
if (this.startedDragging && prevCardPanel != null && card != null) {
|
if (this.startedDragging && prevCardPanel != null && card != null) {
|
||||||
for (Component component : card.getCardArea().getComponents()) {
|
for (Component component : card.getCardArea().getComponents()) {
|
||||||
if (component instanceof CardPanel) {
|
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);
|
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()) {
|
for (Component component : container.getComponents()) {
|
||||||
if (component instanceof CardPanel) {
|
if (component instanceof CardPanel) {
|
||||||
if (!component.equals(card)) {
|
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);
|
component.setLocation(component.getLocation().x, component.getLocation().y + GO_DOWN_ON_DRAG_Y_OFFSET);
|
||||||
}
|
}
|
||||||
cardPanels.add((CardPanel) component);
|
cardPanels.add((CardPanel) component);
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class CallbackClientImpl implements CallbackClient {
|
||||||
ChatMessage message = (ChatMessage) callback.getData();
|
ChatMessage message = (ChatMessage) callback.getData();
|
||||||
// Drop messages from ignored users
|
// Drop messages from ignored users
|
||||||
if (message.getUsername() != null && IgnoreList.IGNORED_MESSAGE_TYPES.contains(message.getMessageType())) {
|
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())) {
|
if (IgnoreList.userIsIgnored(serverAddress, message.getUsername())) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ public class CallbackClientImpl implements CallbackClient {
|
||||||
null, null, MessageType.USER_INFO, ChatMessage.MessageColor.BLUE);
|
null, null, MessageType.USER_INFO, ChatMessage.MessageColor.BLUE);
|
||||||
break;
|
break;
|
||||||
case TABLES:
|
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.")
|
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/>Download icons and symbols by using the \"Symbols\" main menu.")
|
||||||
.append("<br/>\\list - show a list of available chat commands.")
|
.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
|
// special sort for created and seat column
|
||||||
if (column == TablesTableModel.COLUMN_CREATED || column == TablesTableModel.COLUMN_SEATS) {
|
if (column == TablesTableModel.COLUMN_CREATED || column == TablesTableModel.COLUMN_SEATS) {
|
||||||
List<? extends SortKey> sortKeys = getSortKeys();
|
List<? extends SortKey> sortKeys = getSortKeys();
|
||||||
if (!sortKeys.isEmpty() && sortKeys.size() == 2) {
|
if (sortKeys.size() == 2) {
|
||||||
// clear sort on second click
|
// clear sort on second click
|
||||||
setSortKeys(null);
|
setSortKeys(null);
|
||||||
} else {
|
} else {
|
||||||
|
@ -936,7 +936,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
// Hide games of ignored players
|
// Hide games of ignored players
|
||||||
java.util.List<RowFilter<Object, Object>> ignoreListFilterList = new ArrayList<>();
|
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);
|
final Set<String> ignoreListCopy = IgnoreList.getIgnoredUsers(serverAddress);
|
||||||
if (!ignoreListCopy.isEmpty()) {
|
if (!ignoreListCopy.isEmpty()) {
|
||||||
ignoreListFilterList.add(new RowFilter<Object, Object>() {
|
ignoreListFilterList.add(new RowFilter<Object, Object>() {
|
||||||
|
@ -1707,7 +1707,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
options.setRollbackTurnsAllowed(true);
|
options.setRollbackTurnsAllowed(true);
|
||||||
options.setQuitRatio(100);
|
options.setQuitRatio(100);
|
||||||
options.setMinimumRating(0);
|
options.setMinimumRating(0);
|
||||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
|
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||||
options.setBannedUsers(IgnoreList.getIgnoredUsers(serverAddress));
|
options.setBannedUsers(IgnoreList.getIgnoredUsers(serverAddress));
|
||||||
table = SessionHandler.createTable(roomId, options);
|
table = SessionHandler.createTable(roomId, options);
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,6 @@ public class DownloadJob extends AbstractLaternaBean {
|
||||||
* Prepare code to override in custom download tasks (it's calls before work start)
|
* Prepare code to override in custom download tasks (it's calls before work start)
|
||||||
*/
|
*/
|
||||||
public void onPreparing() throws Exception {
|
public void onPreparing() throws Exception {
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,6 +8,8 @@ import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import static mage.client.MageFrame.isChrismasTime;
|
import static mage.client.MageFrame.isChrismasTime;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class ChrismasTest {
|
public class ChrismasTest {
|
||||||
|
|
||||||
|
@ -20,24 +22,24 @@ public class ChrismasTest {
|
||||||
@Test
|
@Test
|
||||||
public void testChrismasDays() throws Exception {
|
public void testChrismasDays() throws Exception {
|
||||||
// chrismas from 15 december to 15 january
|
// chrismas from 15 december to 15 january
|
||||||
Assert.assertEquals(false, isChrismasTime(getDate(2017, 11, 1)));
|
assertFalse(isChrismasTime(getDate(2017, 11, 1)));
|
||||||
Assert.assertEquals(false, isChrismasTime(getDate(2017, 11, 15)));
|
assertFalse(isChrismasTime(getDate(2017, 11, 15)));
|
||||||
Assert.assertEquals(false, isChrismasTime(getDate(2017, 11, 30)));
|
assertFalse(isChrismasTime(getDate(2017, 11, 30)));
|
||||||
Assert.assertEquals(false, isChrismasTime(getDate(2017, 12, 1)));
|
assertFalse(isChrismasTime(getDate(2017, 12, 1)));
|
||||||
Assert.assertEquals(false, isChrismasTime(getDate(2017, 12, 14)));
|
assertFalse(isChrismasTime(getDate(2017, 12, 14)));
|
||||||
Assert.assertEquals(true, isChrismasTime(getDate(2017, 12, 15)));
|
assertTrue(isChrismasTime(getDate(2017, 12, 15)));
|
||||||
Assert.assertEquals(true, isChrismasTime(getDate(2017, 12, 16)));
|
assertTrue(isChrismasTime(getDate(2017, 12, 16)));
|
||||||
Assert.assertEquals(true, isChrismasTime(getDate(2017, 12, 31)));
|
assertTrue(isChrismasTime(getDate(2017, 12, 31)));
|
||||||
Assert.assertEquals(true, isChrismasTime(getDate(2018, 1, 1)));
|
assertTrue(isChrismasTime(getDate(2018, 1, 1)));
|
||||||
Assert.assertEquals(true, isChrismasTime(getDate(2018, 1, 14)));
|
assertTrue(isChrismasTime(getDate(2018, 1, 14)));
|
||||||
Assert.assertEquals(true, isChrismasTime(getDate(2018, 1, 15)));
|
assertTrue(isChrismasTime(getDate(2018, 1, 15)));
|
||||||
Assert.assertEquals(false, isChrismasTime(getDate(2018, 1, 16)));
|
assertFalse(isChrismasTime(getDate(2018, 1, 16)));
|
||||||
Assert.assertEquals(false, isChrismasTime(getDate(2018, 1, 31)));
|
assertFalse(isChrismasTime(getDate(2018, 1, 31)));
|
||||||
Assert.assertEquals(false, isChrismasTime(getDate(2018, 2, 1)));
|
assertFalse(isChrismasTime(getDate(2018, 2, 1)));
|
||||||
Assert.assertEquals(false, isChrismasTime(getDate(2018, 12, 1)));
|
assertFalse(isChrismasTime(getDate(2018, 12, 1)));
|
||||||
Assert.assertEquals(true, isChrismasTime(getDate(2018, 12, 20)));
|
assertTrue(isChrismasTime(getDate(2018, 12, 20)));
|
||||||
Assert.assertEquals(true, isChrismasTime(getDate(2019, 1, 10)));
|
assertTrue(isChrismasTime(getDate(2019, 1, 10)));
|
||||||
Assert.assertEquals(false, isChrismasTime(getDate(2019, 1, 25)));
|
assertFalse(isChrismasTime(getDate(2019, 1, 25)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue