mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
All 1-character strings converted to primitives
"b" + "r" now changed to 'b' + 'w'. It's more straight-forward, and may cause perfomance improvements - character primitives allocation is faster and less expensive than string creation.
This commit is contained in:
parent
7b35e25347
commit
0de8bd2f70
453 changed files with 991 additions and 979 deletions
|
@ -1,5 +1,6 @@
|
|||
XMage.de 1 (Europe/Germany) fast :xmage.de:17171
|
||||
woogerworks (North America/USA) :xmage.woogerworks.com:17171
|
||||
xmage.lukeskywalk.com (North America) :xmage.lukeskywalk.com:17171
|
||||
XMageBr. (South America/Brazil) :magic.ncs3sistemas.com.br:17171
|
||||
XMage.tahiti :xmage.tahiti.one:443
|
||||
Seedds Server (Asia) :115.29.203.80:17171
|
||||
|
|
|
@ -795,7 +795,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
try {
|
||||
LOGGER.debug("connecting (auto): " + currentConnection.getProxyType().toString()
|
||||
+ " " + currentConnection.getProxyHost() + " " + currentConnection.getProxyPort() + " " + currentConnection.getProxyUsername());
|
||||
+ ' ' + currentConnection.getProxyHost() + ' ' + currentConnection.getProxyPort() + ' ' + currentConnection.getProxyUsername());
|
||||
if (MageFrame.connect(currentConnection)) {
|
||||
showGames(false);
|
||||
return true;
|
||||
|
@ -1334,7 +1334,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
hideTables();
|
||||
SessionHandler.disconnect(false);
|
||||
if (errorCall) {
|
||||
UserRequestMessage message = new UserRequestMessage("Connection lost", "The connection to server was lost. Reconnect to " + currentConnection.getHost() + "?");
|
||||
UserRequestMessage message = new UserRequestMessage("Connection lost", "The connection to server was lost. Reconnect to " + currentConnection.getHost() + '?');
|
||||
message.setButton1("No", null);
|
||||
message.setButton2("Yes", PlayerAction.CLIENT_RECONNECT);
|
||||
showUserRequestDialog(message);
|
||||
|
|
|
@ -141,7 +141,7 @@ public class BigCard extends JComponent {
|
|||
|
||||
try {
|
||||
for (String line : strings) {
|
||||
doc.insertString(doc.getLength(), line + "\n", doc.getStyle("regular"));
|
||||
doc.insertString(doc.getLength(), line + '\n', doc.getStyle("regular"));
|
||||
}
|
||||
} catch (BadLocationException ble) {
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
gImage.setFont(new Font("Arial", Font.PLAIN, NAME_FONT_MAX_SIZE));
|
||||
gImage.drawString(card.getName()+"TEST", CONTENT_MAX_XOFFSET, NAME_MAX_YOFFSET);
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
gImage.drawString(card.getPower() + "/" + card.getToughness(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
|
||||
gImage.drawString(card.getPower() + '/' + card.getToughness(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
|
||||
} else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
gImage.drawString(card.getLoyalty(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
|
||||
}
|
||||
|
@ -228,27 +228,27 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
StringBuilder sb = new StringBuilder();
|
||||
if (card instanceof StackAbilityView || card instanceof AbilityView) {
|
||||
for (String rule : getRules()) {
|
||||
sb.append("\n").append(rule);
|
||||
sb.append('\n').append(rule);
|
||||
}
|
||||
} else {
|
||||
sb.append(card.getName());
|
||||
if (card.getManaCost().size() > 0) {
|
||||
sb.append("\n").append(card.getManaCost());
|
||||
sb.append('\n').append(card.getManaCost());
|
||||
}
|
||||
sb.append("\n").append(cardType);
|
||||
sb.append('\n').append(cardType);
|
||||
if (card.getColor().hasColor()) {
|
||||
sb.append("\n").append(card.getColor().toString());
|
||||
sb.append('\n').append(card.getColor().toString());
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
sb.append("\n").append(card.getPower()).append("/").append(card.getToughness());
|
||||
sb.append('\n').append(card.getPower()).append('/').append(card.getToughness());
|
||||
} else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
sb.append("\n").append(card.getLoyalty());
|
||||
sb.append('\n').append(card.getLoyalty());
|
||||
}
|
||||
for (String rule : getRules()) {
|
||||
sb.append("\n").append(rule);
|
||||
sb.append('\n').append(rule);
|
||||
}
|
||||
if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) {
|
||||
sb.append("\n").append(card.getCardNumber()).append(" - ");
|
||||
sb.append('\n').append(card.getCardNumber()).append(" - ");
|
||||
sb.append(Sets.getInstance().get(card.getExpansionSetCode()).getName()).append(" - ");
|
||||
sb.append(card.getRarity().toString());
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
|
||||
try {
|
||||
for (String rule : getRules()) {
|
||||
doc.insertString(doc.getLength(), rule + "\n", doc.getStyle("small"));
|
||||
doc.insertString(doc.getLength(), rule + '\n', doc.getStyle("small"));
|
||||
}
|
||||
} catch (BadLocationException e) {
|
||||
}
|
||||
|
@ -301,17 +301,17 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
StringBuilder sbType = new StringBuilder();
|
||||
|
||||
for (String superType : card.getSuperTypes()) {
|
||||
sbType.append(superType).append(" ");
|
||||
sbType.append(superType).append(' ');
|
||||
}
|
||||
|
||||
for (CardType cardType : card.getCardTypes()) {
|
||||
sbType.append(cardType.toString()).append(" ");
|
||||
sbType.append(cardType.toString()).append(' ');
|
||||
}
|
||||
|
||||
if (card.getSubTypes().size() > 0) {
|
||||
sbType.append("- ");
|
||||
for (String subType : card.getSubTypes()) {
|
||||
sbType.append(subType).append(" ");
|
||||
sbType.append(subType).append(' ');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -708,7 +708,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(" + sort.toString() + "," + Boolean.toString(separateCreatures) + "," + Integer.toString(cardSize) + ")";
|
||||
return '(' + sort.toString() + ',' + Boolean.toString(separateCreatures) + ',' + Integer.toString(cardSize) + ')';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1327,7 +1327,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
if (!s) {
|
||||
String t = "";
|
||||
for (CardType type : card.getCardTypes()) {
|
||||
t += " " + type.toString();
|
||||
t += ' ' + type.toString();
|
||||
}
|
||||
s |= t.toLowerCase().contains(searchStr);
|
||||
}
|
||||
|
@ -1385,14 +1385,14 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
// Type line
|
||||
String t = "";
|
||||
for (CardType type : card.getCardTypes()) {
|
||||
t += " " + type.toString();
|
||||
t += ' ' + type.toString();
|
||||
}
|
||||
// Sub & Super Types
|
||||
for (String str : card.getSuperTypes()) {
|
||||
t += " " + str.toLowerCase();
|
||||
t += ' ' + str.toLowerCase();
|
||||
}
|
||||
for (String str : card.getSubTypes()) {
|
||||
t += " " + str.toLowerCase();
|
||||
t += ' ' + str.toLowerCase();
|
||||
}
|
||||
|
||||
for (String qty : qtys.keySet()) {
|
||||
|
|
|
@ -107,24 +107,24 @@ public class Permanent extends Card {
|
|||
sb.append("\n----- Originally -------\n");
|
||||
sb.append(permanent.getOriginal().getName());
|
||||
if (permanent.getOriginal().getManaCost().size() > 0) {
|
||||
sb.append("\n").append(permanent.getOriginal().getManaCost());
|
||||
sb.append('\n').append(permanent.getOriginal().getManaCost());
|
||||
}
|
||||
sb.append("\n").append(getType(permanent.getOriginal()));
|
||||
sb.append('\n').append(getType(permanent.getOriginal()));
|
||||
if (permanent.getOriginal().getColor().hasColor()) {
|
||||
sb.append("\n").append(permanent.getOriginal().getColor().toString());
|
||||
sb.append('\n').append(permanent.getOriginal().getColor().toString());
|
||||
}
|
||||
if (permanent.getOriginal().getCardTypes().contains(CardType.CREATURE)) {
|
||||
sb.append("\n").append(permanent.getOriginal().getPower()).append("/").append(permanent.getOriginal().getToughness());
|
||||
sb.append('\n').append(permanent.getOriginal().getPower()).append('/').append(permanent.getOriginal().getToughness());
|
||||
}
|
||||
else if (permanent.getOriginal().getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
sb.append("\n").append(permanent.getOriginal().getLoyalty());
|
||||
sb.append('\n').append(permanent.getOriginal().getLoyalty());
|
||||
}
|
||||
for (String rule: getRules()) {
|
||||
sb.append("\n").append(rule);
|
||||
sb.append('\n').append(rule);
|
||||
}
|
||||
if (permanent.getOriginal().getExpansionSetCode().length() > 0) {
|
||||
sb.append("\n").append(permanent.getCardNumber()).append(" - ");
|
||||
sb.append("\n").append(Sets.getInstance().get(permanent.getOriginal().getExpansionSetCode()).getName()).append(" - ");
|
||||
sb.append('\n').append(permanent.getCardNumber()).append(" - ");
|
||||
sb.append('\n').append(Sets.getInstance().get(permanent.getOriginal().getExpansionSetCode()).getName()).append(" - ");
|
||||
sb.append(permanent.getOriginal().getRarity().toString());
|
||||
}
|
||||
// sb.append("\n").append(card.getId());
|
||||
|
|
|
@ -802,6 +802,6 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
return getClass().getName()
|
||||
+ "[axis=" + axis
|
||||
+ ",gap=" + gap
|
||||
+ "]";
|
||||
+ ']';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,7 +168,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(" " + String.valueOf(slider.getValue()) + '%');
|
||||
|
||||
slider.addChangeListener(e -> {
|
||||
String value = String.valueOf(slider.getValue());
|
||||
|
@ -178,7 +178,7 @@ public class RatioAdjustingSliderPanel extends JPanel {
|
|||
labelBuilder.append(" ");
|
||||
}
|
||||
labelBuilder.append(value);
|
||||
labelBuilder.append("%");
|
||||
labelBuilder.append('%');
|
||||
label.setText(labelBuilder.toString());
|
||||
});
|
||||
return label;
|
||||
|
|
|
@ -97,7 +97,7 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return maindeckSettings.toString() + "|" + sideboardSetings.toString() + "|" + dividerLocationNormal + "|" + dividerLocationLimited;
|
||||
return maindeckSettings.toString() + '|' + sideboardSetings.toString() + '|' + dividerLocationNormal + '|' + dividerLocationLimited;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -584,12 +584,12 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
int second = s - (minute * 60);
|
||||
String text;
|
||||
if (minute < 10) {
|
||||
text = "0" + Integer.toString(minute) + ":";
|
||||
text = '0' + Integer.toString(minute) + ':';
|
||||
} else {
|
||||
text = Integer.toString(minute) + ":";
|
||||
text = Integer.toString(minute) + ':';
|
||||
}
|
||||
if (second < 10) {
|
||||
text = text + "0" + Integer.toString(second);
|
||||
text = text + '0' + Integer.toString(second);
|
||||
} else {
|
||||
text = text + Integer.toString(second);
|
||||
}
|
||||
|
@ -599,7 +599,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
}
|
||||
if (timeToSubmit > 0) {
|
||||
timeToSubmit--;
|
||||
btnSubmitTimer.setText("Submit (" + timeToSubmit + ")");
|
||||
btnSubmitTimer.setText("Submit (" + timeToSubmit + ')');
|
||||
btnSubmitTimer.setToolTipText("Submit your deck in " + timeToSubmit + " seconds!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,17 +56,17 @@ public class CardHelper {
|
|||
StringBuilder type = new StringBuilder();
|
||||
for (String superType : c.getSuperTypes()) {
|
||||
type.append(superType);
|
||||
type.append(" ");
|
||||
type.append(' ');
|
||||
}
|
||||
for (CardType cardType : c.getCardTypes()) {
|
||||
type.append(cardType.toString());
|
||||
type.append(" ");
|
||||
type.append(' ');
|
||||
}
|
||||
if (c.getSubTypes().size() > 0) {
|
||||
type.append("- ");
|
||||
for (String subType : c.getSubTypes()) {
|
||||
type.append(subType);
|
||||
type.append(" ");
|
||||
type.append(' ');
|
||||
}
|
||||
}
|
||||
return type.toString();
|
||||
|
|
|
@ -86,10 +86,10 @@ public class MageCardComparator implements Comparator<CardView> {
|
|||
aCom = (float) -1;
|
||||
bCom = (float) -1;
|
||||
if (CardHelper.isCreature(a)) {
|
||||
aCom = new Float(a.getPower() + "." + (a.getToughness().startsWith("-") ? "0" : a.getToughness()));
|
||||
aCom = new Float(a.getPower() + '.' + (a.getToughness().startsWith("-") ? "0" : a.getToughness()));
|
||||
}
|
||||
if (CardHelper.isCreature(b)) {
|
||||
bCom = new Float(b.getPower() + "." + (b.getToughness().startsWith("-") ? "0" : b.getToughness()));
|
||||
bCom = new Float(b.getPower() + '.' + (b.getToughness().startsWith("-") ? "0" : b.getToughness()));
|
||||
}
|
||||
break;
|
||||
// Rarity
|
||||
|
|
|
@ -264,7 +264,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
case 4:
|
||||
return CardHelper.getType(c);
|
||||
case 5:
|
||||
return CardHelper.isCreature(c) ? c.getPower() + "/"
|
||||
return CardHelper.isCreature(c) ? c.getPower() + '/'
|
||||
+ c.getToughness() : "-";
|
||||
case 6:
|
||||
return c.getRarity().toString();
|
||||
|
|
|
@ -134,7 +134,7 @@ public class CardInfoWindowDialog extends MageDialog {
|
|||
|
||||
public void loadCards(ExileView exile, BigCard bigCard, UUID gameId) {
|
||||
boolean changed = cards.loadCards(exile, bigCard, gameId, true);
|
||||
String titel = name + " (" + exile.size() + ")";
|
||||
String titel = name + " (" + exile.size() + ')';
|
||||
setTitle(titel);
|
||||
this.setTitelBarToolTip(titel);
|
||||
if (exile.size() > 0) {
|
||||
|
|
|
@ -397,7 +397,7 @@ public class ConnectDialog extends MageDialog {
|
|||
// pref settings
|
||||
MageFrame.getInstance().setUserPrefsToConnection(connection);
|
||||
|
||||
logger.debug("connecting: " + connection.getProxyType() + " " + connection.getProxyHost() + " " + connection.getProxyPort());
|
||||
logger.debug("connecting: " + connection.getProxyType() + ' ' + connection.getProxyHost() + ' ' + connection.getProxyPort());
|
||||
task = new ConnectTask();
|
||||
task.execute();
|
||||
} finally {
|
||||
|
|
|
@ -100,7 +100,7 @@ public class GameEndDialog extends MageDialog {
|
|||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (PlayerView player : gameEndView.getPlayers()) {
|
||||
sb.append(player.getName()).append(" Life: ").append(player.getLife()).append(" ");
|
||||
sb.append(player.getName()).append(" Life: ").append(player.getLife()).append(' ');
|
||||
}
|
||||
this.txtLife.setText(sb.toString());
|
||||
|
||||
|
@ -128,8 +128,8 @@ public class GameEndDialog extends MageDialog {
|
|||
sdf.applyPattern( "yyyyMMdd_HHmmss" );
|
||||
String fileName = new StringBuilder(dir).append(File.separator)
|
||||
.append(sdf.format(gameEndView.getStartTime()))
|
||||
.append("_").append(gameEndView.getMatchView().getGameType())
|
||||
.append("_").append(gameEndView.getMatchView().getGames().size())
|
||||
.append('_').append(gameEndView.getMatchView().getGameType())
|
||||
.append('_').append(gameEndView.getMatchView().getGames().size())
|
||||
.append(".txt").toString();
|
||||
PrintWriter out = new PrintWriter(fileName);
|
||||
out.print(gamePanel.getGameLog());
|
||||
|
|
|
@ -673,7 +673,7 @@ public class NewTableDialog extends MageDialog {
|
|||
StringBuilder playerTypesString = new StringBuilder();
|
||||
for (Object player : players) {
|
||||
if (playerTypesString.length() > 0) {
|
||||
playerTypesString.append(",");
|
||||
playerTypesString.append(',');
|
||||
}
|
||||
TablePlayerPanel tpp = (TablePlayerPanel) player;
|
||||
playerTypesString.append(tpp.getPlayerType());
|
||||
|
|
|
@ -836,7 +836,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
StringBuilder packList = new StringBuilder();
|
||||
for (ExpansionInfo exp : allExpansions) {
|
||||
packList.append(exp.getCode());
|
||||
packList.append(";");
|
||||
packList.append(';');
|
||||
}
|
||||
txtRandomPacks.setText(packList.toString());
|
||||
}
|
||||
|
@ -860,7 +860,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
StringBuilder packList = new StringBuilder();
|
||||
for (String str : randomPackSelector.getSelectedPacks()) {
|
||||
packList.append(str);
|
||||
packList.append(";");
|
||||
packList.append(';');
|
||||
}
|
||||
this.txtRandomPacks.setText(packList.toString());
|
||||
this.pack();
|
||||
|
@ -1088,7 +1088,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
StringBuilder packlist = new StringBuilder();
|
||||
for (String pack : this.randomPackSelector.getSelectedPacks()){
|
||||
packlist.append(pack);
|
||||
packlist.append(";");
|
||||
packlist.append(';');
|
||||
}
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT, packlist.toString());
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
// If we are logging the draft create a file that will contain
|
||||
// the log.
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
|
||||
logFilename = "Draft_" + sdf.format(new Date()) + "_" + draftId + ".txt";
|
||||
logFilename = "Draft_" + sdf.format(new Date()) + '_' + draftId + ".txt";
|
||||
try {
|
||||
Files.write(pathToDraftLog(), "".getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
|
||||
} catch (IOException ex) {
|
||||
|
@ -366,12 +366,12 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
int second = s - (minute * 60);
|
||||
String text;
|
||||
if (minute < 10) {
|
||||
text = "0" + Integer.toString(minute) + ":";
|
||||
text = '0' + Integer.toString(minute) + ':';
|
||||
} else {
|
||||
text = Integer.toString(minute) + ":";
|
||||
text = Integer.toString(minute) + ':';
|
||||
}
|
||||
if (second < 10) {
|
||||
text = text + "0" + Integer.toString(second);
|
||||
text = text + '0' + Integer.toString(second);
|
||||
} else {
|
||||
text = text + Integer.toString(second);
|
||||
}
|
||||
|
|
|
@ -406,7 +406,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
private void saveDividerLocations() {
|
||||
// save panel sizes and divider locations.
|
||||
Rectangle rec = MageFrame.getDesktop().getBounds();
|
||||
String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight());
|
||||
String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb);
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_GAMEPANEL_DIVIDER_LOCATION_0, Integer.toString(this.jSplitPane0.getDividerLocation()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_GAMEPANEL_DIVIDER_LOCATION_1, Integer.toString(this.jSplitPane1.getDividerLocation()));
|
||||
|
@ -417,7 +417,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
Rectangle rec = MageFrame.getDesktop().getBounds();
|
||||
if (rec != null) {
|
||||
String size = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, null);
|
||||
String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight());
|
||||
String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
|
||||
// use divider positions only if screen size is the same as it was the time the settings were saved
|
||||
if (size != null && size.equals(sb)) {
|
||||
|
||||
|
@ -764,7 +764,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
if (game.getSpellsCastCurrentTurn() > 0 && PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_SHOW_STORM_COUNTER, "true").equals("true")) {
|
||||
this.txtSpellsCast.setVisible(true);
|
||||
this.txtSpellsCast.setText(" " + Integer.toString(game.getSpellsCastCurrentTurn()) + " ");
|
||||
this.txtSpellsCast.setText(' ' + Integer.toString(game.getSpellsCastCurrentTurn()) + ' ');
|
||||
} else {
|
||||
this.txtSpellsCast.setVisible(false);
|
||||
}
|
||||
|
@ -1279,7 +1279,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
pickChoice.showDialog(choice, objectId, choiceWindowState);
|
||||
if (choice.isKeyChoice()) {
|
||||
if (pickChoice.isAutoSelect()) {
|
||||
SessionHandler.sendPlayerString(gameId, "#" + choice.getChoiceKey());
|
||||
SessionHandler.sendPlayerString(gameId, '#' + choice.getChoiceKey());
|
||||
} else {
|
||||
SessionHandler.sendPlayerString(gameId, choice.getChoiceKey());
|
||||
}
|
||||
|
|
|
@ -377,11 +377,11 @@ public class HelperPanel extends JPanel {
|
|||
public void handleAutoAnswerPopupMenuEvent(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
case CMD_AUTO_ANSWER_ID_YES:
|
||||
SessionHandler.sendPlayerAction(REQUEST_AUTO_ANSWER_ID_YES, gameId, originalId.toString() + "#" + message);
|
||||
SessionHandler.sendPlayerAction(REQUEST_AUTO_ANSWER_ID_YES, gameId, originalId.toString() + '#' + message);
|
||||
clickButton(btnLeft);
|
||||
break;
|
||||
case CMD_AUTO_ANSWER_ID_NO:
|
||||
SessionHandler.sendPlayerAction(REQUEST_AUTO_ANSWER_ID_NO, gameId, originalId.toString() + "#" + message);
|
||||
SessionHandler.sendPlayerAction(REQUEST_AUTO_ANSWER_ID_NO, gameId, originalId.toString() + '#' + message);
|
||||
clickButton(btnRight);
|
||||
break;
|
||||
case CMD_AUTO_ANSWER_NAME_YES:
|
||||
|
|
|
@ -360,7 +360,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
int h = priorityTimeLeft / 3600;
|
||||
int m = (priorityTimeLeft % 3600) / 60;
|
||||
int s = priorityTimeLeft % 60;
|
||||
return (h < 10 ? "0" : "") + h + ":" + (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s;
|
||||
return (h < 10 ? "0" : "") + h + ':' + (m < 10 ? "0" : "") + m + ':' + (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
|
||||
protected void update(ManaPoolView pool) {
|
||||
|
|
|
@ -43,7 +43,7 @@ public class MagePreferences {
|
|||
}
|
||||
|
||||
private static String prefixedKey(String prefix, String key) {
|
||||
return prefix + "/" + key;
|
||||
return prefix + '/' + key;
|
||||
}
|
||||
|
||||
public static String getUserName(String serverAddress) {
|
||||
|
|
|
@ -161,11 +161,11 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
JTableHeader th = jTablePlayers.getTableHeader();
|
||||
TableColumnModel tcm = th.getColumnModel();
|
||||
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(1)).setHeaderValue("Players (" + this.players.length + ")");
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(1)).setHeaderValue("Players (" + this.players.length + ')');
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(8)).setHeaderValue(
|
||||
"Games " + roomUserInfo.getNumberActiveGames()
|
||||
+ (roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads() : " (")
|
||||
+ " limit: " + roomUserInfo.getNumberMaxGames() + ")");
|
||||
+ " limit: " + roomUserInfo.getNumberMaxGames() + ')');
|
||||
th.repaint();
|
||||
this.fireTableDataChanged();
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
String pwdColumn = (String) tableModel.getValueAt(modelRow, TableTableModel.COLUMN_PASSWORD);
|
||||
switch (action) {
|
||||
case "Join":
|
||||
if (owner.equals(SessionHandler.getUserName()) || owner.startsWith(SessionHandler.getUserName() + ",")) {
|
||||
if (owner.equals(SessionHandler.getUserName()) || owner.startsWith(SessionHandler.getUserName() + ',')) {
|
||||
try {
|
||||
JDesktopPane desktopPane = (JDesktopPane) MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
|
||||
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(javax.swing.JLayeredPane.DEFAULT_LAYER);
|
||||
|
@ -350,7 +350,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
private void saveDividerLocations() {
|
||||
// save panel sizes and divider locations.
|
||||
Rectangle rec = MageFrame.getDesktop().getBounds();
|
||||
String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight());
|
||||
String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb);
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_1, Integer.toString(this.jSplitPane1.getDividerLocation()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_2, Integer.toString(this.jSplitPaneTables.getDividerLocation()));
|
||||
|
@ -387,7 +387,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
Rectangle rec = MageFrame.getDesktop().getBounds();
|
||||
if (rec != null) {
|
||||
String size = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, null);
|
||||
String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight());
|
||||
String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
|
||||
// use divider positions only if screen size is the same as it was the time the settings were saved
|
||||
if (size != null && size.equals(sb)) {
|
||||
String location = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_1, null);
|
||||
|
|
|
@ -174,7 +174,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
private void saveDividerLocations() {
|
||||
// save panel sizes and divider locations.
|
||||
Rectangle rec = MageFrame.getDesktop().getBounds();
|
||||
String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight());
|
||||
String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb);
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_TOURNAMENT_DIVIDER_LOCATION_1, Integer.toString(this.jSplitPane1.getDividerLocation()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_TOURNAMENT_DIVIDER_LOCATION_2, Integer.toString(this.jSplitPane2.getDividerLocation()));
|
||||
|
@ -184,7 +184,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
Rectangle rec = MageFrame.getDesktop().getBounds();
|
||||
if (rec != null) {
|
||||
String size = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, null);
|
||||
String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight());
|
||||
String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight());
|
||||
// use divider positions only if screen size is the same as it was the time the settings were saved
|
||||
if (size != null && size.equals(sb)) {
|
||||
String location = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TOURNAMENT_DIVIDER_LOCATION_1, null);
|
||||
|
@ -244,7 +244,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
c = c.getParent();
|
||||
}
|
||||
if (c != null) {
|
||||
((TournamentPane) c).setTitle("Tournament [" + tournament.getTournamentName() + "]");
|
||||
((TournamentPane) c).setTitle("Tournament [" + tournament.getTournamentName() + ']');
|
||||
}
|
||||
txtName.setText(tournament.getTournamentName());
|
||||
txtType.setText(tournament.getTournamentType());
|
||||
|
@ -260,7 +260,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
if (tournament.getStepStartTime() != null) {
|
||||
timeLeft = Format.getDuration(tournament.getConstructionTime() - (tournament.getServerTime().getTime() - tournament.getStepStartTime().getTime()) / 1000);
|
||||
}
|
||||
txtTournamentState.setText(new StringBuilder(tournament.getTournamentState()).append(" (").append(timeLeft).append(")").toString());
|
||||
txtTournamentState.setText(new StringBuilder(tournament.getTournamentState()).append(" (").append(timeLeft).append(')').toString());
|
||||
break;
|
||||
case "Dueling":
|
||||
case "Drafting":
|
||||
|
|
|
@ -59,7 +59,7 @@ public class CardsViewUtil {
|
|||
CardsView cards = new CardsView();
|
||||
|
||||
for (SimpleCardView simple: view.values()) {
|
||||
String key = simple.getExpansionSetCode() + "_" + simple.getCardNumber();
|
||||
String key = simple.getExpansionSetCode() + '_' + simple.getCardNumber();
|
||||
Card card = loadedCards.get(key);
|
||||
if(card == null)
|
||||
{
|
||||
|
|
|
@ -62,13 +62,13 @@ public class Format {
|
|||
seconds = seconds % 3600;
|
||||
long m = seconds / 60;
|
||||
long s = seconds % 60;
|
||||
sb.append(h).append(":");
|
||||
sb.append(h).append(':');
|
||||
if (m<10) {
|
||||
sb.append("0");
|
||||
sb.append('0');
|
||||
}
|
||||
sb.append(m).append(":");
|
||||
sb.append(m).append(':');
|
||||
if (s<10) {
|
||||
sb.append("0");
|
||||
sb.append('0');
|
||||
}
|
||||
sb.append(s);
|
||||
return sb.toString();
|
||||
|
|
|
@ -112,7 +112,7 @@ public class MusicPlayer {
|
|||
volume = (FloatControl) sourceDataLine.getControl(FloatControl.Type.MASTER_GAIN);
|
||||
sourceDataLine.start();
|
||||
} catch (Exception e) {
|
||||
log.error("Couldn't load file: " + file + " " + e);
|
||||
log.error("Couldn't load file: " + file + ' ' + e);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ public class GuiDisplayUtil {
|
|||
buffer.append("<tr><td valign='top'><b>");
|
||||
buffer.append(card.getDisplayName());
|
||||
if (card.isGameObject()) {
|
||||
buffer.append(" [").append(card.getId().toString().substring(0, 3)).append("]");
|
||||
buffer.append(" [").append(card.getId().toString().substring(0, 3)).append(']');
|
||||
}
|
||||
buffer.append("</b></td><td align='right' valign='top' style='width:");
|
||||
buffer.append(symbolCount * GUISizeHelper.cardTooltipFontSize);
|
||||
|
@ -232,7 +232,7 @@ public class GuiDisplayUtil {
|
|||
}
|
||||
buffer.append("</td></tr></table>");
|
||||
buffer.append("<table cellspacing=0 cellpadding=0 border=0 width='100%'><tr><td style='margin-left: 1px'>");
|
||||
String imageSize = " width=" + GUISizeHelper.cardTooltipFontSize + " height=" + GUISizeHelper.cardTooltipFontSize + ">";
|
||||
String imageSize = " width=" + GUISizeHelper.cardTooltipFontSize + " height=" + GUISizeHelper.cardTooltipFontSize + '>';
|
||||
if (card.getColor().isWhite()) {
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_white.png")).append("' alt='W' ").append(imageSize);
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ public class GuiDisplayUtil {
|
|||
|
||||
String pt = "";
|
||||
if (CardUtil.isCreature(card)) {
|
||||
pt = card.getPower() + "/" + card.getToughness();
|
||||
pt = card.getPower() + '/' + card.getToughness();
|
||||
} else if (CardUtil.isPlaneswalker(card)) {
|
||||
pt = card.getLoyalty();
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ public class GuiDisplayUtil {
|
|||
buffer.append("<td align='right'>");
|
||||
if (!card.isControlledByOwner()) {
|
||||
if (card instanceof PermanentView) {
|
||||
buffer.append("[").append(((PermanentView) card).getNameOwner()).append("] ");
|
||||
buffer.append('[').append(((PermanentView) card).getNameOwner()).append("] ");
|
||||
} else {
|
||||
buffer.append("[only controlled] ");
|
||||
}
|
||||
|
@ -361,16 +361,16 @@ public class GuiDisplayUtil {
|
|||
private static String getTypes(CardView card) {
|
||||
String types = "";
|
||||
for (String superType : card.getSuperTypes()) {
|
||||
types += superType + " ";
|
||||
types += superType + ' ';
|
||||
}
|
||||
for (CardType cardType : card.getCardTypes()) {
|
||||
types += cardType.toString() + " ";
|
||||
types += cardType.toString() + ' ';
|
||||
}
|
||||
if (card.getSubTypes().size() > 0) {
|
||||
types += "- ";
|
||||
}
|
||||
for (String subType : card.getSubTypes()) {
|
||||
types += subType + " ";
|
||||
types += subType + ' ';
|
||||
}
|
||||
return types.trim();
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ public class TableUtil {
|
|||
for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
|
||||
TableColumn column = table.getColumnModel().getColumn(table.convertColumnIndexToView(i));
|
||||
if (!firstValue) {
|
||||
columnWidthSettings.append(",");
|
||||
columnOrderSettings.append(",");
|
||||
columnWidthSettings.append(',');
|
||||
columnOrderSettings.append(',');
|
||||
} else {
|
||||
firstValue = false;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class MyComboBoxEditor extends BasicComboBoxEditor {
|
|||
|
||||
@Override
|
||||
public Object getItem() {
|
||||
return "[" + this.selectedItem.toString() + "]";
|
||||
return '[' + this.selectedItem.toString() + ']';
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,7 +53,7 @@ public class SaveObjectUtil {
|
|||
}
|
||||
}
|
||||
String time = now(DATE_PATTERN);
|
||||
File f = new File("income" + File.separator + name + "_" + time + ".save");
|
||||
File f = new File("income" + File.separator + name + '_' + time + ".save");
|
||||
if (!f.exists()) {
|
||||
f.createNewFile();
|
||||
}
|
||||
|
|
|
@ -681,17 +681,17 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
|||
StringBuilder sbType = new StringBuilder();
|
||||
|
||||
for (String superType : card.getSuperTypes()) {
|
||||
sbType.append(superType).append(" ");
|
||||
sbType.append(superType).append(' ');
|
||||
}
|
||||
|
||||
for (CardType cardType : card.getCardTypes()) {
|
||||
sbType.append(cardType.toString()).append(" ");
|
||||
sbType.append(cardType.toString()).append(' ');
|
||||
}
|
||||
|
||||
if (card.getSubTypes().size() > 0) {
|
||||
sbType.append("- ");
|
||||
for (String subType : card.getSubTypes()) {
|
||||
sbType.append(subType).append(" ");
|
||||
sbType.append(subType).append(' ');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -702,30 +702,30 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
|||
StringBuilder sb = new StringBuilder();
|
||||
if (card instanceof StackAbilityView || card instanceof AbilityView) {
|
||||
for (String rule : card.getRules()) {
|
||||
sb.append("\n").append(rule);
|
||||
sb.append('\n').append(rule);
|
||||
}
|
||||
} else {
|
||||
sb.append(card.getName());
|
||||
if (card.getManaCost().size() > 0) {
|
||||
sb.append("\n").append(card.getManaCost());
|
||||
sb.append('\n').append(card.getManaCost());
|
||||
}
|
||||
sb.append("\n").append(cardType);
|
||||
sb.append('\n').append(cardType);
|
||||
if (card.getColor().hasColor()) {
|
||||
sb.append("\n").append(card.getColor().toString());
|
||||
sb.append('\n').append(card.getColor().toString());
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||
sb.append("\n").append(card.getPower()).append("/").append(card.getToughness());
|
||||
sb.append('\n').append(card.getPower()).append('/').append(card.getToughness());
|
||||
} else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
||||
sb.append("\n").append(card.getLoyalty());
|
||||
sb.append('\n').append(card.getLoyalty());
|
||||
}
|
||||
if (card.getRules() == null) {
|
||||
card.overrideRules(new ArrayList<>());
|
||||
}
|
||||
for (String rule : card.getRules()) {
|
||||
sb.append("\n").append(rule);
|
||||
sb.append('\n').append(rule);
|
||||
}
|
||||
if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) {
|
||||
sb.append("\n").append(card.getCardNumber()).append(" - ");
|
||||
sb.append('\n').append(card.getCardNumber()).append(" - ");
|
||||
sb.append(card.getExpansionSetCode()).append(" - ");
|
||||
sb.append(card.getRarity().toString());
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ public class CardPanelComponentImpl extends CardPanel {
|
|||
// PT Text
|
||||
ptText = new GlowText();
|
||||
if (CardUtil.isCreature(gameCard)) {
|
||||
ptText.setText(gameCard.getPower() + "/" + gameCard.getToughness());
|
||||
ptText.setText(gameCard.getPower() + '/' + gameCard.getToughness());
|
||||
} else if (CardUtil.isPlaneswalker(gameCard)) {
|
||||
ptText.setText(gameCard.getLoyalty());
|
||||
}
|
||||
|
@ -580,9 +580,9 @@ public class CardPanelComponentImpl extends CardPanel {
|
|||
|
||||
// Update card text
|
||||
if (CardUtil.isCreature(card) && CardUtil.isPlaneswalker(card)) {
|
||||
ptText.setText(card.getPower() + "/" + card.getToughness() + " (" + card.getLoyalty() + ")");
|
||||
ptText.setText(card.getPower() + '/' + card.getToughness() + " (" + card.getLoyalty() + ')');
|
||||
} else if (CardUtil.isCreature(card)) {
|
||||
ptText.setText(card.getPower() + "/" + card.getToughness());
|
||||
ptText.setText(card.getPower() + '/' + card.getToughness());
|
||||
} else if (CardUtil.isPlaneswalker(card)) {
|
||||
ptText.setText(card.getLoyalty());
|
||||
} else {
|
||||
|
|
|
@ -380,15 +380,15 @@ public abstract class CardRenderer {
|
|||
} else {
|
||||
StringBuilder sbType = new StringBuilder();
|
||||
for (String superType : cardView.getSuperTypes()) {
|
||||
sbType.append(superType).append(" ");
|
||||
sbType.append(superType).append(' ');
|
||||
}
|
||||
for (CardType cardType : cardView.getCardTypes()) {
|
||||
sbType.append(cardType.toString()).append(" ");
|
||||
sbType.append(cardType.toString()).append(' ');
|
||||
}
|
||||
if (cardView.getSubTypes().size() > 0) {
|
||||
sbType.append("- ");
|
||||
for (String subType : cardView.getSubTypes()) {
|
||||
sbType.append(subType).append(" ");
|
||||
sbType.append(subType).append(' ');
|
||||
}
|
||||
}
|
||||
return sbType.toString();
|
||||
|
|
|
@ -89,7 +89,7 @@ public class ManaSymbols {
|
|||
setImages.put(set, rarityImages);
|
||||
|
||||
for (String rarityCode : codes) {
|
||||
File file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET + set + "-" + rarityCode + ".jpg");
|
||||
File file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET + set + '-' + rarityCode + ".jpg");
|
||||
try {
|
||||
Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();
|
||||
int width = image.getWidth(null);
|
||||
|
@ -114,11 +114,11 @@ public class ManaSymbols {
|
|||
}
|
||||
|
||||
for (String code : codes) {
|
||||
file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET_SMALL + set + "-" + code + ".png");
|
||||
file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET_SMALL + set + '-' + code + ".png");
|
||||
if (file.exists()) {
|
||||
continue;
|
||||
}
|
||||
file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET + set + "-" + code + ".jpg");
|
||||
file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET + set + '-' + code + ".jpg");
|
||||
Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();
|
||||
try {
|
||||
int width = image.getWidth(null);
|
||||
|
@ -130,7 +130,7 @@ public class ManaSymbols {
|
|||
}
|
||||
Rectangle r = new Rectangle(15 + dx, (int) (height * (15.0f + dx) / width));
|
||||
BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
File newFile = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET_SMALL + File.separator + set + "-" + code + ".png");
|
||||
File newFile = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET_SMALL + File.separator + set + '-' + code + ".png");
|
||||
ImageIO.write(resized, "png", newFile);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -171,7 +171,7 @@ public class ManaSymbols {
|
|||
resourcePath = Constants.RESOURCE_PATH_MANA_MEDIUM;
|
||||
}
|
||||
for (String symbol : symbols) {
|
||||
File file = new File(getSymbolsPath() + resourcePath + "/" + symbol + ".gif");
|
||||
File file = new File(getSymbolsPath() + resourcePath + '/' + symbol + ".gif");
|
||||
try {
|
||||
|
||||
if (size == 15 || size == 25) {
|
||||
|
@ -315,7 +315,7 @@ public class ManaSymbols {
|
|||
if (symbolFilesFound) {
|
||||
replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll(
|
||||
"<img src='file:" + getSymbolsPath(true) + "/symbols/" + resourcePath + "/$1$2.gif' alt='$1$2' width=" + symbolSize
|
||||
+ " height=" + symbolSize + ">");
|
||||
+ " height=" + symbolSize + '>');
|
||||
}
|
||||
replaced = replaced.replace("|source|", "{source}");
|
||||
replaced = replaced.replace("|this|", "{this}");
|
||||
|
@ -328,7 +328,7 @@ public class ManaSymbols {
|
|||
int factor = size / 15 + 1;
|
||||
Integer width = setImagesExist.get(_set).width * factor;
|
||||
Integer height = setImagesExist.get(_set).height * factor;
|
||||
return "<img src='file:" + getSymbolsPath() + "/sets/small/" + _set + "-" + rarity + ".png' alt='" + rarity + "' height='" + height + "' width='" + width + "' >";
|
||||
return "<img src='file:" + getSymbolsPath() + "/sets/small/" + _set + '-' + rarity + ".png' alt='" + rarity + "' height='" + height + "' width='" + width + "' >";
|
||||
} else {
|
||||
return set;
|
||||
}
|
||||
|
|
|
@ -638,7 +638,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
}
|
||||
g.setColor(textColor);
|
||||
g.setFont(ptTextFont);
|
||||
String ptText = cardView.getPower() + "/" + cardView.getToughness();
|
||||
String ptText = cardView.getPower() + '/' + cardView.getToughness();
|
||||
int ptTextWidth = g.getFontMetrics().stringWidth(ptText);
|
||||
g.drawString(ptText,
|
||||
x + (partWidth - ptTextWidth) / 2, curY - ptTextOffset - 1);
|
||||
|
|
|
@ -22,5 +22,5 @@ public class Constants {
|
|||
String IMAGE_PROPERTIES_FILE = "image.url.properties";
|
||||
}
|
||||
|
||||
public static final String CARD_IMAGE_PATH_TEMPLATE = "." + File.separator + "plugins" + File.separator + "images/{set}/{name}.{collector}.full.jpg";
|
||||
public static final String CARD_IMAGE_PATH_TEMPLATE = '.' + File.separator + "plugins" + File.separator + "images/{set}/{name}.{collector}.full.jpg";
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ public class DownloadJob extends AbstractLaternaBean {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return proxy != null ? proxy.type().toString() + " " : "" + url;
|
||||
return proxy != null ? proxy.type().toString() + ' ' : "" + url;
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -196,7 +196,7 @@ public class DownloadJob extends AbstractLaternaBean {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return proxy != null ? proxy.type().toString() + " " : "" + url;
|
||||
return proxy != null ? proxy.type().toString() + ' ' : "" + url;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ public class CardFrames implements Iterable<DownloadJob> {
|
|||
|
||||
private DownloadJob generateDownloadJob(String dirName, String name) {
|
||||
File dst = new File(outDir, name + ".png");
|
||||
String url = BASE_DOWNLOAD_URL + dirName + "/" + name + ".png";
|
||||
return new DownloadJob("frames-" + dirName + "-" + name, fromURL(url), toFile(dst));
|
||||
String url = BASE_DOWNLOAD_URL + dirName + '/' + name + ".png";
|
||||
return new DownloadJob("frames-" + dirName + '-' + name, fromURL(url), toFile(dst));
|
||||
}
|
||||
|
||||
private void useDefaultDir() {
|
||||
|
|
|
@ -163,12 +163,12 @@ public class GathererSets implements Iterable<DownloadJob> {
|
|||
}
|
||||
|
||||
private DownloadJob generateDownloadJob(String set, String rarity, String urlRarity) {
|
||||
File dst = new File(outDir, set + "-" + rarity + ".jpg");
|
||||
File dst = new File(outDir, set + '-' + rarity + ".jpg");
|
||||
if (symbolsReplacements.containsKey(set)) {
|
||||
set = symbolsReplacements.get(set);
|
||||
}
|
||||
String url = "http://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=" + set + "&size=small&rarity=" + urlRarity;
|
||||
return new DownloadJob(set + "-" + rarity, fromURL(url), toFile(dst));
|
||||
return new DownloadJob(set + '-' + rarity, fromURL(url), toFile(dst));
|
||||
}
|
||||
|
||||
private void changeOutDir(String path) {
|
||||
|
|
|
@ -54,6 +54,7 @@ public class GathererSymbols implements Iterable<DownloadJob> {
|
|||
|
||||
@Override
|
||||
protected DownloadJob computeNext() {
|
||||
while (true) {
|
||||
String sym;
|
||||
if (symIndex < symbols.length) {
|
||||
sym = symbols[symIndex++];
|
||||
|
@ -68,7 +69,7 @@ public class GathererSymbols implements Iterable<DownloadJob> {
|
|||
symIndex = 0;
|
||||
numeric = 0;
|
||||
dir = new File(outDir, sizes[sizeIndex]);
|
||||
return computeNext();
|
||||
continue;
|
||||
}
|
||||
String symbol = sym.replaceAll("/", "");
|
||||
File dst = new File(dir, symbol + ".gif");
|
||||
|
@ -111,6 +112,7 @@ public class GathererSymbols implements Iterable<DownloadJob> {
|
|||
|
||||
return new DownloadJob(sym, fromURL(url), toFile(dst));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -174,20 +174,20 @@ public class MagicCardsImageSource implements CardImageSource {
|
|||
|
||||
String preferedLanguage = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PREF_LANGUAGE, "en");
|
||||
|
||||
StringBuilder url = new StringBuilder("http://magiccards.info/scans/").append(preferedLanguage).append("/");
|
||||
url.append(set.toLowerCase()).append("/").append(collectorId);
|
||||
StringBuilder url = new StringBuilder("http://magiccards.info/scans/").append(preferedLanguage).append('/');
|
||||
url.append(set.toLowerCase()).append('/').append(collectorId);
|
||||
|
||||
if (card.isTwoFacedCard()) {
|
||||
url.append(card.isSecondSide() ? "b" : "a");
|
||||
}
|
||||
if (card.isSplitCard()) {
|
||||
url.append("a");
|
||||
url.append('a');
|
||||
}
|
||||
if (card.isFlipCard()) {
|
||||
if (card.isFlippedSide()) { // download rotated by 180 degree image
|
||||
url.append("b");
|
||||
url.append('b');
|
||||
} else {
|
||||
url.append("a");
|
||||
url.append('a');
|
||||
}
|
||||
}
|
||||
url.append(".jpg");
|
||||
|
@ -200,16 +200,16 @@ public class MagicCardsImageSource implements CardImageSource {
|
|||
String name = card.getName();
|
||||
// add type to name if it's not 0
|
||||
if (card.getType() > 0) {
|
||||
name = name + " " + card.getType();
|
||||
name = name + ' ' + card.getType();
|
||||
}
|
||||
name = name.replaceAll(" ", "-").replace(",", "").toLowerCase();
|
||||
String set = "not-supported-set";
|
||||
if (setNameTokenReplacement.containsKey(card.getSet())) {
|
||||
set = setNameTokenReplacement.get(card.getSet());
|
||||
} else {
|
||||
set += "-" + card.getSet();
|
||||
set += '-' + card.getSet();
|
||||
}
|
||||
return "http://magiccards.info/extras/token/" + set + "/" + name + ".jpg";
|
||||
return "http://magiccards.info/extras/token/" + set + '/' + name + ".jpg";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -74,7 +74,7 @@ public class MagidexImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
// This will properly escape the url
|
||||
URI uri = new URI("http", "magidex.com", "/extstatic/card/" + cardSet + "/" + cardDownloadName + ".jpg", null, null);
|
||||
URI uri = new URI("http", "magidex.com", "/extstatic/card/" + cardSet + '/' + cardDownloadName + ".jpg", null, null);
|
||||
return uri.toASCIIString();
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class MtgImageSource implements CardImageSource {
|
|||
throw new Exception("Wrong parameters for image: collector id: " + collectorId + ",card set: " + cardSet);
|
||||
}
|
||||
StringBuilder url = new StringBuilder("http://mtgimage.com/set/");
|
||||
url.append(cardSet.toUpperCase()).append("/");
|
||||
url.append(cardSet.toUpperCase()).append('/');
|
||||
|
||||
if (card.isSplitCard()) {
|
||||
url.append(card.getDownloadName().replaceAll(" // ", ""));
|
||||
|
@ -86,9 +86,9 @@ public class MtgImageSource implements CardImageSource {
|
|||
}
|
||||
if (card.isFlipCard()) {
|
||||
if (card.isFlippedSide()) { // download rotated by 180 degree image
|
||||
url.append("b");
|
||||
url.append('b');
|
||||
} else {
|
||||
url.append("a");
|
||||
url.append('a');
|
||||
}
|
||||
}
|
||||
url.append(".jpg");
|
||||
|
|
|
@ -115,7 +115,7 @@ public class MythicspoilerComSource implements CardImageSource {
|
|||
Connection.ProxyType proxyType = Connection.ProxyType.valueByText(prefs.get("proxyType", "None"));
|
||||
for (String setName : setNames.split("\\^")) {
|
||||
String URLSetName = URLEncoder.encode(setName, "UTF-8");
|
||||
String baseUrl = "http://mythicspoiler.com/" + URLSetName + "/";
|
||||
String baseUrl = "http://mythicspoiler.com/" + URLSetName + '/';
|
||||
|
||||
Map<String, String> pageLinks = getSetLinksFromPage(cardSet, aliasesStart, prefs, proxyType, baseUrl, baseUrl);
|
||||
setLinks.putAll(pageLinks);
|
||||
|
@ -166,7 +166,7 @@ public class MythicspoilerComSource implements CardImageSource {
|
|||
Elements cardsImages = doc.select("img[src^=cards/]"); // starts with cards/
|
||||
if (!aliasesStart.isEmpty()) {
|
||||
for (String text : aliasesStart) {
|
||||
cardsImages.addAll(doc.select("img[src^=" + text + "]"));
|
||||
cardsImages.addAll(doc.select("img[src^=" + text + ']'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,8 +179,8 @@ public class MythicspoilerComSource implements CardImageSource {
|
|||
cardName = cardLink.substring(0, cardLink.length() - 4);
|
||||
}
|
||||
if (cardName != null && !cardName.isEmpty()) {
|
||||
if (cardNameAliases.containsKey(cardSet + "-" + cardName)) {
|
||||
cardName = cardNameAliases.get(cardSet + "-" + cardName);
|
||||
if (cardNameAliases.containsKey(cardSet + '-' + cardName)) {
|
||||
cardName = cardNameAliases.get(cardSet + '-' + cardName);
|
||||
} else if (cardName.endsWith("1") || cardName.endsWith("2") || cardName.endsWith("3") || cardName.endsWith("4") || cardName.endsWith("5")) {
|
||||
if (!cardName.startsWith("forest")
|
||||
&& !cardName.startsWith("swamp")
|
||||
|
|
|
@ -162,19 +162,19 @@ public class TokensMtgImageSource implements CardImageSource {
|
|||
TokenData tokenData;
|
||||
if (type == 0) {
|
||||
if (matchedTokens.size() > 1) {
|
||||
logger.info("Multiple images were found for token " + name + ", set " + set + ".");
|
||||
logger.info("Multiple images were found for token " + name + ", set " + set + '.');
|
||||
}
|
||||
tokenData = matchedTokens.get(0);
|
||||
} else {
|
||||
if (type > matchedTokens.size()) {
|
||||
logger.warn("Not enough images for token with type " + type + ", name " + name + ", set " + set + ".");
|
||||
logger.warn("Not enough images for token with type " + type + ", name " + name + ", set " + set + '.');
|
||||
return null;
|
||||
}
|
||||
tokenData = matchedTokens.get(card.getType() - 1);
|
||||
}
|
||||
|
||||
String url = "http://tokens.mtg.onl/tokens/" + tokenData.getExpansionSetCode().trim() + "_"
|
||||
+ tokenData.getNumber().trim() + "-" + tokenData.getName().trim() + ".jpg";
|
||||
String url = "http://tokens.mtg.onl/tokens/" + tokenData.getExpansionSetCode().trim() + '_'
|
||||
+ tokenData.getNumber().trim() + '-' + tokenData.getName().trim() + ".jpg";
|
||||
url = url.replace(' ', '-');
|
||||
return url;
|
||||
}
|
||||
|
|
|
@ -410,11 +410,11 @@ public class WizardCardsImageSource implements CardImageSource {
|
|||
private String normalizeName(String name) {
|
||||
//Split card
|
||||
if(name.contains("//")) {
|
||||
name = name.substring(0, name.indexOf("(") - 1);
|
||||
name = name.substring(0, name.indexOf('(') - 1);
|
||||
}
|
||||
//Special timeshifted name
|
||||
if(name.startsWith("XX")) {
|
||||
name = name.substring(name.indexOf("(") + 1, name.length() - 1);
|
||||
name = name.substring(name.indexOf('(') + 1, name.length() - 1);
|
||||
}
|
||||
return name.replace("\u2014", "-").replace("\u2019", "'")
|
||||
.replace("\u00C6", "AE").replace("\u00E6", "ae")
|
||||
|
@ -456,7 +456,7 @@ public class WizardCardsImageSource implements CardImageSource {
|
|||
} else {
|
||||
link = setLinks.get(Integer.toString(number - 21));
|
||||
if (link != null) {
|
||||
link = link.replace(Integer.toString(number - 20), (Integer.toString(number - 20) + "a"));
|
||||
link = link.replace(Integer.toString(number - 20), (Integer.toString(number - 20) + 'a'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,12 +325,12 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
|
||||
int tokenImages = 0;
|
||||
for (CardDownloadData card : cardsToDownload) {
|
||||
logger.debug((card.isToken() ? "Token" : "Card") + " image to download: " + card.getName() + " (" + card.getSet() + ")");
|
||||
logger.debug((card.isToken() ? "Token" : "Card") + " image to download: " + card.getName() + " (" + card.getSet() + ')');
|
||||
if (card.isToken()) {
|
||||
tokenImages++;
|
||||
}
|
||||
}
|
||||
logger.info("Check download images (total card images: " + numberCardImages + ", total token images: " + numberAllTokenImages + ")");
|
||||
logger.info("Check download images (total card images: " + numberCardImages + ", total token images: " + numberAllTokenImages + ')');
|
||||
logger.info(" => Missing card images: " + (cardsToDownload.size() - tokenImages));
|
||||
logger.info(" => Missing token images: " + tokenImages);
|
||||
return new ArrayList<>(cardsToDownload);
|
||||
|
@ -445,7 +445,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
|
||||
CardDownloadData card = cardsToDownload.get(i);
|
||||
|
||||
logger.debug("Downloading card: " + card.getName() + " (" + card.getSet() + ")");
|
||||
logger.debug("Downloading card: " + card.getName() + " (" + card.getSet() + ')');
|
||||
|
||||
String url;
|
||||
if (ignoreUrls.contains(card.getSet()) || card.isToken()) {
|
||||
|
@ -470,7 +470,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
} catch (Exception ex) {
|
||||
}
|
||||
} else if (cardImageSource.getTotalImages() == -1) {
|
||||
logger.info("Card not available on " + cardImageSource.getSourceName() + ": " + card.getName() + " (" + card.getSet() + ")");
|
||||
logger.info("Card not available on " + cardImageSource.getSourceName() + ": " + card.getName() + " (" + card.getSet() + ')');
|
||||
synchronized (sync) {
|
||||
update(cardIndex + 1, cardsToDownload.size());
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
try {
|
||||
filePath.append(Constants.IO.imageBaseDir);
|
||||
if (!useSpecifiedPaths && card != null) {
|
||||
filePath.append(card.hashCode()).append(".").append(card.getName().replace(":", "").replace("//", "-")).append(".jpg");
|
||||
filePath.append(card.hashCode()).append('.').append(card.getName().replace(":", "").replace("//", "-")).append(".jpg");
|
||||
temporaryFile = new File(filePath.toString());
|
||||
}
|
||||
String imagePath;
|
||||
|
@ -650,7 +650,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
if (card != null && !useSpecifiedPaths) {
|
||||
logger.warn("Image download for " + card.getName()
|
||||
+ (!card.getDownloadName().equals(card.getName()) ? " downloadname: " + card.getDownloadName() : "")
|
||||
+ "(" + card.getSet() + ") failed - responseCode: " + responseCode + " url: " + url.toString());
|
||||
+ '(' + card.getSet() + ") failed - responseCode: " + responseCode + " url: " + url.toString());
|
||||
}
|
||||
if (logger.isDebugEnabled()) { // Shows the returned html from the request to the web server
|
||||
logger.debug("Returned HTML ERROR:\n" + convertStreamToString(((HttpURLConnection) httpConn).getErrorStream()));
|
||||
|
@ -658,7 +658,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
}
|
||||
|
||||
} catch (AccessDeniedException e) {
|
||||
logger.error("The file " + (outputFile != null ? outputFile.toString() : "to add the image of " + card.getName() + "(" + card.getSet() + ")") + " can't be accessed. Try rebooting your system to remove the file lock.");
|
||||
logger.error("The file " + (outputFile != null ? outputFile.toString() : "to add the image of " + card.getName() + '(' + card.getSet() + ')') + " can't be accessed. Try rebooting your system to remove the file lock.");
|
||||
} catch (Exception e) {
|
||||
logger.error(e, e);
|
||||
} finally {
|
||||
|
|
|
@ -255,11 +255,11 @@ public class ImageCache {
|
|||
* Returns the map key for a card, without any suffixes for the image size.
|
||||
*/
|
||||
private static String getKey(CardView card, String name, String suffix) {
|
||||
return name + "#" + card.getExpansionSetCode() + "#" + card.getType() + "#" + card.getCardNumber() + "#"
|
||||
return name + '#' + card.getExpansionSetCode() + '#' + card.getType() + '#' + card.getCardNumber() + '#'
|
||||
+ (card.getTokenSetCode() == null ? "" : card.getTokenSetCode())
|
||||
+ suffix
|
||||
+ (card.getUsesVariousArt() ? "#usesVariousArt" : "")
|
||||
+ (card.getTokenDescriptor() != null ? "#" + card.getTokenDescriptor() : "#");
|
||||
+ (card.getTokenDescriptor() != null ? '#' + card.getTokenDescriptor() : "#");
|
||||
}
|
||||
|
||||
// /**
|
||||
|
|
|
@ -168,11 +168,11 @@ public class CardImageUtils {
|
|||
String imageDir = getImageDir(card, imagesPath);
|
||||
String imageName;
|
||||
|
||||
String type = card.getType() != 0 ? " " + Integer.toString(card.getType()) : "";
|
||||
String type = card.getType() != 0 ? ' ' + Integer.toString(card.getType()) : "";
|
||||
String name = card.getFileName().isEmpty() ? card.getName().replace(":", "").replace("//", "-") : card.getFileName();
|
||||
|
||||
if (card.getUsesVariousArt()) {
|
||||
imageName = name + "." + card.getCollectorId() + ".full.jpg";
|
||||
imageName = name + '.' + card.getCollectorId() + ".full.jpg";
|
||||
} else {
|
||||
imageName = name + type + ".full.jpg";
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class EntityManagerTest {
|
|||
System.out.print(" arguments=[ ");
|
||||
if (log.getArguments() != null) {
|
||||
for (String argument : log.getArguments()) {
|
||||
System.out.print("arg=" + argument + " ");
|
||||
System.out.print("arg=" + argument + ' ');
|
||||
}
|
||||
}
|
||||
System.out.println("]");
|
||||
|
|
|
@ -93,7 +93,7 @@ public class Connection {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return host + ":" + Integer.toString(port) + "/" + serialization + parameter;
|
||||
return host + ':' + Integer.toString(port) + '/' + serialization + parameter;
|
||||
}
|
||||
|
||||
public String getURI() {
|
||||
|
@ -101,13 +101,13 @@ public class Connection {
|
|||
try {
|
||||
InetAddress inet = getLocalAddress();
|
||||
if (inet != null) {
|
||||
return transport + "://" + inet.getHostAddress() + ":" + port + "/" + serialization + parameter;
|
||||
return transport + "://" + inet.getHostAddress() + ':' + port + '/' + serialization + parameter;
|
||||
}
|
||||
} catch (SocketException ex) {
|
||||
// just use localhost if can't find local ip
|
||||
}
|
||||
}
|
||||
return transport + "://" + host + ":" + port + "/" + serialization + parameter;
|
||||
return transport + "://" + host + ':' + port + '/' + serialization + parameter;
|
||||
}
|
||||
|
||||
public ProxyType getProxyType() {
|
||||
|
|
|
@ -158,7 +158,7 @@ public class SessionImpl implements Session {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unable to connect to server.\n");
|
||||
for (StackTraceElement element : t.getStackTrace()) {
|
||||
sb.append(element.toString()).append("\n");
|
||||
sb.append(element.toString()).append('\n');
|
||||
}
|
||||
client.showMessage(sb.toString());
|
||||
}
|
||||
|
@ -171,11 +171,11 @@ public class SessionImpl implements Session {
|
|||
return establishJBossRemotingConnection(connection) && handleRemotingTaskExceptions(new RemotingTask() {
|
||||
@Override
|
||||
public boolean run() throws Throwable {
|
||||
logger.info("Trying to register as " + getUserName() + " to XMAGE server at " + connection.getHost() + ":" + connection.getPort());
|
||||
logger.info("Trying to register as " + getUserName() + " to XMAGE server at " + connection.getHost() + ':' + connection.getPort());
|
||||
boolean registerResult = server.registerUser(sessionId, connection.getUsername(),
|
||||
connection.getPassword(), connection.getEmail());
|
||||
if (registerResult) {
|
||||
logger.info("Registered as " + getUserName() + " to MAGE server at " + connection.getHost() + ":" + connection.getPort());
|
||||
logger.info("Registered as " + getUserName() + " to MAGE server at " + connection.getHost() + ':' + connection.getPort());
|
||||
}
|
||||
return registerResult;
|
||||
}
|
||||
|
@ -187,10 +187,10 @@ public class SessionImpl implements Session {
|
|||
return establishJBossRemotingConnection(connection) && handleRemotingTaskExceptions(new RemotingTask() {
|
||||
@Override
|
||||
public boolean run() throws Throwable {
|
||||
logger.info("Trying to ask for an auth token to " + getEmail() + " to XMAGE server at " + connection.getHost() + ":" + connection.getPort());
|
||||
logger.info("Trying to ask for an auth token to " + getEmail() + " to XMAGE server at " + connection.getHost() + ':' + connection.getPort());
|
||||
boolean result = server.emailAuthToken(sessionId, connection.getEmail());
|
||||
if (result) {
|
||||
logger.info("An auth token is emailed to " + getEmail() + " from MAGE server at " + connection.getHost() + ":" + connection.getPort());
|
||||
logger.info("An auth token is emailed to " + getEmail() + " from MAGE server at " + connection.getHost() + ':' + connection.getPort());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -202,10 +202,10 @@ public class SessionImpl implements Session {
|
|||
return establishJBossRemotingConnection(connection) && handleRemotingTaskExceptions(new RemotingTask() {
|
||||
@Override
|
||||
public boolean run() throws Throwable {
|
||||
logger.info("Trying reset the password in XMAGE server at " + connection.getHost() + ":" + connection.getPort());
|
||||
logger.info("Trying reset the password in XMAGE server at " + connection.getHost() + ':' + connection.getPort());
|
||||
boolean result = server.resetPassword(sessionId, connection.getEmail(), connection.getAuthToken(), connection.getPassword());
|
||||
if (result) {
|
||||
logger.info("Password is successfully reset in MAGE server at " + connection.getHost() + ":" + connection.getPort());
|
||||
logger.info("Password is successfully reset in MAGE server at " + connection.getHost() + ':' + connection.getPort());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ public class SessionImpl implements Session {
|
|||
&& handleRemotingTaskExceptions(new RemotingTask() {
|
||||
@Override
|
||||
public boolean run() throws Throwable {
|
||||
logger.info("Trying to log-in as " + getUserName() + " to XMAGE server at " + connection.getHost() + ":" + connection.getPort());
|
||||
logger.info("Trying to log-in as " + getUserName() + " to XMAGE server at " + connection.getHost() + ':' + connection.getPort());
|
||||
boolean registerResult;
|
||||
if (connection.getAdminPassword() == null) {
|
||||
// for backward compatibility. don't remove twice call - first one does nothing but for version checking
|
||||
|
@ -234,8 +234,8 @@ public class SessionImpl implements Session {
|
|||
if (!connection.getUsername().equals("Admin")) {
|
||||
updateDatabase(connection.isForceDBComparison(), serverState);
|
||||
}
|
||||
logger.info("Logged-in as " + getUserName() + " to MAGE server at " + connection.getHost() + ":" + connection.getPort());
|
||||
client.connected(getUserName() + "@" + connection.getHost() + ":" + connection.getPort() + " ");
|
||||
logger.info("Logged-in as " + getUserName() + " to MAGE server at " + connection.getHost() + ':' + connection.getPort());
|
||||
client.connected(getUserName() + '@' + connection.getHost() + ':' + connection.getPort() + ' ');
|
||||
return true;
|
||||
}
|
||||
disconnect(false);
|
||||
|
@ -260,7 +260,7 @@ public class SessionImpl implements Session {
|
|||
boolean result = handleRemotingTaskExceptions(new RemotingTask() {
|
||||
@Override
|
||||
public boolean run() throws Throwable {
|
||||
logger.info("Trying to connect to XMAGE server at " + connection.getHost() + ":" + connection.getPort());
|
||||
logger.info("Trying to connect to XMAGE server at " + connection.getHost() + ':' + connection.getPort());
|
||||
|
||||
System.setProperty("http.nonProxyHosts", "code.google.com");
|
||||
System.setProperty("socksNonProxyHosts", "code.google.com");
|
||||
|
@ -391,14 +391,14 @@ public class SessionImpl implements Session {
|
|||
|
||||
Set callbackConnectors = callbackClient.getCallbackConnectors(callbackHandler);
|
||||
if (callbackConnectors.size() != 1) {
|
||||
logger.warn("There should be one callback Connector (number existing = " + callbackConnectors.size() + ")");
|
||||
logger.warn("There should be one callback Connector (number existing = " + callbackConnectors.size() + ')');
|
||||
}
|
||||
|
||||
callbackClient.invoke(null);
|
||||
|
||||
sessionId = callbackClient.getSessionId();
|
||||
sessionState = SessionState.CONNECTED;
|
||||
logger.info("Connected to MAGE server at " + connection.getHost() + ":" + connection.getPort());
|
||||
logger.info("Connected to MAGE server at " + connection.getHost() + ':' + connection.getPort());
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -451,7 +451,7 @@ public class SessionImpl implements Session {
|
|||
break;
|
||||
}
|
||||
if (t.getCause() != null && logger.isDebugEnabled()) {
|
||||
message = "\n" + t.getCause().getMessage() + message;
|
||||
message = '\n' + t.getCause().getMessage() + message;
|
||||
logger.debug(t.getCause().getMessage());
|
||||
}
|
||||
|
||||
|
@ -1434,7 +1434,7 @@ public class SessionImpl implements Session {
|
|||
@Override
|
||||
public boolean endUserSession(String userSessionId) {
|
||||
try {
|
||||
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to mute userSessionId " + userSessionId + "?", "WARNING",
|
||||
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to mute userSessionId " + userSessionId + '?', "WARNING",
|
||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
if (isConnected()) {
|
||||
server.endUserSession(sessionId, userSessionId);
|
||||
|
@ -1470,7 +1470,7 @@ public class SessionImpl implements Session {
|
|||
@Override
|
||||
public boolean setActivation(String userName, boolean active) {
|
||||
try {
|
||||
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to set active to " + active + " for user: " + userName + "?", "WARNING",
|
||||
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to set active to " + active + " for user: " + userName + '?', "WARNING",
|
||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
if (isConnected()) {
|
||||
server.setActivation(sessionId, userName, active);
|
||||
|
@ -1496,7 +1496,7 @@ public class SessionImpl implements Session {
|
|||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
return setActivation(userName, false);
|
||||
}
|
||||
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to toggle activation for user: " + userName + "?", "WARNING",
|
||||
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to toggle activation for user: " + userName + '?', "WARNING",
|
||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
if (isConnected()) {
|
||||
server.toggleActivation(sessionId, userName);
|
||||
|
@ -1542,8 +1542,8 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
|
||||
private void handleInvalidDeckException(InvalidDeckException iex) {
|
||||
logger.warn(iex.getMessage() + "\n" + iex.getInvalid());
|
||||
client.showError(iex.getMessage() + "\n" + iex.getInvalid());
|
||||
logger.warn(iex.getMessage() + '\n' + iex.getInvalid());
|
||||
client.showError(iex.getMessage() + '\n' + iex.getInvalid());
|
||||
}
|
||||
|
||||
private void handleGameException(GameException ex) {
|
||||
|
@ -1588,7 +1588,7 @@ public class SessionImpl implements Session {
|
|||
if (isConnected()) {
|
||||
long startTime = System.nanoTime();
|
||||
if (!server.ping(sessionId, pingInfo)) {
|
||||
logger.error("Ping failed: " + this.getUserName() + " Session: " + sessionId + " to MAGE server at " + connection.getHost() + ":" + connection.getPort());
|
||||
logger.error("Ping failed: " + this.getUserName() + " Session: " + sessionId + " to MAGE server at " + connection.getHost() + ':' + connection.getPort());
|
||||
throw new MageException("Ping failed");
|
||||
}
|
||||
pingTime.add(System.nanoTime() - startTime);
|
||||
|
@ -1602,7 +1602,7 @@ public class SessionImpl implements Session {
|
|||
sum += time;
|
||||
}
|
||||
milliSeconds = TimeUnit.MILLISECONDS.convert(sum / pingTime.size(), TimeUnit.NANOSECONDS);
|
||||
pingInfo = lastPing + " (Av: " + (milliSeconds > 0 ? milliSeconds + "ms" : "<1ms") + ")";
|
||||
pingInfo = lastPing + " (Av: " + (milliSeconds > 0 ? milliSeconds + "ms" : "<1ms") + ')';
|
||||
}
|
||||
return true;
|
||||
} catch (MageException ex) {
|
||||
|
|
|
@ -77,7 +77,7 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return major + "." + minor + "." + patch + info + minorPatch;
|
||||
return major + "." + minor + '.' + patch + info + minorPatch;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -732,7 +732,7 @@ public class CardView extends SimpleCardView {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName() + " [" + getId() + "]";
|
||||
return getName() + " [" + getId() + ']';
|
||||
}
|
||||
|
||||
public boolean isFaceDown() {
|
||||
|
|
|
@ -79,11 +79,11 @@ public class GameEndView implements Serializable {
|
|||
}
|
||||
if (you != null) {
|
||||
if (you.hasWon()) {
|
||||
gameInfo = new StringBuilder("You won the game on turn ").append(game.getTurnNum()).append(".").toString();
|
||||
gameInfo = new StringBuilder("You won the game on turn ").append(game.getTurnNum()).append('.').toString();
|
||||
} else if (winner > 0) {
|
||||
gameInfo = new StringBuilder("You lost the game on turn ").append(game.getTurnNum()).append(".").toString();
|
||||
gameInfo = new StringBuilder("You lost the game on turn ").append(game.getTurnNum()).append('.').toString();
|
||||
} else {
|
||||
gameInfo = new StringBuilder("Game is a draw on Turn ").append(game.getTurnNum()).append(".").toString();
|
||||
gameInfo = new StringBuilder("Game is a draw on Turn ").append(game.getTurnNum()).append('.').toString();
|
||||
}
|
||||
}
|
||||
matchView = new MatchView(table);
|
||||
|
|
|
@ -138,7 +138,7 @@ public class GameView implements Serializable {
|
|||
if (designation != null) {
|
||||
stack.put(stackObject.getId(), new CardView(designation, (StackAbility) stackObject));
|
||||
} else {
|
||||
LOGGER.fatal("Designation object not found: " + object.getName() + " " + object.toString() + " " + object.getClass().toString());
|
||||
LOGGER.fatal("Designation object not found: " + object.getName() + ' ' + object.toString() + ' ' + object.getClass().toString());
|
||||
}
|
||||
|
||||
} else if (object instanceof StackAbility) {
|
||||
|
@ -147,7 +147,7 @@ public class GameView implements Serializable {
|
|||
stack.put(stackObject.getId(), new CardView(((StackAbility) stackObject)));
|
||||
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
|
||||
} else {
|
||||
LOGGER.fatal("Object can't be cast to StackAbility: " + object.getName() + " " + object.toString() + " " + object.getClass().toString());
|
||||
LOGGER.fatal("Object can't be cast to StackAbility: " + object.getName() + ' ' + object.toString() + ' ' + object.getClass().toString());
|
||||
}
|
||||
} else {
|
||||
// can happen if a player times out while ability is on the stack
|
||||
|
|
|
@ -78,7 +78,7 @@ public class MatchView implements Serializable {
|
|||
this.gameType = match.getOptions().getGameType();
|
||||
|
||||
if (table.getName() != null && !table.getName().isEmpty()) {
|
||||
this.deckType = match.getOptions().getDeckType() + " [" + table.getName() + "]";
|
||||
this.deckType = match.getOptions().getDeckType() + " [" + table.getName() + ']';
|
||||
} else {
|
||||
this.deckType = match.getOptions().getDeckType();
|
||||
}
|
||||
|
@ -102,9 +102,9 @@ public class MatchView implements Serializable {
|
|||
int lostGames = match.getNumGames() - (matchPlayer.getWins() + match.getDraws());
|
||||
sb1.append(", ");
|
||||
sb2.append(matchPlayer.getName()).append(" [");
|
||||
sb2.append(matchPlayer.getWins()).append("-");
|
||||
sb2.append(matchPlayer.getWins()).append('-');
|
||||
if (match.getDraws() > 0) {
|
||||
sb2.append(match.getDraws()).append("-");
|
||||
sb2.append(match.getDraws()).append('-');
|
||||
}
|
||||
sb2.append(lostGames).append("], ");
|
||||
}
|
||||
|
@ -127,14 +127,14 @@ public class MatchView implements Serializable {
|
|||
this.matchName = table.getName();
|
||||
this.gameType = table.getGameType();
|
||||
if (table.getTournament().getOptions().getNumberRounds() > 0) {
|
||||
this.gameType = new StringBuilder(this.gameType).append(" ").append(table.getTournament().getOptions().getNumberRounds()).append(" Rounds").toString();
|
||||
this.gameType = new StringBuilder(this.gameType).append(' ').append(table.getTournament().getOptions().getNumberRounds()).append(" Rounds").toString();
|
||||
}
|
||||
StringBuilder sbDeckType = new StringBuilder(table.getDeckType());
|
||||
if (!table.getTournament().getBoosterInfo().isEmpty()) {
|
||||
sbDeckType.append(" ").append(table.getTournament().getBoosterInfo());
|
||||
sbDeckType.append(' ').append(table.getTournament().getBoosterInfo());
|
||||
}
|
||||
if (table.getName() != null && !table.getName().isEmpty()) {
|
||||
sbDeckType.append(table.getDeckType()).append(" [").append(table.getName()).append("]");
|
||||
sbDeckType.append(table.getDeckType()).append(" [").append(table.getName()).append(']');
|
||||
}
|
||||
this.deckType = sbDeckType.toString();
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
|
@ -145,7 +145,7 @@ public class MatchView implements Serializable {
|
|||
StringBuilder sb2 = new StringBuilder();
|
||||
if (table.getTournament().getRounds().size() > 0) {
|
||||
for (TournamentPlayer tPlayer : table.getTournament().getPlayers()) {
|
||||
sb2.append(tPlayer.getPlayer().getName()).append(": ").append(tPlayer.getResults()).append(" ");
|
||||
sb2.append(tPlayer.getPlayer().getName()).append(": ").append(tPlayer.getResults()).append(' ');
|
||||
}
|
||||
} else {
|
||||
sb2.append("Canceled");
|
||||
|
|
|
@ -73,7 +73,7 @@ public class TableView implements Serializable {
|
|||
this.tableName = table.getName();
|
||||
String tableNameInfo = null;
|
||||
if (tableName != null && !tableName.isEmpty()) {
|
||||
tableNameInfo = " [" + table.getName() + "]";
|
||||
tableNameInfo = " [" + table.getName() + ']';
|
||||
}
|
||||
this.controllerName = table.getControllerName();
|
||||
this.tableState = table.getState();
|
||||
|
@ -95,7 +95,7 @@ public class TableView implements Serializable {
|
|||
if (!table.isTournament()) {
|
||||
// MATCH
|
||||
if (table.getState()==TableState.WAITING || table.getState()==TableState.READY_TO_START) {
|
||||
tableStateText = table.getState().toString() + " (" + table.getMatch().getPlayers().size() + "/" + table.getSeats().length + ")";
|
||||
tableStateText = table.getState().toString() + " (" + table.getMatch().getPlayers().size() + '/' + table.getSeats().length + ')';
|
||||
} else {
|
||||
tableStateText = table.getState().toString();
|
||||
}
|
||||
|
@ -107,10 +107,10 @@ public class TableView implements Serializable {
|
|||
for (MatchPlayer matchPlayer : table.getMatch().getPlayers()) {
|
||||
if (matchPlayer.getPlayer() == null) {
|
||||
sb.append(", ").append("[unknown]");
|
||||
sbScore.append("-").append(matchPlayer.getWins());
|
||||
sbScore.append('-').append(matchPlayer.getWins());
|
||||
} else if (!matchPlayer.getName().equals(table.getControllerName())) {
|
||||
sb.append(", ").append(matchPlayer.getName());
|
||||
sbScore.append("-").append(matchPlayer.getWins());
|
||||
sbScore.append('-').append(matchPlayer.getWins());
|
||||
} else {
|
||||
sbScore.insert(0, matchPlayer.getWins()).insert(0, " Score: ");
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public class TableView implements Serializable {
|
|||
} else {
|
||||
// TOURNAMENT
|
||||
if (table.getTournament().getOptions().getNumberRounds() > 0) {
|
||||
this.gameType = new StringBuilder(this.gameType).append(" ").append(table.getTournament().getOptions().getNumberRounds()).append(" Rounds").toString();
|
||||
this.gameType = new StringBuilder(this.gameType).append(' ').append(table.getTournament().getOptions().getNumberRounds()).append(" Rounds").toString();
|
||||
}
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
for (TournamentPlayer tp : table.getTournament().getPlayers()) {
|
||||
|
@ -152,10 +152,10 @@ public class TableView implements Serializable {
|
|||
StringBuilder infoText = new StringBuilder();
|
||||
StringBuilder stateText = new StringBuilder(table.getState().toString());
|
||||
infoText.append("Wins:").append(table.getTournament().getOptions().getMatchOptions().getWinsNeeded());
|
||||
infoText.append(" Seats: ").append(table.getTournament().getPlayers().size()).append("/").append(table.getNumberOfSeats());
|
||||
infoText.append(" Seats: ").append(table.getTournament().getPlayers().size()).append('/').append(table.getNumberOfSeats());
|
||||
switch (table.getState()) {
|
||||
case WAITING:
|
||||
stateText.append(" (").append(table.getTournament().getPlayers().size()).append("/").append(table.getNumberOfSeats()).append(")");
|
||||
stateText.append(" (").append(table.getTournament().getPlayers().size()).append('/').append(table.getNumberOfSeats()).append(')');
|
||||
case READY_TO_START:
|
||||
case STARTING:
|
||||
infoText.append(" Time: ").append(table.getTournament().getOptions().getMatchOptions().getMatchTimeLimit().toString());
|
||||
|
@ -172,13 +172,13 @@ public class TableView implements Serializable {
|
|||
case DRAFTING:
|
||||
Draft draft = table.getTournament().getDraft();
|
||||
if (draft != null) {
|
||||
stateText.append(" ").append(draft.getBoosterNum()).append("/").append(draft.getCardNum() - 1);
|
||||
stateText.append(' ').append(draft.getBoosterNum()).append('/').append(draft.getCardNum() - 1);
|
||||
}
|
||||
default:
|
||||
}
|
||||
this.additionalInfo = infoText.toString();
|
||||
this.tableStateText = stateText.toString();
|
||||
this.deckType = table.getDeckType() + " " + table.getTournament().getBoosterInfo() + (tableNameInfo != null ? tableNameInfo : "");
|
||||
this.deckType = table.getDeckType() + ' ' + table.getTournament().getBoosterInfo() + (tableNameInfo != null ? tableNameInfo : "");
|
||||
this.skillLevel = table.getTournament().getOptions().getMatchOptions().getSkillLevel();
|
||||
this.quitRatio = Integer.toString(table.getTournament().getOptions().getQuitRatio());
|
||||
this.limited = table.getTournament().getOptions().getMatchOptions().isLimited();
|
||||
|
|
|
@ -70,14 +70,14 @@ public class TournamentGameView implements Serializable {
|
|||
|
||||
if (game.hasEnded()) {
|
||||
if (game.getEndTime() != null) {
|
||||
duelingTime = " (" + DateFormat.getDuration((game.getEndTime().getTime() - game.getStartTime().getTime())/1000) + ")";
|
||||
duelingTime = " (" + DateFormat.getDuration((game.getEndTime().getTime() - game.getStartTime().getTime())/1000) + ')';
|
||||
}
|
||||
this.state = "Finished" + duelingTime;
|
||||
this.result = game.getWinner();
|
||||
}
|
||||
else {
|
||||
if (game.getStartTime() != null) {
|
||||
duelingTime = " (" + DateFormat.getDuration((new Date().getTime() - game.getStartTime().getTime())/1000) + ")";
|
||||
duelingTime = " (" + DateFormat.getDuration((new Date().getTime() - game.getStartTime().getTime())/1000) + ')';
|
||||
}
|
||||
this.state = "Dueling" + duelingTime;
|
||||
this.result = "";
|
||||
|
|
|
@ -51,7 +51,7 @@ public class TournamentPlayerView implements Serializable, Comparable {
|
|||
StringBuilder sb = new StringBuilder(tournamentPlayer.getState().toString());
|
||||
String stateInfo = tournamentPlayer.getStateInfo();
|
||||
if (!stateInfo.isEmpty()) {
|
||||
sb.append(" (").append(stateInfo).append(")");
|
||||
sb.append(" (").append(stateInfo).append(')');
|
||||
}
|
||||
sb.append(tournamentPlayer.getDisconnectInfo());
|
||||
this.state = sb.toString();
|
||||
|
|
|
@ -67,7 +67,7 @@ public class TournamentView implements Serializable {
|
|||
typeText.append(" / ").append(tournament.getOptions().getMatchOptions().getDeckType());
|
||||
}
|
||||
if (tournament.getNumberRounds() > 0) {
|
||||
typeText.append(" ").append(tournament.getNumberRounds()).append(" rounds");
|
||||
typeText.append(' ').append(tournament.getNumberRounds()).append(" rounds");
|
||||
}
|
||||
tournamentType = typeText.toString();
|
||||
startTime = tournament.getStartTime();
|
||||
|
@ -79,7 +79,7 @@ public class TournamentView implements Serializable {
|
|||
tournamentState = tournament.getTournamentState();
|
||||
|
||||
if (tournament.getTournamentState().equals("Drafting") && tournament.getDraft() != null) {
|
||||
runningInfo = "booster/card: " + tournament.getDraft().getBoosterNum() +"/" + (tournament.getDraft().getCardNum() -1);
|
||||
runningInfo = "booster/card: " + tournament.getDraft().getBoosterNum() + '/' + (tournament.getDraft().getCardNum() -1);
|
||||
} else {
|
||||
runningInfo = "";
|
||||
}
|
||||
|
|
|
@ -423,7 +423,7 @@ public class ConnectDialog extends JDialog {
|
|||
connection.setProxyPassword(new String(this.txtPasswordField.getPassword()));
|
||||
}
|
||||
|
||||
logger.debug("connecting: " + connection.getProxyType() + " " + connection.getProxyHost() + " " + connection.getProxyPort());
|
||||
logger.debug("connecting: " + connection.getProxyType() + ' ' + connection.getProxyHost() + ' ' + connection.getProxyPort());
|
||||
task = new ConnectTask();
|
||||
task.execute();
|
||||
|
||||
|
|
|
@ -575,14 +575,14 @@ class UpdateUsersTask extends SwingWorker<Void, List<UserView>> {
|
|||
for (UserView u2 : usersToCheck) {
|
||||
if (u1.getUserName().equals(u2.getUserName())) {
|
||||
found = true;
|
||||
String s = u1.getUserName() + "," + u1.getHost();
|
||||
String s = u1.getUserName() + ',' + u1.getHost();
|
||||
if (peopleIps.get(s) == null) {
|
||||
logger.warn("Found new user: " + u1.getUserName() + "," + u1.getHost());
|
||||
logger.warn("Found new user: " + u1.getUserName() + ',' + u1.getHost());
|
||||
peopleIps.put(s, "1");
|
||||
}
|
||||
s = u2.getUserName() + "," + u2.getHost();
|
||||
s = u2.getUserName() + ',' + u2.getHost();
|
||||
if (peopleIps.get(s) == null) {
|
||||
logger.warn("Found new user: " + u1.getUserName() + "," + u1.getHost());
|
||||
logger.warn("Found new user: " + u1.getUserName() + ',' + u1.getHost());
|
||||
peopleIps.put(s, "1");
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -142,16 +142,16 @@ public class Commander extends Constructed {
|
|||
} else {
|
||||
for (Card commander : deck.getSideboard()) {
|
||||
if (bannedCommander.contains(commander.getName())) {
|
||||
invalid.put("Commander", "Commander banned (" + commander.getName() + ")");
|
||||
invalid.put("Commander", "Commander banned (" + commander.getName() + ')');
|
||||
valid = false;
|
||||
}
|
||||
if ((!commander.getCardType().contains(CardType.CREATURE) || !commander.getSupertype().contains("Legendary"))
|
||||
&& (!commander.getCardType().contains(CardType.PLANESWALKER) || !commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) {
|
||||
invalid.put("Commander", "Commander invalid (" + commander.getName() + ")");
|
||||
invalid.put("Commander", "Commander invalid (" + commander.getName() + ')');
|
||||
valid = false;
|
||||
}
|
||||
if (deck.getSideboard().size() == 2 && !commander.getAbilities().contains(PartnerAbility.getInstance())) {
|
||||
invalid.put("Commander", "Commander without Partner (" + commander.getName() + ")");
|
||||
invalid.put("Commander", "Commander without Partner (" + commander.getName() + ')');
|
||||
valid = false;
|
||||
}
|
||||
FilterMana commanderColor = CardUtil.getColorIdentity(commander);
|
||||
|
@ -174,7 +174,7 @@ public class Commander extends Constructed {
|
|||
}
|
||||
for (Card card : deck.getCards()) {
|
||||
if (!cardHasValidColor(colorIdentity, card)) {
|
||||
invalid.put(card.getName(), "Invalid color (" + colorIdentity.toString() + ")");
|
||||
invalid.put(card.getName(), "Invalid color (" + colorIdentity.toString() + ')');
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,11 +189,11 @@ public class TinyLeaders extends Constructed {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
invalid.put("Commander", "Commander banned (" + commander.getName() + ")");
|
||||
invalid.put("Commander", "Commander banned (" + commander.getName() + ')');
|
||||
valid = false;
|
||||
}
|
||||
} else {
|
||||
invalid.put("Commander", "Commander invalide (" + commander.getName() + ")");
|
||||
invalid.put("Commander", "Commander invalide (" + commander.getName() + ')');
|
||||
valid = false;
|
||||
}
|
||||
} else {
|
||||
|
@ -221,22 +221,22 @@ public class TinyLeaders extends Constructed {
|
|||
|
||||
private boolean isCardFormatValid(Card card, Card commander, FilterMana color) {
|
||||
if (!cardHasValideColor(color, card)) {
|
||||
invalid.put(card.getName(), "Invalid color (" + commander.getName() + ")");
|
||||
invalid.put(card.getName(), "Invalid color (" + commander.getName() + ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
//905.5b - Converted mana cost must be 3 or less
|
||||
if (card instanceof SplitCard) {
|
||||
if (((SplitCard) card).getLeftHalfCard().getManaCost().convertedManaCost() > 3) {
|
||||
invalid.put(card.getName(), "Invalid cost (" + ((SplitCard) card).getLeftHalfCard().getManaCost().convertedManaCost() + ")");
|
||||
invalid.put(card.getName(), "Invalid cost (" + ((SplitCard) card).getLeftHalfCard().getManaCost().convertedManaCost() + ')');
|
||||
return false;
|
||||
}
|
||||
if (((SplitCard) card).getRightHalfCard().getManaCost().convertedManaCost() > 3) {
|
||||
invalid.put(card.getName(), "Invalid cost (" + ((SplitCard) card).getRightHalfCard().getManaCost().convertedManaCost() + ")");
|
||||
invalid.put(card.getName(), "Invalid cost (" + ((SplitCard) card).getRightHalfCard().getManaCost().convertedManaCost() + ')');
|
||||
return false;
|
||||
}
|
||||
} else if (card.getManaCost().convertedManaCost() > 3) {
|
||||
invalid.put(card.getName(), "Invalid cost (" + card.getManaCost().convertedManaCost() + ")");
|
||||
invalid.put(card.getName(), "Invalid cost (" + card.getManaCost().convertedManaCost() + ')');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -244,9 +244,9 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
logger.info(new StringBuilder("[").append(game.getPlayer(playerId).getName()).append("], life = ").append(player.getLife()).toString());
|
||||
StringBuilder sb = new StringBuilder("-> Hand: [");
|
||||
for (Card card : player.getHand().getCards(game)) {
|
||||
sb.append(card.getName()).append(";");
|
||||
sb.append(card.getName()).append(';');
|
||||
}
|
||||
logger.info(sb.append("]").toString());
|
||||
logger.info(sb.append(']').toString());
|
||||
sb.setLength(0);
|
||||
sb.append("-> Permanents: [");
|
||||
for (Permanent permanent : game.getBattlefield().getAllPermanents()) {
|
||||
|
@ -258,10 +258,10 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
if (permanent.isAttacking()) {
|
||||
sb.append("(attacking)");
|
||||
}
|
||||
sb.append(";");
|
||||
sb.append(';');
|
||||
}
|
||||
}
|
||||
logger.info(sb.append("]").toString());
|
||||
logger.info(sb.append(']').toString());
|
||||
}
|
||||
|
||||
protected void act(Game game) {
|
||||
|
@ -329,7 +329,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
//System.out.println("[" + game.getPlayer(playerId).getName() + "] Action: not better score");
|
||||
//}
|
||||
} else {
|
||||
logger.info("[" + game.getPlayer(playerId).getName() + "] Action: skip Root.score = " + root.getScore() + " currentScore = " + currentScore);
|
||||
logger.info('[' + game.getPlayer(playerId).getName() + "] Action: skip Root.score = " + root.getScore() + " currentScore = " + currentScore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
}
|
||||
|
||||
protected int minimaxAB(SimulationNode2 node, int depth, int alpha, int beta) {
|
||||
logger.trace("Sim minimaxAB [" + depth + "] -- a: " + alpha + " b: " + beta + " <" + (node != null ? node.getScore() : "null") + ">");
|
||||
logger.trace("Sim minimaxAB [" + depth + "] -- a: " + alpha + " b: " + beta + " <" + (node != null ? node.getScore() : "null") + '>');
|
||||
UUID currentPlayerId = node.getGame().getPlayerList().get();
|
||||
SimulationNode2 bestChild = null;
|
||||
for (SimulationNode2 child : node.getChildren()) {
|
||||
|
@ -569,7 +569,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
List<Ability> allActions = currentPlayer.simulatePriority(game);
|
||||
optimize(game, allActions);
|
||||
if (logger.isInfoEnabled() && allActions.size() > 0 && depth == maxDepth) {
|
||||
logger.info("ADDED ACTIONS (" + allActions.size() + ") " + " " + allActions);
|
||||
logger.info("ADDED ACTIONS (" + allActions.size() + ") " + ' ' + allActions);
|
||||
}
|
||||
int counter = 0;
|
||||
int bestValSubNodes = Integer.MIN_VALUE;
|
||||
|
@ -606,18 +606,18 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
} else {
|
||||
val = addActions(newNode, depth - 1, alpha, beta);
|
||||
}
|
||||
logger.debug("Sim Prio " + BLANKS.substring(0, 2 + (maxDepth - depth) * 3) + "[" + depth + "]#" + counter + " <" + val + "> - (" + action.toString() + ") ");
|
||||
logger.debug("Sim Prio " + BLANKS.substring(0, 2 + (maxDepth - depth) * 3) + '[' + depth + "]#" + counter + " <" + val + "> - (" + action.toString() + ") ");
|
||||
if (logger.isInfoEnabled() && depth >= maxDepth) {
|
||||
StringBuilder sb = new StringBuilder("Sim Prio [").append(depth).append("] #").append(counter)
|
||||
.append(" <").append(val).append("> (").append(action)
|
||||
.append(action.isModal() ? " Mode = " + action.getModes().getMode().toString() : "")
|
||||
.append(listTargets(game, action.getTargets())).append(")")
|
||||
.append(listTargets(game, action.getTargets())).append(')')
|
||||
.append(logger.isTraceEnabled() ? " #" + newNode.hashCode() : "");
|
||||
SimulationNode2 logNode = newNode;
|
||||
while (logNode.getChildren() != null && logNode.getChildren().size() > 0) {
|
||||
logNode = logNode.getChildren().get(0);
|
||||
if (logNode.getAbilities() != null && logNode.getAbilities().size() > 0) {
|
||||
sb.append(" -> [").append(logNode.getDepth()).append("]").append(logNode.getAbilities().toString()).append("<").append(logNode.getScore()).append(">");
|
||||
sb.append(" -> [").append(logNode.getDepth()).append(']').append(logNode.getAbilities().toString()).append('<').append(logNode.getScore()).append('>');
|
||||
}
|
||||
}
|
||||
logger.info(sb);
|
||||
|
@ -1437,7 +1437,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
if (targets != null) {
|
||||
for (Target target : targets) {
|
||||
sb.append("[").append(target.getTargetedName(game)).append("]");
|
||||
sb.append('[').append(target.getTargetedName(game)).append(']');
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
sb.insert(0, " targeting ");
|
||||
|
|
|
@ -174,7 +174,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
if (root.abilities.size() == 1) {
|
||||
for (Ability ability : root.abilities) {
|
||||
if (ability.getManaCosts().convertedManaCost() == 0 && ability.getCosts().isEmpty()) {
|
||||
if (actionCache.contains(ability.getRule() + "_" + ability.getSourceId())) {
|
||||
if (actionCache.contains(ability.getRule() + '_' + ability.getSourceId())) {
|
||||
doThis = false; // don't do it again
|
||||
}
|
||||
}
|
||||
|
@ -184,11 +184,11 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
actions = new LinkedList<>(root.abilities);
|
||||
combat = root.combat;
|
||||
for (Ability ability : actions) {
|
||||
actionCache.add(ability.getRule() + "_" + ability.getSourceId());
|
||||
actionCache.add(ability.getRule() + '_' + ability.getSourceId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.info("[" + game.getPlayer(playerId).getName() + "][pre] Action: skip");
|
||||
logger.info('[' + game.getPlayer(playerId).getName() + "][pre] Action: skip");
|
||||
}
|
||||
} else {
|
||||
logger.debug("Next Action exists!");
|
||||
|
@ -211,10 +211,10 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
actions = new LinkedList<>(root.abilities);
|
||||
combat = root.combat;
|
||||
} else {
|
||||
logger.debug("[" + game.getPlayer(playerId).getName() + "] no better score current: " + currentScore + " bestScore: " + bestScore);
|
||||
logger.debug('[' + game.getPlayer(playerId).getName() + "] no better score current: " + currentScore + " bestScore: " + bestScore);
|
||||
}
|
||||
} else {
|
||||
logger.debug("[" + game.getPlayer(playerId).getName() + "][post] Action: skip");
|
||||
logger.debug('[' + game.getPlayer(playerId).getName() + "][post] Action: skip");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -236,10 +236,10 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
if (depth <= 0 || SimulationNode2.nodeCount > maxNodes || game.gameOver(null)) {
|
||||
val = GameStateEvaluator2.evaluate(playerId, game);
|
||||
if (logger.isTraceEnabled()) {
|
||||
StringBuilder sb = new StringBuilder("Add Actions -- reached end state <").append(val).append(">");
|
||||
StringBuilder sb = new StringBuilder("Add Actions -- reached end state <").append(val).append('>');
|
||||
SimulationNode2 logNode = node;
|
||||
do {
|
||||
sb.append(new StringBuilder(" <- [" + logNode.getDepth() + "]" + (logNode.getAbilities() != null ? logNode.getAbilities().toString() : "[empty]")));
|
||||
sb.append(new StringBuilder(" <- [" + logNode.getDepth() + ']' + (logNode.getAbilities() != null ? logNode.getAbilities().toString() : "[empty]")));
|
||||
logNode = logNode.getParent();
|
||||
} while ((logNode.getParent() != null));
|
||||
logger.trace(sb);
|
||||
|
@ -253,7 +253,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
for (SimulationNode2 logNode : node.getChildren()) {
|
||||
sb.append(logNode.getAbilities() != null ? logNode.getAbilities().toString() : "null").append(", ");
|
||||
}
|
||||
sb.append(")");
|
||||
sb.append(')');
|
||||
logger.debug(sb);
|
||||
}
|
||||
val = minimaxAB(node, depth - 1, alpha, beta);
|
||||
|
@ -308,7 +308,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
for (SimulationNode2 logNode : node.getChildren()) {
|
||||
sb.append(logNode.getAbilities() != null ? logNode.getAbilities().toString() : "null").append(", ");
|
||||
}
|
||||
sb.append(")");
|
||||
sb.append(')');
|
||||
logger.debug(sb);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public class GameStateEvaluator2 {
|
|||
int onePermScore = evaluatePermanent(permanent, game);
|
||||
playerScore += onePermScore;
|
||||
if (logger.isDebugEnabled()) {
|
||||
sbPlayer.append(permanent.getName()).append("[").append(onePermScore).append("] ");
|
||||
sbPlayer.append(permanent.getName()).append('[').append(onePermScore).append("] ");
|
||||
}
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
@ -78,7 +78,7 @@ public class GameStateEvaluator2 {
|
|||
int onePermScore = evaluatePermanent(permanent, game);
|
||||
opponentScore += onePermScore;
|
||||
if (logger.isDebugEnabled()) {
|
||||
sbOpponent.append(permanent.getName()).append("[").append(onePermScore).append("] ");
|
||||
sbOpponent.append(permanent.getName()).append('[').append(onePermScore).append("] ");
|
||||
}
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
@ -97,7 +97,7 @@ public class GameStateEvaluator2 {
|
|||
handScore *= 5;
|
||||
|
||||
int score = lifeScore + permanentScore + handScore;
|
||||
logger.debug(score + " total Score (life:" + lifeScore + " permanents:" + permanentScore + " hand:" + handScore + ")");
|
||||
logger.debug(score + " total Score (life:" + lifeScore + " permanents:" + permanentScore + " hand:" + handScore + ')');
|
||||
|
||||
return score;
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ public class SimulatedPlayer2 extends ComputerPlayer {
|
|||
}
|
||||
}
|
||||
// add the specific value for x
|
||||
newAbility.getManaCostsToPay().add(new ManaCostsImpl(new StringBuilder("{").append(xAmount).append("}").toString()));
|
||||
newAbility.getManaCostsToPay().add(new ManaCostsImpl(new StringBuilder("{").append(xAmount).append('}').toString()));
|
||||
newAbility.getManaCostsToPay().setX(xAmount);
|
||||
if (varCost != null) {
|
||||
varCost.setPaid();
|
||||
|
@ -338,7 +338,7 @@ public class SimulatedPlayer2 extends ComputerPlayer {
|
|||
binary.setLength(0);
|
||||
binary.append(Integer.toBinaryString(i));
|
||||
while (binary.length() < attackersList.size()) {
|
||||
binary.insert(0, "0");
|
||||
binary.insert(0, '0');
|
||||
}
|
||||
for (int j = 0; j < attackersList.size(); j++) {
|
||||
if (binary.charAt(j) == '1') {
|
||||
|
|
|
@ -161,7 +161,7 @@ public class CombatUtil {
|
|||
UUID attackerId = game.getCombat().getAttackerId();
|
||||
UUID defenderId = game.getCombat().getDefenders().iterator().next();
|
||||
if (attackerId == null || defenderId == null) {
|
||||
log.warn("Couldn't find attacker or defender: " + attackerId + " " + defenderId);
|
||||
log.warn("Couldn't find attacker or defender: " + attackerId + ' ' + defenderId);
|
||||
return new CombatInfo();
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ public class CombatUtil {
|
|||
UUID attackerId = game.getCombat().getAttackerId();
|
||||
UUID defenderId = game.getCombat().getDefenders().iterator().next();
|
||||
if (attackerId == null || defenderId == null) {
|
||||
log.warn("Couldn't find attacker or defender: " + attackerId + " " + defenderId);
|
||||
log.warn("Couldn't find attacker or defender: " + attackerId + ' ' + defenderId);
|
||||
return new CombatInfo();
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
@Override
|
||||
public boolean choose(Outcome outcome, Target target, UUID sourceId, Game game, Map<String, Serializable> options) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("chooseTarget: " + outcome.toString() + ":" + target.toString());
|
||||
log.debug("chooseTarget: " + outcome.toString() + ':' + target.toString());
|
||||
}
|
||||
// sometimes a target selection can be made from a player that does not control the ability
|
||||
UUID abilityControllerId = playerId;
|
||||
|
@ -450,7 +450,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
@Override
|
||||
public boolean chooseTarget(Outcome outcome, Target target, Ability source, Game game) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("chooseTarget: " + outcome.toString() + ":" + target.toString());
|
||||
log.debug("chooseTarget: " + outcome.toString() + ':' + target.toString());
|
||||
}
|
||||
// sometimes a target selection can be made from a player that does not control the ability
|
||||
UUID abilityControllerId = playerId;
|
||||
|
@ -817,7 +817,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
@Override
|
||||
public boolean chooseTargetAmount(Outcome outcome, TargetAmount target, Ability source, Game game) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("chooseTarget: " + outcome.toString() + ":" + target.toString());
|
||||
log.debug("chooseTarget: " + outcome.toString() + ':' + target.toString());
|
||||
}
|
||||
UUID opponentId = game.getOpponents(playerId).iterator().next();
|
||||
if (target.getOriginalTarget() instanceof TargetCreatureOrPlayerAmount) {
|
||||
|
@ -1999,7 +1999,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
for (int i = 1; i < powerElements; i++) {
|
||||
String binary = Integer.toBinaryString(i);
|
||||
while (binary.length() < attackersList.size()) {
|
||||
binary = "0" + binary;
|
||||
binary = '0' + binary;
|
||||
}
|
||||
List<Permanent> trialAttackers = new ArrayList<>();
|
||||
for (int j = 0; j < attackersList.size(); j++) {
|
||||
|
@ -2119,7 +2119,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(message).append(": ");
|
||||
for (MageObject object : list) {
|
||||
sb.append(object.getName()).append(",");
|
||||
sb.append(object.getName()).append(',');
|
||||
}
|
||||
log.info(sb.toString());
|
||||
}
|
||||
|
@ -2128,7 +2128,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(message).append(": ");
|
||||
for (Ability ability : list) {
|
||||
sb.append(ability.getRule()).append(",");
|
||||
sb.append(ability.getRule()).append(',');
|
||||
}
|
||||
log.debug(sb.toString());
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ public class ComputerPlayerMCTS extends ComputerPlayer implements Player {
|
|||
UUID opponentId = game.getCombat().getDefenders().iterator().next();
|
||||
for (UUID attackerId: combat.getAttackers()) {
|
||||
this.declareAttacker(attackerId, opponentId, game, false);
|
||||
sb.append(game.getPermanent(attackerId).getName()).append(",");
|
||||
sb.append(game.getPermanent(attackerId).getName()).append(',');
|
||||
}
|
||||
logger.info(sb.toString());
|
||||
MCTSNode.logHitMiss();
|
||||
|
@ -233,9 +233,9 @@ public class ComputerPlayerMCTS extends ComputerPlayer implements Player {
|
|||
sb.append(game.getPermanent(groups.get(i).getAttackers().get(0)).getName()).append(" with: ");
|
||||
for (UUID blockerId: combat.getGroups().get(i).getBlockers()) {
|
||||
this.declareBlocker(this.getId(), blockerId, groups.get(i).getAttackers().get(0), game);
|
||||
sb.append(game.getPermanent(blockerId).getName()).append(",");
|
||||
sb.append(game.getPermanent(blockerId).getName()).append(',');
|
||||
}
|
||||
sb.append("|");
|
||||
sb.append('|');
|
||||
}
|
||||
}
|
||||
logger.info(sb.toString());
|
||||
|
@ -448,7 +448,7 @@ public class ComputerPlayerMCTS extends ComputerPlayer implements Player {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(game.getTurn().getValue(game.getTurnNum()));
|
||||
for (Player player: game.getPlayers().values()) {
|
||||
sb.append("[player ").append(player.getName()).append(":").append(player.getLife()).append("]");
|
||||
sb.append("[player ").append(player.getName()).append(':').append(player.getLife()).append(']');
|
||||
}
|
||||
logger.info(sb.toString());
|
||||
}
|
||||
|
|
|
@ -567,9 +567,9 @@ public class MCTSNode {
|
|||
public static void logHitMiss() {
|
||||
if (USE_ACTION_CACHE) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Playables Cache -- Hits: ").append(playablesHit).append(" Misses: ").append(playablesMiss).append("\n");
|
||||
sb.append("Attacks Cache -- Hits: ").append(attacksHit).append(" Misses: ").append(attacksMiss).append("\n");
|
||||
sb.append("Blocks Cache -- Hits: ").append(blocksHit).append(" Misses: ").append(blocksMiss).append("\n");
|
||||
sb.append("Playables Cache -- Hits: ").append(playablesHit).append(" Misses: ").append(playablesMiss).append('\n');
|
||||
sb.append("Attacks Cache -- Hits: ").append(attacksHit).append(" Misses: ").append(attacksMiss).append('\n');
|
||||
sb.append("Blocks Cache -- Hits: ").append(blocksHit).append(" Misses: ").append(blocksMiss).append('\n');
|
||||
logger.info(sb.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ public class MCTSPlayer extends ComputerPlayer {
|
|||
binary.setLength(0);
|
||||
binary.append(Integer.toBinaryString(i));
|
||||
while (binary.length() < attackersList.size()) {
|
||||
binary.insert(0, "0");
|
||||
binary.insert(0, '0');
|
||||
}
|
||||
List<UUID> engagement = new ArrayList<UUID>();
|
||||
for (int j = 0; j < attackersList.size(); j++) {
|
||||
|
|
|
@ -195,7 +195,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer {
|
|||
StringBuilder binary = new StringBuilder();
|
||||
binary.append(Integer.toBinaryString(value));
|
||||
while (binary.length() < attackersList.size()) {
|
||||
binary.insert(0, "0"); //pad with zeros
|
||||
binary.insert(0, '0'); //pad with zeros
|
||||
}
|
||||
for (int i = 0; i < attackersList.size(); i++) {
|
||||
if (binary.charAt(i) == '1') {
|
||||
|
|
|
@ -297,7 +297,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
|||
task.get(maxThink, TimeUnit.SECONDS);
|
||||
long endTime = System.nanoTime();
|
||||
long duration = endTime - startTime;
|
||||
logger.info("Calculated " + SimulationNode.nodeCount + " nodes in " + duration/1000000000.0 + "s");
|
||||
logger.info("Calculated " + SimulationNode.nodeCount + " nodes in " + duration/1000000000.0 + 's');
|
||||
nodeCount += SimulationNode.nodeCount;
|
||||
thinkTime += duration;
|
||||
} catch (TimeoutException e) {
|
||||
|
@ -311,7 +311,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
|||
}
|
||||
long endTime = System.nanoTime();
|
||||
long duration = endTime - startTime;
|
||||
logger.info("Timeout - Calculated " + SimulationNode.nodeCount + " nodes in " + duration/1000000000.0 + "s");
|
||||
logger.info("Timeout - Calculated " + SimulationNode.nodeCount + " nodes in " + duration/1000000000.0 + 's');
|
||||
nodeCount += SimulationNode.nodeCount;
|
||||
thinkTime += duration;
|
||||
} catch (ExecutionException e) {
|
||||
|
|
|
@ -172,7 +172,7 @@ public class SimulatedPlayer extends ComputerPlayer {
|
|||
binary.setLength(0);
|
||||
binary.append(Integer.toBinaryString(i));
|
||||
while (binary.length() < attackersList.size()) {
|
||||
binary.insert(0, "0");
|
||||
binary.insert(0, '0');
|
||||
}
|
||||
for (int j = 0; j < attackersList.size(); j++) {
|
||||
if (binary.charAt(j) == '1') {
|
||||
|
|
|
@ -990,7 +990,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
} else {
|
||||
Permanent creature = game.getPermanent(creatureId);
|
||||
if (creature != null) {
|
||||
sb.append(creature.getIdName()).append(" ");
|
||||
sb.append(creature.getIdName()).append(' ');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1066,7 +1066,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
StringBuilder sb = new StringBuilder(target.getTargetName());
|
||||
Permanent attacker = game.getPermanent(attackerId);
|
||||
if (attacker != null) {
|
||||
sb.append(" (").append(attacker.getName()).append(")");
|
||||
sb.append(" (").append(attacker.getName()).append(')');
|
||||
target.setTargetName(sb.toString());
|
||||
}
|
||||
}
|
||||
|
@ -1493,7 +1493,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
this.quit(game);
|
||||
return;
|
||||
}
|
||||
logger.debug("Setting game priority to " + getId() + " [" + methodName + "]");
|
||||
logger.debug("Setting game priority to " + getId() + " [" + methodName + ']');
|
||||
game.getState().setPriorityPlayerId(getId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ public class ChatManager {
|
|||
colour = "green";
|
||||
}
|
||||
messageToCheck = messageToCheck.replaceFirst("\\[" + cardName + "\\]", "card");
|
||||
String displayCardName = "<font bgcolor=orange color=" + colour + ">" + cardName + "</font>";
|
||||
String displayCardName = "<font bgcolor=orange color=" + colour + '>' + cardName + "</font>";
|
||||
message = message.replaceFirst("\\[" + cardName + "\\]", displayCardName);
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ public class ChatManager {
|
|||
}
|
||||
if (command.startsWith("W ") || command.startsWith("WHISPER ")) {
|
||||
String rest = message.substring(command.startsWith("W ") ? 3 : 9);
|
||||
int first = rest.indexOf(" ");
|
||||
int first = rest.indexOf(' ');
|
||||
if (first > 1) {
|
||||
String userToName = rest.substring(0, first);
|
||||
rest = rest.substring(first + 1).trim();
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ChatSession {
|
|||
if (!clients.containsKey(userId)) {
|
||||
String userName = user.getName();
|
||||
clients.put(userId, userName);
|
||||
broadcast(null, userName + " has joined (" + user.getClientVersion() + ")", MessageColor.BLUE, true, MessageType.STATUS, null);
|
||||
broadcast(null, userName + " has joined (" + user.getClientVersion() + ')', MessageColor.BLUE, true, MessageType.STATUS, null);
|
||||
logger.trace(userName + " joined chat " + chatId);
|
||||
}
|
||||
});
|
||||
|
@ -84,7 +84,7 @@ public class ChatSession {
|
|||
String userName = clients.get(userId);
|
||||
if (reason != DisconnectReason.LostConnection) { // for lost connection the user will be reconnected or session expire so no remove of chat yet
|
||||
clients.remove(userId);
|
||||
logger.debug(userName + "(" + reason.toString() + ")" + " removed from chatId " + chatId);
|
||||
logger.debug(userName + '(' + reason.toString() + ')' + " removed from chatId " + chatId);
|
||||
}
|
||||
String message;
|
||||
switch (reason) {
|
||||
|
@ -107,7 +107,7 @@ public class ChatSession {
|
|||
message = null;
|
||||
break;
|
||||
default:
|
||||
message = " left (" + reason.toString() + ")";
|
||||
message = " left (" + reason.toString() + ')';
|
||||
}
|
||||
if (message != null) {
|
||||
broadcast(null, userName + message, MessageColor.BLUE, true, MessageType.STATUS, null);
|
||||
|
|
|
@ -118,7 +118,7 @@ public class MageServerImpl implements MageServer {
|
|||
String authToken = generateAuthToken();
|
||||
activeAuthTokens.put(email, authToken);
|
||||
String subject = "XMage Password Reset Auth Token";
|
||||
String text = "Use this auth token to reset " + authorizedUser.name + "'s password: " + authToken + "\n"
|
||||
String text = "Use this auth token to reset " + authorizedUser.name + "'s password: " + authToken + '\n'
|
||||
+ "It's valid until the next server restart.";
|
||||
boolean success;
|
||||
if (!ConfigSettings.getInstance().getMailUser().isEmpty()) {
|
||||
|
@ -221,13 +221,13 @@ public class MageServerImpl implements MageServer {
|
|||
// check if the user itself satisfies the quitRatio requirement.
|
||||
int quitRatio = options.getQuitRatio();
|
||||
if (quitRatio < user.getMatchQuitRatio()) {
|
||||
user.showUserMessage("Create table", "Your quit ratio " + user.getMatchQuitRatio() + "% is higher than the table requirement " + quitRatio + "%");
|
||||
user.showUserMessage("Create table", "Your quit ratio " + user.getMatchQuitRatio() + "% is higher than the table requirement " + quitRatio + '%');
|
||||
throw new MageException("No message");
|
||||
}
|
||||
|
||||
TableView table = GamesRoomManager.getInstance().getRoom(roomId).createTable(userId, options);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("TABLE created - tableId: " + table.getTableId() + " " + table.getTableName());
|
||||
logger.debug("TABLE created - tableId: " + table.getTableId() + ' ' + table.getTableName());
|
||||
logger.debug("- " + user.getName() + " userId: " + user.getId());
|
||||
logger.debug("- chatId: " + TableManager.getInstance().getChatId(table.getTableId()));
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ public class MageServerImpl implements MageServer {
|
|||
int quitRatio = options.getQuitRatio();
|
||||
if (quitRatio < user.getTourneyQuitRatio()) {
|
||||
String message = new StringBuilder("Your quit ratio ").append(user.getTourneyQuitRatio())
|
||||
.append("% is higher than the table requirement ").append(quitRatio).append("%").toString();
|
||||
.append("% is higher than the table requirement ").append(quitRatio).append('%').toString();
|
||||
user.showUserMessage("Create tournament", message);
|
||||
throw new MageException("No message");
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ public class MageServerImpl implements MageServer {
|
|||
if (logger.isTraceEnabled()) {
|
||||
Optional<User> user = UserManager.getInstance().getUser(userId);
|
||||
if (user.isPresent()) {
|
||||
logger.trace("join tourn. tableId: " + tableId + " " + name);
|
||||
logger.trace("join tourn. tableId: " + tableId + ' ' + name);
|
||||
}
|
||||
}
|
||||
if (userId == null) {
|
||||
|
@ -962,7 +962,7 @@ public class MageServerImpl implements MageServer {
|
|||
User user = UserManager.getInstance().getUserByName(userName);
|
||||
if (user != null) {
|
||||
Date muteUntil = new Date(Calendar.getInstance().getTimeInMillis() + (durationMinutes * Timer.ONE_MINUTE));
|
||||
user.showUserMessage("Admin info", "You were muted for chat messages until " + SystemUtil.dateFormat.format(muteUntil) + ".");
|
||||
user.showUserMessage("Admin info", "You were muted for chat messages until " + SystemUtil.dateFormat.format(muteUntil) + '.');
|
||||
user.setChatLockedUntil(muteUntil);
|
||||
}
|
||||
|
||||
|
@ -975,7 +975,7 @@ public class MageServerImpl implements MageServer {
|
|||
User user = UserManager.getInstance().getUserByName(userName);
|
||||
if (user != null) {
|
||||
Date lockUntil = new Date(Calendar.getInstance().getTimeInMillis() + (durationMinutes * Timer.ONE_MINUTE));
|
||||
user.showUserMessage("Admin info", "Your user profile was locked until " + SystemUtil.dateFormat.format(lockUntil) + ".");
|
||||
user.showUserMessage("Admin info", "Your user profile was locked until " + SystemUtil.dateFormat.format(lockUntil) + '.');
|
||||
user.setLockedUntil(lockUntil);
|
||||
if (user.isConnected()) {
|
||||
SessionManager.getInstance().disconnectUser(sessionId, user.getSessionId());
|
||||
|
|
|
@ -23,7 +23,7 @@ public class MailgunClient {
|
|||
String domain = ConfigSettings.getInstance().getMailgunDomain();
|
||||
WebResource webResource = client.resource("https://api.mailgun.net/v3/" + domain + "/messages");
|
||||
MultivaluedMapImpl formData = new MultivaluedMapImpl();
|
||||
formData.add("from", "XMage <postmaster@" + domain + ">");
|
||||
formData.add("from", "XMage <postmaster@" + domain + '>');
|
||||
formData.add("to", email);
|
||||
formData.add("subject", subject);
|
||||
formData.add("text", text);
|
||||
|
|
|
@ -130,7 +130,7 @@ public class Main {
|
|||
logger.info(" - Loading extension from " + f);
|
||||
extensions.add(ExtensionPackageLoader.loadExtension(f));
|
||||
} catch (IOException e) {
|
||||
logger.error("Could not load extension in " + f + "!", e);
|
||||
logger.error("Could not load extension in " + f + '!', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ public class Main {
|
|||
logger.info("Registering custom sets...");
|
||||
for (ExtensionPackage pkg : extensions) {
|
||||
for (ExpansionSet set : pkg.getSets()) {
|
||||
logger.info("- Loading " + set.getName() + " (" + set.getCode() + ")");
|
||||
logger.info("- Loading " + set.getName() + " (" + set.getCode() + ')');
|
||||
Sets.getInstance().addSet(set);
|
||||
}
|
||||
PluginClassloaderRegistery.registerPluginClassloader(pkg.getClassLoader());
|
||||
|
@ -268,7 +268,7 @@ public class Main {
|
|||
StringBuilder sessionInfo = new StringBuilder();
|
||||
Optional<User> user = UserManager.getInstance().getUser(session.getUserId());
|
||||
if (user.isPresent()) {
|
||||
sessionInfo.append(user.get().getName()).append(" [").append(user.get().getGameInfo()).append("]");
|
||||
sessionInfo.append(user.get().getName()).append(" [").append(user.get().getGameInfo()).append(']');
|
||||
} else {
|
||||
sessionInfo.append("[user missing] ");
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class Session {
|
|||
}
|
||||
AuthorizedUserRepository.instance.add(userName, password, email);
|
||||
String subject = "XMage Registration Completed";
|
||||
String text = "You are successfully registered as " + userName + ".";
|
||||
String text = "You are successfully registered as " + userName + '.';
|
||||
text += " Your initial, generated password is: " + password;
|
||||
|
||||
boolean success;
|
||||
|
|
|
@ -179,7 +179,7 @@ public class TableController {
|
|||
if (!Main.isTestMode() && !table.getValidator().validate(deck)) {
|
||||
StringBuilder sb = new StringBuilder("You (").append(name).append(") have an invalid deck for the selected ").append(table.getValidator().getName()).append(" Format. \n\n");
|
||||
for (Map.Entry<String, String> entry : table.getValidator().getInvalid().entrySet()) {
|
||||
sb.append(entry.getKey()).append(": ").append(entry.getValue()).append("\n");
|
||||
sb.append(entry.getKey()).append(": ").append(entry.getValue()).append('\n');
|
||||
}
|
||||
sb.append("\n\nSelect a deck that is appropriate for the selected format and try again!");
|
||||
user.showUserMessage("Join Table", sb.toString());
|
||||
|
@ -194,7 +194,7 @@ public class TableController {
|
|||
int quitRatio = table.getTournament().getOptions().getQuitRatio();
|
||||
if (quitRatio < user.getTourneyQuitRatio()) {
|
||||
String message = new StringBuilder("Your quit ratio ").append(user.getTourneyQuitRatio())
|
||||
.append("% is higher than the table requirement ").append(quitRatio).append("%").toString();
|
||||
.append("% is higher than the table requirement ").append(quitRatio).append('%').toString();
|
||||
user.showUserMessage("Join Table", message);
|
||||
return false;
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ public class TableController {
|
|||
if (!Main.isTestMode() && !table.getValidator().validate(deck)) {
|
||||
StringBuilder sb = new StringBuilder("You (").append(name).append(") have an invalid deck for the selected ").append(table.getValidator().getName()).append(" Format. \n\n");
|
||||
for (Map.Entry<String, String> entry : table.getValidator().getInvalid().entrySet()) {
|
||||
sb.append(entry.getKey()).append(": ").append(entry.getValue()).append("\n");
|
||||
sb.append(entry.getKey()).append(": ").append(entry.getValue()).append('\n');
|
||||
}
|
||||
sb.append("\n\nSelect a deck that is appropriate for the selected format and try again!");
|
||||
user.showUserMessage("Join Table", sb.toString());
|
||||
|
@ -292,7 +292,7 @@ public class TableController {
|
|||
int quitRatio = table.getMatch().getOptions().getQuitRatio();
|
||||
if (quitRatio < user.getMatchQuitRatio()) {
|
||||
String message = new StringBuilder("Your quit ratio ").append(user.getMatchQuitRatio())
|
||||
.append("% is higher than the table requirement ").append(quitRatio).append("%").toString();
|
||||
.append("% is higher than the table requirement ").append(quitRatio).append('%').toString();
|
||||
user.showUserMessage("Join Table", message);
|
||||
return false;
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ public class TableController {
|
|||
user.showUserMessage("Join Table", message);
|
||||
return false;
|
||||
}
|
||||
logger.debug("DECK validated: " + table.getValidator().getName() + " " + player.getName() + " " + deck.getName());
|
||||
logger.debug("DECK validated: " + table.getValidator().getName() + ' ' + player.getName() + ' ' + deck.getName());
|
||||
if (!player.canJoinTable(table)) {
|
||||
user.showUserMessage("Join Table", new StringBuilder("A ").append(seat.getPlayerType()).append(" player can't join this table.").toString());
|
||||
return false;
|
||||
|
@ -505,7 +505,7 @@ public class TableController {
|
|||
if (table.isTournament()) {
|
||||
logger.debug("Quit tournament sub tables for userId: " + userId);
|
||||
TableManager.getInstance().userQuitTournamentSubTables(tournament.getId(), userId);
|
||||
logger.debug("Quit tournament Id: " + table.getTournament().getId() + "(" + table.getTournament().getTournamentState() + ")");
|
||||
logger.debug("Quit tournament Id: " + table.getTournament().getId() + '(' + table.getTournament().getTournamentState() + ')');
|
||||
TournamentManager.getInstance().quit(tournament.getId(), userId);
|
||||
} else {
|
||||
MatchPlayer matchPlayer = match.getPlayer(playerId);
|
||||
|
@ -553,7 +553,7 @@ public class TableController {
|
|||
logger.info("Tourn. match started id:" + match.getId() + " tournId: " + table.getTournament().getId());
|
||||
} else {
|
||||
UserManager.getInstance().getUser(userId).ifPresent(user -> {
|
||||
logger.info("MATCH started [" + match.getName() + "] " + match.getId() + "(" + user.getName() + ")");
|
||||
logger.info("MATCH started [" + match.getName() + "] " + match.getId() + '(' + user.getName() + ')');
|
||||
logger.debug("- " + match.getOptions().getGameType() + " - " + match.getOptions().getDeckType());
|
||||
});
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ public class TableController {
|
|||
|
||||
// log about game started
|
||||
logger.info("GAME started " + (match.getGame() != null ? match.getGame().getId() : "no Game") + " [" + match.getName() + "] " + creator + " - " + opponent.toString());
|
||||
logger.debug("- matchId: " + match.getId() + " [" + match.getName() + "]");
|
||||
logger.debug("- matchId: " + match.getId() + " [" + match.getName() + ']');
|
||||
if (match.getGame() != null) {
|
||||
logger.debug("- chatId: " + GameManager.getInstance().getChatId(match.getGame().getId()));
|
||||
}
|
||||
|
@ -926,12 +926,12 @@ public class TableController {
|
|||
if (!(table.getState() == TableState.WAITING || table.getState() == TableState.STARTING || table.getState() == TableState.READY_TO_START)) {
|
||||
if (match == null) {
|
||||
logger.debug("- Match table with no match:");
|
||||
logger.debug("-- matchId:" + match.getId() + " [" + match.getName() + "]");
|
||||
logger.debug("-- matchId:" + match.getId() + " [" + match.getName() + ']');
|
||||
// return false;
|
||||
} else if (match.isDoneSideboarding() && match.getGame() == null) {
|
||||
// no sideboarding and not active game -> match seems to hang (maybe the Draw bug)
|
||||
logger.debug("- Match with no active game and not in sideboard state:");
|
||||
logger.debug("-- matchId:" + match.getId() + " [" + match.getName() + "]");
|
||||
logger.debug("-- matchId:" + match.getId() + " [" + match.getName() + ']');
|
||||
// return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -368,12 +368,12 @@ public class TableManager {
|
|||
logger.debug(user.getId()
|
||||
+ " | " + formatter.format(user.getConnectionTime())
|
||||
+ " | " + sessionState
|
||||
+ " | " + user.getName() + " (" + user.getUserState().toString() + " - " + user.getPingInfo() + ")");
|
||||
+ " | " + user.getName() + " (" + user.getUserState().toString() + " - " + user.getPingInfo() + ')');
|
||||
}
|
||||
ArrayList<ChatSession> chatSessions = ChatManager.getInstance().getChatSessions();
|
||||
logger.debug("------- ChatSessions: " + chatSessions.size() + " ----------------------------------");
|
||||
for (ChatSession chatSession : chatSessions) {
|
||||
logger.debug(chatSession.getChatId() + " " + formatter.format(chatSession.getCreateTime()) + " " + chatSession.getInfo() + " " + chatSession.getClients().values().toString());
|
||||
logger.debug(chatSession.getChatId() + " " + formatter.format(chatSession.getCreateTime()) + ' ' + chatSession.getInfo() + ' ' + chatSession.getClients().values().toString());
|
||||
}
|
||||
logger.debug("------- Games: " + GameManager.getInstance().getNumberActiveGames() + " --------------------------------------------");
|
||||
logger.debug(" Active Game Worker: " + ThreadExecutor.getInstance().getActiveThreads(ThreadExecutor.getInstance().getGameExecutor()));
|
||||
|
|
|
@ -224,7 +224,7 @@ public class User {
|
|||
|
||||
int minutes = (int) secondsLeft / 60;
|
||||
int seconds = (int) secondsLeft % 60;
|
||||
return new StringBuilder(sign).append(Integer.toString(minutes)).append(":").append(seconds > 9 ? seconds : "0" + Integer.toString(seconds)).toString();
|
||||
return new StringBuilder(sign).append(Integer.toString(minutes)).append(':').append(seconds > 9 ? seconds : '0' + Integer.toString(seconds)).toString();
|
||||
}
|
||||
|
||||
public long getSecondsDisconnected() {
|
||||
|
@ -499,7 +499,7 @@ public class User {
|
|||
}
|
||||
|
||||
if (!isConnected()) {
|
||||
tournamentPlayer.setDisconnectInfo(" (discon. " + getDisconnectDuration() + ")");
|
||||
tournamentPlayer.setDisconnectInfo(" (discon. " + getDisconnectDuration() + ')');
|
||||
} else {
|
||||
tournamentPlayer.setDisconnectInfo("");
|
||||
}
|
||||
|
@ -537,25 +537,25 @@ public class User {
|
|||
tablesToDelete.clear();
|
||||
}
|
||||
if (waiting > 0) {
|
||||
sb.append("Wait: ").append(waiting).append(" ");
|
||||
sb.append("Wait: ").append(waiting).append(' ');
|
||||
}
|
||||
if (match > 0) {
|
||||
sb.append("Match: ").append(match).append(" ");
|
||||
sb.append("Match: ").append(match).append(' ');
|
||||
}
|
||||
if (sideboard > 0) {
|
||||
sb.append("Sideb: ").append(sideboard).append(" ");
|
||||
sb.append("Sideb: ").append(sideboard).append(' ');
|
||||
}
|
||||
if (draft > 0) {
|
||||
sb.append("Draft: ").append(draft).append(" ");
|
||||
sb.append("Draft: ").append(draft).append(' ');
|
||||
}
|
||||
if (construct > 0) {
|
||||
sb.append("Const: ").append(construct).append(" ");
|
||||
sb.append("Const: ").append(construct).append(' ');
|
||||
}
|
||||
if (tournament > 0) {
|
||||
sb.append("Tourn: ").append(tournament).append(" ");
|
||||
sb.append("Tourn: ").append(tournament).append(' ');
|
||||
}
|
||||
if (watchedGames.size() > 0) {
|
||||
sb.append("Watch: ").append(watchedGames.size()).append(" ");
|
||||
sb.append("Watch: ").append(watchedGames.size()).append(' ');
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ public class User {
|
|||
if (isConnected()) {
|
||||
return pingInfo;
|
||||
} else {
|
||||
return " (discon. " + getDisconnectDuration() + ")";
|
||||
return " (discon. " + getDisconnectDuration() + ')';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -658,7 +658,7 @@ public class User {
|
|||
if (quit.size() > 0) {
|
||||
builder.append(" (");
|
||||
joinStrings(builder, quit, " ");
|
||||
builder.append(")");
|
||||
builder.append(')');
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
@ -690,7 +690,7 @@ public class User {
|
|||
if (quit.size() > 0) {
|
||||
builder.append(" (");
|
||||
joinStrings(builder, quit, " ");
|
||||
builder.append(")");
|
||||
builder.append(')');
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ public class UserManager {
|
|||
USER_EXECUTOR.execute(
|
||||
() -> {
|
||||
try {
|
||||
LOGGER.info("USER REMOVE - " + user.getName() + " (" + reason.toString() + ") userId: " + userId + " [" + user.getGameInfo() + "]");
|
||||
LOGGER.info("USER REMOVE - " + user.getName() + " (" + reason.toString() + ") userId: " + userId + " [" + user.getGameInfo() + ']');
|
||||
user.remove(reason);
|
||||
LOGGER.debug("USER REMOVE END - " + user.getName());
|
||||
} catch (Exception ex) {
|
||||
|
|
|
@ -332,7 +332,7 @@ public class GameController implements GameCallback {
|
|||
joinType = "rejoined";
|
||||
}
|
||||
user.get().addGame(playerId, gameSession);
|
||||
logger.debug("Player " + player.getName() + " " + playerId + " has " + joinType + " gameId: " + game.getId());
|
||||
logger.debug("Player " + player.getName() + ' ' + playerId + " has " + joinType + " gameId: " + game.getId());
|
||||
ChatManager.getInstance().broadcast(chatId, "", game.getPlayer(playerId).getLogName() + " has " + joinType + " the game", MessageColor.ORANGE, true, MessageType.GAME, null);
|
||||
checkStart();
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ public class GameController implements GameCallback {
|
|||
} else {
|
||||
// user can already see the cards
|
||||
UserManager.getInstance().getUser(userIdRequester).ifPresent(requester -> {
|
||||
requester.showUserMessage("Request to show hand cards", "You can see already the hand cards of player " + grantingPlayer.getName() + "!");
|
||||
requester.showUserMessage("Request to show hand cards", "You can see already the hand cards of player " + grantingPlayer.getName() + '!');
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -848,9 +848,9 @@ public class GameController implements GameCallback {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(message).append(ex.toString());
|
||||
sb.append("\nServer version: ").append(Main.getVersion().toString());
|
||||
sb.append("\n");
|
||||
sb.append('\n');
|
||||
for (StackTraceElement e : ex.getStackTrace()) {
|
||||
sb.append(e.toString()).append("\n");
|
||||
sb.append(e.toString()).append('\n');
|
||||
}
|
||||
for (final Entry<UUID, GameSessionPlayer> entry : gameSessions.entrySet()) {
|
||||
entry.getValue().gameError(sb.toString());
|
||||
|
@ -1004,9 +1004,9 @@ public class GameController implements GameCallback {
|
|||
if (player != null) {
|
||||
sb.append(player.getName()).append("(Left=").append(player.hasLeft() ? "Y" : "N").append(") ");
|
||||
} else {
|
||||
sb.append("player missing: ").append(playerId).append(" ");
|
||||
sb.append("player missing: ").append(playerId).append(' ');
|
||||
}
|
||||
}
|
||||
return sb.append("]").toString();
|
||||
return sb.append(']').toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -424,7 +424,7 @@ public class TournamentController {
|
|||
TableController tableController = TableManager.getInstance().getController(tableId);
|
||||
if (tableController != null) {
|
||||
if (user.isPresent()) {
|
||||
replacePlayerName = "Draftbot (" + user.get().getName() + ")";
|
||||
replacePlayerName = "Draftbot (" + user.get().getName() + ')';
|
||||
}
|
||||
tableController.replaceDraftPlayer(leavingPlayer.getPlayer(), replacePlayerName, "Computer - draftbot", 5);
|
||||
if (user.isPresent()) {
|
||||
|
|
|
@ -92,13 +92,13 @@ public class TournamentFactory {
|
|||
StringBuilder rv = new StringBuilder( "Random Draft using sets: ");
|
||||
for (Map.Entry<String, Integer> entry: setInfo.entrySet()){
|
||||
rv.append(entry.getKey());
|
||||
rv.append(";");
|
||||
rv.append(';');
|
||||
}
|
||||
tournament.setBoosterInfo(rv.toString());
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Map.Entry<String,Integer> entry:setInfo.entrySet()) {
|
||||
sb.append(entry.getValue().toString()).append("x").append(entry.getKey()).append(" ");
|
||||
sb.append(entry.getValue().toString()).append('x').append(entry.getKey()).append(' ');
|
||||
}
|
||||
tournament.setBoosterInfo(sb.toString());
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class TournamentFactory {
|
|||
logger.fatal("TournamentFactory error ", ex);
|
||||
return null;
|
||||
}
|
||||
logger.debug("Tournament created: " + tournamentType + " " + tournament.getId());
|
||||
logger.debug("Tournament created: " + tournamentType + ' ' + tournament.getId());
|
||||
|
||||
return tournament;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class XMageThreadFactory implements ThreadFactory {
|
|||
@Override
|
||||
public Thread newThread(Runnable r) {
|
||||
Thread thread = new Thread(r);
|
||||
thread.setName(prefix + " " + thread.getThreadGroup().getName() + "-" + thread.getId());
|
||||
thread.setName(prefix + ' ' + thread.getThreadGroup().getName() + '-' + thread.getId());
|
||||
return thread;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ class AcademyResearchersEffect extends OneShotEffect {
|
|||
game.getState().setValue("attachTo:" + auraInHand.getId(), academyResearchers);
|
||||
auraInHand.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), controller.getId());
|
||||
if (academyResearchers.addAttachment(auraInHand.getId(), game)) {
|
||||
game.informPlayers(controller.getLogName() + " put " + auraInHand.getLogName() + " on the battlefield attached to " + academyResearchers.getLogName() + ".");
|
||||
game.informPlayers(controller.getLogName() + " put " + auraInHand.getLogName() + " on the battlefield attached to " + academyResearchers.getLogName() + '.');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class AddleEffect extends OneShotEffect {
|
|||
controller.choose(outcome, choice, game);
|
||||
ObjectColor color = choice.getColor();
|
||||
if(color != null) {
|
||||
game.informPlayers(controller.getLogName() + " chooses " + color + ".");
|
||||
game.informPlayers(controller.getLogName() + " chooses " + color + '.');
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new ColorPredicate(color));
|
||||
Effect effect = new DiscardCardYouChooseTargetEffect(filter);
|
||||
|
|
|
@ -105,7 +105,7 @@ class AetherbornMarauderEffect extends OneShotEffect {
|
|||
filter.add(new CounterPredicate(CounterType.P1P1));
|
||||
boolean firstRun = true;
|
||||
while (game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) {
|
||||
if (controller.chooseUse(outcome, "Move " + (firstRun ? "any" : "more") + " +1/+1 counters from other permanents you control to " + sourceObject.getLogName() + "?", source, game)) {
|
||||
if (controller.chooseUse(outcome, "Move " + (firstRun ? "any" : "more") + " +1/+1 counters from other permanents you control to " + sourceObject.getLogName() + '?', source, game)) {
|
||||
firstRun = false;
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(filter);
|
||||
target.setNotTarget(true);
|
||||
|
|
|
@ -121,7 +121,7 @@ class AlhammarretHighArbiterEffect extends OneShotEffect {
|
|||
controller.chooseTarget(Outcome.Benefit, revealedCards, target, source, game);
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
game.informPlayers("The choosen card name is [" + GameLog.getColoredObjectName(card) + "]");
|
||||
game.informPlayers("The choosen card name is [" + GameLog.getColoredObjectName(card) + ']');
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
sourcePermanent.addInfo("chosen card name", CardUtil.addToolTipMarkTags("Chosen card name: " + card.getName()), game);
|
||||
|
|
|
@ -159,7 +159,7 @@ class AssaultSuitGainControlEffect extends OneShotEffect {
|
|||
if (equipment.getAttachedTo() != null) {
|
||||
Permanent equippedCreature = game.getPermanent(equipment.getAttachedTo());
|
||||
if (equippedCreature != null && controller.chooseUse(outcome,
|
||||
"Let have " + activePlayer.getLogName() + " gain control of " + equippedCreature.getLogName() + "?", source, game)) {
|
||||
"Let have " + activePlayer.getLogName() + " gain control of " + equippedCreature.getLogName() + '?', source, game)) {
|
||||
equippedCreature.untap(game);
|
||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn, activePlayer.getId());
|
||||
effect.setTargetPointer(new FixedTarget(equipment.getAttachedTo()));
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue