From 483eb28924b499f2dbcad5ede3f511063c63422a Mon Sep 17 00:00:00 2001 From: vraskulin Date: Thu, 26 Jan 2017 20:20:03 +0300 Subject: [PATCH 01/12] Removed outdated "main" method that prints few sanitized lines --- .../src/main/java/mage/server/util/SystemUtil.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java index 00cd7ea313..439feaca0b 100644 --- a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java +++ b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java @@ -164,15 +164,6 @@ public class SystemUtil { return input.replaceAll("[^a-zA-Z0-9]", ""); } - public static void main(String... args) { - System.out.println(sanitize("123")); - System.out.println(sanitize("AaAaD_123")); - System.out.println(sanitize("--sas-")); - System.out.println(sanitize("anPlsdf123_") + "|"); - System.out.println(sanitize("anPlsdf123 ") + "|"); - System.out.println(sanitize("anPlsdf123\r\n") + "|"); - } - /** * Get a diff between two dates * From 7b35e25347cae3bd35f64d30c04dddf8ef72465e Mon Sep 17 00:00:00 2001 From: vraskulin Date: Thu, 26 Jan 2017 20:58:40 +0300 Subject: [PATCH 02/12] Try/finally refactored to try with resources --- .../card/dl/sources/TokensMtgImageSource.java | 53 ++--------- .../plugins/card/images/DownloadPictures.java | 91 +++++-------------- .../plugins/counter/CounterPluginImpl.java | 30 ++---- .../java/mage/server/util/SystemUtil.java | 13 +-- .../test/serverside/base/MageTestBase.java | 22 ++--- .../serverside/base/MageTestPlayerBase.java | 22 ++--- .../src/main/java/mage/util/ClassScanner.java | 16 +--- 7 files changed, 61 insertions(+), 186 deletions(-) diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java index 74b1fdb0a5..fbc1ad88e1 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java @@ -27,6 +27,9 @@ */ package org.mage.plugins.card.dl.sources; +import org.apache.log4j.Logger; +import org.mage.plugins.card.images.CardDownloadData; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -36,8 +39,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.log4j.Logger; -import org.mage.plugins.card.images.CardDownloadData; /** * @@ -184,30 +185,18 @@ public class TokensMtgImageSource implements CardImageSource { tokensData = new ArrayList<>(); // get tokens data from resource file - InputStream inputStream = null; - try { - inputStream = this.getClass().getResourceAsStream("/tokens-mtg-onl-list.csv"); + try(InputStream inputStream = this.getClass().getResourceAsStream("/tokens-mtg-onl-list.csv")) { List fileTokensData = parseTokensData(inputStream); tokensData.addAll(fileTokensData); } catch (Exception exception) { logger.warn("Failed to get tokens description from resource file tokens-mtg-onl-list.csv", exception); - } finally { - if (inputStream != null) { - try { - inputStream.close(); - } catch (Exception e) { - logger.error("Input stream close failed:", e); - } - } } // description on site may contain new information // try to add it - try { - URL url = new URL("http://tokens.mtg.onl/data/SetsWithTokens.csv"); - inputStream = url.openStream(); + URL url = new URL("http://tokens.mtg.onl/data/SetsWithTokens.csv"); + try(InputStream inputStream = url.openStream()) { List siteTokensData = parseTokensData(inputStream); - List newTokensData = new ArrayList<>(); for (TokenData siteData : siteTokensData) { boolean isNew = true; @@ -227,14 +216,6 @@ public class TokensMtgImageSource implements CardImageSource { tokensData.addAll(newTokensData); } catch (Exception exception) { logger.warn("Failed to get tokens description from tokens.mtg.onl", exception); - } finally { - if (inputStream != null) { - try { - inputStream.close(); - } catch (Exception e) { - logger.error("Input stream close failed:", e); - } - } } } } @@ -245,12 +226,9 @@ public class TokensMtgImageSource implements CardImageSource { private List parseTokensData(InputStream inputStream) throws IOException { List newTokensData = new ArrayList<>(); - InputStreamReader inputReader = null; - BufferedReader reader = null; - try { + try(InputStreamReader inputReader = new InputStreamReader(inputStream, "Cp1252"); + BufferedReader reader = new BufferedReader(inputReader)) { // we have to specify encoding to read special comma - inputReader = new InputStreamReader(inputStream, "Cp1252"); - reader = new BufferedReader(inputReader); reader.readLine(); // skip header String line = reader.readLine(); @@ -282,21 +260,6 @@ public class TokensMtgImageSource implements CardImageSource { line = reader.readLine(); } - } finally { - if (inputReader != null) { - try { - inputReader.close(); - } catch (Exception e) { - logger.error("Input reader close failed:", e); - } - } - if (reader != null) { - try { - reader.close(); - } catch (Exception e) { - logger.error("Buffered reader close failed:", e); - } - } } return newTokensData; diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java index 0405a759c8..439c89479a 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java @@ -1,45 +1,5 @@ package org.mage.plugins.card.images; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.URL; -import java.net.URLConnection; -import java.nio.file.AccessDeniedException; -import java.util.*; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.atomic.AtomicBoolean; -import javax.imageio.IIOImage; -import javax.imageio.ImageIO; -import javax.imageio.ImageWriteParam; -import javax.imageio.ImageWriter; -import javax.imageio.stream.FileImageOutputStream; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.ComboBoxModel; -import javax.swing.DefaultBoundedRangeModel; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JProgressBar; import mage.cards.repository.CardInfo; import mage.client.constants.Constants; import mage.client.dialog.PreferencesDialog; @@ -51,18 +11,27 @@ import net.java.truevfs.access.TFileOutputStream; import net.java.truevfs.access.TVFS; import net.java.truevfs.kernel.spec.FsSyncException; import org.apache.log4j.Logger; -import org.mage.plugins.card.dl.sources.AltMtgOnlTokensImageSource; -import org.mage.plugins.card.dl.sources.CardImageSource; -import org.mage.plugins.card.dl.sources.GrabbagImageSource; -import org.mage.plugins.card.dl.sources.MagicCardsImageSource; -import org.mage.plugins.card.dl.sources.MagidexImageSource; -import org.mage.plugins.card.dl.sources.MtgOnlTokensImageSource; -import org.mage.plugins.card.dl.sources.MythicspoilerComSource; -import org.mage.plugins.card.dl.sources.TokensMtgImageSource; -import org.mage.plugins.card.dl.sources.WizardCardsImageSource; +import org.mage.plugins.card.dl.sources.*; import org.mage.plugins.card.properties.SettingsManager; import org.mage.plugins.card.utils.CardImageUtils; +import javax.imageio.IIOImage; +import javax.imageio.ImageIO; +import javax.imageio.ImageWriteParam; +import javax.imageio.ImageWriter; +import javax.imageio.stream.FileImageOutputStream; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.*; +import java.net.*; +import java.nio.file.AccessDeniedException; +import java.util.*; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.atomic.AtomicBoolean; + public class DownloadPictures extends DefaultBoundedRangeModel implements Runnable { private static final Logger logger = Logger.getLogger(DownloadPictures.class); @@ -376,11 +345,9 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab return list; } - BufferedReader reader = null; - InputStreamReader input = null; - try { - input = new InputStreamReader(in); - reader = new BufferedReader(input); + + try(InputStreamReader input = new InputStreamReader(in); + BufferedReader reader = new BufferedReader(input)) { String line; line = reader.readLine(); @@ -425,22 +392,6 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab } catch (Exception ex) { logger.error(ex); throw new RuntimeException("DownloadPictures : readFile() error"); - } finally { - if (input != null) { - try { - input.close(); - } catch (Exception e) { - logger.error("Input close failed:", e); - } - } - if (reader != null) { - try { - reader.close(); - } catch (Exception e) { - logger.error("Reader close failed:", e); - } - } - } return list; } diff --git a/Mage.Plugins/Mage.Counter.Plugin/src/main/java/org/mage/plugins/counter/CounterPluginImpl.java b/Mage.Plugins/Mage.Counter.Plugin/src/main/java/org/mage/plugins/counter/CounterPluginImpl.java index dc4e93b206..7c7efdf462 100644 --- a/Mage.Plugins/Mage.Counter.Plugin/src/main/java/org/mage/plugins/counter/CounterPluginImpl.java +++ b/Mage.Plugins/Mage.Counter.Plugin/src/main/java/org/mage/plugins/counter/CounterPluginImpl.java @@ -1,22 +1,15 @@ package org.mage.plugins.counter; -import java.io.EOFException; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - import mage.interfaces.PluginException; import mage.interfaces.plugin.CounterPlugin; import net.xeoh.plugins.base.annotations.PluginImplementation; import net.xeoh.plugins.base.annotations.events.Init; import net.xeoh.plugins.base.annotations.events.PluginLoaded; import net.xeoh.plugins.base.annotations.meta.Author; - import org.apache.log4j.Logger; +import java.io.*; + /** * Implementation of {@link CounterPlugin}.
* Stores data in data folder. @@ -72,12 +65,10 @@ public class CounterPluginImpl implements CounterPlugin { public void addGamePlayed() throws PluginException { if (!isLoaded) return; File data = new File(PLUGIN_DATA_FOLDER_PATH + File.separator + DATA_STORAGE_FILE); - ObjectInputStream ois = null; - ObjectOutputStream oos = null; if (data.exists()) { int prev = 0; - try { - ois = new ObjectInputStream(new FileInputStream(data)); + + try(ObjectInputStream ois = new ObjectInputStream(new FileInputStream(data))) { Object o = ois.readObject(); CounterBean c; if (o instanceof CounterBean) { @@ -90,13 +81,10 @@ public class CounterPluginImpl implements CounterPlugin { throw new PluginException(e); } catch (ClassNotFoundException e) { throw new PluginException(e); - } finally { - if (ois != null) try { ois.close(); } catch (Exception e) {} } - try { + try(ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(data))) { synchronized (this) { - oos = new ObjectOutputStream(new FileOutputStream(data)); CounterBean c = new CounterBean(); c.setGamesPlayed(prev+1); oos.writeObject(c); @@ -104,8 +92,6 @@ public class CounterPluginImpl implements CounterPlugin { } } catch (IOException e) { throw new PluginException(e); - } finally { - if (oos != null) try { oos.close(); } catch (Exception e) {} } } else { log.error("Counter plugin: data file doesn't exist, please restart plugin."); @@ -120,10 +106,8 @@ public class CounterPluginImpl implements CounterPlugin { return 0; } if (data.exists()) { - ObjectInputStream ois = null; - try { + try(ObjectInputStream ois = new ObjectInputStream(new FileInputStream(data))) { synchronized (this) { - ois = new ObjectInputStream(new FileInputStream(data)); Object o = ois.readObject(); CounterBean c = null; if (o instanceof CounterBean) { @@ -138,8 +122,6 @@ public class CounterPluginImpl implements CounterPlugin { throw new PluginException(e); } catch (ClassNotFoundException e) { throw new PluginException(e); - } finally { - if (ois != null) try { ois.close(); } catch (Exception e) {} } } else { log.error("Counter plugin: data file doesn't exist, please restart plugin."); diff --git a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java index 439feaca0b..15d276dfd4 100644 --- a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java +++ b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java @@ -56,7 +56,7 @@ public class SystemUtil { try (Scanner scanner = new Scanner(f)) { while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); - if (line.trim().isEmpty() || line.startsWith("#")) { + if (line.isEmpty() || line.startsWith("#")) { continue; } @@ -69,11 +69,12 @@ public class SystemUtil { String zone = m.group(1); String nickname = m.group(2); - Player player = findPlayer(game, nickname); - if (player == null) { + Optional playerOptional = findPlayer(game, nickname); + if (!playerOptional.isPresent()) { logger.warn("Was skipped: " + line); continue; } + Player player = playerOptional.get(); Zone gameZone; if ("hand".equalsIgnoreCase(zone)) { @@ -148,13 +149,13 @@ public class SystemUtil { * @param name * @return */ - private static Player findPlayer(Game game, String name) { + private static Optional findPlayer(Game game, String name) { for (Player player : game.getPlayers().values()) { if (player.getName().equals(name)) { - return player; + return Optional.of(player); } } - return null; + return Optional.empty(); } public static String sanitize(String input) { diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java index 0d74ac0d8c..0db848daf4 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java @@ -1,15 +1,5 @@ package org.mage.test.serverside.base; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FilenameFilter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Scanner; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import mage.cards.Card; import mage.cards.repository.CardInfo; import mage.cards.repository.CardRepository; @@ -35,6 +25,13 @@ import org.junit.BeforeClass; import org.mage.test.player.RandomPlayer; import org.mage.test.player.TestPlayer; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FilenameFilter; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + /** * Base class for all tests. * @@ -181,8 +178,7 @@ public abstract class MageTestBase { protected void parseScenario(String filename) throws FileNotFoundException { parserState = ParserState.INIT; File f = new File(filename); - Scanner scanner = new Scanner(f); - try { + try(Scanner scanner = new Scanner(f)) { while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); if (line == null || line.isEmpty() || line.startsWith("#")) { @@ -198,8 +194,6 @@ public abstract class MageTestBase { } parseLine(line); } - } finally { - scanner.close(); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java index 6568f377b3..9cdd524421 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java @@ -1,15 +1,5 @@ package org.mage.test.serverside.base; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FilenameFilter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Scanner; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import mage.cards.Card; import mage.cards.repository.CardInfo; import mage.cards.repository.CardRepository; @@ -33,6 +23,13 @@ import org.apache.log4j.Logger; import org.junit.BeforeClass; import org.mage.test.player.TestPlayer; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FilenameFilter; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + /** * Base class for all tests. * @@ -167,8 +164,7 @@ public abstract class MageTestPlayerBase { protected void parseScenario(String filename) throws FileNotFoundException { parserState = ParserState.INIT; File f = new File(filename); - Scanner scanner = new Scanner(f); - try { + try(Scanner scanner = new Scanner(f)) { while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); if (line == null || line.isEmpty() || line.startsWith("#")) { @@ -184,8 +180,6 @@ public abstract class MageTestPlayerBase { } parseLine(line); } - } finally { - scanner.close(); } } diff --git a/Mage/src/main/java/mage/util/ClassScanner.java b/Mage/src/main/java/mage/util/ClassScanner.java index 71253e3e65..ad672ca1a7 100644 --- a/Mage/src/main/java/mage/util/ClassScanner.java +++ b/Mage/src/main/java/mage/util/ClassScanner.java @@ -32,11 +32,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.net.URL; import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.TreeSet; +import java.util.*; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; @@ -111,9 +107,8 @@ public class ClassScanner { List cards = new ArrayList<>(); if (!file.exists()) return cards; - JarInputStream jarFile = null; - try { - jarFile = new JarInputStream(new FileInputStream(file)); + + try(JarInputStream jarFile = new JarInputStream(new FileInputStream(file))) { while (true) { JarEntry jarEntry = jarFile.getNextJarEntry(); if (jarEntry == null) { @@ -127,11 +122,6 @@ public class ClassScanner { } } } catch (IOException ex) { - } finally { - try { - if(jarFile != null) jarFile.close(); - } catch (IOException ex) { - } } return cards; } From 0de8bd2f7010ea11d2165a9e67af1bbc0b5ceac6 Mon Sep 17 00:00:00 2001 From: vraskulin Date: Fri, 27 Jan 2017 15:57:10 +0300 Subject: [PATCH 03/12] 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. --- Mage.Client/serverlist.txt | 1 + .../src/main/java/mage/client/MageFrame.java | 4 +- .../main/java/mage/client/cards/BigCard.java | 2 +- .../src/main/java/mage/client/cards/Card.java | 26 ++--- .../java/mage/client/cards/DragCardGrid.java | 10 +- .../java/mage/client/cards/Permanent.java | 16 +-- .../components/layout/RelativeLayout.java | 2 +- .../generator/RatioAdjustingSliderPanel.java | 4 +- .../java/mage/client/deckeditor/DeckArea.java | 2 +- .../client/deckeditor/DeckEditorPanel.java | 8 +- .../client/deckeditor/table/CardHelper.java | 6 +- .../deckeditor/table/MageCardComparator.java | 4 +- .../client/deckeditor/table/TableModel.java | 2 +- .../client/dialog/CardInfoWindowDialog.java | 2 +- .../mage/client/dialog/ConnectDialog.java | 2 +- .../mage/client/dialog/GameEndDialog.java | 6 +- .../mage/client/dialog/NewTableDialog.java | 2 +- .../client/dialog/NewTournamentDialog.java | 6 +- .../java/mage/client/draft/DraftPanel.java | 8 +- .../main/java/mage/client/game/GamePanel.java | 8 +- .../java/mage/client/game/HelperPanel.java | 4 +- .../java/mage/client/game/PlayerPanelExt.java | 2 +- .../client/preference/MagePreferences.java | 2 +- .../mage/client/table/PlayersChatPanel.java | 4 +- .../java/mage/client/table/TablesPanel.java | 6 +- .../client/tournament/TournamentPanel.java | 8 +- .../java/mage/client/util/CardsViewUtil.java | 2 +- .../main/java/mage/client/util/Format.java | 8 +- .../mage/client/util/audio/MusicPlayer.java | 2 +- .../mage/client/util/gui/GuiDisplayUtil.java | 14 +-- .../java/mage/client/util/gui/TableUtil.java | 4 +- .../util/gui/countryBox/MyComboBoxEditor.java | 2 +- .../client/util/object/SaveObjectUtil.java | 2 +- .../java/org/mage/card/arcane/CardPanel.java | 22 ++-- .../card/arcane/CardPanelComponentImpl.java | 6 +- .../org/mage/card/arcane/CardRenderer.java | 6 +- .../org/mage/card/arcane/ManaSymbols.java | 14 +-- .../mage/card/arcane/ModernCardRenderer.java | 2 +- .../plugins/card/constants/Constants.java | 2 +- .../org/mage/plugins/card/dl/DownloadJob.java | 4 +- .../plugins/card/dl/sources/CardFrames.java | 4 +- .../plugins/card/dl/sources/GathererSets.java | 4 +- .../card/dl/sources/GathererSymbols.java | 104 +++++++++--------- .../dl/sources/MagicCardsImageSource.java | 16 +-- .../card/dl/sources/MagidexImageSource.java | 2 +- .../card/dl/sources/MtgImageSource.java | 6 +- .../dl/sources/MythicspoilerComSource.java | 8 +- .../card/dl/sources/TokensMtgImageSource.java | 8 +- .../dl/sources/WizardCardsImageSource.java | 6 +- .../plugins/card/images/DownloadPictures.java | 14 +-- .../mage/plugins/card/images/ImageCache.java | 4 +- .../plugins/card/utils/CardImageUtils.java | 4 +- .../src/mage/db/EntityManagerTest.java | 2 +- Mage.Common/src/mage/remote/Connection.java | 6 +- Mage.Common/src/mage/remote/SessionImpl.java | 42 +++---- Mage.Common/src/mage/utils/MageVersion.java | 2 +- Mage.Common/src/mage/view/CardView.java | 2 +- Mage.Common/src/mage/view/GameEndView.java | 6 +- Mage.Common/src/mage/view/GameView.java | 4 +- Mage.Common/src/mage/view/MatchView.java | 14 +-- Mage.Common/src/mage/view/TableView.java | 18 +-- .../src/mage/view/TournamentGameView.java | 4 +- .../src/mage/view/TournamentPlayerView.java | 2 +- Mage.Common/src/mage/view/TournamentView.java | 4 +- .../mage/server/console/ConnectDialog.java | 2 +- .../mage/server/console/ConsolePanel.java | 8 +- .../src/mage/deck/Commander.java | 8 +- .../src/mage/deck/TinyLeaders.java | 12 +- .../src/mage/player/ai/ComputerPlayer6.java | 22 ++-- .../src/mage/player/ai/ComputerPlayer7.java | 18 +-- .../mage/player/ai/GameStateEvaluator2.java | 6 +- .../src/mage/player/ai/SimulatedPlayer2.java | 4 +- .../src/mage/player/ai/util/CombatUtil.java | 4 +- .../java/mage/player/ai/ComputerPlayer.java | 12 +- .../mage/player/ai/ComputerPlayerMCTS.java | 8 +- .../src/mage/player/ai/MCTSNode.java | 6 +- .../src/mage/player/ai/MCTSPlayer.java | 2 +- .../mage/player/ai/SimulatedPlayerMCTS.java | 2 +- .../src/mage/player/ai/ComputerPlayer2.java | 4 +- .../src/mage/player/ai/SimulatedPlayer.java | 2 +- .../src/mage/player/human/HumanPlayer.java | 6 +- .../main/java/mage/server/ChatManager.java | 4 +- .../main/java/mage/server/ChatSession.java | 6 +- .../main/java/mage/server/MageServerImpl.java | 14 +-- .../main/java/mage/server/MailgunClient.java | 2 +- .../src/main/java/mage/server/Main.java | 6 +- .../src/main/java/mage/server/Session.java | 2 +- .../java/mage/server/TableController.java | 20 ++-- .../main/java/mage/server/TableManager.java | 4 +- .../src/main/java/mage/server/User.java | 24 ++-- .../main/java/mage/server/UserManager.java | 2 +- .../java/mage/server/game/GameController.java | 12 +- .../tournament/TournamentController.java | 2 +- .../server/tournament/TournamentFactory.java | 6 +- .../java/mage/server/util/ThreadExecutor.java | 2 +- .../src/mage/cards/a/AcademyResearchers.java | 2 +- Mage.Sets/src/mage/cards/a/Addle.java | 2 +- .../src/mage/cards/a/AetherbornMarauder.java | 2 +- .../mage/cards/a/AlhammarretHighArbiter.java | 2 +- Mage.Sets/src/mage/cards/a/AssaultSuit.java | 2 +- Mage.Sets/src/mage/cards/a/AureliasFury.java | 2 +- .../src/mage/cards/a/AuriokSurvivors.java | 2 +- .../src/mage/cards/a/AurraSingBaneOfJedi.java | 2 +- .../src/mage/cards/b/BattletideAlchemist.java | 2 +- Mage.Sets/src/mage/cards/b/BlindZealot.java | 2 +- .../src/mage/cards/b/BorderlandExplorer.java | 2 +- .../src/mage/cards/b/BottledCloister.java | 2 +- Mage.Sets/src/mage/cards/b/BrainGorgers.java | 4 +- .../src/mage/cards/b/BrilliantUltimatum.java | 4 +- Mage.Sets/src/mage/cards/c/Cannibalize.java | 2 +- .../src/mage/cards/c/ChainLightning.java | 2 +- Mage.Sets/src/mage/cards/c/ChainOfVapor.java | 4 +- .../src/mage/cards/c/ChorusOfTheConclave.java | 2 +- Mage.Sets/src/mage/cards/c/ChromeMox.java | 2 +- .../src/mage/cards/c/ChronatogTotem.java | 2 +- .../src/mage/cards/c/CollectiveRestraint.java | 2 +- .../src/mage/cards/c/ConfiscationCoup.java | 2 +- .../src/mage/cards/c/ConfusionInTheRanks.java | 2 +- .../src/mage/cards/c/ConundrumSphinx.java | 2 +- Mage.Sets/src/mage/cards/c/CosmicHorror.java | 2 +- .../src/mage/cards/c/CouncilGuardian.java | 2 +- .../src/mage/cards/c/CranialExtraction.java | 2 +- Mage.Sets/src/mage/cards/d/DashHopes.java | 4 +- Mage.Sets/src/mage/cards/d/DecayingSoil.java | 2 +- .../src/mage/cards/d/DeepfireElemental.java | 2 +- Mage.Sets/src/mage/cards/d/DemonicHordes.java | 2 +- Mage.Sets/src/mage/cards/d/DieYoung.java | 2 +- .../src/mage/cards/d/DiluvianPrimordial.java | 2 +- Mage.Sets/src/mage/cards/d/Duplicant.java | 2 +- Mage.Sets/src/mage/cards/d/DustOfMoments.java | 8 +- Mage.Sets/src/mage/cards/e/EliteArcanist.java | 2 +- .../mage/cards/e/EpiphanyAtTheDrownyard.java | 4 +- Mage.Sets/src/mage/cards/e/Expropriate.java | 2 +- .../src/mage/cards/e/ExtraplanarLens.java | 2 +- Mage.Sets/src/mage/cards/f/FactOrFiction.java | 4 +- .../src/mage/cards/f/FaerieArtisans.java | 2 +- Mage.Sets/src/mage/cards/f/Fatespinner.java | 2 +- Mage.Sets/src/mage/cards/f/FellShepherd.java | 2 +- Mage.Sets/src/mage/cards/f/Flash.java | 2 +- .../src/mage/cards/f/FlowstoneSculpture.java | 18 +-- .../src/mage/cards/f/ForgottenAncient.java | 2 +- .../src/mage/cards/g/GoblinDarkDwellers.java | 2 +- Mage.Sets/src/mage/cards/g/Godsend.java | 4 +- .../src/mage/cards/g/GrandAbolisher.java | 2 +- Mage.Sets/src/mage/cards/h/Heartmender.java | 2 +- .../src/mage/cards/h/HellkiteCharger.java | 2 +- Mage.Sets/src/mage/cards/h/HiddenStrings.java | 4 +- .../src/mage/cards/h/HopeOfGhirapur.java | 2 +- .../mage/cards/i/InfiniteObliteration.java | 2 +- .../src/mage/cards/i/IntetTheDreamer.java | 2 +- .../src/mage/cards/i/IsochronScepter.java | 4 +- .../mage/cards/j/JaceArchitectOfThought.java | 2 +- .../mage/cards/k/KalitasBloodchiefOfGhet.java | 2 +- Mage.Sets/src/mage/cards/k/KnowledgePool.java | 2 +- Mage.Sets/src/mage/cards/l/LunarAvenger.java | 16 ++- Mage.Sets/src/mage/cards/m/Magmasaur.java | 2 +- Mage.Sets/src/mage/cards/m/ManaVortex.java | 4 +- Mage.Sets/src/mage/cards/m/Mindblaze.java | 4 +- .../src/mage/cards/m/MogisGodOfSlaughter.java | 2 +- Mage.Sets/src/mage/cards/m/MysticRemora.java | 2 +- .../mage/cards/n/NahiriTheLithomancer.java | 2 +- .../src/mage/cards/n/NarsetTranscendent.java | 2 +- Mage.Sets/src/mage/cards/n/NayaSoulbeast.java | 2 +- .../src/mage/cards/n/NimDeathmantle.java | 2 +- Mage.Sets/src/mage/cards/p/PardicDragon.java | 2 +- .../src/mage/cards/p/Phantasmagorian.java | 4 +- .../src/mage/cards/p/PhyrexianMarauder.java | 2 +- Mage.Sets/src/mage/cards/p/PowerSink.java | 2 +- .../src/mage/cards/p/PyxisOfPandemonium.java | 2 +- Mage.Sets/src/mage/cards/q/Quicken.java | 4 +- .../src/mage/cards/r/ResearchDevelopment.java | 4 +- .../src/mage/cards/r/ReverseTheSands.java | 2 +- Mage.Sets/src/mage/cards/r/RhysticStudy.java | 2 +- .../src/mage/cards/r/RidersOfGavony.java | 2 +- Mage.Sets/src/mage/cards/r/RunedHalo.java | 2 +- .../mage/cards/s/SarpadianEmpiresVolVii.java | 30 ++--- .../src/mage/cards/s/SavageSummoning.java | 10 +- Mage.Sets/src/mage/cards/s/ScoutsWarning.java | 4 +- .../src/mage/cards/s/SealOfTheGuildpact.java | 2 +- Mage.Sets/src/mage/cards/s/SenTriplets.java | 2 +- Mage.Sets/src/mage/cards/s/Shapeshifter.java | 2 +- Mage.Sets/src/mage/cards/s/SharedFate.java | 4 +- .../src/mage/cards/s/SimicManipulator.java | 2 +- Mage.Sets/src/mage/cards/s/SoulFoundry.java | 2 +- .../src/mage/cards/s/SparkOfCreativity.java | 2 +- Mage.Sets/src/mage/cards/s/Spellbinder.java | 4 +- .../src/mage/cards/s/SphereOfSafety.java | 2 +- .../src/mage/cards/s/SphinxAmbassador.java | 2 +- .../src/mage/cards/s/SphinxOfUthuun.java | 4 +- Mage.Sets/src/mage/cards/s/SqueesRevenge.java | 2 +- Mage.Sets/src/mage/cards/s/SteamAugury.java | 4 +- .../src/mage/cards/s/StonewiseFortifier.java | 2 +- .../src/mage/cards/s/StrongholdGambit.java | 2 +- .../src/mage/cards/t/TemporalExtortion.java | 4 +- .../cards/t/TheTabernacleAtPendrellVale.java | 2 +- Mage.Sets/src/mage/cards/t/ThoughtPrison.java | 2 +- Mage.Sets/src/mage/cards/t/TimeVault.java | 2 +- .../src/mage/cards/t/ToilsOfNightAndDay.java | 4 +- .../src/mage/cards/t/TorrentialGearhulk.java | 2 +- Mage.Sets/src/mage/cards/w/WarCadence.java | 2 +- Mage.Sets/src/mage/cards/w/WarTax.java | 2 +- Mage.Sets/src/mage/cards/w/WarpWorld.java | 2 +- Mage.Sets/src/mage/cards/w/WeirdHarvest.java | 2 +- .../src/mage/cards/w/WellOfLostDreams.java | 2 +- .../src/mage/cards/w/WhimsOfTheFates.java | 4 +- Mage.Sets/src/mage/cards/w/WoodSage.java | 2 +- Mage.Sets/src/mage/cards/z/ZursWeirding.java | 2 +- .../com/xmage/ws/util/json/JSONParser.java | 4 +- .../BattlefieldThaumaturgeTest.java | 2 +- .../org/mage/test/player/RandomPlayer.java | 2 +- .../java/org/mage/test/player/TestPlayer.java | 12 +- .../test/serverside/base/MageTestBase.java | 6 +- .../serverside/base/MageTestPlayerBase.java | 6 +- .../serverside/base/impl/CardTestAPIImpl.java | 8 +- .../base/impl/CardTestPlayerAPIImpl.java | 46 ++++---- .../mage/test/sets/BoosterGenerationTest.java | 2 +- .../java/mage/verify/VerifyCardDataTest.java | 2 +- Mage/src/main/java/mage/MageObjectImpl.java | 2 +- Mage/src/main/java/mage/Mana.java | 2 +- Mage/src/main/java/mage/ObjectColor.java | 10 +- .../main/java/mage/abilities/AbilityImpl.java | 14 +-- .../java/mage/abilities/ActivationInfo.java | 4 +- .../abilities/abilityword/KinshipAbility.java | 2 +- .../ActivateIfConditionActivatedAbility.java | 2 +- .../abilities/common/ChancellorAbility.java | 2 +- ...oGraveFromAnywhereAllTriggeredAbility.java | 2 +- ...PutIntoGraveFromAnywhereSourceAbility.java | 2 +- .../delayed/PactDelayedTriggeredAbility.java | 2 +- .../common/CreatureCountCondition.java | 4 +- .../costs/AlternativeCostSourceAbility.java | 6 +- .../java/mage/abilities/costs/OrCost.java | 2 +- .../costs/common/DiscardXTargetCost.java | 2 +- .../costs/common/ExileFromGraveCost.java | 2 +- .../costs/common/ExileXFromYourGraveCost.java | 2 +- .../costs/common/PayLoyaltyCost.java | 2 +- .../costs/common/PayVariableLifeCost.java | 2 +- .../costs/common/PutCountersSourceCost.java | 2 +- .../costs/common/RemoveCounterCost.java | 4 +- .../common/RemoveCountersSourceCost.java | 2 +- .../RemoveVariableCountersTargetCost.java | 4 +- ...rnToHandChosenControlledPermanentCost.java | 2 +- .../common/ReturnToHandFromGraveyardCost.java | 2 +- .../costs/common/SacrificeXTargetCost.java | 2 +- .../abilities/costs/common/TapTargetCost.java | 2 +- .../costs/common/TapVariableTargetCost.java | 2 +- .../costs/common/UntapTargetCost.java | 2 +- .../abilities/costs/mana/ColoredManaCost.java | 2 +- .../abilities/costs/mana/GenericManaCost.java | 2 +- .../abilities/costs/mana/HybridManaCost.java | 2 +- .../costs/mana/MonoHybridManaCost.java | 2 +- .../costs/mana/PhyrexianManaCost.java | 2 +- .../dynamicvalue/common/ParleyCount.java | 2 +- .../common/SignInversionDynamicValue.java | 2 +- .../effects/AsTurnedFaceUpEffect.java | 2 +- .../abilities/effects/ContinuousEffects.java | 4 +- .../java/mage/abilities/effects/Effects.java | 2 +- .../effects/EntersBattlefieldEffect.java | 2 +- .../common/AddManaInAnyCombinationEffect.java | 2 +- .../common/CantBeRegeneratedSourceEffect.java | 4 +- .../common/CantBeRegeneratedTargetEffect.java | 4 +- .../common/CantBeTargetedAllEffect.java | 2 +- .../common/CantBeTargetedAttachedEffect.java | 2 +- .../common/CantBeTargetedSourceEffect.java | 2 +- .../common/CantBeTargetedTargetEffect.java | 2 +- ...getOfTargetSpellAbilityToSourceEffect.java | 4 +- .../abilities/effects/common/ClashEffect.java | 4 +- .../CopySpellForEachItCouldTargetEffect.java | 4 +- .../common/CouncilsDilemmaVoteEffect.java | 2 +- .../effects/common/CreateTokenEffect.java | 2 +- .../common/CreateTokenTargetEffect.java | 2 +- .../common/DestroyMultiTargetEffect.java | 2 +- .../effects/common/DoIfCostPaid.java | 2 +- ...nControllersNextUntapStepSourceEffect.java | 2 +- ...nControllersNextUntapStepTargetEffect.java | 2 +- ...InControllersUntapStepEnchantedEffect.java | 2 +- ...tapInControllersUntapStepTargetEffect.java | 2 +- ...ntapInOpponentsNextUntapStepAllEffect.java | 2 +- .../DrawCardSourceControllerEffect.java | 2 +- .../effects/common/DrawCardTargetEffect.java | 4 +- .../abilities/effects/common/EpicEffect.java | 2 +- ...xileCardYouChooseTargetOpponentEffect.java | 2 +- .../common/ExileFromZoneTargetEffect.java | 2 +- .../common/ExileSourceUnlessPaysEffect.java | 2 +- .../effects/common/GainLifeEffect.java | 4 +- .../effects/common/GainLifeTargetEffect.java | 2 +- .../effects/common/GetEmblemEffect.java | 2 +- .../common/GetEmblemTargetPlayerEffect.java | 2 +- .../LookLibraryAndPickControllerEffect.java | 2 +- .../common/LoseLifeOpponentsEffect.java | 2 +- .../effects/common/LoseLifeTargetEffect.java | 2 +- .../effects/common/NameACardEffect.java | 2 +- .../common/PreventAllDamageToAllEffect.java | 2 +- .../PreventAllNonCombatDamageToAllEffect.java | 2 +- .../PreventDamageToControllerEffect.java | 4 +- .../common/PreventDamageToTargetEffect.java | 2 +- .../common/PutOnLibraryTargetEffect.java | 2 +- ...romGraveyardToBattlefieldTargetEffect.java | 2 +- ...ReturnFromGraveyardToHandTargetEffect.java | 2 +- ...ToHandChosenControlledPermanentEffect.java | 2 +- .../ReturnToHandChosenPermanentEffect.java | 2 +- .../common/ReturnToHandTargetEffect.java | 2 +- .../effects/common/SacrificeAllEffect.java | 2 +- .../effects/common/SacrificeEffect.java | 2 +- .../common/SacrificeOpponentsEffect.java | 4 +- .../SacrificeOpponentsUnlessPayEffect.java | 4 +- .../SacrificeSourceUnlessPaysEffect.java | 2 +- .../common/SkipUntapOptionalSourceEffect.java | 2 +- .../effects/common/TapTargetEffect.java | 4 +- .../effects/common/UntapTargetEffect.java | 2 +- .../abilities/effects/common/WishEffect.java | 4 +- ...kAsThoughItDidntHaveDefenderAllEffect.java | 2 +- .../combat/CantAttackAnyPlayerAllEffect.java | 4 +- .../combat/CantAttackBlockAllEffect.java | 4 +- .../combat/CantBeBlockedTargetEffect.java | 2 +- .../combat/CantBlockAttachedEffect.java | 4 +- .../common/combat/CantBlockTargetEffect.java | 10 +- .../AssignNoCombatDamageSourceEffect.java | 2 +- .../BecomesBasicLandTargetEffect.java | 2 +- .../BecomesColorOrColorsTargetEffect.java | 12 +- .../continuous/BecomesColorSourceEffect.java | 2 +- .../continuous/BecomesColorTargetEffect.java | 2 +- .../BecomesCreatureTargetEffect.java | 2 +- .../BecomesCreatureTypeTargetEffect.java | 2 +- .../continuous/BecomesSubtypeAllEffect.java | 2 +- .../common/continuous/BoostAllEffect.java | 8 +- .../continuous/BoostControlledEffect.java | 8 +- .../continuous/BoostEnchantedEffect.java | 10 +- .../continuous/BoostEquippedEffect.java | 10 +- .../common/continuous/BoostSourceEffect.java | 10 +- .../common/continuous/BoostTargetEffect.java | 10 +- .../continuous/CantGainLifeAllEffect.java | 2 +- .../continuous/CantGainLifeTargetEffect.java | 2 +- .../CastAsThoughItHadFlashAllEffect.java | 3 +- .../continuous/GainAbilityAllEffect.java | 6 +- .../continuous/GainAbilityAttachedEffect.java | 2 +- .../GainAbilityControlledEffect.java | 4 +- .../GainAbilityControllerEffect.java | 2 +- .../continuous/GainAbilitySourceEffect.java | 2 +- .../continuous/GainAbilityTargetEffect.java | 10 +- .../continuous/GainControlTargetEffect.java | 2 +- .../GainProtectionFromTypeTargetEffect.java | 2 +- .../continuous/LoseAbilityAllEffect.java | 2 +- ...seAbilityOrAnotherAbilityTargetEffect.java | 2 +- .../continuous/LoseAbilitySourceEffect.java | 2 +- .../continuous/LoseAbilityTargetEffect.java | 2 +- .../SetCardSubtypeAttachedEffect.java | 2 +- .../SetPowerToughnessAllEffect.java | 4 +- .../SetPowerToughnessSourceEffect.java | 2 +- .../SetPowerToughnessTargetEffect.java | 2 +- .../SwitchPowerToughnessAllEffect.java | 2 +- .../SwitchPowerToughnessTargetEffect.java | 2 +- .../cost/SpellsCostReductionAllEffect.java | 2 +- .../SpellsCostReductionControllerEffect.java | 2 +- .../common/counter/AddCountersAllEffect.java | 4 +- .../counter/AddCountersAttachedEffect.java | 2 +- .../counter/AddCountersControllerEffect.java | 2 +- .../counter/AddCountersSourceEffect.java | 6 +- .../counter/AddCountersTargetEffect.java | 12 +- ...AddRemoveAllTimeSuspentCountersEffect.java | 4 +- .../counter/DistributeCountersEffect.java | 2 +- .../GetEnergyCountersControllerEffect.java | 2 +- .../counter/MoveCountersTargetsEffect.java | 8 +- .../common/counter/ProliferateEffect.java | 4 +- .../counter/RemoveCounterSourceEffect.java | 6 +- .../counter/RemoveCounterTargetEffect.java | 6 +- .../DiscardCardYouChooseTargetEffect.java | 4 +- .../discard/DiscardControllerEffect.java | 6 +- .../discard/DiscardEachPlayerEffect.java | 4 +- .../CastOnlyDuringPhaseStepSourceEffect.java | 2 +- ...SearchLibraryGraveyardPutInHandEffect.java | 4 +- .../search/SearchLibraryPutInHandEffect.java | 2 +- .../search/SearchLibraryPutInPlayEffect.java | 4 +- ...rchLibraryPutInPlayTargetPlayerEffect.java | 4 +- .../keyword/ManifestTargetPlayerEffect.java | 2 +- .../abilities/keyword/AuraSwapAbility.java | 2 +- .../abilities/keyword/BuybackAbility.java | 2 +- .../abilities/keyword/CascadeAbility.java | 2 +- .../abilities/keyword/ConspireAbility.java | 2 +- .../keyword/CumulativeUpkeepAbility.java | 4 +- .../abilities/keyword/CyclingAbility.java | 2 +- .../mage/abilities/keyword/DashAbility.java | 2 +- .../mage/abilities/keyword/EchoAbility.java | 4 +- .../abilities/keyword/EntwineAbility.java | 2 +- .../mage/abilities/keyword/EvokeAbility.java | 2 +- .../mage/abilities/keyword/ExtortAbility.java | 2 +- .../abilities/keyword/FlashbackAbility.java | 6 +- .../mage/abilities/keyword/GraftAbility.java | 4 +- .../mage/abilities/keyword/HauntAbility.java | 4 +- .../abilities/keyword/HideawayAbility.java | 2 +- .../mage/abilities/keyword/KickerAbility.java | 2 +- .../abilities/keyword/LevelerCardBuilder.java | 8 +- .../abilities/keyword/ModularAbility.java | 2 +- .../mage/abilities/keyword/MorphAbility.java | 6 +- .../mage/abilities/keyword/MyriadAbility.java | 2 +- .../abilities/keyword/OfferingAbility.java | 2 +- .../mage/abilities/keyword/ProwlAbility.java | 2 +- .../abilities/keyword/RecoverAbility.java | 2 +- .../abilities/keyword/ReplicateAbility.java | 2 +- .../abilities/keyword/SunburstAbility.java | 2 +- .../abilities/keyword/UnleashAbility.java | 2 +- .../mana/ActivateIfConditionManaAbility.java | 2 +- .../ConditionalSpellManaBuilder.java | 4 +- .../java/mage/actions/MageDrawAction.java | 2 +- Mage/src/main/java/mage/cards/CardImpl.java | 2 +- Mage/src/main/java/mage/cards/CardsImpl.java | 2 +- Mage/src/main/java/mage/cards/Sets.java | 2 +- Mage/src/main/java/mage/cards/decks/Deck.java | 2 +- .../cards/decks/InvalidDeckException.java | 4 +- .../cards/decks/importer/DckDeckImporter.java | 2 +- .../cards/decks/importer/DecDeckImporter.java | 4 +- .../cards/decks/importer/DekDeckImporter.java | 6 +- .../cards/decks/importer/MWSDeckImporter.java | 4 +- .../cards/decks/importer/TxtDeckImporter.java | 4 +- .../java/mage/cards/repository/CardInfo.java | 2 +- .../mage/cards/repository/CardRepository.java | 2 +- .../java/mage/designations/Designation.java | 2 +- .../main/java/mage/filter/FilterAbility.java | 2 +- .../mage/filter/predicate/Predicates.java | 6 +- .../predicate/mageobject/CardIdPredicate.java | 2 +- .../permanent/CanBeEnchantedByPredicate.java | 2 +- .../permanent/PermanentIdPredicate.java | 2 +- Mage/src/main/java/mage/game/GameImpl.java | 6 +- .../java/mage/game/GameTinyLeadersImpl.java | 2 +- .../main/java/mage/game/combat/Combat.java | 10 +- .../java/mage/game/command/Commander.java | 2 +- .../main/java/mage/game/command/Emblem.java | 2 +- .../main/java/mage/game/draft/DraftCube.java | 4 +- .../main/java/mage/game/match/MatchImpl.java | 4 +- .../mage/game/permanent/PermanentImpl.java | 2 +- .../java/mage/game/permanent/token/Token.java | 2 +- .../game/permanent/token/ZombieToken2.java | 2 +- Mage/src/main/java/mage/game/stack/Spell.java | 2 +- .../java/mage/game/stack/StackAbility.java | 4 +- .../java/mage/game/stack/StackObjImpl.java | 6 +- .../mage/game/tournament/TournamentImpl.java | 8 +- Mage/src/main/java/mage/game/turn/Turn.java | 14 +-- .../main/java/mage/players/PlayerImpl.java | 18 +-- .../src/main/java/mage/target/TargetImpl.java | 4 +- .../main/java/mage/target/TargetObject.java | 2 +- .../main/java/mage/target/TargetPlayer.java | 2 +- .../target/common/TargetActivatedAbility.java | 4 +- .../TargetCreatureOrPlaneswalkerAmount.java | 2 +- .../target/common/TargetCreatureOrPlayer.java | 4 +- .../common/TargetCreatureOrPlayerAmount.java | 4 +- .../common/TargetCreaturePermanentAmount.java | 2 +- .../mage/target/common/TargetDefender.java | 4 +- .../common/TargetPermanentOrPlayer.java | 4 +- .../TargetPermanentOrSuspendedCard.java | 4 +- .../target/common/TargetSpellOrPermanent.java | 4 +- .../src/main/java/mage/util/ClassScanner.java | 2 +- Mage/src/main/java/mage/util/DateFormat.java | 8 +- Mage/src/main/java/mage/util/ManaUtil.java | 2 +- .../watchers/common/CommanderInfoWatcher.java | 6 +- 453 files changed, 991 insertions(+), 979 deletions(-) diff --git a/Mage.Client/serverlist.txt b/Mage.Client/serverlist.txt index 103f2b6336..2e71716dc9 100644 --- a/Mage.Client/serverlist.txt +++ b/Mage.Client/serverlist.txt @@ -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 diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index 01274af98d..67167a7582 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -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); diff --git a/Mage.Client/src/main/java/mage/client/cards/BigCard.java b/Mage.Client/src/main/java/mage/client/cards/BigCard.java index cc3417c1b4..3dd8910da5 100644 --- a/Mage.Client/src/main/java/mage/client/cards/BigCard.java +++ b/Mage.Client/src/main/java/mage/client/cards/BigCard.java @@ -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) { } diff --git a/Mage.Client/src/main/java/mage/client/cards/Card.java b/Mage.Client/src/main/java/mage/client/cards/Card.java index f8d974caf6..96aff7602a 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Card.java +++ b/Mage.Client/src/main/java/mage/client/cards/Card.java @@ -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(' '); } } diff --git a/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java b/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java index e352c154e6..8a4d3a1771 100644 --- a/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java +++ b/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java @@ -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()) { diff --git a/Mage.Client/src/main/java/mage/client/cards/Permanent.java b/Mage.Client/src/main/java/mage/client/cards/Permanent.java index f5b3dd2494..f9f8fa9b96 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Permanent.java +++ b/Mage.Client/src/main/java/mage/client/cards/Permanent.java @@ -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()); diff --git a/Mage.Client/src/main/java/mage/client/components/layout/RelativeLayout.java b/Mage.Client/src/main/java/mage/client/components/layout/RelativeLayout.java index a139a2a144..2abca497ac 100644 --- a/Mage.Client/src/main/java/mage/client/components/layout/RelativeLayout.java +++ b/Mage.Client/src/main/java/mage/client/components/layout/RelativeLayout.java @@ -802,6 +802,6 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable { return getClass().getName() + "[axis=" + axis + ",gap=" + gap - + "]"; + + ']'; } } diff --git a/Mage.Client/src/main/java/mage/client/deck/generator/RatioAdjustingSliderPanel.java b/Mage.Client/src/main/java/mage/client/deck/generator/RatioAdjustingSliderPanel.java index 219bd7ad27..bd6903eaec 100644 --- a/Mage.Client/src/main/java/mage/client/deck/generator/RatioAdjustingSliderPanel.java +++ b/Mage.Client/src/main/java/mage/client/deck/generator/RatioAdjustingSliderPanel.java @@ -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; diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/DeckArea.java b/Mage.Client/src/main/java/mage/client/deckeditor/DeckArea.java index 8437a0b310..241dcc25e4 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/DeckArea.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/DeckArea.java @@ -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; } } diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java b/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java index 53333ae05d..cb11486d6e 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java @@ -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!"); } } diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java index 94bd8e6152..fce95ec0f8 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java @@ -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(); diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java index ab692662d5..71f67900d9 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java @@ -86,10 +86,10 @@ public class MageCardComparator implements Comparator { 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 diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java index 987ccff8c9..2291e16200 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java @@ -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(); diff --git a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java index e4a697854a..71ad41544e 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java @@ -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) { diff --git a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java index a738721cfe..4ee513a38a 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java @@ -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 { diff --git a/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.java b/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.java index 17a6122fc9..2af0eeaa53 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.java @@ -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()); diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java index 37ef502484..9cb6b7a3ee 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java @@ -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()); diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java index 709d7369e1..a67491bd0f 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java @@ -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()); } diff --git a/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java b/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java index a722263569..ce5a118398 100644 --- a/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java +++ b/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java @@ -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); } diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index c4fbcc0bd0..966e036ae6 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -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()); } diff --git a/Mage.Client/src/main/java/mage/client/game/HelperPanel.java b/Mage.Client/src/main/java/mage/client/game/HelperPanel.java index 79d3ddb8a6..d801a15d3a 100644 --- a/Mage.Client/src/main/java/mage/client/game/HelperPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/HelperPanel.java @@ -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: diff --git a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java index 8c228cf300..fe3ab8d668 100644 --- a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java +++ b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java @@ -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) { diff --git a/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java b/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java index 98e861c60e..646f2e554f 100644 --- a/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java +++ b/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java @@ -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) { diff --git a/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java b/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java index 365f2d6529..c67a88c655 100644 --- a/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java @@ -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(); } diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index 4081bcdc2b..72cc9d9e94 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -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); diff --git a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java index fea2f500e4..884cb53ef4 100644 --- a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java +++ b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java @@ -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": diff --git a/Mage.Client/src/main/java/mage/client/util/CardsViewUtil.java b/Mage.Client/src/main/java/mage/client/util/CardsViewUtil.java index ed5dd61d12..7ab38acb40 100644 --- a/Mage.Client/src/main/java/mage/client/util/CardsViewUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/CardsViewUtil.java @@ -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) { diff --git a/Mage.Client/src/main/java/mage/client/util/Format.java b/Mage.Client/src/main/java/mage/client/util/Format.java index 50b9bdf4ff..492c10f6ee 100644 --- a/Mage.Client/src/main/java/mage/client/util/Format.java +++ b/Mage.Client/src/main/java/mage/client/util/Format.java @@ -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(); diff --git a/Mage.Client/src/main/java/mage/client/util/audio/MusicPlayer.java b/Mage.Client/src/main/java/mage/client/util/audio/MusicPlayer.java index b823ad3ed0..d77d81ef09 100644 --- a/Mage.Client/src/main/java/mage/client/util/audio/MusicPlayer.java +++ b/Mage.Client/src/main/java/mage/client/util/audio/MusicPlayer.java @@ -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); } } diff --git a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java index 081245971d..9dbdb8e3a7 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java @@ -222,7 +222,7 @@ public class GuiDisplayUtil { buffer.append(""); 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(""); - String imageSize = " width=" + GUISizeHelper.cardTooltipFontSize + " height=" + GUISizeHelper.cardTooltipFontSize + ">"; + String imageSize = " width=" + GUISizeHelper.cardTooltipFontSize + " height=" + GUISizeHelper.cardTooltipFontSize + '>'; if (card.getColor().isWhite()) { buffer.append("W"); 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(); } diff --git a/Mage.Client/src/main/java/mage/client/util/gui/TableUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/TableUtil.java index c86933d041..01c77482b0 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/TableUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/TableUtil.java @@ -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; } diff --git a/Mage.Client/src/main/java/mage/client/util/gui/countryBox/MyComboBoxEditor.java b/Mage.Client/src/main/java/mage/client/util/gui/countryBox/MyComboBoxEditor.java index 03f3760a31..00c1f256e3 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/countryBox/MyComboBoxEditor.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/countryBox/MyComboBoxEditor.java @@ -65,7 +65,7 @@ public class MyComboBoxEditor extends BasicComboBoxEditor { @Override public Object getItem() { - return "[" + this.selectedItem.toString() + "]"; + return '[' + this.selectedItem.toString() + ']'; } @Override diff --git a/Mage.Client/src/main/java/mage/client/util/object/SaveObjectUtil.java b/Mage.Client/src/main/java/mage/client/util/object/SaveObjectUtil.java index 081532510b..f8bb49615a 100644 --- a/Mage.Client/src/main/java/mage/client/util/object/SaveObjectUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/object/SaveObjectUtil.java @@ -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(); } diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java index fd329f538d..81dfd06989 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java @@ -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()); } diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java index 827ecc70a5..781df3cb46 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java @@ -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 { diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java index 4b3bcc54b6..fb883c04c9 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java @@ -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(); diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java b/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java index 32e2e6c0e7..fdc1b195c3 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java @@ -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( "$1$2"); + + " 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 "" + rarity + ""; + return "" + rarity + ""; } else { return set; } diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/ModernCardRenderer.java b/Mage.Client/src/main/java/org/mage/card/arcane/ModernCardRenderer.java index 562e1f0c69..b727c29d44 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/ModernCardRenderer.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/ModernCardRenderer.java @@ -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); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/constants/Constants.java b/Mage.Client/src/main/java/org/mage/plugins/card/constants/Constants.java index b7744ae219..c5ed731747 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/constants/Constants.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/constants/Constants.java @@ -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"; } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/DownloadJob.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/DownloadJob.java index 049a9f8403..e82220c845 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/DownloadJob.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/DownloadJob.java @@ -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; } }; } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardFrames.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardFrames.java index 368f128c9b..1f3228bd07 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardFrames.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardFrames.java @@ -78,8 +78,8 @@ public class CardFrames implements Iterable { 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() { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java index 5d63f8ee15..03420448c9 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java @@ -163,12 +163,12 @@ public class GathererSets implements Iterable { } 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) { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSymbols.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSymbols.java index 485582d6a4..2beb29d6ac 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSymbols.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSymbols.java @@ -54,62 +54,64 @@ public class GathererSymbols implements Iterable { @Override protected DownloadJob computeNext() { - String sym; - if (symIndex < symbols.length) { - sym = symbols[symIndex++]; - } else if (numeric <= maxNumeric) { - sym = "" + (numeric++); - } else { - sizeIndex++; - if (sizeIndex == sizes.length) { - return endOfData(); + while (true) { + String sym; + if (symIndex < symbols.length) { + sym = symbols[symIndex++]; + } else if (numeric <= maxNumeric) { + sym = "" + (numeric++); + } else { + sizeIndex++; + if (sizeIndex == sizes.length) { + return endOfData(); + } + + symIndex = 0; + numeric = 0; + dir = new File(outDir, sizes[sizeIndex]); + continue; + } + String symbol = sym.replaceAll("/", ""); + File dst = new File(dir, symbol + ".gif"); + + /** + * Handle a bug on Gatherer where a few symbols are missing at the large size. + * Fall back to using the medium symbol for those cases. + */ + int modSizeIndex = sizeIndex; + if (sizeIndex == 2) { + switch (sym) { + case "WP": + case "UP": + case "BP": + case "RP": + case "GP": + case "E": + case "C": + modSizeIndex = 1; + break; + + default: + // Nothing to do, symbol is available in the large size + } } - symIndex = 0; - numeric = 0; - dir = new File(outDir, sizes[sizeIndex]); - return computeNext(); - } - String symbol = sym.replaceAll("/", ""); - File dst = new File(dir, symbol + ".gif"); - - /** - * Handle a bug on Gatherer where a few symbols are missing at the large size. - * Fall back to using the medium symbol for those cases. - */ - int modSizeIndex = sizeIndex; - if (sizeIndex == 2) { - switch (sym) { - case "WP": - case "UP": - case "BP": - case "RP": - case "GP": - case "E": - case "C": - modSizeIndex = 1; + switch (symbol) { + case "T": + symbol = "tap"; + break; + case "Q": + symbol = "untap"; + break; + case "S": + symbol = "snow"; break; - - default: - // Nothing to do, symbol is available in the large size } + + String url = format(urlFmt, sizes[modSizeIndex], symbol); + + return new DownloadJob(sym, fromURL(url), toFile(dst)); } - - switch (symbol) { - case "T": - symbol = "tap"; - break; - case "Q": - symbol = "untap"; - break; - case "S": - symbol = "snow"; - break; - } - - String url = format(urlFmt, sizes[modSizeIndex], symbol); - - return new DownloadJob(sym, fromURL(url), toFile(dst)); } }; } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java index d9d732b73f..25dbe9bf66 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java @@ -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 diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagidexImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagidexImageSource.java index 7a39d6768a..46e79774dc 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagidexImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagidexImageSource.java @@ -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(); } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java index 25673e33af..96a0ccb5d0 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java @@ -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"); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java index 23d3275ab4..646894efb3 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java @@ -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 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") diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java index fbc1ad88e1..38376e1888 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java @@ -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; } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java index e0b2b7c9fe..52869723ef 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java @@ -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')); } } } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java index 439c89479a..7db13b2326 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java @@ -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 { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java index f31d98eea8..5595794bd7 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java @@ -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() : "#"); } // /** diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java index 74db210fe9..ed67783972 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java @@ -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"; } diff --git a/Mage.Common/src/mage/db/EntityManagerTest.java b/Mage.Common/src/mage/db/EntityManagerTest.java index fc38832125..339c20ad56 100644 --- a/Mage.Common/src/mage/db/EntityManagerTest.java +++ b/Mage.Common/src/mage/db/EntityManagerTest.java @@ -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("]"); diff --git a/Mage.Common/src/mage/remote/Connection.java b/Mage.Common/src/mage/remote/Connection.java index 2a989da8dc..f739c45c5e 100644 --- a/Mage.Common/src/mage/remote/Connection.java +++ b/Mage.Common/src/mage/remote/Connection.java @@ -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() { diff --git a/Mage.Common/src/mage/remote/SessionImpl.java b/Mage.Common/src/mage/remote/SessionImpl.java index 594bf09430..f8170971dd 100644 --- a/Mage.Common/src/mage/remote/SessionImpl.java +++ b/Mage.Common/src/mage/remote/SessionImpl.java @@ -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) { diff --git a/Mage.Common/src/mage/utils/MageVersion.java b/Mage.Common/src/mage/utils/MageVersion.java index adf31bb5b6..68aeb0f11b 100644 --- a/Mage.Common/src/mage/utils/MageVersion.java +++ b/Mage.Common/src/mage/utils/MageVersion.java @@ -77,7 +77,7 @@ public class MageVersion implements Serializable, Comparable { @Override public String toString() { - return major + "." + minor + "." + patch + info + minorPatch; + return major + "." + minor + '.' + patch + info + minorPatch; } @Override diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index 3d03b865f2..0548837a35 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -732,7 +732,7 @@ public class CardView extends SimpleCardView { @Override public String toString() { - return getName() + " [" + getId() + "]"; + return getName() + " [" + getId() + ']'; } public boolean isFaceDown() { diff --git a/Mage.Common/src/mage/view/GameEndView.java b/Mage.Common/src/mage/view/GameEndView.java index 8e99e2ee11..830f9fb725 100644 --- a/Mage.Common/src/mage/view/GameEndView.java +++ b/Mage.Common/src/mage/view/GameEndView.java @@ -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); diff --git a/Mage.Common/src/mage/view/GameView.java b/Mage.Common/src/mage/view/GameView.java index 5ee494809d..1c55dac842 100644 --- a/Mage.Common/src/mage/view/GameView.java +++ b/Mage.Common/src/mage/view/GameView.java @@ -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 diff --git a/Mage.Common/src/mage/view/MatchView.java b/Mage.Common/src/mage/view/MatchView.java index 6b808ebd23..47fc3d6625 100644 --- a/Mage.Common/src/mage/view/MatchView.java +++ b/Mage.Common/src/mage/view/MatchView.java @@ -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"); diff --git a/Mage.Common/src/mage/view/TableView.java b/Mage.Common/src/mage/view/TableView.java index 52051be04c..1d8b74e041 100644 --- a/Mage.Common/src/mage/view/TableView.java +++ b/Mage.Common/src/mage/view/TableView.java @@ -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(); diff --git a/Mage.Common/src/mage/view/TournamentGameView.java b/Mage.Common/src/mage/view/TournamentGameView.java index 6aa2263798..8813ec4d94 100644 --- a/Mage.Common/src/mage/view/TournamentGameView.java +++ b/Mage.Common/src/mage/view/TournamentGameView.java @@ -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 = ""; diff --git a/Mage.Common/src/mage/view/TournamentPlayerView.java b/Mage.Common/src/mage/view/TournamentPlayerView.java index c2a8078a25..198d007435 100644 --- a/Mage.Common/src/mage/view/TournamentPlayerView.java +++ b/Mage.Common/src/mage/view/TournamentPlayerView.java @@ -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(); diff --git a/Mage.Common/src/mage/view/TournamentView.java b/Mage.Common/src/mage/view/TournamentView.java index ae6ca94a64..8197a72774 100644 --- a/Mage.Common/src/mage/view/TournamentView.java +++ b/Mage.Common/src/mage/view/TournamentView.java @@ -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 = ""; } diff --git a/Mage.Server.Console/src/main/java/mage/server/console/ConnectDialog.java b/Mage.Server.Console/src/main/java/mage/server/console/ConnectDialog.java index 6a4b6e8620..6851c2c1c3 100644 --- a/Mage.Server.Console/src/main/java/mage/server/console/ConnectDialog.java +++ b/Mage.Server.Console/src/main/java/mage/server/console/ConnectDialog.java @@ -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(); diff --git a/Mage.Server.Console/src/main/java/mage/server/console/ConsolePanel.java b/Mage.Server.Console/src/main/java/mage/server/console/ConsolePanel.java index d272053f9b..5e2b590c2b 100644 --- a/Mage.Server.Console/src/main/java/mage/server/console/ConsolePanel.java +++ b/Mage.Server.Console/src/main/java/mage/server/console/ConsolePanel.java @@ -575,14 +575,14 @@ class UpdateUsersTask extends SwingWorker> { 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; diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java index 1d35210ae5..804e336bb7 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java @@ -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; } } diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/TinyLeaders.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/TinyLeaders.java index cf8896ccac..ab3b3ec42f 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/TinyLeaders.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/TinyLeaders.java @@ -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; diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java index 908ae33f08..17b7cf9a50 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java @@ -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 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 "); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java index c1ff29cb74..9dc9c24766 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java @@ -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); } diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/GameStateEvaluator2.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/GameStateEvaluator2.java index 68661f92b8..7c762ebe3d 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/GameStateEvaluator2.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/GameStateEvaluator2.java @@ -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; } diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java index 6ae7612a78..8699ba43a4 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java @@ -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') { diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/util/CombatUtil.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/util/CombatUtil.java index a511893676..3ea315a049 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/util/CombatUtil.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/util/CombatUtil.java @@ -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(); } diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index 75e70c3c8d..2ec47e1f00 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -199,7 +199,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { @Override public boolean choose(Outcome outcome, Target target, UUID sourceId, Game game, Map 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 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()); } diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java index e36bde422e..bfacd03fdb 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java @@ -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()); } diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSNode.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSNode.java index f28f868392..7eef75f10e 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSNode.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSNode.java @@ -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()); } } diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java index 9c2769eb1d..d7589f2636 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java @@ -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 engagement = new ArrayList(); for (int j = 0; j < attackersList.size(); j++) { diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java index 2c015d350c..344964fb75 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java @@ -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') { diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java index 3141c5227e..3cba31ffd9 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java @@ -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) { diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java index 743c6a6544..fdefaa68d2 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java @@ -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') { diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index ea2af12d1a..c199fda2c5 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -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()); } } diff --git a/Mage.Server/src/main/java/mage/server/ChatManager.java b/Mage.Server/src/main/java/mage/server/ChatManager.java index 69c51f2a6d..0127a61cb1 100644 --- a/Mage.Server/src/main/java/mage/server/ChatManager.java +++ b/Mage.Server/src/main/java/mage/server/ChatManager.java @@ -161,7 +161,7 @@ public class ChatManager { colour = "green"; } messageToCheck = messageToCheck.replaceFirst("\\[" + cardName + "\\]", "card"); - String displayCardName = "" + cardName + ""; + String displayCardName = ""; 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(); diff --git a/Mage.Server/src/main/java/mage/server/ChatSession.java b/Mage.Server/src/main/java/mage/server/ChatSession.java index fdb5f58f90..0f97c01ca6 100644 --- a/Mage.Server/src/main/java/mage/server/ChatSession.java +++ b/Mage.Server/src/main/java/mage/server/ChatSession.java @@ -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); diff --git a/Mage.Server/src/main/java/mage/server/MageServerImpl.java b/Mage.Server/src/main/java/mage/server/MageServerImpl.java index d4384d241c..255d29b4d1 100644 --- a/Mage.Server/src/main/java/mage/server/MageServerImpl.java +++ b/Mage.Server/src/main/java/mage/server/MageServerImpl.java @@ -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 = 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()); diff --git a/Mage.Server/src/main/java/mage/server/MailgunClient.java b/Mage.Server/src/main/java/mage/server/MailgunClient.java index 45b3557aa6..cc012886db 100644 --- a/Mage.Server/src/main/java/mage/server/MailgunClient.java +++ b/Mage.Server/src/main/java/mage/server/MailgunClient.java @@ -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 "); + formData.add("from", "XMage '); formData.add("to", email); formData.add("subject", subject); formData.add("text", text); diff --git a/Mage.Server/src/main/java/mage/server/Main.java b/Mage.Server/src/main/java/mage/server/Main.java index 1131b0fd15..1839fa3e44 100644 --- a/Mage.Server/src/main/java/mage/server/Main.java +++ b/Mage.Server/src/main/java/mage/server/Main.java @@ -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 = 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] "); } diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java index ab6f404de2..31f0a2fe49 100644 --- a/Mage.Server/src/main/java/mage/server/Session.java +++ b/Mage.Server/src/main/java/mage/server/Session.java @@ -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; diff --git a/Mage.Server/src/main/java/mage/server/TableController.java b/Mage.Server/src/main/java/mage/server/TableController.java index 21d6f8aec6..b831426c2e 100644 --- a/Mage.Server/src/main/java/mage/server/TableController.java +++ b/Mage.Server/src/main/java/mage/server/TableController.java @@ -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 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 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; } } diff --git a/Mage.Server/src/main/java/mage/server/TableManager.java b/Mage.Server/src/main/java/mage/server/TableManager.java index 2d8ec48fd7..e7ff34a203 100644 --- a/Mage.Server/src/main/java/mage/server/TableManager.java +++ b/Mage.Server/src/main/java/mage/server/TableManager.java @@ -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 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())); diff --git a/Mage.Server/src/main/java/mage/server/User.java b/Mage.Server/src/main/java/mage/server/User.java index c4411ff94f..ec97db3753 100644 --- a/Mage.Server/src/main/java/mage/server/User.java +++ b/Mage.Server/src/main/java/mage/server/User.java @@ -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(); } diff --git a/Mage.Server/src/main/java/mage/server/UserManager.java b/Mage.Server/src/main/java/mage/server/UserManager.java index 61a673d788..acd963a62d 100644 --- a/Mage.Server/src/main/java/mage/server/UserManager.java +++ b/Mage.Server/src/main/java/mage/server/UserManager.java @@ -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) { diff --git a/Mage.Server/src/main/java/mage/server/game/GameController.java b/Mage.Server/src/main/java/mage/server/game/GameController.java index 854f40680e..710a6cd8b4 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameController.java +++ b/Mage.Server/src/main/java/mage/server/game/GameController.java @@ -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 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(); } } diff --git a/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java b/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java index b5ae735a81..bca997678d 100644 --- a/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java +++ b/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java @@ -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()) { diff --git a/Mage.Server/src/main/java/mage/server/tournament/TournamentFactory.java b/Mage.Server/src/main/java/mage/server/tournament/TournamentFactory.java index 4a09cc84fe..3a479da566 100644 --- a/Mage.Server/src/main/java/mage/server/tournament/TournamentFactory.java +++ b/Mage.Server/src/main/java/mage/server/tournament/TournamentFactory.java @@ -92,13 +92,13 @@ public class TournamentFactory { StringBuilder rv = new StringBuilder( "Random Draft using sets: "); for (Map.Entry entry: setInfo.entrySet()){ rv.append(entry.getKey()); - rv.append(";"); + rv.append(';'); } tournament.setBoosterInfo(rv.toString()); } else { StringBuilder sb = new StringBuilder(); for (Map.Entry 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; } diff --git a/Mage.Server/src/main/java/mage/server/util/ThreadExecutor.java b/Mage.Server/src/main/java/mage/server/util/ThreadExecutor.java index 0a171959fe..60f3e56c95 100644 --- a/Mage.Server/src/main/java/mage/server/util/ThreadExecutor.java +++ b/Mage.Server/src/main/java/mage/server/util/ThreadExecutor.java @@ -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; } diff --git a/Mage.Sets/src/mage/cards/a/AcademyResearchers.java b/Mage.Sets/src/mage/cards/a/AcademyResearchers.java index 274378afc3..9ba8e5afe0 100644 --- a/Mage.Sets/src/mage/cards/a/AcademyResearchers.java +++ b/Mage.Sets/src/mage/cards/a/AcademyResearchers.java @@ -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; } } diff --git a/Mage.Sets/src/mage/cards/a/Addle.java b/Mage.Sets/src/mage/cards/a/Addle.java index 9f17a79c67..afd3f43a09 100644 --- a/Mage.Sets/src/mage/cards/a/Addle.java +++ b/Mage.Sets/src/mage/cards/a/Addle.java @@ -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); diff --git a/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java b/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java index 1f32696376..0237247f08 100644 --- a/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java +++ b/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java @@ -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); diff --git a/Mage.Sets/src/mage/cards/a/AlhammarretHighArbiter.java b/Mage.Sets/src/mage/cards/a/AlhammarretHighArbiter.java index 1c58bb68d6..9390e33105 100644 --- a/Mage.Sets/src/mage/cards/a/AlhammarretHighArbiter.java +++ b/Mage.Sets/src/mage/cards/a/AlhammarretHighArbiter.java @@ -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); diff --git a/Mage.Sets/src/mage/cards/a/AssaultSuit.java b/Mage.Sets/src/mage/cards/a/AssaultSuit.java index 729729ffe8..d2c1c1c631 100644 --- a/Mage.Sets/src/mage/cards/a/AssaultSuit.java +++ b/Mage.Sets/src/mage/cards/a/AssaultSuit.java @@ -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())); diff --git a/Mage.Sets/src/mage/cards/a/AureliasFury.java b/Mage.Sets/src/mage/cards/a/AureliasFury.java index 1f2ecff390..29ee0ae014 100644 --- a/Mage.Sets/src/mage/cards/a/AureliasFury.java +++ b/Mage.Sets/src/mage/cards/a/AureliasFury.java @@ -169,7 +169,7 @@ class AureliasFuryCantCastEffect extends ContinuousRuleModifyingEffectImpl { public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - return "You can't cast noncreature spells this turn (you were dealt damage by " + mageObject.getLogName() + ")"; + return "You can't cast noncreature spells this turn (you were dealt damage by " + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage.Sets/src/mage/cards/a/AuriokSurvivors.java b/Mage.Sets/src/mage/cards/a/AuriokSurvivors.java index 34e25bf401..3a006b8c24 100644 --- a/Mage.Sets/src/mage/cards/a/AuriokSurvivors.java +++ b/Mage.Sets/src/mage/cards/a/AuriokSurvivors.java @@ -97,7 +97,7 @@ class AuriokSurvivorsEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (p != null && player != null && sourcePermanent != null) { - if (player.chooseUse(Outcome.Benefit, "Attach " + p.getName() + " to " + sourcePermanent.getName() + "?", source, game)) { + if (player.chooseUse(Outcome.Benefit, "Attach " + p.getName() + " to " + sourcePermanent.getName() + '?', source, game)) { sourcePermanent.addAttachment(p.getId(), game); } return true; diff --git a/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java b/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java index 54ef0caba2..4ad8d32e28 100644 --- a/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java +++ b/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java @@ -118,7 +118,7 @@ class AurraSingBaneOfJediEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - if (controller.chooseUse(outcome, "Deal 2 damage to " + game.getPermanent(getTargetPointer().getFirst(game, source)).getName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Deal 2 damage to " + game.getPermanent(getTargetPointer().getFirst(game, source)).getName() + '?', source, game)) { new DamageTargetEffect(2).apply(game, source); } else { new DamageControllerEffect(1).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java b/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java index 4a34978a4f..2f72855579 100644 --- a/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java +++ b/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java @@ -96,7 +96,7 @@ class BattletideAlchemistEffect extends PreventionEffectImpl { if (controller != null) { int numberOfClericsControlled = new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent("Cleric", "Clerics")).calculate(game, source, this); int toPrevent = Math.min(numberOfClericsControlled, event.getAmount()); - if (toPrevent > 0 && controller.chooseUse(Outcome.PreventDamage, "Prevent " + toPrevent + " damage to " + targetPlayer.getName() + "?", source, game)) { + if (toPrevent > 0 && controller.chooseUse(Outcome.PreventDamage, "Prevent " + toPrevent + " damage to " + targetPlayer.getName() + '?', source, game)) { GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, targetPlayer.getId(), source.getSourceId(), source.getControllerId(), toPrevent, false); if (!game.replaceEvent(preventEvent)) { if (event.getAmount() >= toPrevent) { diff --git a/Mage.Sets/src/mage/cards/b/BlindZealot.java b/Mage.Sets/src/mage/cards/b/BlindZealot.java index 7e47066d93..74d7892455 100644 --- a/Mage.Sets/src/mage/cards/b/BlindZealot.java +++ b/Mage.Sets/src/mage/cards/b/BlindZealot.java @@ -109,7 +109,7 @@ class BlindZealotTriggeredAbility extends TriggeredAbilityImpl { StringBuilder sb = new StringBuilder(); sb.append("Do you wish to sacrifice ").append(sourcePermanent.getIdName()); sb.append(" to destroy target creature controlled by "); - sb.append(game.getPlayer(event.getTargetId()).getLogName()).append("?"); + sb.append(game.getPlayer(event.getTargetId()).getLogName()).append('?'); if (player.chooseUse(Outcome.DestroyPermanent, sb.toString(), this, game)) { FilterCreaturePermanent filter = new FilterCreaturePermanent(); filter.add(new ControllerIdPredicate(event.getTargetId())); diff --git a/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java b/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java index 7351904528..ae0a9ac04a 100644 --- a/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java +++ b/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java @@ -154,7 +154,7 @@ class BorderlandExplorerEffect extends OneShotEffect { for (UUID cardId : cardsPlayer) { Cards cards = new CardsImpl(game.getCard(cardId)); Card card = game.getCard(cardId); - player.revealCards(card.getIdName() + " (" + player.getName() + ")", cards, game); + player.revealCards(card.getIdName() + " (" + player.getName() + ')', cards, game); player.moveCardToHandWithInfo(card, source.getSourceId(), game); player.shuffleLibrary(source, game); } diff --git a/Mage.Sets/src/mage/cards/b/BottledCloister.java b/Mage.Sets/src/mage/cards/b/BottledCloister.java index dc06c89dce..7b13322429 100644 --- a/Mage.Sets/src/mage/cards/b/BottledCloister.java +++ b/Mage.Sets/src/mage/cards/b/BottledCloister.java @@ -103,7 +103,7 @@ class BottledCloisterExileEffect extends OneShotEffect { card.moveToExile(exileId, sourcePermanent.getName(), source.getSourceId(), game); card.setFaceDown(true, game); } - game.informPlayers(sourcePermanent.getName() + ": " + controller.getLogName() + " exiles his or her hand face down (" + numberOfCards + "card" + (numberOfCards > 1 ?"s":"") +")"); + game.informPlayers(sourcePermanent.getName() + ": " + controller.getLogName() + " exiles his or her hand face down (" + numberOfCards + "card" + (numberOfCards > 1 ?"s":"") + ')'); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BrainGorgers.java b/Mage.Sets/src/mage/cards/b/BrainGorgers.java index 2707fdeac0..3edc103928 100644 --- a/Mage.Sets/src/mage/cards/b/BrainGorgers.java +++ b/Mage.Sets/src/mage/cards/b/BrainGorgers.java @@ -99,9 +99,9 @@ class BrainGorgersCounterSourceEffect extends OneShotEffect { cost.clearPaid(); Player player = game.getPlayer(playerId); if (cost.canPay(source, source.getSourceId(), player.getId(), game) - && player.chooseUse(outcome, "Sacrifice a creature to counter " + sourceObject.getIdName() + "?", source, game)) { + && player.chooseUse(outcome, "Sacrifice a creature to counter " + sourceObject.getIdName() + '?', source, game)) { if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { - game.informPlayers(player.getLogName() + " sacrifices a creature to counter " + sourceObject.getIdName() + "."); + game.informPlayers(player.getLogName() + " sacrifices a creature to counter " + sourceObject.getIdName() + '.'); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { game.getStack().counter(spell.getId(), source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/b/BrilliantUltimatum.java b/Mage.Sets/src/mage/cards/b/BrilliantUltimatum.java index bd1b7b99c9..6f892ed356 100644 --- a/Mage.Sets/src/mage/cards/b/BrilliantUltimatum.java +++ b/Mage.Sets/src/mage/cards/b/BrilliantUltimatum.java @@ -135,8 +135,8 @@ class BrilliantUltimatumEffect extends OneShotEffect { selectedPileCards = pileTwo; selectedPile = pile2; } - game.informPlayers(controller.getLogName() + " chose " + selectedPileName + "."); - while (!selectedPileCards.isEmpty() && controller.chooseUse(Outcome.PlayForFree, "Do you want to play a card for free from " + selectedPileName + "?", source, game)) { + game.informPlayers(controller.getLogName() + " chose " + selectedPileName + '.'); + while (!selectedPileCards.isEmpty() && controller.chooseUse(Outcome.PlayForFree, "Do you want to play a card for free from " + selectedPileName + '?', source, game)) { TargetCard targetExiledCard = new TargetCard(Zone.EXILED, new FilterCard()); if (controller.chooseTarget(Outcome.PlayForFree, selectedPile, targetExiledCard, source, game)) { Card card = selectedPile.get(targetExiledCard.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/c/Cannibalize.java b/Mage.Sets/src/mage/cards/c/Cannibalize.java index 8ec6596b60..d466822acb 100644 --- a/Mage.Sets/src/mage/cards/c/Cannibalize.java +++ b/Mage.Sets/src/mage/cards/c/Cannibalize.java @@ -95,7 +95,7 @@ class CannibalizeEffect extends OneShotEffect { for(UUID targetId: getTargetPointer().getTargets(game, source)) { Permanent creature = game.getPermanent(targetId); if (creature != null) { - if ((count == 0 && controller.chooseUse(Outcome.Exile, "Exile " + creature.getLogName() +"?", source, game)) + if ((count == 0 && controller.chooseUse(Outcome.Exile, "Exile " + creature.getLogName() + '?', source, game)) || (count == 1 && !exileDone)) { controller.moveCardToExileWithInfo(creature, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); exileDone = true; diff --git a/Mage.Sets/src/mage/cards/c/ChainLightning.java b/Mage.Sets/src/mage/cards/c/ChainLightning.java index dc2dcd0cab..bb06d3431b 100644 --- a/Mage.Sets/src/mage/cards/c/ChainLightning.java +++ b/Mage.Sets/src/mage/cards/c/ChainLightning.java @@ -106,7 +106,7 @@ class ChainLightningEffect extends OneShotEffect { Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { spell.createCopyOnStack(game, source, affectedPlayer.getId(), true); - game.informPlayers(affectedPlayer.getLogName() + " copies " + spell.getName() + "."); + game.informPlayers(affectedPlayer.getLogName() + " copies " + spell.getName() + '.'); } } } diff --git a/Mage.Sets/src/mage/cards/c/ChainOfVapor.java b/Mage.Sets/src/mage/cards/c/ChainOfVapor.java index fbfb18babb..5efbb59dd3 100644 --- a/Mage.Sets/src/mage/cards/c/ChainOfVapor.java +++ b/Mage.Sets/src/mage/cards/c/ChainOfVapor.java @@ -96,7 +96,7 @@ class ChainOfVaporEffect extends OneShotEffect { if (permanent != null) { controller.moveCards(permanent, Zone.HAND, source, game); Player player = game.getPlayer(permanent.getControllerId()); - TargetControlledPermanent target = new TargetControlledPermanent(0, 1, new FilterControlledLandPermanent("a land to sacrifice (to be able to copy " + sourceObject.getName() + ")"), true); + TargetControlledPermanent target = new TargetControlledPermanent(0, 1, new FilterControlledLandPermanent("a land to sacrifice (to be able to copy " + sourceObject.getName() + ')'), true); if (player.chooseTarget(Outcome.Sacrifice, target, source, game)) { Permanent land = game.getPermanent(target.getFirstTarget()); if (land != null && land.sacrifice(source.getSourceId(), game)) { @@ -109,7 +109,7 @@ class ChainOfVaporEffect extends OneShotEffect { if (activateMessage.startsWith(" casts ")) { activateMessage = activateMessage.substring(6); } - game.informPlayers(player.getLogName() + " " + activateMessage); + game.informPlayers(player.getLogName() + ' ' + activateMessage); } } } diff --git a/Mage.Sets/src/mage/cards/c/ChorusOfTheConclave.java b/Mage.Sets/src/mage/cards/c/ChorusOfTheConclave.java index c08a79536b..3901ba4f8f 100644 --- a/Mage.Sets/src/mage/cards/c/ChorusOfTheConclave.java +++ b/Mage.Sets/src/mage/cards/c/ChorusOfTheConclave.java @@ -151,7 +151,7 @@ class ChorusOfTheConclaveReplacementEffect extends ReplacementEffectImpl { payed = true; } } - game.informPlayers(player.getLogName() + " pays {" + xValue + "}"); + game.informPlayers(player.getLogName() + " pays {" + xValue + '}'); return xValue; } diff --git a/Mage.Sets/src/mage/cards/c/ChromeMox.java b/Mage.Sets/src/mage/cards/c/ChromeMox.java index d0ccd0356b..a7c8406e39 100644 --- a/Mage.Sets/src/mage/cards/c/ChromeMox.java +++ b/Mage.Sets/src/mage/cards/c/ChromeMox.java @@ -114,7 +114,7 @@ class ChromeMoxEffect extends OneShotEffect { if (cardToImprint != null) { controller.moveCardsToExile(cardToImprint, source, game, true, source.getSourceId(), sourceObject.getIdName() + " (Imprint)"); sourcePermanent.imprint(cardToImprint.getId(), game); - sourcePermanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + GameLog.getColoredObjectIdNameForTooltip(cardToImprint) + "]"), game); + sourcePermanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + GameLog.getColoredObjectIdNameForTooltip(cardToImprint) + ']'), game); } else { sourcePermanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - None]"), game); } diff --git a/Mage.Sets/src/mage/cards/c/ChronatogTotem.java b/Mage.Sets/src/mage/cards/c/ChronatogTotem.java index 6930843c56..7a2bfb2fb3 100644 --- a/Mage.Sets/src/mage/cards/c/ChronatogTotem.java +++ b/Mage.Sets/src/mage/cards/c/ChronatogTotem.java @@ -127,7 +127,7 @@ class ChronatogTotemAbility extends LimitedTimesPerTurnActivatedAbility { public String getRule() { StringBuilder sb = new StringBuilder(super.getRule()); sb.deleteCharAt(sb.length() - 1); // remove last '.' - sb.append(" and only if ").append(condition.toString()).append("."); + sb.append(" and only if ").append(condition.toString()).append('.'); return sb.toString(); } } diff --git a/Mage.Sets/src/mage/cards/c/CollectiveRestraint.java b/Mage.Sets/src/mage/cards/c/CollectiveRestraint.java index d0cf351fc6..a956c84595 100644 --- a/Mage.Sets/src/mage/cards/c/CollectiveRestraint.java +++ b/Mage.Sets/src/mage/cards/c/CollectiveRestraint.java @@ -80,7 +80,7 @@ class CollectiveRestraintPayManaToAttackAllEffect extends CantAttackYouUnlessPay public ManaCosts getManaCostToPay(GameEvent event, Ability source, Game game) { int domainValue = new DomainValue().calculate(game, source, this); if (domainValue > 0) { - return new ManaCostsImpl<>("{" + domainValue + "}"); + return new ManaCostsImpl<>("{" + domainValue + '}'); } return null; } diff --git a/Mage.Sets/src/mage/cards/c/ConfiscationCoup.java b/Mage.Sets/src/mage/cards/c/ConfiscationCoup.java index 4636fbfd09..35d8f7aa7a 100644 --- a/Mage.Sets/src/mage/cards/c/ConfiscationCoup.java +++ b/Mage.Sets/src/mage/cards/c/ConfiscationCoup.java @@ -108,7 +108,7 @@ class ConfiscationCoupEffect extends OneShotEffect { for (int i = 0; i < targetPermanent.getManaCost().convertedManaCost(); i++) { energy += "{E}"; } - if (controller.chooseUse(outcome, "Pay " + energy + " to get control of " + targetPermanent.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Pay " + energy + " to get control of " + targetPermanent.getLogName() + '?', source, game)) { if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { ContinuousEffect controllEffect = new GainControlTargetEffect(Duration.Custom); controllEffect.setTargetPointer(new FixedTarget(targetPermanent, game)); diff --git a/Mage.Sets/src/mage/cards/c/ConfusionInTheRanks.java b/Mage.Sets/src/mage/cards/c/ConfusionInTheRanks.java index d2f3b5856c..9ce9bb67b4 100644 --- a/Mage.Sets/src/mage/cards/c/ConfusionInTheRanks.java +++ b/Mage.Sets/src/mage/cards/c/ConfusionInTheRanks.java @@ -106,7 +106,7 @@ public class ConfusionInTheRanks extends CardImpl { if (!message.isEmpty()) { message += "or "; } - message += cardTypeEntering.toString().toLowerCase() + " "; + message += cardTypeEntering.toString().toLowerCase() + ' '; } filterTarget.add(Predicates.or(cardTypesPredicates)); message += "you do not control"; diff --git a/Mage.Sets/src/mage/cards/c/ConundrumSphinx.java b/Mage.Sets/src/mage/cards/c/ConundrumSphinx.java index 85bada78c2..7defd8d789 100644 --- a/Mage.Sets/src/mage/cards/c/ConundrumSphinx.java +++ b/Mage.Sets/src/mage/cards/c/ConundrumSphinx.java @@ -100,7 +100,7 @@ class ConundrumSphinxEffect extends OneShotEffect { } } String cardName = cardChoice.getChoice(); - game.informPlayers("Conundrum Sphinx, player: " + player.getLogName() + ", named card: [" + cardName + "]"); + game.informPlayers("Conundrum Sphinx, player: " + player.getLogName() + ", named card: [" + cardName + ']'); Card card = player.getLibrary().removeFromTop(game); Cards cards = new CardsImpl(); cards.add(card); diff --git a/Mage.Sets/src/mage/cards/c/CosmicHorror.java b/Mage.Sets/src/mage/cards/c/CosmicHorror.java index 201165802f..464a0cabb4 100644 --- a/Mage.Sets/src/mage/cards/c/CosmicHorror.java +++ b/Mage.Sets/src/mage/cards/c/CosmicHorror.java @@ -93,7 +93,7 @@ class CosmicHorrorEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent cosmicHorror = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && cosmicHorror != null) { - StringBuilder sb = new StringBuilder(cost.getText()).append("?"); + StringBuilder sb = new StringBuilder(cost.getText()).append('?'); if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) { sb.insert(0, "Pay "); } diff --git a/Mage.Sets/src/mage/cards/c/CouncilGuardian.java b/Mage.Sets/src/mage/cards/c/CouncilGuardian.java index a2bf0f3aa1..cee931c9f5 100644 --- a/Mage.Sets/src/mage/cards/c/CouncilGuardian.java +++ b/Mage.Sets/src/mage/cards/c/CouncilGuardian.java @@ -118,7 +118,7 @@ class CouncilsGuardianEffect extends OneShotEffect { } chosenColors.put(color, 1); } - game.informPlayers(player.getLogName() + " has chosen " + color.getDescription() + "."); + game.informPlayers(player.getLogName() + " has chosen " + color.getDescription() + '.'); } } } diff --git a/Mage.Sets/src/mage/cards/c/CranialExtraction.java b/Mage.Sets/src/mage/cards/c/CranialExtraction.java index 5a03316013..8d871d7e39 100644 --- a/Mage.Sets/src/mage/cards/c/CranialExtraction.java +++ b/Mage.Sets/src/mage/cards/c/CranialExtraction.java @@ -98,7 +98,7 @@ class CranialExtractionEffect extends SearchTargetGraveyardHandLibraryForCardNam String cardName = cardChoice.getChoice(); MageObject sourceObject = game.getObject(source.getSourceId()); if (sourceObject != null) { - game.informPlayers(sourceObject.getName() + " named card: [" + cardName + "]"); + game.informPlayers(sourceObject.getName() + " named card: [" + cardName + ']'); } super.applySearchAndExile(game, source, cardName, player.getId()); } diff --git a/Mage.Sets/src/mage/cards/d/DashHopes.java b/Mage.Sets/src/mage/cards/d/DashHopes.java index a55550a166..aa197c6381 100644 --- a/Mage.Sets/src/mage/cards/d/DashHopes.java +++ b/Mage.Sets/src/mage/cards/d/DashHopes.java @@ -95,9 +95,9 @@ class DashHopesCounterSourceEffect extends OneShotEffect { Player player = game.getPlayer(playerId); cost.clearPaid(); if (cost.canPay(source, source.getSourceId(), player.getId(), game) - && player.chooseUse(outcome, "Pay 5 life to counter " + sourceObject.getIdName() + "?", source, game)) { + && player.chooseUse(outcome, "Pay 5 life to counter " + sourceObject.getIdName() + '?', source, game)) { if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { - game.informPlayers(player.getLogName() + " pays 5 life to counter " + sourceObject.getIdName() + "."); + game.informPlayers(player.getLogName() + " pays 5 life to counter " + sourceObject.getIdName() + '.'); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { game.getStack().counter(spell.getId(), source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/d/DecayingSoil.java b/Mage.Sets/src/mage/cards/d/DecayingSoil.java index e06cb61391..530a6910c0 100644 --- a/Mage.Sets/src/mage/cards/d/DecayingSoil.java +++ b/Mage.Sets/src/mage/cards/d/DecayingSoil.java @@ -172,7 +172,7 @@ class DecayingSoilEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - if (player.chooseUse(Outcome.Benefit, " - Pay " + cost.getText() + "?", source, game)) { + if (player.chooseUse(Outcome.Benefit, " - Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { UUID target = this.getTargetPointer().getFirst(game, source); diff --git a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java index 4c76862c89..fa3b71d630 100644 --- a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java +++ b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java @@ -79,7 +79,7 @@ public class DeepfireElemental extends CardImpl { if (ability.getOriginalId().equals(originalId)) { ability.getTargets().clear(); FilterPermanent newFilter = filter.copy(); - newFilter.setMessage(new StringBuilder("artifact or creature with converted mana cost {").append(ability.getManaCostsToPay().getX()).append("}").toString()); + newFilter.setMessage(new StringBuilder("artifact or creature with converted mana cost {").append(ability.getManaCostsToPay().getX()).append('}').toString()); newFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, ability.getManaCostsToPay().getX())); Target target = new TargetPermanent(newFilter); ability.addTarget(target); diff --git a/Mage.Sets/src/mage/cards/d/DemonicHordes.java b/Mage.Sets/src/mage/cards/d/DemonicHordes.java index d5212f9e02..1019b6d746 100644 --- a/Mage.Sets/src/mage/cards/d/DemonicHordes.java +++ b/Mage.Sets/src/mage/cards/d/DemonicHordes.java @@ -104,7 +104,7 @@ class DemonicHordesEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent demonicHordes = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && demonicHordes != null) { - StringBuilder sb = new StringBuilder(cost.getText()).append("?"); + StringBuilder sb = new StringBuilder(cost.getText()).append('?'); if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) { sb.insert(0, "Pay "); } diff --git a/Mage.Sets/src/mage/cards/d/DieYoung.java b/Mage.Sets/src/mage/cards/d/DieYoung.java index e9cb79068f..8b5c4037ab 100644 --- a/Mage.Sets/src/mage/cards/d/DieYoung.java +++ b/Mage.Sets/src/mage/cards/d/DieYoung.java @@ -93,7 +93,7 @@ class DieYoungEffect extends OneShotEffect { if (controller != null) { new GetEnergyCountersControllerEffect(2).apply(game, source); int max = controller.getCounters().getCount(CounterType.ENERGY); - int numberToPayed = controller.getAmount(0, max, "How many energy counters do you like to pay? (maximum = " + max + ")", game); + int numberToPayed = controller.getAmount(0, max, "How many energy counters do you like to pay? (maximum = " + max + ')', game); if (numberToPayed > 0) { Cost cost = new PayEnergyCost(numberToPayed); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { diff --git a/Mage.Sets/src/mage/cards/d/DiluvianPrimordial.java b/Mage.Sets/src/mage/cards/d/DiluvianPrimordial.java index 5844aeb3ee..cb84ea95cd 100644 --- a/Mage.Sets/src/mage/cards/d/DiluvianPrimordial.java +++ b/Mage.Sets/src/mage/cards/d/DiluvianPrimordial.java @@ -126,7 +126,7 @@ class DiluvianPrimordialEffect extends OneShotEffect { if (target instanceof TargetCardInOpponentsGraveyard) { Card targetCard = game.getCard(target.getFirstTarget()); if (targetCard != null) { - if (controller.chooseUse(outcome, "Cast " + targetCard.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Cast " + targetCard.getLogName() + '?', source, game)) { if (controller.cast(targetCard.getSpellAbility(), game, true)) { ContinuousEffect effect = new DiluvianPrimordialReplacementEffect(); effect.setTargetPointer(new FixedTarget(targetCard.getId(), game.getState().getZoneChangeCounter(targetCard.getId()))); diff --git a/Mage.Sets/src/mage/cards/d/Duplicant.java b/Mage.Sets/src/mage/cards/d/Duplicant.java index f0dd4a0346..2132a893d4 100644 --- a/Mage.Sets/src/mage/cards/d/Duplicant.java +++ b/Mage.Sets/src/mage/cards/d/Duplicant.java @@ -108,7 +108,7 @@ class ExileTargetEffect extends OneShotEffect { if (permanent != null) { if(sourcePermananent != null){ sourcePermananent.imprint(permanent.getId(), game); - sourcePermananent.addInfo("imprint", new StringBuilder("[Imprinted card - ").append(permanent.getName()).append("]").toString(), game); + sourcePermananent.addInfo("imprint", new StringBuilder("[Imprinted card - ").append(permanent.getName()).append(']').toString(), game); } return permanent.moveToExile(null, null, source.getSourceId(), game); } diff --git a/Mage.Sets/src/mage/cards/d/DustOfMoments.java b/Mage.Sets/src/mage/cards/d/DustOfMoments.java index 658d0dc24b..529125a9d1 100644 --- a/Mage.Sets/src/mage/cards/d/DustOfMoments.java +++ b/Mage.Sets/src/mage/cards/d/DustOfMoments.java @@ -144,8 +144,8 @@ public class DustOfMoments extends CardImpl { } if (!game.isSimulation()) { game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") - .append(controller.getLogName()).append(getActionStr()).append("s") - .append(counter.getCount()).append(" ").append(counterName.toLowerCase()) + .append(controller.getLogName()).append(getActionStr()).append('s') + .append(counter.getCount()).append(' ').append(counterName.toLowerCase()) .append(" counter on ").append(card.getName()).toString()); } } @@ -170,7 +170,7 @@ public class DustOfMoments extends CardImpl { if (!game.isSimulation()) { game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") .append(controller.getLogName()).append(getActionStr()).append("s ") - .append(counter.getCount()).append(" ").append(counterName.toLowerCase()) + .append(counter.getCount()).append(' ').append(counterName.toLowerCase()) .append(" counter on ").append(card.getName()).toString()); } } @@ -185,7 +185,7 @@ public class DustOfMoments extends CardImpl { StringBuilder sb = new StringBuilder(); sb.append(getActionStr()); if (counter.getCount() > 1) { - sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName().toLowerCase()).append(" counters on each "); + sb.append(Integer.toString(counter.getCount())).append(' ').append(counter.getName().toLowerCase()).append(" counters on each "); } else { sb.append("a ").append(counter.getName().toLowerCase()).append(" counter on each "); } diff --git a/Mage.Sets/src/mage/cards/e/EliteArcanist.java b/Mage.Sets/src/mage/cards/e/EliteArcanist.java index 7098eb85dc..f4fa74b99b 100644 --- a/Mage.Sets/src/mage/cards/e/EliteArcanist.java +++ b/Mage.Sets/src/mage/cards/e/EliteArcanist.java @@ -128,7 +128,7 @@ class EliteArcanistImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", new StringBuilder("[Exiled card - ").append(card.getName()).append("]").toString(), game); + permanent.addInfo("imprint", new StringBuilder("[Exiled card - ").append(card.getName()).append(']').toString(), game); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java b/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java index 8548373f18..0bf68ea784 100644 --- a/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java +++ b/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java @@ -160,13 +160,13 @@ class EpiphanyAtTheDrownyardEffect extends OneShotEffect { } game.informPlayers(sb.toString()); - sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(":"); + sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(':'); i = 0; for (UUID cardUuid : pile2CardsIds) { Card card = game.getCard(cardUuid); if (card != null) { i++; - sb.append(" ").append(GameLog.getColoredObjectName(card)); + sb.append(' ').append(GameLog.getColoredObjectName(card)); if (i < pile2CardsIds.size()) { sb.append(", "); } diff --git a/Mage.Sets/src/mage/cards/e/Expropriate.java b/Mage.Sets/src/mage/cards/e/Expropriate.java index 7c17bd8d09..db60697b19 100644 --- a/Mage.Sets/src/mage/cards/e/Expropriate.java +++ b/Mage.Sets/src/mage/cards/e/Expropriate.java @@ -156,7 +156,7 @@ class ExpropriateDilemmaEffect extends CouncilsDilemmaVoteEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - if (player.chooseUse(Outcome.Vote, "Choose " + choiceOne + "?", source, game)) { + if (player.chooseUse(Outcome.Vote, "Choose " + choiceOne + '?', source, game)) { voteOneCount++; game.informPlayers(player.getName() + " has voted for " + choiceOne); } else { diff --git a/Mage.Sets/src/mage/cards/e/ExtraplanarLens.java b/Mage.Sets/src/mage/cards/e/ExtraplanarLens.java index 8ee5606259..962a277092 100644 --- a/Mage.Sets/src/mage/cards/e/ExtraplanarLens.java +++ b/Mage.Sets/src/mage/cards/e/ExtraplanarLens.java @@ -103,7 +103,7 @@ class ExtraplanarLensImprintEffect extends OneShotEffect { if (targetLand != null) { targetLand.moveToExile(null, extraplanarLens.getName() + " (Imprint)", source.getSourceId(), game); extraplanarLens.imprint(targetLand.getId(), game); - extraplanarLens.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + targetLand.getLogName() + "]"), game); + extraplanarLens.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + targetLand.getLogName() + ']'), game); } } return true; diff --git a/Mage.Sets/src/mage/cards/f/FactOrFiction.java b/Mage.Sets/src/mage/cards/f/FactOrFiction.java index 6a93b12673..1bc2dc39e8 100644 --- a/Mage.Sets/src/mage/cards/f/FactOrFiction.java +++ b/Mage.Sets/src/mage/cards/f/FactOrFiction.java @@ -137,11 +137,11 @@ class FactOrFictionEffect extends OneShotEffect { } game.informPlayers(sb.toString()); - sb = new StringBuilder("Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (":"); + sb = new StringBuilder("Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (':'); i = 0; for (Card card: pile2) { i++; - sb.append(" ").append(card.getName()); + sb.append(' ').append(card.getName()); if (i < pile2.size()) { sb.append(", "); } diff --git a/Mage.Sets/src/mage/cards/f/FaerieArtisans.java b/Mage.Sets/src/mage/cards/f/FaerieArtisans.java index fb99035e3e..80a433d0fb 100644 --- a/Mage.Sets/src/mage/cards/f/FaerieArtisans.java +++ b/Mage.Sets/src/mage/cards/f/FaerieArtisans.java @@ -121,7 +121,7 @@ class FaerieArtisansEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); for (Permanent permanent : effect.getAddedPermanent()) { if (sb.length() > 0) { - sb.append(";"); + sb.append(';'); } sb.append(permanent.getId()); } diff --git a/Mage.Sets/src/mage/cards/f/Fatespinner.java b/Mage.Sets/src/mage/cards/f/Fatespinner.java index 7ed714bf29..6078d1eb96 100644 --- a/Mage.Sets/src/mage/cards/f/Fatespinner.java +++ b/Mage.Sets/src/mage/cards/f/Fatespinner.java @@ -113,7 +113,7 @@ class FatespinnerChooseEffect extends OneShotEffect { } } String chosenPhase = choice.getChoice(); - game.informPlayers(player.getLogName() + " has chosen to skip " + chosenPhase.toLowerCase() + "."); + game.informPlayers(player.getLogName() + " has chosen to skip " + chosenPhase.toLowerCase() + '.'); game.addEffect(new FatespinnerSkipEffect(chosenPhase), source); return true; } diff --git a/Mage.Sets/src/mage/cards/f/FellShepherd.java b/Mage.Sets/src/mage/cards/f/FellShepherd.java index bb01cc12f7..c4db208110 100644 --- a/Mage.Sets/src/mage/cards/f/FellShepherd.java +++ b/Mage.Sets/src/mage/cards/f/FellShepherd.java @@ -162,7 +162,7 @@ class FellShepherdEffect extends OneShotEffect { Card card = game.getCard(creatureId); if (card != null) { card.moveToZone(Zone.HAND, source.getSourceId(), game, false); - sb.append(" ").append(card.getName()); + sb.append(' ').append(card.getName()); } } } diff --git a/Mage.Sets/src/mage/cards/f/Flash.java b/Mage.Sets/src/mage/cards/f/Flash.java index c52032bb75..0cf62455aa 100644 --- a/Mage.Sets/src/mage/cards/f/Flash.java +++ b/Mage.Sets/src/mage/cards/f/Flash.java @@ -101,7 +101,7 @@ class FlashEffect extends OneShotEffect { card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId()); ManaCosts reducedCost = CardUtil.removeVariableManaCost(CardUtil.reduceCost(card.getManaCost(), 2)); - StringBuilder sb = new StringBuilder("Pay ").append(reducedCost.getText()).append("?"); + StringBuilder sb = new StringBuilder("Pay ").append(reducedCost.getText()).append('?'); if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { reducedCost.clearPaid(); if (reducedCost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { diff --git a/Mage.Sets/src/mage/cards/f/FlowstoneSculpture.java b/Mage.Sets/src/mage/cards/f/FlowstoneSculpture.java index c830de50e3..69507915ee 100644 --- a/Mage.Sets/src/mage/cards/f/FlowstoneSculpture.java +++ b/Mage.Sets/src/mage/cards/f/FlowstoneSculpture.java @@ -124,14 +124,16 @@ class FlowstoneSculptureEffect extends OneShotEffect { } else { Ability gainedAbility; - if(chosen.equals("Flying")) { - gainedAbility = FlyingAbility.getInstance(); - } - else if(chosen.equals("First strike")) { - gainedAbility = FirstStrikeAbility.getInstance(); - } - else { - gainedAbility = TrampleAbility.getInstance(); + switch (chosen) { + case "Flying": + gainedAbility = FlyingAbility.getInstance(); + break; + case "First strike": + gainedAbility = FirstStrikeAbility.getInstance(); + break; + default: + gainedAbility = TrampleAbility.getInstance(); + break; } game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.WhileOnBattlefield), source); return true; diff --git a/Mage.Sets/src/mage/cards/f/ForgottenAncient.java b/Mage.Sets/src/mage/cards/f/ForgottenAncient.java index d13001fa77..7513d62d57 100644 --- a/Mage.Sets/src/mage/cards/f/ForgottenAncient.java +++ b/Mage.Sets/src/mage/cards/f/ForgottenAncient.java @@ -124,7 +124,7 @@ public class ForgottenAncient extends CardImpl { continue; } - int amountToMove = controller.getAmount(0, numCounters, "How many counters do you want to move? " + "(" + numCounters + ")" + " counters remaining.", game); + int amountToMove = controller.getAmount(0, numCounters, "How many counters do you want to move? " + '(' + numCounters + ')' + " counters remaining.", game); if(amountToMove > 0) { boolean previouslyChosen = false; diff --git a/Mage.Sets/src/mage/cards/g/GoblinDarkDwellers.java b/Mage.Sets/src/mage/cards/g/GoblinDarkDwellers.java index 7a5e27bc3a..bd4243485f 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinDarkDwellers.java +++ b/Mage.Sets/src/mage/cards/g/GoblinDarkDwellers.java @@ -113,7 +113,7 @@ class GoblinDarkDwellersEffect extends OneShotEffect { if (controller != null) { Card card = game.getCard(this.getTargetPointer().getFirst(game, source)); if (card != null) { - if (controller.chooseUse(outcome, "Cast " + card.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Cast " + card.getLogName() + '?', source, game)) { if (controller.cast(card.getSpellAbility(), game, true)) { ContinuousEffect effect = new GoblinDarkDwellersReplacementEffect(card.getId()); effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId()))); diff --git a/Mage.Sets/src/mage/cards/g/Godsend.java b/Mage.Sets/src/mage/cards/g/Godsend.java index 42acb71b40..f0743615e1 100644 --- a/Mage.Sets/src/mage/cards/g/Godsend.java +++ b/Mage.Sets/src/mage/cards/g/Godsend.java @@ -191,7 +191,7 @@ class GodsendExileEffect extends OneShotEffect { if (creature != null && controller != null && sourcePermanent != null) { UUID exileId = CardUtil.getCardExileZoneId(game, source); controller.moveCardToExileWithInfo(creature, exileId, - sourcePermanent.getIdName() + " (" + sourcePermanent.getZoneChangeCounter(game) + ")", source.getSourceId(), game, Zone.BATTLEFIELD, true); + sourcePermanent.getIdName() + " (" + sourcePermanent.getZoneChangeCounter(game) + ')', source.getSourceId(), game, Zone.BATTLEFIELD, true); } return false; @@ -218,7 +218,7 @@ class GodsendRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl { public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - return "You can't cast this spell because a card with the same name is exiled by " + mageObject.getLogName() + "."; + return "You can't cast this spell because a card with the same name is exiled by " + mageObject.getLogName() + '.'; } return null; } diff --git a/Mage.Sets/src/mage/cards/g/GrandAbolisher.java b/Mage.Sets/src/mage/cards/g/GrandAbolisher.java index 1201a553fb..3eb9c5964b 100644 --- a/Mage.Sets/src/mage/cards/g/GrandAbolisher.java +++ b/Mage.Sets/src/mage/cards/g/GrandAbolisher.java @@ -98,7 +98,7 @@ class GrandAbolisherEffect extends ContinuousRuleModifyingEffectImpl { MageObject mageObject = game.getObject(source.getSourceId()); if (activePlayer != null && mageObject != null) { return "You can't cast spells or activate abilities of artifacts, creatures, or enchantments during the turns of " + activePlayer.getLogName() + - " (" + mageObject.getLogName() + ")"; + " (" + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage.Sets/src/mage/cards/h/Heartmender.java b/Mage.Sets/src/mage/cards/h/Heartmender.java index 5211a7a058..05b9db5c38 100644 --- a/Mage.Sets/src/mage/cards/h/Heartmender.java +++ b/Mage.Sets/src/mage/cards/h/Heartmender.java @@ -100,7 +100,7 @@ class HeartmenderEffect extends OneShotEffect { if (creature != null && creature.getCounters(game).getCount(counter.getName()) >= counter.getCount()) { creature.removeCounters(counter.getName(), counter.getCount(), game); - game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName()) + game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(' ').append(counter.getName()) .append(" counter from ").append(creature.getName()).toString()); applied = true; } diff --git a/Mage.Sets/src/mage/cards/h/HellkiteCharger.java b/Mage.Sets/src/mage/cards/h/HellkiteCharger.java index 5151be6ed3..40e0435a31 100644 --- a/Mage.Sets/src/mage/cards/h/HellkiteCharger.java +++ b/Mage.Sets/src/mage/cards/h/HellkiteCharger.java @@ -96,7 +96,7 @@ class HellkiteChargerEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { ManaCosts cost = new ManaCostsImpl("{5}{R}{R}"); - if (player.chooseUse(Outcome.Damage, "Pay " + cost.getText() + "?", source, game)) { + if (player.chooseUse(Outcome.Damage, "Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { new UntapAllControllerEffect(new FilterAttackingCreature(),"").apply(game, source); diff --git a/Mage.Sets/src/mage/cards/h/HiddenStrings.java b/Mage.Sets/src/mage/cards/h/HiddenStrings.java index a29f12c38e..52b47eb6b7 100644 --- a/Mage.Sets/src/mage/cards/h/HiddenStrings.java +++ b/Mage.Sets/src/mage/cards/h/HiddenStrings.java @@ -98,11 +98,11 @@ class HiddenStringsEffect extends OneShotEffect { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { if (permanent.isTapped()) { - if (player.chooseUse(Outcome.Untap, new StringBuilder("Untap ").append(permanent.getName()).append("?").toString(), source, game)) { + if (player.chooseUse(Outcome.Untap, new StringBuilder("Untap ").append(permanent.getName()).append('?').toString(), source, game)) { permanent.untap(game); } } else { - if (player.chooseUse(Outcome.Tap, new StringBuilder("Tap ").append(permanent.getName()).append("?").toString(), source, game)) { + if (player.chooseUse(Outcome.Tap, new StringBuilder("Tap ").append(permanent.getName()).append('?').toString(), source, game)) { permanent.tap(game); } } diff --git a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java index 411652317c..a34d13da76 100644 --- a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java +++ b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java @@ -132,7 +132,7 @@ class HopeOfGhirapurCantCastEffect extends ContinuousRuleModifyingEffectImpl { public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - return "You can't cast noncreature spells this turn (you were dealt damage by " + mageObject.getLogName() + ")"; + return "You can't cast noncreature spells this turn (you were dealt damage by " + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage.Sets/src/mage/cards/i/InfiniteObliteration.java b/Mage.Sets/src/mage/cards/i/InfiniteObliteration.java index 2d91175784..ecd3f9cce6 100644 --- a/Mage.Sets/src/mage/cards/i/InfiniteObliteration.java +++ b/Mage.Sets/src/mage/cards/i/InfiniteObliteration.java @@ -97,7 +97,7 @@ class InfiniteObliterationEffect extends SearchTargetGraveyardHandLibraryForCard cardName = cardChoice.getChoice(); MageObject sourceObject = game.getObject(source.getSourceId()); if (sourceObject != null) { - game.informPlayers(sourceObject.getName() + " named card: [" + cardName + "]"); + game.informPlayers(sourceObject.getName() + " named card: [" + cardName + ']'); } super.applySearchAndExile(game, source, cardName, player.getId()); diff --git a/Mage.Sets/src/mage/cards/i/IntetTheDreamer.java b/Mage.Sets/src/mage/cards/i/IntetTheDreamer.java index b6185063b0..f58b9d92ca 100644 --- a/Mage.Sets/src/mage/cards/i/IntetTheDreamer.java +++ b/Mage.Sets/src/mage/cards/i/IntetTheDreamer.java @@ -162,7 +162,7 @@ class IntetTheDreamerCastEffect extends AsThoughEffectImpl { if (zone != null && zone.contains(card.getId())/* && CardUtil.cardCanBePlayedNow(card, controller.getId(), game)*/) { if (card.getCardType().contains(CardType.LAND)) { if (game.canPlaySorcery(controller.getId()) && game.getPlayer(controller.getId()).canPlayLand()) { - return controller.chooseUse(outcome, "Play " + card.getIdName() + "?", source, game); + return controller.chooseUse(outcome, "Play " + card.getIdName() + '?', source, game); } } else { controller.setCastSourceIdWithAlternateMana(objectId, null, null); diff --git a/Mage.Sets/src/mage/cards/i/IsochronScepter.java b/Mage.Sets/src/mage/cards/i/IsochronScepter.java index b23de5bf68..96407d8af2 100644 --- a/Mage.Sets/src/mage/cards/i/IsochronScepter.java +++ b/Mage.Sets/src/mage/cards/i/IsochronScepter.java @@ -113,7 +113,7 @@ class IsochronScepterImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + "]"), game); + permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + ']'), game); } } } @@ -155,7 +155,7 @@ class IsochronScepterCopyEffect extends OneShotEffect { if (scepter != null && scepter.getImprinted() != null && !scepter.getImprinted().isEmpty()) { Card imprintedInstant = game.getCard(scepter.getImprinted().get(0)); if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) { - if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append("?").toString(), source, game)) { + if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append('?').toString(), source, game)) { Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId()); if (copiedCard != null) { game.getExile().add(source.getSourceId(), "", copiedCard); diff --git a/Mage.Sets/src/mage/cards/j/JaceArchitectOfThought.java b/Mage.Sets/src/mage/cards/j/JaceArchitectOfThought.java index f6c11df488..c589670c0b 100644 --- a/Mage.Sets/src/mage/cards/j/JaceArchitectOfThought.java +++ b/Mage.Sets/src/mage/cards/j/JaceArchitectOfThought.java @@ -264,7 +264,7 @@ class JaceArchitectOfThoughtEffect2 extends OneShotEffect { private void postPileToLog(String pileName, Set cards, Game game) { StringBuilder message = new StringBuilder(pileName).append(": "); for (Card card : cards) { - message.append(card.getName()).append(" "); + message.append(card.getName()).append(' '); } if (cards.isEmpty()) { message.append(" (empty)"); diff --git a/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java b/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java index 30fd18f176..9ff74ced51 100644 --- a/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java +++ b/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java @@ -103,7 +103,7 @@ class KalitasDestroyEffect extends OneShotEffect { class VampireToken extends Token { public VampireToken(int tokenPower, int tokenToughness) { - super("Vampire", new StringBuilder(tokenPower).append("/").append(tokenToughness).append(" black Vampire creature token").toString()); + super("Vampire", new StringBuilder(tokenPower).append('/').append(tokenToughness).append(" black Vampire creature token").toString()); cardType.add(CardType.CREATURE); color.setBlack(true); subtype.add("Vampire"); diff --git a/Mage.Sets/src/mage/cards/k/KnowledgePool.java b/Mage.Sets/src/mage/cards/k/KnowledgePool.java index 0fb3745420..1a83a89bb8 100644 --- a/Mage.Sets/src/mage/cards/k/KnowledgePool.java +++ b/Mage.Sets/src/mage/cards/k/KnowledgePool.java @@ -101,7 +101,7 @@ class KnowledgePoolEffect1 extends OneShotEffect { if (player != null) { player.moveCardsToExile(player.getLibrary().getTopCards(game, 3), source, game, true, CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), - sourceObject.getIdName() + " (" + sourceObject.getZoneChangeCounter(game) + ")"); + sourceObject.getIdName() + " (" + sourceObject.getZoneChangeCounter(game) + ')'); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LunarAvenger.java b/Mage.Sets/src/mage/cards/l/LunarAvenger.java index de4a09a51f..232b503747 100644 --- a/Mage.Sets/src/mage/cards/l/LunarAvenger.java +++ b/Mage.Sets/src/mage/cards/l/LunarAvenger.java @@ -119,12 +119,16 @@ class LunarAvengerEffect extends OneShotEffect { Ability gainedAbility; String chosen = choice.getChoice(); - if (chosen.equals("Flying")) { - gainedAbility = FlyingAbility.getInstance(); - } else if (chosen.equals("First strike")) { - gainedAbility = FirstStrikeAbility.getInstance(); - } else { - gainedAbility = HasteAbility.getInstance(); + switch (chosen) { + case "Flying": + gainedAbility = FlyingAbility.getInstance(); + break; + case "First strike": + gainedAbility = FirstStrikeAbility.getInstance(); + break; + default: + gainedAbility = HasteAbility.getInstance(); + break; } game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.EndOfTurn), source); diff --git a/Mage.Sets/src/mage/cards/m/Magmasaur.java b/Mage.Sets/src/mage/cards/m/Magmasaur.java index a6e8c573f6..82fe68b611 100644 --- a/Mage.Sets/src/mage/cards/m/Magmasaur.java +++ b/Mage.Sets/src/mage/cards/m/Magmasaur.java @@ -108,7 +108,7 @@ class MagmasaurEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourceObject = (Permanent) source.getSourceObjectIfItStillExists(game); if (sourceObject != null && controller != null) { - if (controller.chooseUse(outcome, "Remove a +1/+1 counter from " + sourceObject.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Remove a +1/+1 counter from " + sourceObject.getLogName() + '?', source, game)) { sourceObject.removeCounters(CounterType.P1P1.getName(), 1, game); } else { int counters = sourceObject.getCounters(game).getCount(CounterType.P1P1); diff --git a/Mage.Sets/src/mage/cards/m/ManaVortex.java b/Mage.Sets/src/mage/cards/m/ManaVortex.java index f46e2b3237..9ca657b5ad 100644 --- a/Mage.Sets/src/mage/cards/m/ManaVortex.java +++ b/Mage.Sets/src/mage/cards/m/ManaVortex.java @@ -110,10 +110,10 @@ class CounterSourceEffect extends OneShotEffect { } if(spell != null){ Player controller = game.getPlayer(source.getControllerId()); - if(controller.chooseUse(Outcome.Detriment, "Sacrifice a land to not counter " + spell.getName() + "?", source, game)){ + if(controller.chooseUse(Outcome.Detriment, "Sacrifice a land to not counter " + spell.getName() + '?', source, game)){ SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledLandPermanent())); if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)){ - game.informPlayers(controller.getLogName() + " sacrifices a land to not counter " + spell.getName() + "."); + game.informPlayers(controller.getLogName() + " sacrifices a land to not counter " + spell.getName() + '.'); return true; } else { diff --git a/Mage.Sets/src/mage/cards/m/Mindblaze.java b/Mage.Sets/src/mage/cards/m/Mindblaze.java index 4917ffdac8..6bb549849b 100644 --- a/Mage.Sets/src/mage/cards/m/Mindblaze.java +++ b/Mage.Sets/src/mage/cards/m/Mindblaze.java @@ -113,8 +113,8 @@ class MindblazeEffect extends OneShotEffect { } } - game.informPlayers("Mindblaze, named card: [" + cardChoice.getChoice() + "]"); - game.informPlayers("Mindblaze, chosen number: [" + numberChoice.getChoice() + "]"); + game.informPlayers("Mindblaze, named card: [" + cardChoice.getChoice() + ']'); + game.informPlayers("Mindblaze, chosen number: [" + numberChoice.getChoice() + ']'); Cards cards = new CardsImpl(); cards.addAll(player.getLibrary().getCards(game)); diff --git a/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java b/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java index 67cf0f96a7..175418106f 100644 --- a/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java +++ b/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java @@ -124,7 +124,7 @@ class DoUnlessTargetPaysCost extends OneShotEffect { if (player != null && mageObject != null) { String message = userMessage; if (message == null) { - message = getCostText() + " to prevent " + executingEffect.getText(source.getModes().getMode()) + "?"; + message = getCostText() + " to prevent " + executingEffect.getText(source.getModes().getMode()) + '?'; } message = CardUtil.replaceSourceName(message, mageObject.getLogName()); cost.clearPaid(); diff --git a/Mage.Sets/src/mage/cards/m/MysticRemora.java b/Mage.Sets/src/mage/cards/m/MysticRemora.java index b69bda270e..62c0dd8dc4 100644 --- a/Mage.Sets/src/mage/cards/m/MysticRemora.java +++ b/Mage.Sets/src/mage/cards/m/MysticRemora.java @@ -145,7 +145,7 @@ class MysticRemoraTriggeredAbility extends TriggeredAbilityImpl { Cost cost = new GenericManaCost(4); String message = "Would you like to pay {4} to prevent the opponent to draw a card?"; if (!(opponent.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null))) { - if(controller.chooseUse(Outcome.DrawCard, "Draw a card (" + sourceObject.getLogName() +")", source, game)) { + if(controller.chooseUse(Outcome.DrawCard, "Draw a card (" + sourceObject.getLogName() + ')', source, game)) { controller.drawCards(1, game); } } diff --git a/Mage.Sets/src/mage/cards/n/NahiriTheLithomancer.java b/Mage.Sets/src/mage/cards/n/NahiriTheLithomancer.java index 5ab434ecab..289300c2c2 100644 --- a/Mage.Sets/src/mage/cards/n/NahiriTheLithomancer.java +++ b/Mage.Sets/src/mage/cards/n/NahiriTheLithomancer.java @@ -134,7 +134,7 @@ class NahiriTheLithomancerFirstAbilityEffect extends OneShotEffect { //TODO: Make sure the Equipment can legally enchant the token, preferably on targetting. Target target = new TargetControlledPermanent(0, 1, filter, true); if (target.canChoose(source.getSourceId(), controller.getId(), game) - && controller.chooseUse(outcome, "Attach an Equipment you control to the created " + tokenPermanent.getIdName() + "?", source, game)) { + && controller.chooseUse(outcome, "Attach an Equipment you control to the created " + tokenPermanent.getIdName() + '?', source, game)) { if (target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) { Permanent equipmentPermanent = game.getPermanent(target.getFirstTarget()); if (equipmentPermanent != null) { diff --git a/Mage.Sets/src/mage/cards/n/NarsetTranscendent.java b/Mage.Sets/src/mage/cards/n/NarsetTranscendent.java index 2565deb3f8..a4480cfdbb 100644 --- a/Mage.Sets/src/mage/cards/n/NarsetTranscendent.java +++ b/Mage.Sets/src/mage/cards/n/NarsetTranscendent.java @@ -257,7 +257,7 @@ class NarsetTranscendentCantCastEffect extends ContinuousRuleModifyingEffectImpl public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - return "You can't cast can't cast noncreature spells (it is prevented by emblem of " + mageObject.getLogName() + ")"; + return "You can't cast can't cast noncreature spells (it is prevented by emblem of " + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java b/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java index e00bef79a6..e7e24c4f24 100644 --- a/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java +++ b/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java @@ -110,7 +110,7 @@ class NayaSoulbeastCastEffect extends OneShotEffect { if (player.getLibrary().size() > 0) { Card card = player.getLibrary().getFromTop(game); cmc += card.getConvertedManaCost(); - player.revealCards(sourceObject.getName() + " (" + player.getName() + ")", new CardsImpl(card), game); + player.revealCards(sourceObject.getName() + " (" + player.getName() + ')', new CardsImpl(card), game); } } } diff --git a/Mage.Sets/src/mage/cards/n/NimDeathmantle.java b/Mage.Sets/src/mage/cards/n/NimDeathmantle.java index 1049bba9b9..8b53dab95e 100644 --- a/Mage.Sets/src/mage/cards/n/NimDeathmantle.java +++ b/Mage.Sets/src/mage/cards/n/NimDeathmantle.java @@ -151,7 +151,7 @@ class NimDeathmantleEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent equipment = game.getPermanent(source.getSourceId()); if (controller != null && equipment != null) { - if (controller.chooseUse(Outcome.Benefit, equipment.getName() + " - Pay " + cost.getText() + "?", source, game)) { + if (controller.chooseUse(Outcome.Benefit, equipment.getName() + " - Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { UUID target = targetPointer.getFirst(game, source); diff --git a/Mage.Sets/src/mage/cards/p/PardicDragon.java b/Mage.Sets/src/mage/cards/p/PardicDragon.java index d80d164648..066c516b47 100644 --- a/Mage.Sets/src/mage/cards/p/PardicDragon.java +++ b/Mage.Sets/src/mage/cards/p/PardicDragon.java @@ -113,7 +113,7 @@ class PardicDragonEffect extends OneShotEffect { Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); Card sourceCard = game.getCard(source.getSourceId()); if (opponent != null && sourceCard != null) { - if (opponent.chooseUse(outcome, new StringBuilder("Put a time counter on ").append(sourceCard.getName()).append("?").toString(), source, game)) { + if (opponent.chooseUse(outcome, new StringBuilder("Put a time counter on ").append(sourceCard.getName()).append('?').toString(), source, game)) { sourceCard.addCounters(CounterType.TIME.createInstance(), source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/p/Phantasmagorian.java b/Mage.Sets/src/mage/cards/p/Phantasmagorian.java index 0640ffcbd9..e58c48dfc6 100644 --- a/Mage.Sets/src/mage/cards/p/Phantasmagorian.java +++ b/Mage.Sets/src/mage/cards/p/Phantasmagorian.java @@ -101,9 +101,9 @@ class CounterSourceEffect extends OneShotEffect { Player player = game.getPlayer(playerId); cost.clearPaid(); if (cost.canPay(source, source.getSourceId(), player.getId(), game) - && player.chooseUse(outcome, "Discard three cards to counter " + sourceObject.getIdName() + "?", source, game)) { + && player.chooseUse(outcome, "Discard three cards to counter " + sourceObject.getIdName() + '?', source, game)) { if (cost.pay(source, game, source.getSourceId(), playerId, false, null)) { - game.informPlayers(player.getLogName() + " discards 3 cards to counter " + sourceObject.getIdName() + "."); + game.informPlayers(player.getLogName() + " discards 3 cards to counter " + sourceObject.getIdName() + '.'); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { game.getStack().counter(spell.getId(), source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianMarauder.java b/Mage.Sets/src/mage/cards/p/PhyrexianMarauder.java index eda4cad154..68bf40ed5b 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianMarauder.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianMarauder.java @@ -100,7 +100,7 @@ class PhyrexianMarauderCantAttackUnlessYouPayEffect extends CantAttackBlockUnles if (sourceObject != null) { int counter = sourceObject.getCounters(game).getCount(CounterType.P1P1); if (counter > 0) { - return new ManaCostsImpl<>("{" + counter + "}"); + return new ManaCostsImpl<>("{" + counter + '}'); } } return null; diff --git a/Mage.Sets/src/mage/cards/p/PowerSink.java b/Mage.Sets/src/mage/cards/p/PowerSink.java index 2273f48fce..6876100c93 100644 --- a/Mage.Sets/src/mage/cards/p/PowerSink.java +++ b/Mage.Sets/src/mage/cards/p/PowerSink.java @@ -98,7 +98,7 @@ class PowerSinkCounterUnlessPaysEffect extends OneShotEffect { int amount = source.getManaCostsToPay().getX(); if (amount > 0) { GenericManaCost cost = new GenericManaCost(amount); - StringBuilder sb = new StringBuilder("Pay ").append(cost.getText()).append("?"); + StringBuilder sb = new StringBuilder("Pay ").append(cost.getText()).append('?'); if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { game.informPlayers(new StringBuilder(sourceObject.getName()).append(": additional cost was paid").toString()); diff --git a/Mage.Sets/src/mage/cards/p/PyxisOfPandemonium.java b/Mage.Sets/src/mage/cards/p/PyxisOfPandemonium.java index 6db2e4c42a..73c19fe322 100644 --- a/Mage.Sets/src/mage/cards/p/PyxisOfPandemonium.java +++ b/Mage.Sets/src/mage/cards/p/PyxisOfPandemonium.java @@ -122,7 +122,7 @@ class PyxisOfPandemoniumExileEffect extends OneShotEffect { exileId = UUID.randomUUID(); exileIds.put(exileKey, exileId); } - player.moveCardsToExile(card, source, game, false, exileId, sourceObject.getIdName() + " (" + player.getName() + ")"); + player.moveCardsToExile(card, source, game, false, exileId, sourceObject.getIdName() + " (" + player.getName() + ')'); card.setFaceDown(true, game); } } diff --git a/Mage.Sets/src/mage/cards/q/Quicken.java b/Mage.Sets/src/mage/cards/q/Quicken.java index 41162038ec..04b2d4a018 100644 --- a/Mage.Sets/src/mage/cards/q/Quicken.java +++ b/Mage.Sets/src/mage/cards/q/Quicken.java @@ -153,12 +153,12 @@ class QuickenWatcher extends Watcher { } public void addQuickenSpell(UUID playerId, UUID sourceId, int zoneChangeCounter) { - String spellKey = playerId.toString() + sourceId.toString() + "_" + zoneChangeCounter; + String spellKey = playerId.toString() + sourceId.toString() + '_' + zoneChangeCounter; activeQuickenSpells.add(spellKey); } public boolean isQuickenSpellActive(UUID playerId, UUID sourceId, int zoneChangeCounter) { - String spellKey = playerId.toString() + sourceId.toString() + "_" + zoneChangeCounter; + String spellKey = playerId.toString() + sourceId.toString() + '_' + zoneChangeCounter; return activeQuickenSpells.contains(spellKey); } diff --git a/Mage.Sets/src/mage/cards/r/ResearchDevelopment.java b/Mage.Sets/src/mage/cards/r/ResearchDevelopment.java index 9601fb20d3..1646982006 100644 --- a/Mage.Sets/src/mage/cards/r/ResearchDevelopment.java +++ b/Mage.Sets/src/mage/cards/r/ResearchDevelopment.java @@ -127,7 +127,7 @@ class ResearchEffect extends OneShotEffect { textToAsk = new StringBuilder(choiceText); textToAsk.append(" ("); textToAsk.append(count); - textToAsk.append(")"); + textToAsk.append(')'); } } @@ -170,7 +170,7 @@ class DevelopmentEffect extends OneShotEffect { for (UUID opponentUuid : opponents) { Player opponent = game.getPlayer(opponentUuid); if (opponent != null && opponent.chooseUse(Outcome.Detriment, - "Allow " + player.getLogName() + " to draw a card instead? (" + Integer.toString(i+1) + ")", source, game)) { + "Allow " + player.getLogName() + " to draw a card instead? (" + Integer.toString(i+1) + ')', source, game)) { game.informPlayers(opponent.getLogName() + " had chosen to let " + player.getLogName() + " draw a card."); player.drawCards(1, game); putToken = false; diff --git a/Mage.Sets/src/mage/cards/r/ReverseTheSands.java b/Mage.Sets/src/mage/cards/r/ReverseTheSands.java index 6053a99996..970864b126 100644 --- a/Mage.Sets/src/mage/cards/r/ReverseTheSands.java +++ b/Mage.Sets/src/mage/cards/r/ReverseTheSands.java @@ -105,7 +105,7 @@ class ReverseTheSandsEffect extends OneShotEffect { } else { selectedChoice = choices.iterator().next(); } - int index = selectedChoice.indexOf(" "); + int index = selectedChoice.indexOf(' '); if (index > 0) { String lifeString = selectedChoice.substring(0, index); int life = Integer.parseInt(lifeString); diff --git a/Mage.Sets/src/mage/cards/r/RhysticStudy.java b/Mage.Sets/src/mage/cards/r/RhysticStudy.java index d00a339e8d..41e2e18fda 100644 --- a/Mage.Sets/src/mage/cards/r/RhysticStudy.java +++ b/Mage.Sets/src/mage/cards/r/RhysticStudy.java @@ -92,7 +92,7 @@ class RhysticStudyDrawEffect extends OneShotEffect { Cost cost = new GenericManaCost(1); String message = "Would you like to pay {1} to prevent the opponent to draw a card?"; if (!(opponent.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null))) { - if(controller.chooseUse(Outcome.DrawCard, "Draw a card (" + sourceObject.getLogName() +")", source, game)) { + if(controller.chooseUse(Outcome.DrawCard, "Draw a card (" + sourceObject.getLogName() + ')', source, game)) { controller.drawCards(1, game); } } diff --git a/Mage.Sets/src/mage/cards/r/RidersOfGavony.java b/Mage.Sets/src/mage/cards/r/RidersOfGavony.java index 074ada3a05..4c1fae2158 100644 --- a/Mage.Sets/src/mage/cards/r/RidersOfGavony.java +++ b/Mage.Sets/src/mage/cards/r/RidersOfGavony.java @@ -114,7 +114,7 @@ class RidersOfGavonyGainAbilityControlledEffect extends ContinuousEffectImpl { if (permanent != null) { String subtype = (String) game.getState().getValue(permanent.getId() + "_type"); if (subtype != null) { - protectionFilter = new FilterPermanent(subtype + "s"); + protectionFilter = new FilterPermanent(subtype + 's'); protectionFilter.add(new SubtypePredicate(subtype)); } } diff --git a/Mage.Sets/src/mage/cards/r/RunedHalo.java b/Mage.Sets/src/mage/cards/r/RunedHalo.java index 7e5a7d8e0d..f6d89e6dfb 100644 --- a/Mage.Sets/src/mage/cards/r/RunedHalo.java +++ b/Mage.Sets/src/mage/cards/r/RunedHalo.java @@ -96,7 +96,7 @@ class RunedHaloSetProtectionEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY); if (controller != null && cardName != null && !cardName.isEmpty()) { - FilterObject filter = new FilterObject("the name [" + cardName + "]"); + FilterObject filter = new FilterObject("the name [" + cardName + ']'); filter.add(new NamePredicate(cardName)); ContinuousEffect effect = new GainAbilityControllerEffect(new ProtectionAbility(filter), Duration.Custom); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/s/SarpadianEmpiresVolVii.java b/Mage.Sets/src/mage/cards/s/SarpadianEmpiresVolVii.java index f205359c8a..d2effe914a 100644 --- a/Mage.Sets/src/mage/cards/s/SarpadianEmpiresVolVii.java +++ b/Mage.Sets/src/mage/cards/s/SarpadianEmpiresVolVii.java @@ -135,20 +135,22 @@ class CreateSelectedTokenEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { String tokenType = game.getState().getValue(source.getSourceId().toString() + "_SarpadianEmpiresVolVii").toString(); Token token; - if(tokenType.equals("White Citizen")) { - token = new CitizenToken(); - } - else if(tokenType.equals("Blue Camarid")) { - token = new CamaridToken(); - } - else if(tokenType.equals("Black Thrull")) { - token = new ThrullToken(); - } - else if(tokenType.equals("Red Goblin")) { - token = new GoblinToken(); - } - else { - token = new SaprolingToken(); + switch (tokenType) { + case "White Citizen": + token = new CitizenToken(); + break; + case "Blue Camarid": + token = new CamaridToken(); + break; + case "Black Thrull": + token = new ThrullToken(); + break; + case "Red Goblin": + token = new GoblinToken(); + break; + default: + token = new SaprolingToken(); + break; } token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); return true; diff --git a/Mage.Sets/src/mage/cards/s/SavageSummoning.java b/Mage.Sets/src/mage/cards/s/SavageSummoning.java index 645a1bf1bd..1633ecd3f6 100644 --- a/Mage.Sets/src/mage/cards/s/SavageSummoning.java +++ b/Mage.Sets/src/mage/cards/s/SavageSummoning.java @@ -182,7 +182,7 @@ class SavageSummoningWatcher extends Watcher { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && spell.getCardType().contains(CardType.CREATURE)) { spellsCastWithSavageSummoning.put(spell.getId(), new HashSet<>(savageSummoningSpells)); - String cardKey = new StringBuilder(spell.getCard().getId().toString()).append("_").append(spell.getCard().getZoneChangeCounter(game)).toString(); + String cardKey = new StringBuilder(spell.getCard().getId().toString()).append('_').append(spell.getCard().getZoneChangeCounter(game)).toString(); cardsCastWithSavageSummoning.put(cardKey, new HashSet<>(savageSummoningSpells)); savageSummoningSpells.clear(); } @@ -191,7 +191,7 @@ class SavageSummoningWatcher extends Watcher { } public void setSavageSummoningSpellActive(Card card, Game game) { - String cardKey = new StringBuilder(card.getId().toString()).append("_").append(card.getZoneChangeCounter(game)).toString(); + String cardKey = new StringBuilder(card.getId().toString()).append('_').append(card.getZoneChangeCounter(game)).toString(); savageSummoningSpells.add(cardKey); } @@ -200,15 +200,15 @@ class SavageSummoningWatcher extends Watcher { } public boolean isSpellCastWithThisSavageSummoning(UUID spellId, UUID cardId, int zoneChangeCounter) { - String cardKey = new StringBuilder(cardId.toString()).append("_").append(zoneChangeCounter).toString(); + String cardKey = new StringBuilder(cardId.toString()).append('_').append(zoneChangeCounter).toString(); HashSet savageSpells = (HashSet) spellsCastWithSavageSummoning.get(spellId); return savageSpells != null && savageSpells.contains(cardKey); } public boolean isCardCastWithThisSavageSummoning(Card card, UUID cardId, int zoneChangeCounter, Game game) { - String creatureCardKey = card.getId().toString() + "_" + (card.getZoneChangeCounter(game)); + String creatureCardKey = card.getId().toString() + '_' + (card.getZoneChangeCounter(game)); // add one because card is now gone to battlefield as creature - String cardKey = cardId.toString() + "_" + zoneChangeCounter; + String cardKey = cardId.toString() + '_' + zoneChangeCounter; HashSet savageSpells = (HashSet) cardsCastWithSavageSummoning.get(creatureCardKey); return savageSpells != null && savageSpells.contains(cardKey); } diff --git a/Mage.Sets/src/mage/cards/s/ScoutsWarning.java b/Mage.Sets/src/mage/cards/s/ScoutsWarning.java index 5eab7fabbf..bf81872687 100644 --- a/Mage.Sets/src/mage/cards/s/ScoutsWarning.java +++ b/Mage.Sets/src/mage/cards/s/ScoutsWarning.java @@ -152,12 +152,12 @@ class ScoutsWarningWatcher extends Watcher { } public void addScoutsWarningSpell(UUID sourceId, int zoneChangeCounter) { - String spellKey = new StringBuilder(sourceId.toString()).append("_").append(zoneChangeCounter).toString(); + String spellKey = new StringBuilder(sourceId.toString()).append('_').append(zoneChangeCounter).toString(); activeScoutsWarningSpells.add(spellKey); } public boolean isScoutsWarningSpellActive(UUID sourceId, int zoneChangeCounter) { - String spellKey = new StringBuilder(sourceId.toString()).append("_").append(zoneChangeCounter).toString(); + String spellKey = new StringBuilder(sourceId.toString()).append('_').append(zoneChangeCounter).toString(); return activeScoutsWarningSpells.contains(spellKey); } diff --git a/Mage.Sets/src/mage/cards/s/SealOfTheGuildpact.java b/Mage.Sets/src/mage/cards/s/SealOfTheGuildpact.java index 3c06e7928e..e9e815b992 100644 --- a/Mage.Sets/src/mage/cards/s/SealOfTheGuildpact.java +++ b/Mage.Sets/src/mage/cards/s/SealOfTheGuildpact.java @@ -132,7 +132,7 @@ class SealOfTheGuildpactChooseColorEffect extends OneShotEffect { } String color2 = choice2.getChoice(); if (!game.isSimulation()) { - game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + color1 + " and " + color2 + "."); + game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + color1 + " and " + color2 + '.'); } game.getState().setValue(mageObject.getId() + "_color1", choice1.getColor()); game.getState().setValue(mageObject.getId() + "_color2", choice2.getColor()); diff --git a/Mage.Sets/src/mage/cards/s/SenTriplets.java b/Mage.Sets/src/mage/cards/s/SenTriplets.java index 4a260e2a05..715c6d9873 100644 --- a/Mage.Sets/src/mage/cards/s/SenTriplets.java +++ b/Mage.Sets/src/mage/cards/s/SenTriplets.java @@ -112,7 +112,7 @@ class SenTripletsRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl { MageObject mageObject = game.getObject(source.getSourceId()); if (targetPlayer != null && mageObject != null) { return "This turn you can't cast spells or activate abilities" + - " (" + mageObject.getLogName() + ")"; + " (" + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage.Sets/src/mage/cards/s/Shapeshifter.java b/Mage.Sets/src/mage/cards/s/Shapeshifter.java index b17dce99c4..4194f86be8 100644 --- a/Mage.Sets/src/mage/cards/s/Shapeshifter.java +++ b/Mage.Sets/src/mage/cards/s/Shapeshifter.java @@ -119,7 +119,7 @@ class ShapeshifterEffect extends OneShotEffect { return false; } } - game.informPlayers("Shapeshifter, chosen number: [" + numberChoice.getChoice() + "]"); + game.informPlayers("Shapeshifter, chosen number: [" + numberChoice.getChoice() + ']'); game.getState().setValue(source.getSourceId().toString() + "_Shapeshifter", numberChoice.getChoice()); if (mageObject instanceof Permanent) { ((Permanent) mageObject).addInfo("lastChosenNumber", CardUtil.addToolTipMarkTags("Last chosen number: " + numberChoice.getChoice()), game); diff --git a/Mage.Sets/src/mage/cards/s/SharedFate.java b/Mage.Sets/src/mage/cards/s/SharedFate.java index f3bb10985c..1d12d4d225 100644 --- a/Mage.Sets/src/mage/cards/s/SharedFate.java +++ b/Mage.Sets/src/mage/cards/s/SharedFate.java @@ -109,7 +109,7 @@ class SharedFateReplacementEffect extends ReplacementEffectImpl { game, false, CardUtil.getExileZoneId(source.getSourceId().toString() + sourcePermanent.getZoneChangeCounter(game) + playerToDraw.getId().toString(), game), - "Shared Fate (" + playerToDraw.getName() + ")"); + "Shared Fate (" + playerToDraw.getName() + ')'); card.setFaceDown(true, game); } } @@ -159,7 +159,7 @@ class SharedFatePlayEffect extends AsThoughEffectImpl { if (exileId != null) { ExileZone exileZone = game.getExile().getExileZone(exileId); if (exileZone != null && exileZone.contains(objectId)) { - if (player.chooseUse(outcome, "Play " + game.getCard(objectId).getIdName() + "?", source, game)) { + if (player.chooseUse(outcome, "Play " + game.getCard(objectId).getIdName() + '?', source, game)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SimicManipulator.java b/Mage.Sets/src/mage/cards/s/SimicManipulator.java index 79db02c1e2..28682aea6f 100644 --- a/Mage.Sets/src/mage/cards/s/SimicManipulator.java +++ b/Mage.Sets/src/mage/cards/s/SimicManipulator.java @@ -143,6 +143,6 @@ class SimicManipulatorGainControlTargetEffect extends ContinuousEffectImpl { @Override public String getText(Mode mode) { - return "Gain control of target " + mode.getTargets().get(0).getTargetName() + " " + duration.toString(); + return "Gain control of target " + mode.getTargets().get(0).getTargetName() + ' ' + duration.toString(); } } diff --git a/Mage.Sets/src/mage/cards/s/SoulFoundry.java b/Mage.Sets/src/mage/cards/s/SoulFoundry.java index 4d8651a89a..1b2c712dba 100644 --- a/Mage.Sets/src/mage/cards/s/SoulFoundry.java +++ b/Mage.Sets/src/mage/cards/s/SoulFoundry.java @@ -137,7 +137,7 @@ class SoulFoundryImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + "]"), game); + permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + ']'), game); } } } diff --git a/Mage.Sets/src/mage/cards/s/SparkOfCreativity.java b/Mage.Sets/src/mage/cards/s/SparkOfCreativity.java index 9c4acfb0be..1db8aab6db 100644 --- a/Mage.Sets/src/mage/cards/s/SparkOfCreativity.java +++ b/Mage.Sets/src/mage/cards/s/SparkOfCreativity.java @@ -98,7 +98,7 @@ class SparkOfCreativityEffect extends OneShotEffect { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { int cmc = card.getManaCost().convertedManaCost(); - if (controller.chooseUse(outcome, "Let " + sourceObject.getLogName() + " deal " + cmc + " damage to " + targetCreature.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Let " + sourceObject.getLogName() + " deal " + cmc + " damage to " + targetCreature.getLogName() + '?', source, game)) { targetCreature.damage(cmc, source.getSourceId(), game, false, true); return true; } diff --git a/Mage.Sets/src/mage/cards/s/Spellbinder.java b/Mage.Sets/src/mage/cards/s/Spellbinder.java index 1012fc39c7..482c7e4d19 100644 --- a/Mage.Sets/src/mage/cards/s/Spellbinder.java +++ b/Mage.Sets/src/mage/cards/s/Spellbinder.java @@ -147,7 +147,7 @@ class SpellbinderImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + "]"), game); + permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + ']'), game); } } } @@ -189,7 +189,7 @@ class SpellbinderCopyEffect extends OneShotEffect { if (spellbinder != null && spellbinder.getImprinted() != null && !spellbinder.getImprinted().isEmpty()) { Card imprintedInstant = game.getCard(spellbinder.getImprinted().get(0)); if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) { - if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append("?").toString(), source, game)) { + if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append('?').toString(), source, game)) { Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId()); if (copiedCard != null) { game.getExile().add(source.getSourceId(), "", copiedCard); diff --git a/Mage.Sets/src/mage/cards/s/SphereOfSafety.java b/Mage.Sets/src/mage/cards/s/SphereOfSafety.java index af97aa7eae..af2255a56f 100644 --- a/Mage.Sets/src/mage/cards/s/SphereOfSafety.java +++ b/Mage.Sets/src/mage/cards/s/SphereOfSafety.java @@ -81,7 +81,7 @@ class SphereOfSafetyPayManaToAttackAllEffect extends CantAttackYouUnlessPayManaA public ManaCosts getManaCostToPay(GameEvent event, Ability source, Game game) { int enchantments = game.getBattlefield().countAll(new FilterEnchantmentPermanent(), source.getControllerId(), game); if (enchantments > 0) { - return new ManaCostsImpl<>("{" + enchantments + "}"); + return new ManaCostsImpl<>("{" + enchantments + '}'); } return null; } diff --git a/Mage.Sets/src/mage/cards/s/SphinxAmbassador.java b/Mage.Sets/src/mage/cards/s/SphinxAmbassador.java index 1c2a4b062f..d2bd6f6fdd 100644 --- a/Mage.Sets/src/mage/cards/s/SphinxAmbassador.java +++ b/Mage.Sets/src/mage/cards/s/SphinxAmbassador.java @@ -121,7 +121,7 @@ class SphinxAmbassadorEffect extends OneShotEffect { } String cardName = cardChoice.getChoice(); - game.informPlayers(new StringBuilder(sourcePermanent.getName()).append(", named card: [").append(cardName).append("]").toString()); + game.informPlayers(new StringBuilder(sourcePermanent.getName()).append(", named card: [").append(cardName).append(']').toString()); if (!card.getName().equals(cardName) && card.getCardType().contains(CardType.CREATURE)) { if (controller.chooseUse(outcome, new StringBuilder("Put ").append(card.getName()).append(" onto the battlefield?").toString(), source, game)) { controller.moveCards(card, Zone.BATTLEFIELD, source, game); diff --git a/Mage.Sets/src/mage/cards/s/SphinxOfUthuun.java b/Mage.Sets/src/mage/cards/s/SphinxOfUthuun.java index 3731a6102f..15dbf48a6a 100644 --- a/Mage.Sets/src/mage/cards/s/SphinxOfUthuun.java +++ b/Mage.Sets/src/mage/cards/s/SphinxOfUthuun.java @@ -162,13 +162,13 @@ class SphinxOfUthuunEffect extends OneShotEffect { } game.informPlayers(sb.toString()); - sb = new StringBuilder(sourceObject.getLogName()).append(": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (":"); + sb = new StringBuilder(sourceObject.getLogName()).append(": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (':'); i = 0; for (UUID cardUuid : pile2CardsIds) { Card card = game.getCard(cardUuid); if (card != null) { i++; - sb.append(" ").append(card.getName()); + sb.append(' ').append(card.getName()); if (i < pile2CardsIds.size()) { sb.append(", "); } diff --git a/Mage.Sets/src/mage/cards/s/SqueesRevenge.java b/Mage.Sets/src/mage/cards/s/SqueesRevenge.java index e7d050422c..b360c55ac5 100644 --- a/Mage.Sets/src/mage/cards/s/SqueesRevenge.java +++ b/Mage.Sets/src/mage/cards/s/SqueesRevenge.java @@ -80,7 +80,7 @@ class SqueesRevengeEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if(player != null) { int number = player.announceXMana(0, Integer.MAX_VALUE, "Choose how many times to flip a coin", game, source); - game.informPlayers(player.getLogName() + " chooses " + number + "."); + game.informPlayers(player.getLogName() + " chooses " + number + '.'); for(int i = 0; i < number; i++) { if(!player.flipCoin(game)) { return true; diff --git a/Mage.Sets/src/mage/cards/s/SteamAugury.java b/Mage.Sets/src/mage/cards/s/SteamAugury.java index e6287d3ac4..7644421780 100644 --- a/Mage.Sets/src/mage/cards/s/SteamAugury.java +++ b/Mage.Sets/src/mage/cards/s/SteamAugury.java @@ -161,13 +161,13 @@ class SteamAuguryEffect extends OneShotEffect { } game.informPlayers(sb.toString()); - sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(":"); + sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(':'); i = 0; for (UUID cardUuid : pile2CardsIds) { Card card = game.getCard(cardUuid); if (card != null) { i++; - sb.append(" ").append(GameLog.getColoredObjectName(card)); + sb.append(' ').append(GameLog.getColoredObjectName(card)); if (i < pile2CardsIds.size()) { sb.append(", "); } diff --git a/Mage.Sets/src/mage/cards/s/StonewiseFortifier.java b/Mage.Sets/src/mage/cards/s/StonewiseFortifier.java index 2f8726a477..772587ec89 100644 --- a/Mage.Sets/src/mage/cards/s/StonewiseFortifier.java +++ b/Mage.Sets/src/mage/cards/s/StonewiseFortifier.java @@ -104,7 +104,7 @@ class StonewiseFortifierPreventAllDamageToEffect extends PreventionEffectImpl { if (damageSource != null && preventionSource != null) { StringBuilder message = new StringBuilder(preventedDamage).append(" damage from "); message.append(damageSource.getName()).append(" prevented "); - message.append("(").append(preventionSource).append(")"); + message.append('(').append(preventionSource).append(')'); game.informPlayers(message.toString()); } event.setAmount(0); diff --git a/Mage.Sets/src/mage/cards/s/StrongholdGambit.java b/Mage.Sets/src/mage/cards/s/StrongholdGambit.java index 0d4c93bd21..f1b9620544 100644 --- a/Mage.Sets/src/mage/cards/s/StrongholdGambit.java +++ b/Mage.Sets/src/mage/cards/s/StrongholdGambit.java @@ -106,7 +106,7 @@ class StrongholdGambitEffect extends OneShotEffect { Card card = game.getCard(choosenCard.get(playerId)); if (card != null) { Cards cardsToReveal = new CardsImpl(card); - player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", cardsToReveal, game); + player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', cardsToReveal, game); if (card.getCardType().contains(CardType.CREATURE) && lowestCMC > card.getConvertedManaCost()) { lowestCMC = card.getConvertedManaCost(); diff --git a/Mage.Sets/src/mage/cards/t/TemporalExtortion.java b/Mage.Sets/src/mage/cards/t/TemporalExtortion.java index ee47429139..832f9a188d 100644 --- a/Mage.Sets/src/mage/cards/t/TemporalExtortion.java +++ b/Mage.Sets/src/mage/cards/t/TemporalExtortion.java @@ -89,10 +89,10 @@ class TemporalExtortionCounterSourceEffect extends OneShotEffect { if (sourceObject != null) { for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) { Player player = game.getPlayer(playerId); - if (player.chooseUse(outcome, "Pay half your life, rounded up to counter " + sourceObject.getIdName() + "?", source, game)) { + if (player.chooseUse(outcome, "Pay half your life, rounded up to counter " + sourceObject.getIdName() + '?', source, game)) { Integer amount = (int) Math.ceil(player.getLife() / 2f); player.loseLife(amount, game, false); - game.informPlayers(player.getLogName() + " pays half his or her life, rounded up to counter " + sourceObject.getIdName() + "."); + game.informPlayers(player.getLogName() + " pays half his or her life, rounded up to counter " + sourceObject.getIdName() + '.'); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { game.getStack().counter(spell.getId(), source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/t/TheTabernacleAtPendrellVale.java b/Mage.Sets/src/mage/cards/t/TheTabernacleAtPendrellVale.java index 2efb2539a5..07dd69ea82 100644 --- a/Mage.Sets/src/mage/cards/t/TheTabernacleAtPendrellVale.java +++ b/Mage.Sets/src/mage/cards/t/TheTabernacleAtPendrellVale.java @@ -89,7 +89,7 @@ class DestroySourceUnlessPaysEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { - if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "?", source, game)) { + if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; diff --git a/Mage.Sets/src/mage/cards/t/ThoughtPrison.java b/Mage.Sets/src/mage/cards/t/ThoughtPrison.java index 085d39a818..606a57c384 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtPrison.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtPrison.java @@ -120,7 +120,7 @@ class ThoughtPrisonImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", new StringBuilder("[Exiled card - ").append(card.getName()).append("]").toString(), game); + permanent.addInfo("imprint", new StringBuilder("[Exiled card - ").append(card.getName()).append(']').toString(), game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TimeVault.java b/Mage.Sets/src/mage/cards/t/TimeVault.java index d118f7be6a..29b20b4893 100644 --- a/Mage.Sets/src/mage/cards/t/TimeVault.java +++ b/Mage.Sets/src/mage/cards/t/TimeVault.java @@ -118,7 +118,7 @@ class TimeVaultReplacementEffect extends ReplacementEffectImpl { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { - if (player.chooseUse(Outcome.Untap, "Skip your turn to untap " + permanent.getName() + "?", source, game)) { + if (player.chooseUse(Outcome.Untap, "Skip your turn to untap " + permanent.getName() + '?', source, game)) { permanent.untap(game); game.informPlayers(player.getLogName() + " skips his or her turn to untap " + permanent.getLogName()); return true; diff --git a/Mage.Sets/src/mage/cards/t/ToilsOfNightAndDay.java b/Mage.Sets/src/mage/cards/t/ToilsOfNightAndDay.java index bf645b6178..5ce5b0c0a0 100644 --- a/Mage.Sets/src/mage/cards/t/ToilsOfNightAndDay.java +++ b/Mage.Sets/src/mage/cards/t/ToilsOfNightAndDay.java @@ -89,9 +89,9 @@ public class ToilsOfNightAndDay extends CardImpl { for (UUID targetId : source.getTargets().get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - if (player.chooseUse(Outcome.Tap, new StringBuilder("Tap ").append(permanent.getName()).append("?").toString(), source, game)) { + if (player.chooseUse(Outcome.Tap, new StringBuilder("Tap ").append(permanent.getName()).append('?').toString(), source, game)) { permanent.tap(game); - } else if (player.chooseUse(Outcome.Untap, new StringBuilder("Untap ").append(permanent.getName()).append("?").toString(), source, game)) { + } else if (player.chooseUse(Outcome.Untap, new StringBuilder("Untap ").append(permanent.getName()).append('?').toString(), source, game)) { permanent.untap(game); } } diff --git a/Mage.Sets/src/mage/cards/t/TorrentialGearhulk.java b/Mage.Sets/src/mage/cards/t/TorrentialGearhulk.java index 39ebe3e996..0f5bcee906 100644 --- a/Mage.Sets/src/mage/cards/t/TorrentialGearhulk.java +++ b/Mage.Sets/src/mage/cards/t/TorrentialGearhulk.java @@ -112,7 +112,7 @@ class TorrentialGearhulkEffect extends OneShotEffect { if (controller != null) { Card card = game.getCard(this.getTargetPointer().getFirst(game, source)); if (card != null) { - if (controller.chooseUse(outcome, "Cast " + card.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Cast " + card.getLogName() + '?', source, game)) { if (controller.cast(card.getSpellAbility(), game, true)) { ContinuousEffect effect = new TorrentialGearhulkReplacementEffect(card.getId()); effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId()))); diff --git a/Mage.Sets/src/mage/cards/w/WarCadence.java b/Mage.Sets/src/mage/cards/w/WarCadence.java index 76dd94dfbb..2a5f38d0f3 100644 --- a/Mage.Sets/src/mage/cards/w/WarCadence.java +++ b/Mage.Sets/src/mage/cards/w/WarCadence.java @@ -87,7 +87,7 @@ class WarCadenceReplacementEffect extends ReplacementEffectImpl { if (player != null) { int amount = xCosts.calculate(game, source, this); if (amount > 0) { - String mana = "{" + amount + "}"; + String mana = "{" + amount + '}'; ManaCostsImpl cost = new ManaCostsImpl(mana); if (cost.canPay(source, source.getSourceId(), event.getPlayerId(), game) && player.chooseUse(Outcome.Benefit, "Pay " + mana + " to declare blocker?", source, game)) { diff --git a/Mage.Sets/src/mage/cards/w/WarTax.java b/Mage.Sets/src/mage/cards/w/WarTax.java index 2beac05396..5cae163e64 100644 --- a/Mage.Sets/src/mage/cards/w/WarTax.java +++ b/Mage.Sets/src/mage/cards/w/WarTax.java @@ -87,7 +87,7 @@ class WarTaxReplacementEffect extends ReplacementEffectImpl { if (player != null) { int amount = xCosts.calculate(game, source, this); if (amount > 0) { - String mana = "{" + amount + "}"; + String mana = "{" + amount + '}'; ManaCostsImpl cost = new ManaCostsImpl(mana); if (cost.canPay(source, source.getSourceId(), event.getPlayerId(), game) && player.chooseUse(Outcome.Benefit, "Pay " + mana + " to declare attacker?", source, game)) { diff --git a/Mage.Sets/src/mage/cards/w/WarpWorld.java b/Mage.Sets/src/mage/cards/w/WarpWorld.java index 2608475d80..b74b899fa9 100644 --- a/Mage.Sets/src/mage/cards/w/WarpWorld.java +++ b/Mage.Sets/src/mage/cards/w/WarpWorld.java @@ -132,7 +132,7 @@ class WarpWorldEffect extends OneShotEffect { if (player != null) { CardsImpl cards = new CardsImpl(); cards.addAll(player.getLibrary().getTopCards(game, permanentsCount.get(player.getId()))); - player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", cards, game); + player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', cards, game); cardsRevealed.put(player.getId(), cards); } } diff --git a/Mage.Sets/src/mage/cards/w/WeirdHarvest.java b/Mage.Sets/src/mage/cards/w/WeirdHarvest.java index c6ffb034ee..96091a99d6 100644 --- a/Mage.Sets/src/mage/cards/w/WeirdHarvest.java +++ b/Mage.Sets/src/mage/cards/w/WeirdHarvest.java @@ -118,7 +118,7 @@ class WeirdHarvestEffect extends OneShotEffect { if (target.getTargets().size() > 0) { Cards cards = new CardsImpl(target.getTargets()); player.moveCards(cards, Zone.HAND, source, game); - player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", cards, game); + player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', cards, game); } } } diff --git a/Mage.Sets/src/mage/cards/w/WellOfLostDreams.java b/Mage.Sets/src/mage/cards/w/WellOfLostDreams.java index 81a4686a1e..9eb26ebc9c 100644 --- a/Mage.Sets/src/mage/cards/w/WellOfLostDreams.java +++ b/Mage.Sets/src/mage/cards/w/WellOfLostDreams.java @@ -87,7 +87,7 @@ class WellOfLostDreamsEffect extends OneShotEffect { int xValue = controller.announceXMana(0, amount, "Announce X Value", game, source); if (xValue > 0) { if (new GenericManaCost(xValue).pay(source, game, source.getSourceId(), controller.getId(), false)) { - game.informPlayers(new StringBuilder(controller.getLogName()).append(" payed {").append(xValue).append("}").toString()); + game.informPlayers(new StringBuilder(controller.getLogName()).append(" payed {").append(xValue).append('}').toString()); controller.drawCards(xValue, game); } else { return false; diff --git a/Mage.Sets/src/mage/cards/w/WhimsOfTheFates.java b/Mage.Sets/src/mage/cards/w/WhimsOfTheFates.java index 30f70be1ad..327b53cef5 100644 --- a/Mage.Sets/src/mage/cards/w/WhimsOfTheFates.java +++ b/Mage.Sets/src/mage/cards/w/WhimsOfTheFates.java @@ -143,7 +143,7 @@ class WhimsOfTheFateEffect extends OneShotEffect { for (UUID permanentId : target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - message.append(permanent.getName()).append(" "); + message.append(permanent.getName()).append(' '); } } } @@ -156,7 +156,7 @@ class WhimsOfTheFateEffect extends OneShotEffect { for (Permanent permanent : game.getState().getBattlefield().getAllActivePermanents(currentPlayer.getId())) { if (!playerPiles.get(1).contains(permanent.getId()) && !playerPiles.get(2).contains(permanent.getId())) { playerPiles.get(3).add(permanent.getId()); - message.append(permanent.getName()).append(" "); + message.append(permanent.getName()).append(' '); } } if (playerPiles.get(3).isEmpty()) { diff --git a/Mage.Sets/src/mage/cards/w/WoodSage.java b/Mage.Sets/src/mage/cards/w/WoodSage.java index 1838a6a47d..c562393390 100644 --- a/Mage.Sets/src/mage/cards/w/WoodSage.java +++ b/Mage.Sets/src/mage/cards/w/WoodSage.java @@ -107,7 +107,7 @@ class WoodSageEffect extends OneShotEffect { } String cardName = cardChoice.getChoice(); if (!game.isSimulation()) { - game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + "]"); + game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + ']'); } FilterCreatureCard filter = new FilterCreatureCard("all of them with that name"); diff --git a/Mage.Sets/src/mage/cards/z/ZursWeirding.java b/Mage.Sets/src/mage/cards/z/ZursWeirding.java index b50b3f5b6e..4026213b23 100644 --- a/Mage.Sets/src/mage/cards/z/ZursWeirding.java +++ b/Mage.Sets/src/mage/cards/z/ZursWeirding.java @@ -101,7 +101,7 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl { Card card = player.getLibrary().getFromTop(game); if (card != null) { // reveals it instead - player.revealCards(sourceObject.getIdName() + " next draw of " + player.getName() + " (" + game.getTurnNum() + "|" + game.getPhase().getType() + ")", new CardsImpl(card), game); + player.revealCards(sourceObject.getIdName() + " next draw of " + player.getName() + " (" + game.getTurnNum() + '|' + game.getPhase().getType() + ')', new CardsImpl(card), game); // Then any other player may pay 2 life. If a player does, put that card into its owner's graveyard String message = "Pay 2 life to put " + card.getLogName() + " into graveyard?"; diff --git a/Mage.Stats/src/main/java/com/xmage/ws/util/json/JSONParser.java b/Mage.Stats/src/main/java/com/xmage/ws/util/json/JSONParser.java index 62e000d45c..3654f32585 100644 --- a/Mage.Stats/src/main/java/com/xmage/ws/util/json/JSONParser.java +++ b/Mage.Stats/src/main/java/com/xmage/ws/util/json/JSONParser.java @@ -97,9 +97,9 @@ public class JSONParser { json = (JSONObject) jsonArray.get(index); jsonArray = null; } else if (param.contains("[")) { - int find = param.indexOf("["); + int find = param.indexOf('['); String newParam = param.substring(0, find); - String s = param.substring(find+1, param.indexOf("]")); + String s = param.substring(find+1, param.indexOf(']')); if (s.isEmpty()) { jsonArray = (JSONArray) json.get(newParam); json = null; diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/cost/modification/BattlefieldThaumaturgeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/cost/modification/BattlefieldThaumaturgeTest.java index a779b7e5ee..9b446aee8c 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/cost/modification/BattlefieldThaumaturgeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/cost/modification/BattlefieldThaumaturgeTest.java @@ -201,7 +201,7 @@ public class BattlefieldThaumaturgeTest extends CardTestPlayerBase { * For each creature destroyed this way, its controller puts a 4/4 red Dragon creature token with flying onto the battlefield. * Battlefield Thaumaturge should reduce the cost of the spell when cast, before he is destroyed and replaced with a dragon. */ - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Descent of the Dragons", createTargetingString(playerACreatures) + "^" + createTargetingString(playerBCreatures)); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Descent of the Dragons", createTargetingString(playerACreatures) + '^' + createTargetingString(playerBCreatures)); setStopAt(1, PhaseStep.END_TURN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java index b611c66f88..821954e2d9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java @@ -200,7 +200,7 @@ public class RandomPlayer extends ComputerPlayer { 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') { diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index e86fc59995..5d98013248 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -491,7 +491,7 @@ public class TestPlayer implements Player { if (numberOfActions == actions.size()) { foundNoAction++; if (foundNoAction > maxCallsWithoutAction) { - throw new AssertionError("More priority calls to " + getName() + " and doing no action than allowed (" + maxCallsWithoutAction + ")"); + throw new AssertionError("More priority calls to " + getName() + " and doing no action than allowed (" + maxCallsWithoutAction + ')'); } } else { foundNoAction = 0; @@ -671,7 +671,7 @@ public class TestPlayer implements Player { break; } } - } else if ((permanent.getName() + "-" + permanent.getExpansionSetCode()).equals(targetName)) { + } else if ((permanent.getName() + '-' + permanent.getExpansionSetCode()).equals(targetName)) { if (target.isNotTarget() || ((TargetPermanent) target).canTarget(computerPlayer.getId(), permanent.getId(), source, game)) { if ((permanent.isCopy() && !originOnly) || (!permanent.isCopy() && !copyOnly)) { target.add(permanent.getId(), game); @@ -816,7 +816,7 @@ public class TestPlayer implements Player { filter = ((FilterCreatureOrPlayer) filter).getCreatureFilter(); } for (Permanent permanent : game.getBattlefield().getAllActivePermanents((FilterPermanent) filter, game)) { - if (permanent.getName().equals(targetName) || (permanent.getName() + "-" + permanent.getExpansionSetCode()).equals(targetName)) { + if (permanent.getName().equals(targetName) || (permanent.getName() + '-' + permanent.getExpansionSetCode()).equals(targetName)) { if (target.canTarget(abilityControllerId, permanent.getId(), source, game) && !target.getTargets().contains(permanent.getId())) { if ((permanent.isCopy() && !originOnly) || (!permanent.isCopy() && !copyOnly)) { target.add(permanent.getId(), game); @@ -841,7 +841,7 @@ public class TestPlayer implements Player { boolean targetFound = false; for (String targetName : targetList) { for (Card card : computerPlayer.getHand().getCards(((TargetCardInHand) target).getFilter(), game)) { - if (card.getName().equals(targetName) || (card.getName() + "-" + card.getExpansionSetCode()).equals(targetName)) { + if (card.getName().equals(targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { if (((TargetCardInHand) target).canTarget(abilityControllerId, card.getId(), source, game) && !target.getTargets().contains(card.getId())) { target.add(card.getId(), game); targetFound = true; @@ -863,7 +863,7 @@ public class TestPlayer implements Player { boolean targetFound = false; for (String targetName : targetList) { for (Card card : computerPlayer.getGraveyard().getCards(((TargetCardInYourGraveyard) target).getFilter(), game)) { - if (card.getName().equals(targetName) || (card.getName() + "-" + card.getExpansionSetCode()).equals(targetName)) { + if (card.getName().equals(targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { if (((TargetCardInYourGraveyard) target).canTarget(abilityControllerId, card.getId(), source, game) && !target.getTargets().contains(card.getId())) { target.add(card.getId(), game); targetFound = true; @@ -890,7 +890,7 @@ public class TestPlayer implements Player { if (computerPlayer.hasOpponent(opponentId, game)) { Player opponent = game.getPlayer(opponentId); for (Card card : opponent.getGraveyard().getCards(((TargetCardInOpponentsGraveyard) target).getFilter(), game)) { - if (card.getName().equals(targetName) || (card.getName() + "-" + card.getExpansionSetCode()).equals(targetName)) { + if (card.getName().equals(targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { if (((TargetCardInOpponentsGraveyard) target).canTarget(abilityControllerId, card.getId(), source, game) && !target.getTargets().contains(card.getId())) { target.add(card.getId(), game); targetFound = true; diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java index 0db848daf4..84fb5ef357 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java @@ -120,7 +120,7 @@ public abstract class MageTestBase { private static Class loadPlugin(Plugin plugin) { try { - classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); + classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL()); logger.info("Loading plugin: " + plugin.getClassName()); return Class.forName(plugin.getClassName(), true, classLoader); } catch (ClassNotFoundException ex) { @@ -133,7 +133,7 @@ public abstract class MageTestBase { private static MatchType loadGameType(GamePlugin plugin) { try { - classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); + classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL()); logger.info("Loading game type: " + plugin.getClassName()); return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance(); } catch (ClassNotFoundException ex) { @@ -146,7 +146,7 @@ public abstract class MageTestBase { private static TournamentType loadTournamentType(GamePlugin plugin) { try { - classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); + classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL()); logger.info("Loading tournament type: " + plugin.getClassName()); return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance(); } catch (ClassNotFoundException ex) { diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java index 9cdd524421..265495fbe9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java @@ -106,7 +106,7 @@ public abstract class MageTestPlayerBase { private static Class loadPlugin(Plugin plugin) { try { - classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); + classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL()); logger.info("Loading plugin: " + plugin.getClassName()); return Class.forName(plugin.getClassName(), true, classLoader); } catch (ClassNotFoundException ex) { @@ -119,7 +119,7 @@ public abstract class MageTestPlayerBase { private static MatchType loadGameType(GamePlugin plugin) { try { - classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); + classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL()); logger.info("Loading game type: " + plugin.getClassName()); return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance(); } catch (ClassNotFoundException ex) { @@ -132,7 +132,7 @@ public abstract class MageTestPlayerBase { private static TournamentType loadTournamentType(GamePlugin plugin) { try { - classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); + classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL()); logger.info("Loading tournament type: " + plugin.getClassName()); return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance(); } catch (ClassNotFoundException ex) { diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java index ed59291a0b..8825bc72b7 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java @@ -290,9 +290,9 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP if (permanent.getName().equals(cardName)) { count++; if (scope.equals(Filter.ComparisonScope.All)) { - Assert.assertEquals("Power is not the same (" + power + " vs. " + permanent.getPower().getValue() + ")", + Assert.assertEquals("Power is not the same (" + power + " vs. " + permanent.getPower().getValue() + ')', power, permanent.getPower().getValue()); - Assert.assertEquals("Toughness is not the same (" + toughness + " vs. " + permanent.getToughness().getValue() + ")", + Assert.assertEquals("Toughness is not the same (" + toughness + " vs. " + permanent.getToughness().getValue() + ')', toughness, permanent.getToughness().getValue()); } else if (scope.equals(Filter.ComparisonScope.Any)) { if (power == permanent.getPower().getValue() && toughness == permanent.getToughness().getValue()) { @@ -372,7 +372,7 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP } } } - Assert.assertEquals("(Battlefield) Card counts are not equal (" + cardName + ")", count, actualCount); + Assert.assertEquals("(Battlefield) Card counts are not equal (" + cardName + ')', count, actualCount); } public Permanent getPermanent(String cardName, UUID controller) { @@ -387,7 +387,7 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP } } Assert.assertNotNull("Couldn't find a card with specified name: " + cardName, permanent0); - Assert.assertEquals("More than one permanent was found: " + cardName + "(" + count + ")", 1, count); + Assert.assertEquals("More than one permanent was found: " + cardName + '(' + count + ')', 1, count); return permanent0; } diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index c2b6e993c4..9aa176560d 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -446,9 +446,9 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement if (permanent.getName().equals(cardName) && permanent.getControllerId().equals(player.getId())) { count++; if (scope.equals(Filter.ComparisonScope.All)) { - Assert.assertEquals("Power is not the same (" + power + " vs. " + permanent.getPower().getValue() + ")", + Assert.assertEquals("Power is not the same (" + power + " vs. " + permanent.getPower().getValue() + ')', power, permanent.getPower().getValue()); - Assert.assertEquals("Toughness is not the same (" + toughness + " vs. " + permanent.getToughness().getValue() + ")", + Assert.assertEquals("Toughness is not the same (" + toughness + " vs. " + permanent.getToughness().getValue() + ')', toughness, permanent.getToughness().getValue()); } else if (scope.equals(Filter.ComparisonScope.Any)) { if (power == permanent.getPower().getValue() && toughness == permanent.getToughness().getValue()) { @@ -466,8 +466,8 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement + ", cardName=" + cardName, count > 0); if (scope.equals(Filter.ComparisonScope.Any)) { - Assert.assertTrue("There is no such creature under player's control with specified p/t of " + power + "/" + toughness + ", player=" + player.getName() - + ", cardName=" + cardName + " (found similar: " + found + ", one of them: power=" + foundPower + " toughness=" + foundToughness + ")", fit > 0); + Assert.assertTrue("There is no such creature under player's control with specified p/t of " + power + '/' + toughness + ", player=" + player.getName() + + ", cardName=" + cardName + " (found similar: " + found + ", one of them: power=" + foundPower + " toughness=" + foundToughness + ')', fit > 0); } } @@ -584,7 +584,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } } - Assert.assertEquals("(Battlefield) Permanents counts for " + player.getName() + " are not equal (" + cardName + ")", count, actualCount); + Assert.assertEquals("(Battlefield) Permanents counts for " + player.getName() + " are not equal (" + cardName + ')', count, actualCount); } @Override @@ -595,7 +595,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement actualCount++; } } - Assert.assertEquals("(Command Zone) Card counts are not equal (" + commandZoneObjectName + ")", count, actualCount); + Assert.assertEquals("(Command Zone) Card counts are not equal (" + commandZoneObjectName + ')', count, actualCount); } /** @@ -636,7 +636,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } Assert.assertNotNull("There is no such permanent " + (player == null ? "" : "for player " + player.getName()) + " on the battlefield, cardName=" + cardName, found); - Assert.assertEquals("(Battlefield) Counter counts are not equal (" + cardName + ":" + type + ")", count, found.getCounters(currentGame).getCount(type)); + Assert.assertEquals("(Battlefield) Counter counts are not equal (" + cardName + ':' + type + ')', count, found.getCounters(currentGame).getCount(type)); } /** @@ -659,7 +659,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } Assert.assertNotNull("There is no such card in the exile, cardName=" + cardName, found); - Assert.assertEquals("(Exile) Counter counts are not equal (" + cardName + ":" + type + ")", count, found.getCounters(currentGame).getCount(type)); + Assert.assertEquals("(Exile) Counter counts are not equal (" + cardName + ':' + type + ')', count, found.getCounters(currentGame).getCount(type)); } /** @@ -670,7 +670,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement * @param count Expected count. */ public void assertCounterCount(Player player, CounterType type, int count) throws AssertionError { - Assert.assertEquals("(Battlefield) Counter counts are not equal (" + player.getName() + ":" + type + ")", count, player.getCounters().getCount(type)); + Assert.assertEquals("(Battlefield) Counter counts are not equal (" + player.getName() + ':' + type + ')', count, player.getCounters().getCount(type)); } /** @@ -691,7 +691,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found); - Assert.assertTrue("(Battlefield) card type not found (" + cardName + ":" + type + ")", (found.getCardType().contains(type) == flag)); + Assert.assertTrue("(Battlefield) card type not found (" + cardName + ':' + type + ')', (found.getCardType().contains(type) == flag)); } @@ -713,9 +713,9 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found); - Assert.assertTrue("(Battlefield) card type not found (" + cardName + ":" + type + ")", found.getCardType().contains(type)); + Assert.assertTrue("(Battlefield) card type not found (" + cardName + ':' + type + ')', found.getCardType().contains(type)); if (subType != null) { - Assert.assertTrue("(Battlefield) card sub-type not equal (" + cardName + ":" + subType + ")", found.getSubtype(currentGame).contains(subType)); + Assert.assertTrue("(Battlefield) card sub-type not equal (" + cardName + ':' + subType + ')', found.getSubtype(currentGame).contains(subType)); } } @@ -740,7 +740,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found); - Assert.assertEquals("(Battlefield) Tapped state is not equal (" + cardName + ")", tapped, found.isTapped()); + Assert.assertEquals("(Battlefield) Tapped state is not equal (" + cardName + ')', tapped, found.isTapped()); } /** @@ -781,7 +781,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found); - Assert.assertEquals("(Battlefield) Attacking state is not equal (" + cardName + ")", attacking, found.isAttacking()); + Assert.assertEquals("(Battlefield) Attacking state is not equal (" + cardName + ')', attacking, found.isAttacking()); } /** @@ -836,7 +836,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } - Assert.assertEquals("(Exile) Card counts are not equal (" + cardName + ")", count, actualCount); + Assert.assertEquals("(Exile) Card counts are not equal (" + cardName + ')', count, actualCount); } /** @@ -873,7 +873,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } - Assert.assertEquals("(Graveyard " + player.getName() + ") Card counts are not equal (" + cardName + ")", count, actualCount); + Assert.assertEquals("(Graveyard " + player.getName() + ") Card counts are not equal (" + cardName + ')', count, actualCount); } /** @@ -904,7 +904,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } - Assert.assertEquals("(Library " + player.getName() + ") Card counts are not equal (" + cardName + ")", count, actualCount); + Assert.assertEquals("(Library " + player.getName() + ") Card counts are not equal (" + cardName + ')', count, actualCount); } /** @@ -938,7 +938,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } Assert.assertNotNull("Couldn't find a card with specified name: " + cardName, permanent0); - Assert.assertEquals("More than one permanent was found: " + cardName + "(" + count + ")", 1, count); + Assert.assertEquals("More than one permanent was found: " + cardName + '(' + count + ')', 1, count); return permanent0; } @@ -1021,11 +1021,11 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName, String spellOnStack, StackClause clause) { if (StackClause.WHILE_ON_STACK.equals(clause)) { player.addAction(turnNum, step, "activate:Cast " + cardName - + "$" + (targetName != null && targetName.startsWith("target") ? targetName : "target=" + targetName) + + '$' + (targetName != null && targetName.startsWith("target") ? targetName : "target=" + targetName) + "$spellOnStack=" + spellOnStack); } else { player.addAction(turnNum, step, "activate:Cast " + cardName - + "$" + (targetName != null && targetName.startsWith("target") ? targetName : "target=" + targetName) + + '$' + (targetName != null && targetName.startsWith("target") ? targetName : "target=" + targetName) + "$!spellOnStack=" + spellOnStack); } } @@ -1077,13 +1077,13 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement sb.append("$target=").append(targetName); } if (spellOnStack != null && !spellOnStack.isEmpty()) { - sb.append("$").append(StackClause.WHILE_ON_STACK.equals(clause) ? "" : "!").append("spellOnStack=").append(spellOnStack); + sb.append('$').append(StackClause.WHILE_ON_STACK.equals(clause) ? "" : "!").append("spellOnStack=").append(spellOnStack); } player.addAction(turnNum, step, sb.toString()); } public void addCounters(int turnNum, PhaseStep step, TestPlayer player, String cardName, CounterType type, int count) { - player.addAction(turnNum, step, "addCounters:" + cardName + "$" + type.getName() + "$" + count); + player.addAction(turnNum, step, "addCounters:" + cardName + '$' + type.getName() + '$' + count); } public void attack(int turnNum, TestPlayer player, String attacker) { @@ -1099,7 +1099,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } public void block(int turnNum, TestPlayer player, String blocker, String attacker) { - player.addAction(turnNum, PhaseStep.DECLARE_BLOCKERS, "block:" + blocker + "$" + attacker); + player.addAction(turnNum, PhaseStep.DECLARE_BLOCKERS, "block:" + blocker + '$' + attacker); } /** diff --git a/Mage.Tests/src/test/java/org/mage/test/sets/BoosterGenerationTest.java b/Mage.Tests/src/test/java/org/mage/test/sets/BoosterGenerationTest.java index 5b3ce77e29..8dd6fa7187 100644 --- a/Mage.Tests/src/test/java/org/mage/test/sets/BoosterGenerationTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/sets/BoosterGenerationTest.java @@ -77,7 +77,7 @@ public class BoosterGenerationTest extends MageTestBase { sb.append(", "); } } - sb.append("] (").append(cards.size()).append(")"); + sb.append("] (").append(cards.size()).append(')'); return sb.toString(); } diff --git a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java index d2fd8a0d57..f4140b0703 100644 --- a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java +++ b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java @@ -194,7 +194,7 @@ public class VerifyCardDataTest { private void checkPT(Card card, JsonCard ref) { if (!eqPT(card.getPower().toString(), ref.power) || !eqPT(card.getToughness().toString(), ref.toughness)) { String pt = card.getPower() + "/" + card.getToughness(); - String expected = ref.power + "/" + ref.toughness; + String expected = ref.power + '/' + ref.toughness; fail(card, "pt", pt + " != " + expected); } } diff --git a/Mage/src/main/java/mage/MageObjectImpl.java b/Mage/src/main/java/mage/MageObjectImpl.java index 0e7df0a0e6..19f2ac9dcc 100644 --- a/Mage/src/main/java/mage/MageObjectImpl.java +++ b/Mage/src/main/java/mage/MageObjectImpl.java @@ -108,7 +108,7 @@ public abstract class MageObjectImpl implements MageObject { @Override public String getIdName() { - return getName() + " [" + getId().toString().substring(0, 3) + "]"; + return getName() + " [" + getId().toString().substring(0, 3) + ']'; } @Override diff --git a/Mage/src/main/java/mage/Mana.java b/Mage/src/main/java/mage/Mana.java index 329aba528c..7a7ff39d6b 100644 --- a/Mage/src/main/java/mage/Mana.java +++ b/Mage/src/main/java/mage/Mana.java @@ -443,7 +443,7 @@ public class Mana implements Comparable, Serializable, Copyable { public String toString() { StringBuilder sbMana = new StringBuilder(); if (generic > 0) { - sbMana.append("{").append(Integer.toString(generic)).append("}"); + sbMana.append('{').append(Integer.toString(generic)).append('}'); } for (int i = 0; i < colorless; i++) { sbMana.append("{C}"); diff --git a/Mage/src/main/java/mage/ObjectColor.java b/Mage/src/main/java/mage/ObjectColor.java index c151245260..fe73f3d829 100644 --- a/Mage/src/main/java/mage/ObjectColor.java +++ b/Mage/src/main/java/mage/ObjectColor.java @@ -231,19 +231,19 @@ public class ObjectColor implements Serializable, Copyable, Compara public String toString() { StringBuilder sb = new StringBuilder(5); if (white) { - sb.append("W"); + sb.append('W'); } if (blue) { - sb.append("U"); + sb.append('U'); } if (black) { - sb.append("B"); + sb.append('B'); } if (red) { - sb.append("R"); + sb.append('R'); } if (green) { - sb.append("G"); + sb.append('G'); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index a259bee667..41e362a34c 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -345,7 +345,7 @@ public abstract class AbilityImpl implements Ability { for (Cost cost : optionalCosts) { if (cost instanceof ManaCost) { cost.clearPaid(); - if (controller.chooseUse(Outcome.Benefit, "Pay optional cost " + cost.getText() + "?", this, game)) { + if (controller.chooseUse(Outcome.Benefit, "Pay optional cost " + cost.getText() + '?', this, game)) { manaCostsToPay.add((ManaCost) cost); } } @@ -504,11 +504,11 @@ public abstract class AbilityImpl implements Ability { // set the xcosts to paid variableCost.setAmount(xValue); ((Cost) variableCost).setPaid(); - String message = controller.getLogName() + " announces a value of " + xValue + " (" + variableCost.getActionText() + ")"; + String message = controller.getLogName() + " announces a value of " + xValue + " (" + variableCost.getActionText() + ')'; if (announceString == null) { announceString = message; } else { - announceString = announceString + " " + message; + announceString = announceString + ' ' + message; } } } @@ -543,7 +543,7 @@ public abstract class AbilityImpl implements Ability { int amountMana = xValue * variableManaCost.getMultiplier(); StringBuilder manaString = threadLocalBuilder.get(); if (variableManaCost.getFilter() == null || variableManaCost.getFilter().isGeneric()) { - manaString.append("{").append(amountMana).append("}"); + manaString.append('{').append(amountMana).append('}'); } else { String manaSymbol = null; if (variableManaCost.getFilter().isBlack()) { @@ -561,7 +561,7 @@ public abstract class AbilityImpl implements Ability { throw new UnsupportedOperationException("ManaFilter is not supported: " + this.toString()); } for (int i = 0; i < amountMana; i++) { - manaString.append("{").append(manaSymbol).append("}"); + manaString.append('{').append(manaSymbol).append('}'); } } manaCostsToPay.add(new ManaCostsImpl(manaString.toString())); @@ -742,7 +742,7 @@ public abstract class AbilityImpl implements Ability { } if (costs.size() > 0) { if (sbRule.length() > 0) { - sbRule.append(","); + sbRule.append(','); } sbRule.append(costs.getText()); } @@ -1066,7 +1066,7 @@ public abstract class AbilityImpl implements Ability { for (Mode mode : spellModes.values()) { item++; if (mode.getId().equals(selectedMode.getId())) { - sb.append(" (mode ").append(item).append(")"); + sb.append(" (mode ").append(item).append(')'); sb.append(getTargetDescriptionForLog(selectedMode.getTargets(), game)); break; } diff --git a/Mage/src/main/java/mage/abilities/ActivationInfo.java b/Mage/src/main/java/mage/abilities/ActivationInfo.java index bf322f03af..016b76fe35 100644 --- a/Mage/src/main/java/mage/abilities/ActivationInfo.java +++ b/Mage/src/main/java/mage/abilities/ActivationInfo.java @@ -53,7 +53,7 @@ public class ActivationInfo { Integer activations = (Integer) game.getState().getValue(key); ActivationInfo activationInfo; if (activations != null) { - Integer turnNum = (Integer) game.getState().getValue(key + "T"); + Integer turnNum = (Integer) game.getState().getValue(key + 'T'); activationInfo = new ActivationInfo(game, turnNum, activations); } else { activationInfo = new ActivationInfo(game, game.getTurnNum(), 0); @@ -79,7 +79,7 @@ public class ActivationInfo { activationCounter++; } game.getState().setValue(key, activationCounter); - game.getState().setValue(key + "T", turnNum); + game.getState().setValue(key + 'T', turnNum); } public int getActivationCounter() { diff --git a/Mage/src/main/java/mage/abilities/abilityword/KinshipAbility.java b/Mage/src/main/java/mage/abilities/abilityword/KinshipAbility.java index 201b23fca8..cc5c531c57 100644 --- a/Mage/src/main/java/mage/abilities/abilityword/KinshipAbility.java +++ b/Mage/src/main/java/mage/abilities/abilityword/KinshipAbility.java @@ -127,7 +127,7 @@ class KinshipBaseEffect extends OneShotEffect { Cards cards = new CardsImpl(card); controller.lookAtCards(sourcePermanent.getName(), cards, game); if (CardUtil.shareSubtypes(sourcePermanent, card, game)) { - if (controller.chooseUse(outcome,new StringBuilder("Kinship - Reveal ").append(card.getLogName()).append("?").toString(), source, game)) { + if (controller.chooseUse(outcome,new StringBuilder("Kinship - Reveal ").append(card.getLogName()).append('?').toString(), source, game)) { controller.revealCards(sourcePermanent.getName(), cards, game); for (Effect effect: kinshipEffects) { effect.setTargetPointer(new FixedTarget(card.getId())); diff --git a/Mage/src/main/java/mage/abilities/common/ActivateIfConditionActivatedAbility.java b/Mage/src/main/java/mage/abilities/common/ActivateIfConditionActivatedAbility.java index 80b1ec132b..430d82f3e8 100644 --- a/Mage/src/main/java/mage/abilities/common/ActivateIfConditionActivatedAbility.java +++ b/Mage/src/main/java/mage/abilities/common/ActivateIfConditionActivatedAbility.java @@ -92,7 +92,7 @@ public class ActivateIfConditionActivatedAbility extends ActivatedAbilityImpl { !condition.toString().startsWith("before")) { sb.append("if "); } - sb.append(condition.toString()).append("."); + sb.append(condition.toString()).append('.'); } else { sb.append(" [Condition toSting() == null] "); } diff --git a/Mage/src/main/java/mage/abilities/common/ChancellorAbility.java b/Mage/src/main/java/mage/abilities/common/ChancellorAbility.java index 80e6c235b1..bfa5a4cd67 100644 --- a/Mage/src/main/java/mage/abilities/common/ChancellorAbility.java +++ b/Mage/src/main/java/mage/abilities/common/ChancellorAbility.java @@ -70,7 +70,7 @@ public class ChancellorAbility extends StaticAbility implements OpeningHandActio @Override public boolean askUseOpeningHandAction(Card card, Player player, Game game) { - return player.chooseUse(Outcome.PutCardInPlay, "Do you wish to reveal " + card.getIdName() + "?", this, game); + return player.chooseUse(Outcome.PutCardInPlay, "Do you wish to reveal " + card.getIdName() + '?', this, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/common/PutCardIntoGraveFromAnywhereAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/PutCardIntoGraveFromAnywhereAllTriggeredAbility.java index 0635847f29..048400d92d 100644 --- a/Mage/src/main/java/mage/abilities/common/PutCardIntoGraveFromAnywhereAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/PutCardIntoGraveFromAnywhereAllTriggeredAbility.java @@ -78,7 +78,7 @@ public class PutCardIntoGraveFromAnywhereAllTriggeredAbility extends TriggeredAb sb.append("your"); break; default: - sb.append("a"); + sb.append('a'); } sb.append(" graveyard, "); ruleText = sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/common/PutIntoGraveFromAnywhereSourceAbility.java b/Mage/src/main/java/mage/abilities/common/PutIntoGraveFromAnywhereSourceAbility.java index 4272b15086..4658bed21e 100644 --- a/Mage/src/main/java/mage/abilities/common/PutIntoGraveFromAnywhereSourceAbility.java +++ b/Mage/src/main/java/mage/abilities/common/PutIntoGraveFromAnywhereSourceAbility.java @@ -148,7 +148,7 @@ class PutIntoGraveFromAnywhereEffect extends ReplacementEffectImpl { if (controller == null || object == null) { return false; } - if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append("?").toString(), source, game)) { + if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append('?').toString(), source, game)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/common/delayed/PactDelayedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/delayed/PactDelayedTriggeredAbility.java index 5451a2fda6..363962126b 100644 --- a/Mage/src/main/java/mage/abilities/common/delayed/PactDelayedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/delayed/PactDelayedTriggeredAbility.java @@ -98,7 +98,7 @@ class PactEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "?", source, game)) { + if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)){ return true; diff --git a/Mage/src/main/java/mage/abilities/condition/common/CreatureCountCondition.java b/Mage/src/main/java/mage/abilities/condition/common/CreatureCountCondition.java index c4cfce4e97..89705f8e40 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/CreatureCountCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/CreatureCountCondition.java @@ -67,14 +67,14 @@ public class CreatureCountCondition implements Condition { case ANY: sb.append("if "); sb.append(creatureCount); - sb.append(" "); + sb.append(' '); sb.append(filter.getMessage()); sb.append(" are on the battlefield"); return sb.toString(); } sb.append(" control exactly "); sb.append(creatureCount); - sb.append(" "); + sb.append(' '); sb.append(filter.getMessage()); return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/costs/AlternativeCostSourceAbility.java b/Mage/src/main/java/mage/abilities/costs/AlternativeCostSourceAbility.java index 65e1d4fabe..b6937c67a3 100644 --- a/Mage/src/main/java/mage/abilities/costs/AlternativeCostSourceAbility.java +++ b/Mage/src/main/java/mage/abilities/costs/AlternativeCostSourceAbility.java @@ -160,7 +160,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter if (dynamicCost != null) { costChoiceText = dynamicCost.getText(ability, game); } else { - costChoiceText = alternativeCostsToCheck.isEmpty() ? "Cast without paying its mana cost?" : "Pay alternative costs? (" + alternativeCostsToCheck.getText() + ")"; + costChoiceText = alternativeCostsToCheck.isEmpty() ? "Cast without paying its mana cost?" : "Pay alternative costs? (" + alternativeCostsToCheck.getText() + ')'; } if (alternativeCostsToCheck.canPay(ability, ability.getSourceId(), ability.getControllerId(), game) @@ -263,9 +263,9 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter } else if (alternateCosts.isEmpty()) { sb.append("cast {this} without paying its mana cost"); } - sb.append("."); + sb.append('.'); if (numberCosts == 1 && remarkText != null) { - sb.append(" ").append(remarkText); + sb.append(' ').append(remarkText); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/costs/OrCost.java b/Mage/src/main/java/mage/abilities/costs/OrCost.java index a2bd70c0bb..0b921701c2 100644 --- a/Mage/src/main/java/mage/abilities/costs/OrCost.java +++ b/Mage/src/main/java/mage/abilities/costs/OrCost.java @@ -99,7 +99,7 @@ public class OrCost implements Cost { if (firstCost instanceof ManaCost) { sb.append("Pay "); } - sb.append(firstCost.getText()).append("?"); + sb.append(firstCost.getText()).append('?'); if (controller.chooseUse(Outcome.Detriment, sb.toString(), ability, game)) { selectedCost = firstCost; } else { diff --git a/Mage/src/main/java/mage/abilities/costs/common/DiscardXTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/DiscardXTargetCost.java index bd2fc1dd1b..51c084654b 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/DiscardXTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/DiscardXTargetCost.java @@ -52,7 +52,7 @@ public class DiscardXTargetCost extends VariableCostImpl { public DiscardXTargetCost(FilterCard filter, boolean additionalCostText) { super(new StringBuilder(filter.getMessage()).append(" to discard").toString()); this.text = new StringBuilder(additionalCostText ? "As an additional cost to cast {source}, discard ":"Discard ") - .append(xText).append(" ").append(filter.getMessage()).toString(); + .append(xText).append(' ').append(filter.getMessage()).toString(); this.filter = filter; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java index 6e267bcc56..c639e0dc70 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java @@ -59,7 +59,7 @@ public class ExileFromGraveCost extends CostImpl { + (target.getNumberOfTargets() == 1 && target.getMaxNumberOfTargets() == Integer.MAX_VALUE ? "one or more" : ((target.getNumberOfTargets() < target.getMaxNumberOfTargets() ? "up to " : "")) + CardUtil.numberToText(target.getMaxNumberOfTargets())) - + " " + target.getTargetName(); + + ' ' + target.getTargetName(); } else { this.text = "Exile " + target.getTargetName(); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileXFromYourGraveCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileXFromYourGraveCost.java index e3c070c1b7..317b5e45ac 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileXFromYourGraveCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileXFromYourGraveCost.java @@ -50,7 +50,7 @@ public class ExileXFromYourGraveCost extends VariableCostImpl { public ExileXFromYourGraveCost(FilterCard filter, boolean additionalCostText) { super(filter.getMessage() + " to exile"); this.filter = filter; - this.text = (additionalCostText ? "As an additional cost to cast {source}, exile " : "Exile ") + xText + " " + filter.getMessage(); + this.text = (additionalCostText ? "As an additional cost to cast {source}, exile " : "Exile ") + xText + ' ' + filter.getMessage(); } public ExileXFromYourGraveCost(final ExileXFromYourGraveCost cost) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java index 9944d89abc..64945cb846 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java @@ -47,7 +47,7 @@ public class PayLoyaltyCost extends CostImpl { this.amount = amount; this.text = Integer.toString(amount); if (amount >= 0) { - this.text = "+" + this.text; + this.text = '+' + this.text; } } diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayVariableLifeCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayVariableLifeCost.java index 5fb4cea23c..5577627230 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayVariableLifeCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayVariableLifeCost.java @@ -48,7 +48,7 @@ public class PayVariableLifeCost extends VariableCostImpl { public PayVariableLifeCost(boolean additionalCostText) { super("life to pay"); this.text = new StringBuilder(additionalCostText ? "As an additional cost to cast {source}, pay ":"Pay ") - .append(xText).append(" ").append("life").toString(); + .append(xText).append(' ').append("life").toString(); } public PayVariableLifeCost(final PayVariableLifeCost cost) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java index b5d98d44f1..336dddaabb 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java @@ -51,7 +51,7 @@ public class PutCountersSourceCost extends CostImpl { this.amount = counter.getCount(); this.name = counter.getName(); this.text = new StringBuilder("Put ").append((amount == 1 ? "a" : CardUtil.numberToText(amount))) - .append(" ").append(name).append(" counter").append((amount != 1 ? "s" : "")) + .append(' ').append(name).append(" counter").append((amount != 1 ? "s" : "")) .append(" on {this}").toString(); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java index 100beada6c..f24a5dbf47 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java @@ -133,7 +133,7 @@ public class RemoveCounterCost extends CostImpl { countersRemoved += numberOfCountersSelected; if (!game.isSimulation()) { game.informPlayers(new StringBuilder(controller.getLogName()) - .append(" removes ").append(numberOfCountersSelected == 1 ? "a" : numberOfCountersSelected).append(" ") + .append(" removes ").append(numberOfCountersSelected == 1 ? "a" : numberOfCountersSelected).append(' ') .append(counterName).append(numberOfCountersSelected == 1 ? " counter from " : " counters from ") .append(permanent.getName()).toString()); } @@ -158,7 +158,7 @@ public class RemoveCounterCost extends CostImpl { private String setText() { StringBuilder sb = new StringBuilder("Remove "); - sb.append(CardUtil.numberToText(countersToRemove, "a")).append(" "); + sb.append(CardUtil.numberToText(countersToRemove, "a")).append(' '); if (counterTypeToRemove != null) { sb.append(counterTypeToRemove.getName()); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java index 66b8f49efa..44677e4c90 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java @@ -50,7 +50,7 @@ public class RemoveCountersSourceCost extends CostImpl { this.amount = counter.getCount(); this.name = counter.getName(); this.text = new StringBuilder("Remove ").append((amount == 1 ? "a" : CardUtil.numberToText(amount))) - .append(" ").append(name).append(" counter").append((amount != 1 ? "s" : "")) + .append(' ').append(name).append(" counter").append((amount != 1 ? "s" : "")) .append(" from {this}").toString(); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java index bb5160b012..5bdc1966e9 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java @@ -58,7 +58,7 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl { } public RemoveVariableCountersTargetCost(FilterPermanent filter, CounterType counterTypeToRemove, String xText, int minValue) { - super(xText, new StringBuilder(counterTypeToRemove != null ? counterTypeToRemove.getName() + " ":"").append("counters to remove").toString()); + super(xText, new StringBuilder(counterTypeToRemove != null ? counterTypeToRemove.getName() + ' ' :"").append("counters to remove").toString()); this.filter = filter; this.counterTypeToRemove = counterTypeToRemove; this.text = setText(); @@ -79,7 +79,7 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl { private String setText() { StringBuilder sb = new StringBuilder("Remove ").append(xText); if (counterTypeToRemove != null) { - sb.append(" ").append(counterTypeToRemove.getName()); + sb.append(' ').append(counterTypeToRemove.getName()); } sb.append(" counters from among ").append(filter.getMessage()); return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java index a0144cb7ec..df84b8d1f4 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java @@ -52,7 +52,7 @@ public class ReturnToHandChosenControlledPermanentCost extends CostImpl { target.setNotTarget(true); this.addTarget(target); if (target.getMaxNumberOfTargets() > 1 && target.getMaxNumberOfTargets() == target.getNumberOfTargets()) { - this.text = "return " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + " " + target.getTargetName() + " you control to their owner's hand"; + this.text = "return " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + ' ' + target.getTargetName() + " you control to their owner's hand"; } else { this.text = "return " + target.getTargetName() + " you control to its owner's hand"; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java index 767d60cb32..e792c2d66f 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java @@ -49,7 +49,7 @@ public class ReturnToHandFromGraveyardCost extends CostImpl { public ReturnToHandFromGraveyardCost(TargetCardInYourGraveyard target) { this.addTarget(target); if (target.getMaxNumberOfTargets() > 1 && target.getMaxNumberOfTargets() == target.getNumberOfTargets()) { - this.text = new StringBuilder("return ").append(target.getMaxNumberOfTargets()).append(" ").append(target.getTargetName()).append(" from graveyard to it's owner's hand").toString(); + this.text = new StringBuilder("return ").append(target.getMaxNumberOfTargets()).append(' ').append(target.getTargetName()).append(" from graveyard to it's owner's hand").toString(); } else { this.text = new StringBuilder("return ").append(target.getTargetName()).append(" from graveyard to it's owner's hand").toString(); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/SacrificeXTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/SacrificeXTargetCost.java index 7a5a26312d..e83014b796 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/SacrificeXTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/SacrificeXTargetCost.java @@ -48,7 +48,7 @@ public class SacrificeXTargetCost extends VariableCostImpl { public SacrificeXTargetCost(FilterControlledPermanent filter, boolean additionalCostText) { super(filter.getMessage() + " to sacrifice"); - this.text = (additionalCostText ? "As an additional cost to cast {source}, sacrifice " : "Sacrifice ") + xText + " " + filter.getMessage(); + this.text = (additionalCostText ? "As an additional cost to cast {source}, sacrifice " : "Sacrifice ") + xText + ' ' + filter.getMessage(); this.filter = filter; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java index 7f6eedbd10..ef095d353c 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java @@ -51,7 +51,7 @@ public class TapTargetCost extends CostImpl { this.text = new StringBuilder("Tap ") .append((target.getTargetName().startsWith("a ") || target.getTargetName().startsWith("an ") || target.getTargetName().startsWith("another")) - ? "" : CardUtil.numberToText(target.getMaxNumberOfTargets()) + " ") + ? "" : CardUtil.numberToText(target.getMaxNumberOfTargets()) + ' ') .append(target.getTargetName()).toString(); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/TapVariableTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/TapVariableTargetCost.java index 7da86d69f6..5f2bc10650 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/TapVariableTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/TapVariableTargetCost.java @@ -51,7 +51,7 @@ public class TapVariableTargetCost extends VariableCostImpl { super(xText, new StringBuilder(filter.getMessage()).append(" to tap").toString()); this.filter = filter; this.text = new StringBuilder(additionalCostText ? "As an additional cost to cast {source}, tap ":"Tap ") - .append(this.xText).append(" ").append(filter.getMessage()).toString(); + .append(this.xText).append(' ').append(filter.getMessage()).toString(); } public TapVariableTargetCost(final TapVariableTargetCost cost) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java index e0609fa9d9..6f58c745bd 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java @@ -49,7 +49,7 @@ public class UntapTargetCost extends CostImpl { public UntapTargetCost(TargetControlledPermanent target) { this.target = target; - this.text = "Untap " + target.getMaxNumberOfTargets() + " " + target.getTargetName(); + this.text = "Untap " + target.getMaxNumberOfTargets() + ' ' + target.getTargetName(); } public UntapTargetCost(final UntapTargetCost cost) { diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java index e100bcc223..14ef126220 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java @@ -69,7 +69,7 @@ public class ColoredManaCost extends ManaCostImpl { @Override public String getText() { - return "{" + mana.toString() + "}"; + return '{' + mana.toString() + '}'; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/mana/GenericManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/GenericManaCost.java index 32708f1a8e..102da50b9e 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/GenericManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/GenericManaCost.java @@ -73,7 +73,7 @@ public class GenericManaCost extends ManaCostImpl { @Override public String getText() { - return "{" + Integer.toString(mana) + "}"; + return '{' + Integer.toString(mana) + '}'; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java index ae57cd25c1..183150ecdd 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java @@ -76,7 +76,7 @@ public class HybridManaCost extends ManaCostImpl { @Override public String getText() { - return "{" + mana1.toString() + "/" + mana2.toString() + "}"; + return '{' + mana1.toString() + '/' + mana2.toString() + '}'; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java index d02227d18b..e6571177bc 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java @@ -77,7 +77,7 @@ public class MonoHybridManaCost extends ManaCostImpl { @Override public String getText() { - return "{2/" + mana.toString() + "}"; + return "{2/" + mana.toString() + '}'; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/mana/PhyrexianManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/PhyrexianManaCost.java index 885d9cf88b..703f61ddff 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/PhyrexianManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/PhyrexianManaCost.java @@ -57,7 +57,7 @@ public class PhyrexianManaCost extends ColoredManaCost { @Override public String getText() { - return "{" + mana.toString() + "P}"; + return '{' + mana.toString() + "P}"; } @Override diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java index 70133b75d0..4903c8e82f 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java @@ -71,7 +71,7 @@ public class ParleyCount implements DynamicValue, MageSingleton { if (!card.getCardType().contains(CardType.LAND)) { parleyValue++; } - player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", new CardsImpl(card), game); + player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', new CardsImpl(card), game); } } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java index 030870ebca..6f630c4861 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java @@ -29,7 +29,7 @@ public class SignInversionDynamicValue implements DynamicValue { @Override public String toString() { - return "-" + value.toString(); + return '-' + value.toString(); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/AsTurnedFaceUpEffect.java b/Mage/src/main/java/mage/abilities/effects/AsTurnedFaceUpEffect.java index 8386f2cef7..71d1e22817 100644 --- a/Mage/src/main/java/mage/abilities/effects/AsTurnedFaceUpEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/AsTurnedFaceUpEffect.java @@ -85,7 +85,7 @@ public class AsTurnedFaceUpEffect extends ReplacementEffectImpl { if (controller == null || object == null) { return false; } - if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append("?").toString(), source, game)) { + if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append('?').toString(), source, game)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java index d78dea4be7..3450de2385 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java @@ -1234,9 +1234,9 @@ public class ContinuousEffects implements Serializable { for (Ability ability : entry.getValue()) { MageObject object = game.getObject(ability.getSourceId()); if (object != null) { - texts.put(ability.getId().toString() + "_" + entry.getKey().getId().toString(), object.getName() + ": " + ability.getRule(object.getName())); + texts.put(ability.getId().toString() + '_' + entry.getKey().getId().toString(), object.getName() + ": " + ability.getRule(object.getName())); } else { - texts.put(ability.getId().toString() + "_" + entry.getKey().getId().toString(), entry.getKey().getText(null)); + texts.put(ability.getId().toString() + '_' + entry.getKey().getId().toString(), entry.getKey().getText(null)); } } } else { diff --git a/Mage/src/main/java/mage/abilities/effects/Effects.java b/Mage/src/main/java/mage/abilities/effects/Effects.java index 9f207eeeca..f479863bfb 100644 --- a/Mage/src/main/java/mage/abilities/effects/Effects.java +++ b/Mage/src/main/java/mage/abilities/effects/Effects.java @@ -90,7 +90,7 @@ public class Effects extends ArrayList { !lastRule.startsWith("Level ") && !lastRule.endsWith(".)") && !lastRule.endsWith("") ) { - sbText.append("."); + sbText.append('.'); } return sbText.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/EntersBattlefieldEffect.java b/Mage/src/main/java/mage/abilities/effects/EntersBattlefieldEffect.java index 37589a698c..320ddaa08b 100644 --- a/Mage/src/main/java/mage/abilities/effects/EntersBattlefieldEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/EntersBattlefieldEffect.java @@ -129,7 +129,7 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl { if (controller == null || object == null) { return false; } - if (!controller.chooseUse(outcome, "Use effect of " + object.getLogName() + "?", source, game)) { + if (!controller.chooseUse(outcome, "Use effect of " + object.getLogName() + '?', source, game)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/AddManaInAnyCombinationEffect.java b/Mage/src/main/java/mage/abilities/effects/common/AddManaInAnyCombinationEffect.java index 722fc0468d..72fae649de 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/AddManaInAnyCombinationEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/AddManaInAnyCombinationEffect.java @@ -134,7 +134,7 @@ public class AddManaInAnyCombinationEffect extends ManaEffect { if (i > 1) { sb.append(" and/or "); } - sb.append("{").append(coloredManaSymbol.toString()).append("}"); + sb.append('{').append(coloredManaSymbol.toString()).append('}'); } } sb.append(" to your mana pool"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java index 79f43448c9..34d107f71b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java @@ -78,11 +78,11 @@ public class CantBeRegeneratedSourceEffect extends ContinuousRuleModifyingEffect StringBuilder sb = new StringBuilder(); sb.append(" {this} can't be regenerated"); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append(" this turn"); } else { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java index d3720acb40..a5cb7335c2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java @@ -81,11 +81,11 @@ public class CantBeRegeneratedTargetEffect extends ContinuousRuleModifyingEffect } sb.append(" can't be regenerated"); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append(" this turn"); } else { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java index 40635ee0c3..29b32ee2d0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java @@ -118,7 +118,7 @@ public class CantBeTargetedAllEffect extends ContinuousRuleModifyingEffectImpl { sb.append("spells"); } if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java index c1bc1edec5..e4d0498e14 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java @@ -117,7 +117,7 @@ public class CantBeTargetedAttachedEffect extends ContinuousRuleModifyingEffectI sb.append(" can't be the target of "); sb.append(filterSource.getMessage()); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append("this turn"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java index 2a09645f96..8c5744862a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java @@ -94,7 +94,7 @@ public class CantBeTargetedSourceEffect extends ContinuousRuleModifyingEffectImp StringBuilder sb = new StringBuilder(); sb.append("{this} can't be the target of "); sb.append(filterSource.getMessage()); - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java index 9e10bde4cb..977c48a5d4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java @@ -114,7 +114,7 @@ public class CantBeTargetedTargetEffect extends ContinuousRuleModifyingEffectImp sb.append(" can't be the target of "); sb.append(filterSource.getMessage()); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append("this turn"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/ChangeATargetOfTargetSpellAbilityToSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ChangeATargetOfTargetSpellAbilityToSourceEffect.java index 8884c6c141..4354f0904d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ChangeATargetOfTargetSpellAbilityToSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ChangeATargetOfTargetSpellAbilityToSourceEffect.java @@ -83,7 +83,7 @@ public class ChangeATargetOfTargetSpellAbilityToSourceEffect extends OneShotEffe if (target.canTarget(stackObject.getControllerId(), source.getSourceId(), sourceAbility, game)) { validTargets = true; if (name != null - && controller.chooseUse(Outcome.Neutral, "Change target from " + name + " to " + sourceObject.getLogName() + "?", source, game)) { + && controller.chooseUse(Outcome.Neutral, "Change target from " + name + " to " + sourceObject.getLogName() + '?', source, game)) { oldTargetName = getTargetName(targetId, game); target.remove(targetId); // The source is still the spell on the stack @@ -97,7 +97,7 @@ public class ChangeATargetOfTargetSpellAbilityToSourceEffect extends OneShotEffe } } if (oldTargetName == null) { - game.informPlayer(controller, "You have to select at least one target to change to " + sourceObject.getIdName() + "!"); + game.informPlayer(controller, "You have to select at least one target to change to " + sourceObject.getIdName() + '!'); } } while (validTargets && oldTargetName == null); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java index 0d42a86272..44db56cada 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java @@ -134,7 +134,7 @@ public class ClashEffect extends OneShotEffect implements MageSingleton { cards.add(cardController); controller.revealCards(sourceObject.getIdName() + ": Clash card of " + controller.getName(), cards, game); cmcController = cardController.getConvertedManaCost(); - message.append(" (").append(cmcController).append(")"); + message.append(" (").append(cmcController).append(')'); } else { message.append(" no card"); } @@ -145,7 +145,7 @@ public class ClashEffect extends OneShotEffect implements MageSingleton { cards.add(cardOpponent); opponent.revealCards(sourceObject.getIdName() + ": Clash card of " + opponent.getName(), cards, game); cmcOpponent = cardOpponent.getConvertedManaCost(); - message.append(" (").append(cmcOpponent).append(")"); + message.append(" (").append(cmcOpponent).append(')'); } else { message.append(" no card"); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java index 9fa78743ac..955ed8c3c4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java @@ -466,11 +466,11 @@ class TargetWithAdditionalFilter extends TargetImpl { for (UUID targetId : getTargets()) { MageObject object = game.getObject(targetId); if (object != null) { - sb.append(object.getLogName()).append(" "); + sb.append(object.getLogName()).append(' '); } else { Player player = game.getPlayer(targetId); if (player != null) { - sb.append(player.getLogName()).append(" "); + sb.append(player.getLogName()).append(' '); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CouncilsDilemmaVoteEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CouncilsDilemmaVoteEffect.java index 3402df0a00..f80cff7c1a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CouncilsDilemmaVoteEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CouncilsDilemmaVoteEffect.java @@ -55,7 +55,7 @@ public abstract class CouncilsDilemmaVoteEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - if (player.chooseUse(Outcome.Vote, "Choose " + choiceOne + "?", source, game)) { + if (player.chooseUse(Outcome.Vote, "Choose " + choiceOne + '?', source, game)) { voteOneCount++; game.informPlayers(player.getName() + " has voted for " + choiceOne); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java index 422b4ec0fa..28a8e93b1c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java @@ -118,7 +118,7 @@ public class CreateTokenEffect extends OneShotEffect { } sb.append(token.getDescription()); } else { - sb.append(CardUtil.numberToText(amount.toString())).append(" "); + sb.append(CardUtil.numberToText(amount.toString())).append(' '); if (tapped && !attacking) { sb.append("tapped "); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java index 0132ebf36b..5243e83300 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java @@ -69,7 +69,7 @@ public class CreateTokenTargetEffect extends OneShotEffect { } StringBuilder sb = new StringBuilder("put "); sb.append(CardUtil.numberToText(amount.toString(), "a")); - sb.append(" ").append(token.getDescription()).append(" onto the battlefield"); + sb.append(' ').append(token.getDescription()).append(" onto the battlefield"); if (tapped) { sb.append(" tapped"); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DestroyMultiTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DestroyMultiTargetEffect.java index 6be73a2eb9..b275b2f96a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DestroyMultiTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DestroyMultiTargetEffect.java @@ -87,7 +87,7 @@ public class DestroyMultiTargetEffect extends OneShotEffect { while (iterator.hasNext()) { Target target = iterator.next(); if (target.getNumberOfTargets() > 1) { - sb.append(target.getNumberOfTargets()).append(" "); + sb.append(target.getNumberOfTargets()).append(' '); } sb.append("target ").append(target.getTargetName()); if (iterator.hasNext()) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java index 6edef3c794..cc27e9ca5c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java @@ -59,7 +59,7 @@ public class DoIfCostPaid extends OneShotEffect { if (effectText.length() > 0 && effectText.charAt(effectText.length() - 1) == '.') { effectText = effectText.substring(0, effectText.length() - 1); } - message = getCostText() + " and " + effectText + "?"; + message = getCostText() + " and " + effectText + '?'; message = Character.toUpperCase(message.charAt(0)) + message.substring(1); } else { message = chooseUseText; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepSourceEffect.java index 98973401bd..666aa0a08b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepSourceEffect.java @@ -37,7 +37,7 @@ public class DontUntapInControllersNextUntapStepSourceEffect extends ContinuousR public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - return "{this} doesn't untap (" + mageObject.getLogName() + ")"; + return "{this} doesn't untap (" + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java index f59773e1e4..d77a8abdb9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java @@ -100,7 +100,7 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR MageObject mageObject = game.getObject(source.getSourceId()); Permanent permanentToUntap = game.getPermanent((event.getTargetId())); if (permanentToUntap != null && mageObject != null) { - return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ")"; + return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java index 1919824f29..f259f9568d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java @@ -43,7 +43,7 @@ public class DontUntapInControllersUntapStepEnchantedEffect extends ContinuousRu if (enchantment != null && enchantment.getAttachedTo() != null) { Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); if (enchanted != null) { - return enchanted.getLogName() + " doesn't untap during its controller's untap step (" + enchantment.getLogName() + ")"; + return enchanted.getLogName() + " doesn't untap during its controller's untap step (" + enchantment.getLogName() + ')'; } } return null; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java index 3eac0bd7e0..69118f2ac1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java @@ -69,7 +69,7 @@ public class DontUntapInControllersUntapStepTargetEffect extends ContinuousRuleM MageObject mageObject = game.getObject(source.getSourceId()); Permanent permanentToUntap = game.getPermanent((event.getTargetId())); if (permanentToUntap != null && mageObject != null) { - return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ")"; + return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInOpponentsNextUntapStepAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInOpponentsNextUntapStepAllEffect.java index 2a20c30e91..53a627a1d9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInOpponentsNextUntapStepAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInOpponentsNextUntapStepAllEffect.java @@ -85,7 +85,7 @@ public class DontUntapInOpponentsNextUntapStepAllEffect extends ContinuousRuleMo MageObject mageObject = game.getObject(source.getSourceId()); Permanent permanentToUntap = game.getPermanent((event.getTargetId())); if (permanentToUntap != null && mageObject != null) { - return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ")"; + return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java index 2a152eebc1..62da3f0a0d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java @@ -80,7 +80,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect { || amount instanceof PermanentsOnBattlefieldCount || amount.toString().equals("1"); sb.append("draw ").append(oneCard ? "a" : CardUtil.numberToText(amount.toString())).append(" card"); if (!oneCard) { - sb.append("s"); + sb.append('s'); } String message = amount.getMessage(); if (message.length() > 0) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java index 76558defd9..ae0c85ec39 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java @@ -130,10 +130,10 @@ public class DrawCardTargetEffect extends OneShotEffect { sb.append(CardUtil.numberToText(amount.toString(), "a")).append(" card"); try { if (Integer.parseInt(amount.toString()) > 1) { - sb.append("s"); + sb.append('s'); } } catch (Exception e) { - sb.append("s"); + sb.append('s'); } String message = amount.getMessage(); if (message.length() > 0) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/EpicEffect.java b/Mage/src/main/java/mage/abilities/effects/common/EpicEffect.java index a695f7a936..87ddd2f748 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/EpicEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/EpicEffect.java @@ -100,7 +100,7 @@ class EpicReplacementEffect extends ContinuousRuleModifyingEffectImpl { public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - return "For the rest of the game, you can't cast spells (Epic - " + mageObject.getName() + ")"; + return "For the rest of the game, you can't cast spells (Epic - " + mageObject.getName() + ')'; } return null; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileCardYouChooseTargetOpponentEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileCardYouChooseTargetOpponentEffect.java index 5517e52b38..dc0d697844 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileCardYouChooseTargetOpponentEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileCardYouChooseTargetOpponentEffect.java @@ -68,7 +68,7 @@ public class ExileCardYouChooseTargetOpponentEffect extends OneShotEffect { Card sourceCard = game.getCard(source.getSourceId()); if (controller != null && opponent != null) { if (!opponent.getHand().isEmpty()) { - opponent.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ")" : "Exile", opponent.getHand(), game); + opponent.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ')' : "Exile", opponent.getHand(), game); TargetCard target = new TargetCard(Zone.HAND, filter); if (controller.choose(Outcome.Exile, opponent.getHand(), target, game)) { Card card = opponent.getHand().get(target.getFirstTarget(), game); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileFromZoneTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileFromZoneTargetEffect.java index 97ecc487a0..4ff7097f65 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileFromZoneTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileFromZoneTargetEffect.java @@ -106,6 +106,6 @@ public class ExileFromZoneTargetEffect extends OneShotEffect { } private void setText() { - staticText = "target player exiles " + CardUtil.numberToText(amount, "a") + " " + filter.getMessage() + " from his or her " + zone.toString().toLowerCase(); + staticText = "target player exiles " + CardUtil.numberToText(amount, "a") + ' ' + filter.getMessage() + " from his or her " + zone.toString().toLowerCase(); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java index f6043e913f..1b10a2c554 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java @@ -60,7 +60,7 @@ public class ExileSourceUnlessPaysEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && sourcePermanent != null) { - StringBuilder sb = new StringBuilder(cost.getText()).append("?"); + StringBuilder sb = new StringBuilder(cost.getText()).append('?'); if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) { sb.insert(0, "Pay "); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java index c01b6923cf..af86ff288c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java @@ -87,9 +87,9 @@ public class GainLifeEffect extends OneShotEffect { String message = life.getMessage(); sb.append("you gain "); if (message.startsWith("that")) { - sb.append(message).append(" "); + sb.append(message).append(' '); } else if (message.isEmpty() || !message.equals("1")) { - sb.append(life).append(" "); + sb.append(life).append(' '); } sb.append("life"); if (message.length() > 0 && !message.startsWith("that")) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java index e51c820b5e..3e965d01ee 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java @@ -92,7 +92,7 @@ public class GainLifeTargetEffect extends OneShotEffect { } sb.append(" gains "); if (message.isEmpty() || !message.equals("1")) { - sb.append(life.toString()).append(" "); + sb.append(life.toString()).append(' '); } sb.append("life"); if (message.length() > 0) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/GetEmblemEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GetEmblemEffect.java index cd7c4dd6b3..796fb67700 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GetEmblemEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GetEmblemEffect.java @@ -45,7 +45,7 @@ public class GetEmblemEffect extends OneShotEffect { public GetEmblemEffect(Emblem emblem) { super(Outcome.Benefit); this.emblem = emblem; - this.staticText = "You get an emblem with \"" + emblem.getAbilities().getRules(null) + "\""; + this.staticText = "You get an emblem with \"" + emblem.getAbilities().getRules(null) + '"'; } public GetEmblemEffect(final GetEmblemEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/GetEmblemTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GetEmblemTargetPlayerEffect.java index 7f5daf3849..7c274efee2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GetEmblemTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GetEmblemTargetPlayerEffect.java @@ -79,6 +79,6 @@ public class GetEmblemTargetPlayerEffect extends OneShotEffect { if (staticText != null && !staticText.isEmpty()) { return staticText; } - return "Target " + mode.getTargets().get(0).getTargetName() + " gets an emblem with \"" + emblem.getAbilities().getRules(null) + "\""; + return "Target " + mode.getTargets().get(0).getTargetName() + " gets an emblem with \"" + emblem.getAbilities().getRules(null) + '"'; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java index b8b7167858..0d1c9dda85 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java @@ -222,7 +222,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff sb.append("put ").append(filter.getMessage()).append(" into your graveyard"); break; } - return sb.append("?").toString(); + return sb.append('?').toString(); } private String getPickText() { diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java index f63c0f5011..7537b12f15 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java @@ -84,7 +84,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect { sb.append("each opponent loses "); if (message.isEmpty() || !message.equals("1")) { - sb.append(amount).append(" "); + sb.append(amount).append(' '); } sb.append("life"); if (message.length() > 0) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java index 38164b67db..2909da13cb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java @@ -88,7 +88,7 @@ public class LoseLifeTargetEffect extends OneShotEffect { } sb.append(" loses "); if (message.isEmpty() || !message.equals("1")) { - sb.append(amount).append(" "); + sb.append(amount).append(' '); } sb.append("life"); if (message.length() > 0) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/NameACardEffect.java b/Mage/src/main/java/mage/abilities/effects/common/NameACardEffect.java index dccac2abdc..3559542e8b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/NameACardEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/NameACardEffect.java @@ -108,7 +108,7 @@ public class NameACardEffect extends OneShotEffect { } String cardName = cardChoice.getChoice(); if (!game.isSimulation()) { - game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + "]"); + game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + ']'); } game.getState().setValue(source.getSourceId().toString() + INFO_KEY, cardName); if (sourceObject instanceof Permanent) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToAllEffect.java index 6fe9320041..b57ae00a4b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToAllEffect.java @@ -64,7 +64,7 @@ public class PreventAllDamageToAllEffect extends PreventionEffectImpl { + (onlyCombat ? "combat ":"") + "damage that would be dealt to " + filter.getMessage() - + (duration.toString().isEmpty() ?"": " "+ duration.toString()); + + (duration.toString().isEmpty() ?"": ' ' + duration.toString()); } public PreventAllDamageToAllEffect(final PreventAllDamageToAllEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventAllNonCombatDamageToAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventAllNonCombatDamageToAllEffect.java index e17d8dafaf..7a3ef9802b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventAllNonCombatDamageToAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventAllNonCombatDamageToAllEffect.java @@ -49,7 +49,7 @@ public class PreventAllNonCombatDamageToAllEffect extends PreventionEffectImpl { public PreventAllNonCombatDamageToAllEffect(Duration duration, FilterInPlay filter) { super(duration, Integer.MAX_VALUE, false); this.filter = filter; - staticText = "Prevent all non combat damage that would be dealt to " + filter.getMessage() + " " + duration.toString(); + staticText = "Prevent all non combat damage that would be dealt to " + filter.getMessage() + ' ' + duration.toString(); } public PreventAllNonCombatDamageToAllEffect(final PreventAllNonCombatDamageToAllEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToControllerEffect.java index 92ae7dcf75..a3a87151d1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToControllerEffect.java @@ -80,9 +80,9 @@ public class PreventDamageToControllerEffect extends PreventionEffectImpl { if (amountToPrevent == Integer.MAX_VALUE) { sb.append("all "); } else if (amountToPreventDynamic != null) { - sb.append("the next ").append(amountToPreventDynamic.toString()).append(" "); + sb.append("the next ").append(amountToPreventDynamic.toString()).append(' '); } else { - sb.append("the next ").append(amountToPrevent).append(" "); + sb.append("the next ").append(amountToPrevent).append(' '); } if (onlyCombat) { sb.append("combat "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetEffect.java index c6aacddc43..6b651aa8e0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetEffect.java @@ -89,7 +89,7 @@ public class PreventDamageToTargetEffect extends PreventionEffectImpl { } sb.append(mode.getTargets().get(0).getTargetName()); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append("this turn"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java index d5638262ca..0b71592368 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java @@ -155,7 +155,7 @@ public class PutOnLibraryTargetEffect extends OneShotEffect { if (target.getMaxNumberOfTargets() > target.getNumberOfTargets()) { sb.append("up to "); } - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' '); } sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" on "); sb.append(onTop ? "top" : "the bottom").append(" of its owner's library"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToBattlefieldTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToBattlefieldTargetEffect.java index cc449d0cec..90516fa4ff 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToBattlefieldTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToBattlefieldTargetEffect.java @@ -97,7 +97,7 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) { sb.append("up to "); } - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' '); } sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" to the battlefield"); if (tapped) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToHandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToHandTargetEffect.java index fdd5ad5cf3..a78bd5c6b5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToHandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToHandTargetEffect.java @@ -78,7 +78,7 @@ public class ReturnFromGraveyardToHandTargetEffect extends OneShotEffect { if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) { sb.append("up to "); } - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' '); } if (!mode.getTargets().get(0).getTargetName().startsWith("another")) { sb.append("target "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenControlledPermanentEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenControlledPermanentEffect.java index 3d7d07cd2e..6a6949d37e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenControlledPermanentEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenControlledPermanentEffect.java @@ -68,7 +68,7 @@ public class ReturnToHandChosenControlledPermanentEffect extends ReturnToHandCho if (!filter.getMessage().startsWith("another")) { sb.append(CardUtil.numberToText(number, "a")); } - sb.append(" ").append(filter.getMessage()); + sb.append(' ').append(filter.getMessage()); if (number > 1) { sb.append(" to their owner's hand"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java index ccb9e97478..86538efe0b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java @@ -90,7 +90,7 @@ public class ReturnToHandChosenPermanentEffect extends OneShotEffect { if (!filter.getMessage().startsWith("another")) { sb.append(CardUtil.numberToText(number, "a")); } - sb.append(" ").append(filter.getMessage()); + sb.append(' ').append(filter.getMessage()); sb.append(" he or she controls"); if (number > 1) { sb.append(" to their owner's hand"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandTargetEffect.java index 5e85cdfac7..2ab4c45591 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandTargetEffect.java @@ -110,7 +110,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect { return sb.toString(); } else { if (target.getNumberOfTargets() > 1) { - sb.append(CardUtil.numberToText(target.getNumberOfTargets())).append(" "); + sb.append(CardUtil.numberToText(target.getNumberOfTargets())).append(' '); } if (!target.getTargetName().startsWith("another")) { sb.append("target "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeAllEffect.java index b58d273475..84377c93b3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeAllEffect.java @@ -115,7 +115,7 @@ public class SacrificeAllEffect extends OneShotEffect { } else { sb.append(CardUtil.numberToText(amount.toString(), "a")); } - sb.append(" "); + sb.append(' '); sb.append(filter.getMessage()); staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeEffect.java index a821c35458..6950c5d43e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeEffect.java @@ -130,7 +130,7 @@ public class SacrificeEffect extends OneShotEffect{ sb.append(" sacrifice "); } } - sb.append(CardUtil.numberToText(count.toString(), "a")).append(" "); + sb.append(CardUtil.numberToText(count.toString(), "a")).append(' '); sb.append(filter.getMessage()); staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsEffect.java index 5cdc5da396..147df3a392 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsEffect.java @@ -114,13 +114,13 @@ public class SacrificeOpponentsEffect extends OneShotEffect { } else { if (amount.toString().equals("1")) { if (!filter.getMessage().startsWith("a ") && !filter.getMessage().startsWith("an ")) { - sb.append("a"); + sb.append('a'); } } else { sb.append(CardUtil.numberToText(amount.toString())); } } - sb.append(" "); + sb.append(' '); sb.append(filter.getMessage()); staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsUnlessPayEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsUnlessPayEffect.java index 1b6ccbcdaf..5c891be7df 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsUnlessPayEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsUnlessPayEffect.java @@ -189,14 +189,14 @@ public class SacrificeOpponentsUnlessPayEffect extends OneShotEffect{ } else { if (amount.toString().equals("1")) { if (!filter.getMessage().startsWith("a ") && !filter.getMessage().startsWith("an ")) { - sb.append("a"); + sb.append('a'); } } else { sb.append(CardUtil.numberToText(amount.toString())); } } - sb.append(" "); + sb.append(' '); sb.append(filter.getMessage()); sb.append(" unless he or she pays "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java index 3b8afb7944..e9990d91b1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java @@ -33,7 +33,7 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && sourcePermanent != null) { - StringBuilder sb = new StringBuilder(cost.getText()).append("?"); + StringBuilder sb = new StringBuilder(cost.getText()).append('?'); if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) { sb.insert(0, "Pay "); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SkipUntapOptionalSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SkipUntapOptionalSourceEffect.java index dc98024dd9..f12a191f58 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SkipUntapOptionalSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SkipUntapOptionalSourceEffect.java @@ -60,7 +60,7 @@ public class SkipUntapOptionalSourceEffect extends RestrictionEffect { @Override public boolean canBeUntapped(Permanent permanent, Ability source, Game game) { Player player = game.getPlayer(permanent.getControllerId()); - return player != null && player.chooseUse(Outcome.Benefit, "Untap " + permanent.getLogName() + "?", source, game); + return player != null && player.chooseUse(Outcome.Benefit, "Untap " + permanent.getLogName() + '?', source, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java index efc2b9321d..d92c01d4c7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java @@ -83,9 +83,9 @@ public class TapTargetEffect extends OneShotEffect { Target target = mode.getTargets().get(0); if (target.getMaxNumberOfTargets() > 1) { if (target.getMaxNumberOfTargets() == target.getNumberOfTargets()) { - return "tap " + CardUtil.numberToText(target.getNumberOfTargets()) + " target " + target.getTargetName() + "s"; + return "tap " + CardUtil.numberToText(target.getNumberOfTargets()) + " target " + target.getTargetName() + 's'; } else { - return "tap up to " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + " target " + target.getTargetName() + "s"; + return "tap up to " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + " target " + target.getTargetName() + 's'; } } else if (target.getMaxNumberOfTargets() == 0){ return "tap X target " + mode.getTargets().get(0).getTargetName(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/UntapTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/UntapTargetEffect.java index 1347aeaeb1..57d5a9bbc0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/UntapTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/UntapTargetEffect.java @@ -81,7 +81,7 @@ public class UntapTargetEffect extends OneShotEffect { } if (target.getMaxNumberOfTargets() > 1 || target.getNumberOfTargets() == 0) { - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append("s"); + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append('s'); } else { if (!target.getTargetName().startsWith("another")) { sb.append("target "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/WishEffect.java b/Mage/src/main/java/mage/abilities/effects/common/WishEffect.java index 05208eb958..e18709fa15 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/WishEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/WishEffect.java @@ -101,7 +101,7 @@ public class WishEffect extends OneShotEffect { List exile = game.getExile().getAllCards(game); boolean noTargets = cards.isEmpty() && (alsoFromExile ? exile.isEmpty() : true); if (noTargets) { - game.informPlayer(controller, "You have no cards outside the game" + (alsoFromExile ? " or in exile" : "") + "."); + game.informPlayer(controller, "You have no cards outside the game" + (alsoFromExile ? " or in exile" : "") + '.'); return true; } @@ -118,7 +118,7 @@ public class WishEffect extends OneShotEffect { } } if (filteredCards.isEmpty()) { - game.informPlayer(controller, "You don't have " + filter.getMessage() + " outside the game" + (alsoFromExile ? " or in exile" : "") + "."); + game.informPlayer(controller, "You don't have " + filter.getMessage() + " outside the game" + (alsoFromExile ? " or in exile" : "") + '.'); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CanAttackAsThoughItDidntHaveDefenderAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CanAttackAsThoughItDidntHaveDefenderAllEffect.java index 85a4e2eff6..1acbd8bba1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CanAttackAsThoughItDidntHaveDefenderAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CanAttackAsThoughItDidntHaveDefenderAllEffect.java @@ -86,7 +86,7 @@ public class CanAttackAsThoughItDidntHaveDefenderAllEffect extends AsThoughEffec } else { sb.append(duration.toString()); } - sb.append(" "); + sb.append(' '); } sb.append("as though they didn't have defender"); return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAnyPlayerAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAnyPlayerAllEffect.java index d5fa0b7dd9..436ed02beb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAnyPlayerAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAnyPlayerAllEffect.java @@ -49,11 +49,11 @@ public class CantAttackAnyPlayerAllEffect extends RestrictionEffect { this.filter = filter; StringBuilder sb = new StringBuilder(filter.getMessage()).append(" can't attack"); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append(" this turn"); } else { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } } staticText = sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockAllEffect.java index 7fee1dd847..96a726b457 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockAllEffect.java @@ -47,11 +47,11 @@ public class CantAttackBlockAllEffect extends RestrictionEffect { this.filter = filter; StringBuilder sb = new StringBuilder(filter.getMessage()).append(" can't attack or block"); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append(" this turn"); } else { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } } staticText = sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java index 121b5aa6ba..67abeff84d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java @@ -88,7 +88,7 @@ public class CantBeBlockedTargetEffect extends RestrictionEffect { } } if (target.getMaxNumberOfTargets() > 1) { - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' '); } sb.append("target ").append(mode.getTargets().get(0).getTargetName()); if (target.getMaxNumberOfTargets() > 1) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockAttachedEffect.java index 2c5f215b82..50927b66ab 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockAttachedEffect.java @@ -62,10 +62,10 @@ public class CantBlockAttachedEffect extends RestrictionEffect { sb.append("Equipped creature can't block"); } if (!filter.getMessage().equals("creature")) { - sb.append(" ").append(filter.getMessage()); + sb.append(' ').append(filter.getMessage()); } if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockTargetEffect.java index 940ab26b09..5e61b12edd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockTargetEffect.java @@ -75,17 +75,17 @@ public class CantBlockTargetEffect extends RestrictionEffect { } StringBuilder sb = new StringBuilder(); Target target = mode.getTargets().get(0); - if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) { - sb.append("any number of "); - } else if (target.getMaxNumberOfTargets() > 1) { + if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) { + sb.append("any number of "); + } else if (target.getMaxNumberOfTargets() > 1) { if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) { sb.append("up to "); } - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' '); } sb.append("target ").append(mode.getTargets().get(0).getTargetName()); if (target.getMaxNumberOfTargets() > 1) { - sb.append("s"); + sb.append('s'); } sb.append(" can't block"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java index 380b3a1fff..9961a6f614 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java @@ -107,7 +107,7 @@ public class AssignNoCombatDamageSourceEffect extends ReplacementEffectImpl { break; default: if (duration.toString().length() > 0) { - text += " " + duration.toString(); + text += ' ' + duration.toString(); } } return text; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java index 22ccfa003e..ef525ea505 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java @@ -216,7 +216,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { } } if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java index 0f5244ef2b..a9312c85d3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java @@ -85,15 +85,15 @@ public class BecomesColorOrColorsTargetEffect extends OneShotEffect { game.informPlayers(target.getName() + ": " + controller.getLogName() + " has chosen " + choiceColor.getChoice()); } if (choiceColor.getColor().isBlack()) { - sb.append("B"); + sb.append('B'); } else if (choiceColor.getColor().isBlue()) { - sb.append("U"); + sb.append('U'); } else if (choiceColor.getColor().isRed()) { - sb.append("R"); + sb.append('R'); } else if (choiceColor.getColor().isGreen()) { - sb.append("G"); + sb.append('G'); } else if (choiceColor.getColor().isWhite()) { - sb.append("W"); + sb.append('W'); } } String colors = new String(sb); @@ -123,7 +123,7 @@ public class BecomesColorOrColorsTargetEffect extends OneShotEffect { sb.append(mode.getTargets().get(0).getFilter().getMessage()); sb.append(" becomes the color or colors of your choice"); if (duration.toString().length() > 0) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorSourceEffect.java index c945fbcd2a..2ab725e74a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorSourceEffect.java @@ -120,6 +120,6 @@ public class BecomesColorSourceEffect extends ContinuousEffectImpl { return staticText; } return "{this} becomes " + (setColor == null ? "the color of your choice" : setColor.getDescription()) - + " " + duration.toString(); + + ' ' + duration.toString(); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorTargetEffect.java index f1d1369cdb..12675f6798 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorTargetEffect.java @@ -143,7 +143,7 @@ public class BecomesColorTargetEffect extends ContinuousEffectImpl { } else { sb.append(setColor.getDescription()); } - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); return sb.toString(); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java index 00475d4f93..e16b52adcc 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java @@ -184,7 +184,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { sb.append(" becomes a "); } sb.append(token.getDescription()); - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); if (addStillALandText) { if (target.getMaxNumberOfTargets() > 1) { sb.append(". They're still lands"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java index 4837e258e1..f7bb98281d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java @@ -101,7 +101,7 @@ public class BecomesCreatureTypeTargetEffect extends ContinuousEffectImpl { StringBuilder sb = new StringBuilder(); sb.append("Target creature becomes that type"); if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java index e1967e797a..7d38ce39c6 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java @@ -105,7 +105,7 @@ public class BecomesSubtypeAllEffect extends ContinuousEffectImpl { sb.append("Target creature becomes that type"); if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllEffect.java index 74f5f39b5b..e16c81de1f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllEffect.java @@ -178,15 +178,15 @@ public class BoostAllEffect extends ContinuousEffectImpl { sb.append(filter.getMessage()).append(" get "); String p = power.toString(); if (!p.startsWith("-")) { - sb.append("+"); + sb.append('+'); } - sb.append(p).append("/"); + sb.append(p).append('/'); String t = toughness.toString(); if (!t.startsWith("-")) { if (p.startsWith("-")) { - sb.append("-"); + sb.append('-'); } else { - sb.append("+"); + sb.append('+'); } } sb.append(t); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostControlledEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostControlledEffect.java index 1ac09946b4..7a743e6f5e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostControlledEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostControlledEffect.java @@ -161,15 +161,15 @@ public class BoostControlledEffect extends ContinuousEffectImpl { String p = power.toString(); if (!p.startsWith("-")) { - sb.append("+"); + sb.append('+'); } - sb.append(p).append("/"); + sb.append(p).append('/'); String t = toughness.toString(); if (!t.startsWith("-")) { if (p.startsWith("-")) { - sb.append("-"); + sb.append('-'); } else { - sb.append("+"); + sb.append('+'); } } sb.append(t); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEnchantedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEnchantedEffect.java index 4470727115..41d5d5dda2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEnchantedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEnchantedEffect.java @@ -118,20 +118,20 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl { sb.append("Enchanted creature gets "); String p = power.toString(); if (!p.startsWith("-")) { - sb.append("+"); + sb.append('+'); } - sb.append(p).append("/"); + sb.append(p).append('/'); String t = toughness.toString(); if (!t.startsWith("-")) { if (p.startsWith("-")) { - sb.append("-"); + sb.append('-'); } else { - sb.append("+"); + sb.append('+'); } } sb.append(t); if (duration != Duration.WhileOnBattlefield) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } String message = null; String fixedPart = null; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java index dd3150b62e..33eff81c6a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java @@ -119,18 +119,18 @@ public class BoostEquippedEffect extends ContinuousEffectImpl { sb.append("Equipped creature gets "); String p = power.toString(); if (!p.startsWith("-")) - sb.append("+"); - sb.append(p).append("/"); + sb.append('+'); + sb.append(p).append('/'); String t = toughness.toString(); if (!t.startsWith("-")) { if (p.startsWith("-")) - sb.append("-"); + sb.append('-'); else - sb.append("+"); + sb.append('+'); } sb.append(t); if (duration != Duration.WhileOnBattlefield) - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); String message = power.getMessage(); if (message.length() > 0) { sb.append(" for each "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostSourceEffect.java index 93ab0363ad..2442da61cf 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostSourceEffect.java @@ -121,21 +121,21 @@ public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEff sb.append("{this} gets "); String p = power.toString(); if(!p.startsWith("-")) { - sb.append("+"); + sb.append('+'); } - sb.append(p).append("/"); + sb.append(p).append('/'); String t = toughness.toString(); if(!t.startsWith("-")){ if(t.startsWith("-")) { - sb.append("-"); + sb.append('-'); } else { - sb.append("+"); + sb.append('+'); } } sb.append(t); if (duration != Duration.WhileOnBattlefield) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } String message = null; String fixedPart = null; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostTargetEffect.java index 31655da573..6b8eaed477 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostTargetEffect.java @@ -133,20 +133,20 @@ public class BoostTargetEffect extends ContinuousEffectImpl { } String p = power.toString(); if (!p.startsWith("-")) { - sb.append("+"); + sb.append('+'); } - sb.append(p).append("/"); + sb.append(p).append('/'); String t = toughness.toString(); if (!t.startsWith("-")) { if (t.equals("0") && p.startsWith("-")) { - sb.append("-"); + sb.append('-'); } else { - sb.append("+"); + sb.append('+'); } } sb.append(t); if (duration != Duration.WhileOnBattlefield) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } String message = null; String fixedPart = null; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeAllEffect.java index e14041fc65..1e32816cce 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeAllEffect.java @@ -129,7 +129,7 @@ public class CantGainLifeAllEffect extends ContinuousEffectImpl { } sb.append(" can't gain life"); if (!this.duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append("this turn"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeTargetEffect.java index a1dd5e5819..7ac097963a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeTargetEffect.java @@ -51,7 +51,7 @@ public class CantGainLifeTargetEffect extends ContinuousEffectImpl { if (duration.equals(Duration.EndOfTurn)) { sb.append("this turn, "); } else { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } } sb.append("that player gains no life instead"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/CastAsThoughItHadFlashAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/CastAsThoughItHadFlashAllEffect.java index 5589f5e8ca..ab7967dc1d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/CastAsThoughItHadFlashAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/CastAsThoughItHadFlashAllEffect.java @@ -97,7 +97,8 @@ public class CastAsThoughItHadFlashAllEffect extends AsThoughEffectImpl { if (duration.equals(Duration.EndOfTurn)) { sb.append(" this turn"); } else { - sb.append(" "); + sb.append(' '); + sb.append(' '); sb.append(duration.toString()); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java index b7a948f298..66320f7a27 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java @@ -191,14 +191,14 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl { sb.append(" gain "); } if (quotes) { - sb.append("\""); + sb.append('"'); } sb.append(ability.getRule()); if (quotes) { - sb.append("\""); + sb.append('"'); } if (duration.toString().length() > 0) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAttachedEffect.java index d26eaf8ab7..90734de9f2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAttachedEffect.java @@ -137,7 +137,7 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl { } sb.append(ability.getRule()); if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledEffect.java index c20ada07bd..d9811387ea 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledEffect.java @@ -166,7 +166,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl { if (duration.equals(Duration.WhileOnBattlefield) || duration.equals(Duration.EndOfGame)) { sb.append("have "); if (gainedAbility.startsWith("Whenever ") || gainedAbility.startsWith("{T}")) { - gainedAbility = "\"" + gainedAbility + "\""; + gainedAbility = '"' + gainedAbility + '"'; } } else { @@ -174,7 +174,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl { } sb.append(gainedAbility); if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControllerEffect.java index a4842f68bb..2bd6476997 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControllerEffect.java @@ -63,7 +63,7 @@ public class GainAbilityControllerEffect extends ContinuousEffectImpl { this.ability = ability; staticText = "You have " + ability.getRule(); if (!duration.toString().isEmpty()) { - staticText += " " + duration.toString(); + staticText += ' ' + duration.toString(); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java index 609ad65d29..1d6666a93a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java @@ -64,7 +64,7 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl implements Sou public GainAbilitySourceEffect(Ability ability, Duration duration, boolean onCard) { super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); this.ability = ability; - staticText = "{this} gains " + ability.getRule() + " " + duration.toString(); + staticText = "{this} gains " + ability.getRule() + ' ' + duration.toString(); this.onCard = onCard; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java index ac019f328d..b689d1224d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java @@ -162,11 +162,11 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl { } StringBuilder sb = new StringBuilder(); Target target = mode.getTargets().get(0); - if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) { - sb.append("any number of target ").append(target.getTargetName()).append(" gain "); - } else if (target.getMaxNumberOfTargets() > 1) { + if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) { + sb.append("any number of target ").append(target.getTargetName()).append(" gain "); + } else if (target.getMaxNumberOfTargets() > 1) { if (target.getNumberOfTargets() < target.getMaxNumberOfTargets()) { - sb.append("up to "); + sb.append("up to "); } sb.append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()).append(" gain "); } else { @@ -180,7 +180,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl { if (durationPhaseStep != null) { sb.append(" until your next ").append(durationPhaseStep.toString().toLowerCase(Locale.ENGLISH)); } else if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainControlTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainControlTargetEffect.java index 3927e34b34..9a3d9fedd4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainControlTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainControlTargetEffect.java @@ -150,7 +150,7 @@ public class GainControlTargetEffect extends ContinuousEffectImpl { } sb.append(mode.getTargets().get(0).getTargetName()); if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromTypeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromTypeTargetEffect.java index 8cd87d07f1..2d51b991f3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromTypeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromTypeTargetEffect.java @@ -47,7 +47,7 @@ public class GainProtectionFromTypeTargetEffect extends GainAbilityTargetEffect super(new ProtectionAbility(new FilterCard()), duration); ((ProtectionAbility)ability).setFilter(protectionFrom); typeName = protectionFrom.getMessage(); - staticText = "Target creature gains protection from " + typeName + " " + duration.toString(); + staticText = "Target creature gains protection from " + typeName + ' ' + duration.toString(); } public GainProtectionFromTypeTargetEffect(final GainProtectionFromTypeTargetEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAllEffect.java index 3962f8f9a1..4e8e86e908 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAllEffect.java @@ -28,7 +28,7 @@ public class LoseAbilityAllEffect extends ContinuousEffectImpl { super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); this.filter = filter; this.ability = ability; - staticText = filter.getMessage() + " lose " + ability.toString() + (duration.toString().isEmpty() ? "" : " " + duration.toString()); + staticText = filter.getMessage() + " lose " + ability.toString() + (duration.toString().isEmpty() ? "" : ' ' + duration.toString()); } public LoseAbilityAllEffect(final LoseAbilityAllEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityOrAnotherAbilityTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityOrAnotherAbilityTargetEffect.java index beec0ac0a2..aa7201f1f8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityOrAnotherAbilityTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityOrAnotherAbilityTargetEffect.java @@ -123,7 +123,7 @@ public class LoseAbilityOrAnotherAbilityTargetEffect extends LoseAbilityTargetEf sb.append(" or "); sb.append(ability2.getRule()); if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilitySourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilitySourceEffect.java index 785420e329..bbb09b1281 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilitySourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilitySourceEffect.java @@ -27,7 +27,7 @@ public class LoseAbilitySourceEffect extends ContinuousEffectImpl{ public LoseAbilitySourceEffect(Ability ability, Duration duration){ super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.LoseAbility); this.ability = ability; - staticText = "{this} loses " + ability.getRule() + " " + duration.toString(); + staticText = "{this} loses " + ability.getRule() + ' ' + duration.toString(); } public LoseAbilitySourceEffect(final LoseAbilitySourceEffect effect){ diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityTargetEffect.java index 6ceab45adb..3ac29f8314 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityTargetEffect.java @@ -93,7 +93,7 @@ public class LoseAbilityTargetEffect extends ContinuousEffectImpl { } sb.append(ability.getRule()); if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java index f6636df1e2..cb528774c9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java @@ -96,7 +96,7 @@ public class SetCardSubtypeAttachedEffect extends ContinuousEffectImpl { sb.append(" creature is a"); for (String subtype : this.setSubtypes) { - sb.append(" ").append(subtype); + sb.append(' ').append(subtype); } staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessAllEffect.java index 8b1c6fa277..0e47cf0ea0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessAllEffect.java @@ -131,9 +131,9 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl { } else { sb.append(" have base power and toughness "); } - sb.append(power).append("/").append(toughness); + sb.append(power).append('/').append(toughness); if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java index 36e4ec09c1..5947dbdb31 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java @@ -66,7 +66,7 @@ public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl { super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature); this.power = power; this.toughness = toughness; - staticText = "{this}'s power and toughness is " + power + "/" + toughness + " " + duration.toString(); + staticText = "{this}'s power and toughness is " + power + '/' + toughness + ' ' + duration.toString(); } public SetPowerToughnessSourceEffect(final SetPowerToughnessSourceEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessTargetEffect.java index 0824e1b523..f9cd504ccb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessTargetEffect.java @@ -96,7 +96,7 @@ public class SetPowerToughnessTargetEffect extends ContinuousEffectImpl { } StringBuilder sb = new StringBuilder(); sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" has base power and toughness "); - sb.append(power).append("/").append(toughness).append(" ").append(duration.toString()); + sb.append(power).append('/').append(toughness).append(' ').append(duration.toString()); return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessAllEffect.java index 576aeaf0e6..d61932de00 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessAllEffect.java @@ -109,7 +109,7 @@ public class SwitchPowerToughnessAllEffect extends ContinuousEffectImpl { StringBuilder sb = new StringBuilder(); sb.append("Switch each creature's power and toughness"); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); sb.append(duration.toString()); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessTargetEffect.java index bd1bbdb961..759ae59865 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessTargetEffect.java @@ -73,7 +73,7 @@ public class SwitchPowerToughnessTargetEffect extends ContinuousEffectImpl { public String getText(Mode mode) { StringBuilder sb = new StringBuilder(); sb.append("Switch target ").append(mode.getTargets().get(0).getTargetName()).append("'s power and toughness") - .append(" ").append(duration.toString()); + .append(' ').append(duration.toString()); return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java index 50b4e1506a..e63c115b7e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java @@ -67,7 +67,7 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl { this.amount = amount; this.upTo = upTo; - this.staticText = filter.getMessage() + " cost " + (upTo ? "up to " : "") + "{" + amount + "} less to cast"; + this.staticText = filter.getMessage() + " cost " + (upTo ? "up to " : "") + '{' + amount + "} less to cast"; } protected SpellsCostReductionAllEffect(SpellsCostReductionAllEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java index 9aa7fc3710..20d8ab95b7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java @@ -83,7 +83,7 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI this.filter = filter; this.amount = amount; this.upTo = upTo; - this.staticText = filter.getMessage() + " you cast cost " + (upTo ? "up to " : "") + "{" + amount + "} less to cast"; + this.staticText = filter.getMessage() + " you cast cost " + (upTo ? "up to " : "") + '{' + amount + "} less to cast"; } protected SpellsCostReductionControllerEffect(final SpellsCostReductionControllerEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAllEffect.java index 0dc24e8709..3bc9ba0e98 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAllEffect.java @@ -68,7 +68,7 @@ public class AddCountersAllEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.addCounters(counter.copy(), source, game); if (!game.isSimulation()) { - game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + counter.getCount() + " " + counter.getName().toLowerCase() + game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + counter.getCount() + ' ' + counter.getName().toLowerCase() + " counter on " + permanent.getLogName()); } } @@ -82,7 +82,7 @@ public class AddCountersAllEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("put "); if (counter.getCount() > 1) { - sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName().toLowerCase()).append(" counters on each "); + sb.append(Integer.toString(counter.getCount())).append(' ').append(counter.getName().toLowerCase()).append(" counters on each "); } else { sb.append("a ").append(counter.getName().toLowerCase()).append(" counter on each "); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java index a96dfea05f..20554668e2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java @@ -95,7 +95,7 @@ public class AddCountersAttachedEffect extends OneShotEffect { // put a +1/+1 counter on it sb.append("put "); if (counter.getCount() > 1) { - sb.append(CardUtil.numberToText(counter.getCount())).append(" "); + sb.append(CardUtil.numberToText(counter.getCount())).append(' '); } else { sb.append("a "); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersControllerEffect.java index 36234a508c..6e937a1c47 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersControllerEffect.java @@ -94,7 +94,7 @@ public class AddCountersControllerEffect extends OneShotEffect { private void setText() { if (counter.getCount() > 1) { StringBuilder sb = new StringBuilder(); - sb.append("its controller gets ").append(Integer.toString(counter.getCount())).append(" ").append(counter.getName()).append(" counters"); + sb.append("its controller gets ").append(Integer.toString(counter.getCount())).append(' ').append(counter.getName()).append(" counters"); staticText = sb.toString(); } else { staticText = "its controller gets a " + counter.getName() + " counter"; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java index 99f46c8f7a..f1b1bb981c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java @@ -107,7 +107,7 @@ public class AddCountersSourceEffect extends OneShotEffect { if (informPlayers && !game.isSimulation()) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - game.informPlayers(player.getLogName() + " puts " + newCounter.getCount() + " " + newCounter.getName().toLowerCase() + " counter on " + card.getLogName()); + game.informPlayers(player.getLogName() + " puts " + newCounter.getCount() + ' ' + newCounter.getName().toLowerCase() + " counter on " + card.getLogName()); } } } @@ -133,7 +133,7 @@ public class AddCountersSourceEffect extends OneShotEffect { int amountAdded = permanent.getCounters(game).getCount(newCounter.getName()) - before; Player player = game.getPlayer(source.getControllerId()); if (player != null) { - game.informPlayers(player.getLogName() + " puts " + amountAdded + " " + newCounter.getName().toLowerCase() + " counter on " + permanent.getLogName()); + game.informPlayers(player.getLogName() + " puts " + amountAdded + ' ' + newCounter.getName().toLowerCase() + " counter on " + permanent.getLogName()); } } } @@ -149,7 +149,7 @@ public class AddCountersSourceEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("put "); if (counter.getCount() > 1) { - sb.append(CardUtil.numberToText(counter.getCount())).append(" "); + sb.append(CardUtil.numberToText(counter.getCount())).append(' '); } else { if (amount.toString().equals("X") && amount.getMessage().isEmpty()) { sb.append("X "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index 05587f40fb..f2f40afefd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -102,7 +102,7 @@ public class AddCountersTargetEffect extends OneShotEffect { affectedTargets++; if (!game.isSimulation()) { game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " - + numberAdded + " " + counter.getName().toLowerCase() + " counter on " + permanent.getLogName()); + + numberAdded + ' ' + counter.getName().toLowerCase() + " counter on " + permanent.getLogName()); } } else if (player != null) { Counter newCounter = counter.copy(); @@ -111,14 +111,14 @@ public class AddCountersTargetEffect extends OneShotEffect { affectedTargets++; if (!game.isSimulation()) { game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " - + counter.getCount() + " " + counter.getName().toLowerCase() + " counter on " + player.getLogName()); + + counter.getCount() + ' ' + counter.getName().toLowerCase() + " counter on " + player.getLogName()); } } else if (card != null) { card.addCounters(counter, source, game); if (!game.isSimulation()) { - game.informPlayers(new StringBuilder("Added ").append(counter.getCount()).append(" ").append(counter.getName()) + game.informPlayers(new StringBuilder("Added ").append(counter.getCount()).append(' ').append(counter.getName()) .append(" counter to ").append(card.getName()) - .append(" (").append(card.getCounters(game).getCount(counter.getName())).append(")").toString()); + .append(" (").append(card.getCounters(game).getCount(counter.getName())).append(')').toString()); } return true; } @@ -136,13 +136,13 @@ public class AddCountersTargetEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("put "); if (counter.getCount() > 1) { - sb.append(CardUtil.numberToText(counter.getCount())).append(" "); + sb.append(CardUtil.numberToText(counter.getCount())).append(' '); } else { sb.append("a "); } sb.append(counter.getName().toLowerCase()).append(" counter"); if (counter.getCount() > 1) { - sb.append("s"); + sb.append('s'); } sb.append(" on "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java index 6d84a0614f..0e59f9641e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java @@ -98,7 +98,7 @@ public class AddRemoveAllTimeSuspentCountersEffect extends OneShotEffect { if (!game.isSimulation()) { game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") .append(controller.getLogName()).append(actionStr) - .append(counter.getCount()).append(" ").append(counterName.toLowerCase()) + .append(counter.getCount()).append(' ').append(counterName.toLowerCase()) .append(" counter on ").append(card.getName()).toString()); } } @@ -110,7 +110,7 @@ public class AddRemoveAllTimeSuspentCountersEffect extends OneShotEffect { final String actionsStr2 = removeCounter ? "remove " : " put "; sb.append(actionsStr2); if (counter.getCount() > 1) { - sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName().toLowerCase()).append(" counters on each "); + sb.append(Integer.toString(counter.getCount())).append(' ').append(counter.getName().toLowerCase()).append(" counters on each "); } else { sb.append("a ").append(counter.getName().toLowerCase()).append(" counter on each "); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java index 0f74a9fb4c..6cb3f44bb1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java @@ -102,7 +102,7 @@ public class DistributeCountersEffect extends OneShotEffect { } String name = counterType.getName(); - String text = "distribute " + CardUtil.numberToText(amount) + " " + name + " counters among " + targetDescription + "."; + String text = "distribute " + CardUtil.numberToText(amount) + ' ' + name + " counters among " + targetDescription + '.'; if (removeAtEndOfTurn) { text += " For each " + name + " counter you put on a creature this way, remove a " + name + " counter from that creature at the beginning of the next cleanup step."; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java index b255546221..983797d08c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java @@ -88,7 +88,7 @@ public class GetEnergyCountersControllerEffect extends OneShotEffect { sb.append(val > 1 ? "s" : ""); sb.append(")"); if ((value instanceof StaticValue)) { - sb.append("."); + sb.append('.'); } else { sb.append(" for each "); sb.append(value.getMessage()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java index 4979d2ca0f..c4fce2f0f1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java @@ -70,7 +70,7 @@ public class MoveCountersTargetsEffect extends OneShotEffect { removeTargetCreature.removeCounters(counterType.createInstance(amount), game); addTargetCreature.addCounters(counterType.createInstance(amount), source, game); if (!game.isSimulation()) { - game.informPlayers("Moved " + amount + " " + counterType.getName() + " counter" + (amount > 1 ? "s" : "") + " from " + removeTargetCreature.getLogName() + " to " + addTargetCreature.getLogName()); + game.informPlayers("Moved " + amount + ' ' + counterType.getName() + " counter" + (amount > 1 ? "s" : "") + " from " + removeTargetCreature.getLogName() + " to " + addTargetCreature.getLogName()); } return true; } @@ -87,15 +87,15 @@ public class MoveCountersTargetsEffect extends OneShotEffect { if (amount > 1) { sb.append(amount); } else { - sb.append("a"); + sb.append('a'); } - sb.append(" "); + sb.append(' '); sb.append(counterType.getName()); sb.append(" counter"); if (amount > 1) { sb.append("s "); } else { - sb.append(" "); + sb.append(' '); } sb.append("from one target creature to another target creature"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java index 89f4ff24cd..b67caad706 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java @@ -88,7 +88,7 @@ public class ProliferateEffect extends OneShotEffect { choices.add(counter.getName()); } choice.setChoices(choices); - choice.setMessage("Choose a counter to proliferate (" + permanent.getIdName() + ")"); + choice.setMessage("Choose a counter to proliferate (" + permanent.getIdName() + ')'); controller.choose(Outcome.Benefit, choice, game); for (Counter counter : permanent.getCounters(game).values()) { if (counter.getName().equals(choice.getChoice())) { @@ -115,7 +115,7 @@ public class ProliferateEffect extends OneShotEffect { choices.add(counter.getName()); } choice.setChoices(choices); - choice.setMessage("Choose a counter to proliferate (" + player.getLogName() + ")"); + choice.setMessage("Choose a counter to proliferate (" + player.getLogName() + ')'); controller.choose(Outcome.Benefit, choice, game); for (Counter counter : player.getCounters().values()) { if (counter.getName().equals(choice.getChoice())) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java index 6322b59d12..2e4feb8c52 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java @@ -62,7 +62,7 @@ public class RemoveCounterSourceEffect extends OneShotEffect { if (toRemove > 0) { permanent.removeCounters(counter.getName(), toRemove, game); if (!game.isSimulation()) { - game.informPlayers("Removed " + toRemove + " " + counter.getName() + " counter from " + permanent.getLogName()); + game.informPlayers("Removed " + toRemove + ' ' + counter.getName() + " counter from " + permanent.getLogName()); } } return true; @@ -73,7 +73,7 @@ public class RemoveCounterSourceEffect extends OneShotEffect { if (toRemove > 0) { card.removeCounters(counter.getName(), toRemove, game); if (!game.isSimulation()) { - game.informPlayers("Removed " + toRemove + " " + counter.getName() + game.informPlayers("Removed " + toRemove + ' ' + counter.getName() + " counter from " + card.getLogName() + " (" + card.getCounters(game).getCount(counter.getName()) + " left)"); } @@ -91,7 +91,7 @@ public class RemoveCounterSourceEffect extends OneShotEffect { private void setText() { if (counter.getCount() > 1) { StringBuilder sb = new StringBuilder(); - sb.append("remove ").append(Integer.toString(counter.getCount())).append(" ").append(counter.getName()).append(" counters from {this}"); + sb.append("remove ").append(Integer.toString(counter.getCount())).append(' ').append(counter.getName()).append(" counters from {this}"); staticText = sb.toString(); } else { staticText = "remove a " + counter.getName() + " counter from {this}"; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java index ff8a03f950..3647644a9d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java @@ -74,7 +74,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { if(toRemove != null && p.getCounters(game).getCount(toRemove.getName()) >= toRemove.getCount()) { p.removeCounters(toRemove.getName(), toRemove.getCount(), game); if(!game.isSimulation()) - game.informPlayers("Removed " + toRemove.getCount() + " " + toRemove.getName() + game.informPlayers("Removed " + toRemove.getCount() + ' ' + toRemove.getName() + " counter from " + p.getName()); return true; } @@ -83,7 +83,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { if (c != null && counter != null && c.getCounters(game).getCount(counter.getName()) >= counter.getCount()) { c.removeCounters(counter.getName(), counter.getCount(), game); if (!game.isSimulation()) - game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName()) + game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(' ').append(counter.getName()) .append(" counter from ").append(c.getName()) .append(" (").append(c.getCounters(game).getCount(counter.getName())).append(" left)").toString()); return true; @@ -135,7 +135,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { text += "a counter"; } else { - text += CardUtil.numberToText(counter.getCount(), "a") + " " + counter.getName(); + text += CardUtil.numberToText(counter.getCount(), "a") + ' ' + counter.getName(); text += counter.getCount() > 1 ? " counters" : " counter"; } text += " from target " + mode.getTargets().get(0).getTargetName(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java index f0daee0174..b527f9073f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java @@ -151,7 +151,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect { revealedCards.addAll(player.getHand()); } - player.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ")" : "Discard", revealedCards, game); + player.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ')' : "Discard", revealedCards, game); boolean result = true; int filteredCardsCount = revealedCards.count(filter, source.getSourceId(), source.getControllerId(), game); @@ -208,7 +208,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect { sb.append(". You choose "); boolean discardMultipleCards = !numberCardsToDiscard.toString().equals("1"); if (discardMultipleCards) { - sb.append(numberCardsToDiscard).append(" "); + sb.append(numberCardsToDiscard).append(' '); } else { if (!filter.getMessage().startsWith("a ") && !filter.getMessage().startsWith("an ")) { sb.append("a "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java index fa9d314a21..e21c7574d8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java @@ -100,17 +100,17 @@ public class DiscardControllerEffect extends OneShotEffect { private void setText() { StringBuilder sb = new StringBuilder("discard "); if (amount.toString().equals("1")) { - sb.append("a"); + sb.append('a'); } else { sb.append(CardUtil.numberToText(amount.toString())); } sb.append(" card"); try { if (Integer.parseInt(amount.toString()) > 1) { - sb.append("s"); + sb.append('s'); } } catch (Exception e) { - sb.append("s"); + sb.append('s'); } if (randomDiscard) { sb.append(" at random"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java index c4817e5e59..7272b439ce 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java @@ -140,10 +140,10 @@ public class DiscardEachPlayerEffect extends OneShotEffect { sb.append(CardUtil.numberToText(amount.toString(), "a")).append(" card"); try { if (Integer.parseInt(amount.toString()) > 1) { - sb.append("s"); + sb.append('s'); } } catch (Exception e) { - sb.append("s"); + sb.append('s'); } if (randomDiscard) { sb.append(" at random"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyDuringPhaseStepSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyDuringPhaseStepSourceEffect.java index f506db3798..c20202dfc9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyDuringPhaseStepSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyDuringPhaseStepSourceEffect.java @@ -72,7 +72,7 @@ public class CastOnlyDuringPhaseStepSourceEffect extends ContinuousRuleModifying sb.append("the ").append(phaseStep.getStepText()); } if (condition != null) { - sb.append(" ").append(condition.toString()); + sb.append(' ').append(condition.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java index 0b007176b8..656a47b3e7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java @@ -78,7 +78,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect { MageObject sourceObject = source.getSourceObject(game); Card cardFound = null; if (controller != null && sourceObject != null) { - if (forceToSearchBoth || controller.chooseUse(outcome, "Search your library for a card named " + filter.getMessage() + "?", source, game)) { + if (forceToSearchBoth || controller.chooseUse(outcome, "Search your library for a card named " + filter.getMessage() + '?', source, game)) { TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter); target.clearChosen(); if (controller.searchLibrary(target, game)) { @@ -89,7 +89,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect { controller.shuffleLibrary(source, game); } - if (cardFound == null && controller.chooseUse(outcome, "Search your graveyard for a card named " + filter.getMessage() + "?", source, game)) { + if (cardFound == null && controller.chooseUse(outcome, "Search your graveyard for a card named " + filter.getMessage() + '?', source, game)) { TargetCard target = new TargetCard(0, 1, Zone.GRAVEYARD, filter); target.clearChosen(); if (controller.choose(outcome, controller.getGraveyard(), target, game)) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java index a992a18e79..8ce316cfc5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java @@ -121,7 +121,7 @@ public class SearchLibraryPutInHandEffect extends SearchEffect { StringBuilder sb = new StringBuilder(); sb.append(rulePrefix); if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) { - sb.append("up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + sb.append("up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' '); sb.append(target.getTargetName()).append(revealCards ? ", reveal them," : "").append(" and put them into your hand"); } else { sb.append("a ").append(target.getTargetName()).append(revealCards ? ", reveal it," : "").append(" and put that card into your hand"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java index c0b387f67d..39d26abaf5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java @@ -106,9 +106,9 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect { sb.append("search your library for "); if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) { if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) { - sb.append("any number of ").append(" "); + sb.append("any number of ").append(' '); } else { - sb.append("up to ").append(target.getMaxNumberOfTargets()).append(" "); + sb.append("up to ").append(target.getMaxNumberOfTargets()).append(' '); } sb.append(target.getTargetName()).append(" and put them onto the battlefield"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java index 6b145d3a39..0b851ee858 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java @@ -92,9 +92,9 @@ public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect { sb.append("target player searches his or her library for "); if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) { if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) { - sb.append("any number of ").append(" "); + sb.append("any number of ").append(' '); } else { - sb.append("up to ").append(target.getMaxNumberOfTargets()).append(" "); + sb.append("up to ").append(target.getMaxNumberOfTargets()).append(' '); } sb.append(target.getTargetName()).append(" and put them onto the battlefield"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java index 1f7ed73df7..184850b354 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java @@ -105,7 +105,7 @@ public class ManifestTargetPlayerEffect extends OneShotEffect { private String setText() { StringBuilder sb = new StringBuilder(); if (prefix != null && !prefix.isEmpty()) { - sb.append(prefix).append(" "); + sb.append(prefix).append(' '); } sb.append("manifest the top "); if (amount > 1) { diff --git a/Mage/src/main/java/mage/abilities/keyword/AuraSwapAbility.java b/Mage/src/main/java/mage/abilities/keyword/AuraSwapAbility.java index c1ede4ef17..c2ae418441 100644 --- a/Mage/src/main/java/mage/abilities/keyword/AuraSwapAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/AuraSwapAbility.java @@ -104,7 +104,7 @@ class AuraSwapEffect extends OneShotEffect { game.getState().setValue("attachTo:" + auraInHand.getId(), enchantedPermanent); auraInHand.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), controller.getId()); enchantedPermanent.addAttachment(auraInHand.getId(), game); - game.informPlayers(controller.getLogName() + " put " + auraInHand.getLogName() + " on the battlefield attached to " + enchantedPermanent.getLogName() + "."); + game.informPlayers(controller.getLogName() + " put " + auraInHand.getLogName() + " on the battlefield attached to " + enchantedPermanent.getLogName() + '.'); enchantedPermanent.removeAttachment(auraSourcePermanent.getId(), game); return controller.moveCards(game.getCard(source.getSourceId()), Zone.HAND, source, game); } diff --git a/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java b/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java index 98eb6e7752..8bd67d0348 100644 --- a/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java @@ -138,7 +138,7 @@ public class BuybackAbility extends StaticAbility implements OptionalAdditionalS StringBuilder sb = new StringBuilder(); if (buybackCost != null) { sb.append(buybackCost.getText(false)); - sb.append(" ").append(buybackCost.getReminderText()); + sb.append(' ').append(buybackCost.getReminderText()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java index 2cb6ca432b..dbe8a87d8d 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java @@ -124,7 +124,7 @@ class CascadeEffect extends OneShotEffect { controller.getLibrary().reset(); // set back empty draw state if that caused an empty draw if (card != null) { - if (controller.chooseUse(outcome, "Use cascade effect on " + card.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Use cascade effect on " + card.getLogName() + '?', source, game)) { if (controller.cast(card.getSpellAbility(), game, true)) { exile.remove(card.getId()); } diff --git a/Mage/src/main/java/mage/abilities/keyword/ConspireAbility.java b/Mage/src/main/java/mage/abilities/keyword/ConspireAbility.java index 26b23a062c..fe9421ac61 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ConspireAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ConspireAbility.java @@ -195,7 +195,7 @@ public class ConspireAbility extends StaticAbility implements OptionalAdditional StringBuilder sb = new StringBuilder(); if (conspireCost != null) { sb.append(conspireCost.getText(false)); - sb.append(" ").append(conspireCost.getReminderText()); + sb.append(' ').append(conspireCost.getReminderText()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java index eb8e0e7bac..f24a1a8817 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java @@ -104,7 +104,7 @@ class CumulativeUpkeepEffect extends OneShotEffect { for (int i = 0; i < ageCounter; i++) { totalCost.add((ManaCost) cumulativeCost.copy()); } - if (player.chooseUse(Outcome.Benefit, "Pay " + totalCost.getText() + "?", source, game)) { + if (player.chooseUse(Outcome.Benefit, "Pay " + totalCost.getText() + '?', source, game)) { totalCost.clearPaid(); if (totalCost.payOrRollback(source, game, source.getSourceId(), source.getControllerId())) { game.fireEvent(new GameEvent(EventType.PAID_CUMULATIVE_UPKEEP, permanent.getId(), permanent.getId(), player.getId(), ageCounter, false)); @@ -119,7 +119,7 @@ class CumulativeUpkeepEffect extends OneShotEffect { for (int i = 0; i < ageCounter; i++) { totalCost.add(cumulativeCost.copy()); } - if (player.chooseUse(Outcome.Benefit, totalCost.getText() + "?", source, game)) { + if (player.chooseUse(Outcome.Benefit, totalCost.getText() + '?', source, game)) { totalCost.clearPaid(); int bookmark = game.bookmarkState(); if (totalCost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { diff --git a/Mage/src/main/java/mage/abilities/keyword/CyclingAbility.java b/Mage/src/main/java/mage/abilities/keyword/CyclingAbility.java index e52a77724c..3f9cc3700e 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CyclingAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CyclingAbility.java @@ -77,7 +77,7 @@ public class CyclingAbility extends ActivatedAbilityImpl { public String getRule() { StringBuilder rule = new StringBuilder(this.text); if(cost instanceof ManaCost){ - rule.append(" "); + rule.append(' '); } else{ rule.append("—"); diff --git a/Mage/src/main/java/mage/abilities/keyword/DashAbility.java b/Mage/src/main/java/mage/abilities/keyword/DashAbility.java index 6b862cff30..20a087dd96 100644 --- a/Mage/src/main/java/mage/abilities/keyword/DashAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/DashAbility.java @@ -179,7 +179,7 @@ public class DashAbility extends StaticAbility implements AlternativeSourceCosts ++numberCosts; } if (numberCosts == 1) { - sb.append(" ").append(remarkText); + sb.append(' ').append(remarkText); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java b/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java index e3c0531073..8b28bb0e00 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java @@ -118,7 +118,7 @@ public class EchoAbility extends TriggeredAbilityImpl { public String getRule() { StringBuilder sb = new StringBuilder("Echo"); if (manaEcho) { - sb.append(" "); + sb.append(' '); } else { sb.append("—"); } @@ -145,7 +145,7 @@ class EchoEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && source.getSourceObjectIfItStillExists(game) != null) { - if (controller.chooseUse(Outcome.Benefit, "Pay " + cost.getText() /* + " or sacrifice " + permanent.getName() */ + "?", source, game)) { + if (controller.chooseUse(Outcome.Benefit, "Pay " + cost.getText() /* + " or sacrifice " + permanent.getName() */ + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; diff --git a/Mage/src/main/java/mage/abilities/keyword/EntwineAbility.java b/Mage/src/main/java/mage/abilities/keyword/EntwineAbility.java index c98c6334ec..a51b621d91 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EntwineAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EntwineAbility.java @@ -134,7 +134,7 @@ public class EntwineAbility extends StaticAbility implements OptionalAdditionalM StringBuilder sb = new StringBuilder(); if (additionalCost != null) { sb.append(additionalCost.getText(false)); - sb.append(" ").append(additionalCost.getReminderText()); + sb.append(' ').append(additionalCost.getReminderText()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java b/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java index d4aca82458..8253232c6e 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java @@ -171,7 +171,7 @@ public class EvokeAbility extends StaticAbility implements AlternativeSourceCost ++numberCosts; } if (numberCosts == 1) { - sb.append(" ").append(remarkText); + sb.append(' ').append(remarkText); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java b/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java index 63e7fda4e6..4ab4ff99c5 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java @@ -101,7 +101,7 @@ class ExtortEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { - if (player.chooseUse(Outcome.Damage, new StringBuilder("Extort opponents? (").append(permanent.getName()).append(")").toString(), source, game)) { + if (player.chooseUse(Outcome.Damage, new StringBuilder("Extort opponents? (").append(permanent.getName()).append(')').toString(), source, game)) { Cost cost = new ManaCostsImpl("{W/B}"); if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { int loseLife = 0; diff --git a/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java b/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java index 214d84e9c5..350cc8e517 100644 --- a/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java @@ -126,7 +126,7 @@ public class FlashbackAbility extends SpellAbility { if (costs.size() > 0) { sbRule.append(" - "); } else { - sbRule.append(" "); + sbRule.append(' '); } if (manaCosts.size() > 0) { sbRule.append(manaCosts.getText()); @@ -136,10 +136,10 @@ public class FlashbackAbility extends SpellAbility { sbRule.append(", "); } sbRule.append(costs.getText()); - sbRule.append("."); + sbRule.append('.'); } if (abilityName != null) { - sbRule.append(" "); + sbRule.append(' '); sbRule.append(abilityName); } sbRule.append(" (You may cast this card from your graveyard for its flashback cost. Then exile it.)"); diff --git a/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java b/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java index 937501a4ea..6d6e781d6c 100644 --- a/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java @@ -71,7 +71,7 @@ public class GraftAbility extends TriggeredAbilityImpl { this.amount = amount; StringBuilder sb = new StringBuilder(); for (CardType theCardtype : card.getCardType()) { - sb.append(theCardtype.toString().toLowerCase(Locale.ENGLISH)).append(" "); + sb.append(theCardtype.toString().toLowerCase(Locale.ENGLISH)).append(' '); } this.cardtype = sb.toString().trim(); addSubAbility(new GraftStaticAbility(amount)); @@ -113,7 +113,7 @@ public class GraftAbility extends TriggeredAbilityImpl { @Override public String getRule() { StringBuilder sb = new StringBuilder("Graft"); - sb.append(" ").append(amount).append(" (This ").append(cardtype).append(" enters the battlefield with ") + sb.append(' ').append(amount).append(" (This ").append(cardtype).append(" enters the battlefield with ") .append(amount == 1 ? "a" : CardUtil.numberToText(amount)) .append(" +1/+1 counter on it. Whenever a creature enters the battlefield, you may move a +1/+1 counter from this ") .append(cardtype).append(" onto it.)"); diff --git a/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java b/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java index e104a5e26c..5a033f3a2d 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java @@ -108,7 +108,7 @@ public class HauntAbility extends TriggeredAbilityImpl { if (zEvent.isDiesEvent()) { Card card = game.getCard(getSourceId()); if (card != null) { - String key = new StringBuilder("Haunting_").append(getSourceId().toString()).append("_").append(card.getZoneChangeCounter(game)).toString(); + String key = new StringBuilder("Haunting_").append(getSourceId().toString()).append('_').append(card.getZoneChangeCounter(game)).toString(); Object object = game.getState().getValue(key); if (object != null && object instanceof FixedTarget) { FixedTarget target = (FixedTarget) object; @@ -209,7 +209,7 @@ class HauntEffect extends OneShotEffect { if (hauntedCreature != null) { if (card.moveToExile(source.getSourceId(), "Haunting", source.getSourceId(), game)) { // remember the haunted creature - String key = new StringBuilder("Haunting_").append(source.getSourceId().toString()).append("_").append(card.getZoneChangeCounter(game)).toString(); + String key = new StringBuilder("Haunting_").append(source.getSourceId().toString()).append('_').append(card.getZoneChangeCounter(game)).toString(); game.getState().setValue(key, new FixedTarget(targetPointer.getFirst(game, source))); card.addInfo("hauntinfo", new StringBuilder("Haunting ").append(hauntedCreature.getLogName()).toString(), game); hauntedCreature.addInfo("hauntinfo", new StringBuilder("Haunted by ").append(card.getLogName()).toString(), game); diff --git a/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java b/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java index 6052344429..bd839096a4 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java @@ -125,7 +125,7 @@ class HideawayExileEffect extends OneShotEffect { if (card != null) { cards.remove(card); controller.moveCardToExileWithInfo(card, CardUtil.getCardExileZoneId(game, source), - "Hideaway (" + hideawaySource.getIdName() + ")", source.getSourceId(), game, Zone.LIBRARY, false); + "Hideaway (" + hideawaySource.getIdName() + ')', source.getSourceId(), game, Zone.LIBRARY, false); card.setFaceDown(true, game); } } diff --git a/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java b/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java index 138189fc08..e897faae38 100644 --- a/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java @@ -291,7 +291,7 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo ++numberKicker; } if (numberKicker == 1) { - sb.append(" ").append(remarkText); + sb.append(' ').append(remarkText); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/keyword/LevelerCardBuilder.java b/Mage/src/main/java/mage/abilities/keyword/LevelerCardBuilder.java index 950d40d008..0749bbe6c5 100644 --- a/Mage/src/main/java/mage/abilities/keyword/LevelerCardBuilder.java +++ b/Mage/src/main/java/mage/abilities/keyword/LevelerCardBuilder.java @@ -210,13 +210,13 @@ public class LevelerCardBuilder { StringBuilder sb = new StringBuilder(); sb.append("Level ").append(level1); if (level2 == -1) { - sb.append("+"); + sb.append('+'); } else { - sb.append("-").append(level2); + sb.append('-').append(level2); } - sb.append(": ").append(power).append("/").append(toughness).append(" "); + sb.append(": ").append(power).append('/').append(toughness).append(' '); for (String rule : abilities.getRules("{this}")) { - sb.append(rule).append(" "); + sb.append(rule).append(' '); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java b/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java index bcac6e5cd6..bb155c232b 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java @@ -93,7 +93,7 @@ public class ModularAbility extends DiesTriggeredAbility { if (sunburst) { sb.append("-Sunburst (This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it. When it dies, you may put its +1/+1 counters on target artifact creature.)"); } else { - sb.append(" ").append(amount).append(" (This enters the battlefield with ") + sb.append(' ').append(amount).append(" (This enters the battlefield with ") .append(CardUtil.numberToText(amount, "a")) .append(" +1/+1 counter").append(amount != 1 ? "s" : "") .append(" on it. When it dies, you may put its +1/+1 counters on target artifact creature.)"); diff --git a/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java b/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java index 7ea7f48f7e..fa8f8b6e08 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java @@ -127,9 +127,9 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost this.setWorksFaceDown(true); StringBuilder sb = new StringBuilder(); if (megamorph) { - sb.append(ABILITY_KEYWORD_MEGA).append(" "); + sb.append(ABILITY_KEYWORD_MEGA).append(' '); } else { - sb.append(ABILITY_KEYWORD).append(" "); + sb.append(ABILITY_KEYWORD).append(' '); } name = ABILITY_KEYWORD; for (Cost cost : morphCosts) { @@ -138,7 +138,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost break; } } - sb.append(morphCosts.getText()).append(" "); + sb.append(morphCosts.getText()).append(' '); if (megamorph) { sb.append(REMINDER_TEXT_MEGA); } else { diff --git a/Mage/src/main/java/mage/abilities/keyword/MyriadAbility.java b/Mage/src/main/java/mage/abilities/keyword/MyriadAbility.java index 8fc0d734e3..d09b69ee59 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MyriadAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MyriadAbility.java @@ -101,7 +101,7 @@ class MyriadEffect extends OneShotEffect { if (!playerId.equals(defendingPlayerId) && controller.hasOpponent(playerId, game)) { Player opponent = game.getPlayer(playerId); if (opponent != null && controller.chooseUse(Outcome.PutCreatureInPlay, - "Put a copy of " + sourceObject.getIdName() + " onto battlefield attacking " + opponent.getName() + "?", source, game)) { + "Put a copy of " + sourceObject.getIdName() + " onto battlefield attacking " + opponent.getName() + '?', source, game)) { PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(controller.getId(), null, false, 1, true, true, playerId); effect.setTargetPointer(new FixedTarget(sourceObject, game)); effect.apply(game, source); diff --git a/Mage/src/main/java/mage/abilities/keyword/OfferingAbility.java b/Mage/src/main/java/mage/abilities/keyword/OfferingAbility.java index 5f0532ee44..15d4747d69 100644 --- a/Mage/src/main/java/mage/abilities/keyword/OfferingAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/OfferingAbility.java @@ -159,7 +159,7 @@ class OfferingAsThoughEffect extends AsThoughEffectImpl { Card spellToCast = game.getCard(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (player != null && !CardUtil.isCheckPlayableMode(affectedAbility) && - player.chooseUse(Outcome.Benefit, "Offer a " + filter.getMessage() + " to cast " + spellToCast.getName() + "?", source, game)) { + player.chooseUse(Outcome.Benefit, "Offer a " + filter.getMessage() + " to cast " + spellToCast.getName() + '?', source, game)) { Target target = new TargetControlledCreaturePermanent(1,1,filter,true); player.chooseTarget(Outcome.Sacrifice, target, source, game); if (!target.isChosen()) { diff --git a/Mage/src/main/java/mage/abilities/keyword/ProwlAbility.java b/Mage/src/main/java/mage/abilities/keyword/ProwlAbility.java index b61921457f..9d59fdf140 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ProwlAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ProwlAbility.java @@ -167,7 +167,7 @@ public class ProwlAbility extends StaticAbility implements AlternativeSourceCost ++numberCosts; } if (numberCosts == 1) { - sb.append(" ").append(remarkText); + sb.append(' ').append(remarkText); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java b/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java index 55fbe2116d..dc9637865f 100644 --- a/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java @@ -132,7 +132,7 @@ class RecoverEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("Recover"); if (cost instanceof ManaCost) { - sb.append(" ").append(cost.getText()).append(" "); + sb.append(' ').append(cost.getText()).append(' '); } else { sb.append("—").append(cost.getText()).append(". "); } diff --git a/Mage/src/main/java/mage/abilities/keyword/ReplicateAbility.java b/Mage/src/main/java/mage/abilities/keyword/ReplicateAbility.java index 0499ba0d9e..13c064507b 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ReplicateAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ReplicateAbility.java @@ -143,7 +143,7 @@ public class ReplicateAbility extends StaticAbility implements OptionalAdditiona StringBuilder sb = new StringBuilder(); if (additionalCost != null) { sb.append(additionalCost.getText(false)); - sb.append(" ").append(additionalCost.getReminderText()); + sb.append(' ').append(additionalCost.getReminderText()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java b/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java index 725d15424b..80b10df022 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java @@ -102,7 +102,7 @@ class SunburstEffect extends OneShotEffect { if (!game.isSimulation()) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - game.informPlayers(player.getLogName() + " puts " + counter.getCount() + " " + counter.getName() + " counter on " + permanent.getName()); + game.informPlayers(player.getLogName() + " puts " + counter.getCount() + ' ' + counter.getName() + " counter on " + permanent.getName()); } } } diff --git a/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java b/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java index 3f9cfbfcaf..6cdc697f12 100644 --- a/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java @@ -101,7 +101,7 @@ class UnleashReplacementEffect extends ReplacementEffectImpl { Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); Player controller = game.getPlayer(source.getControllerId()); if (creature != null && controller != null) { - if (controller.chooseUse(outcome, "Unleash " + creature.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Unleash " + creature.getLogName() + '?', source, game)) { if (!game.isSimulation()) { game.informPlayers(controller.getLogName() + " unleashes " + creature.getName()); } diff --git a/Mage/src/main/java/mage/abilities/mana/ActivateIfConditionManaAbility.java b/Mage/src/main/java/mage/abilities/mana/ActivateIfConditionManaAbility.java index b7f846f957..f12d8e5565 100644 --- a/Mage/src/main/java/mage/abilities/mana/ActivateIfConditionManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/ActivateIfConditionManaAbility.java @@ -74,7 +74,7 @@ public class ActivateIfConditionManaAbility extends ActivatedManaAbilityImpl { @Override public String getRule() { - return new StringBuilder(super.getRule()).append(" Activate this ability only if ").append(condition.toString()).append(".").toString(); + return new StringBuilder(super.getRule()).append(" Activate this ability only if ").append(condition.toString()).append('.').toString(); } @Override diff --git a/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java b/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java index 6b7a7c40b1..c1d071e93f 100644 --- a/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java +++ b/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java @@ -38,7 +38,7 @@ public class ConditionalSpellManaBuilder extends ConditionalManaBuilder { @Override public String getRule() { - return "Spend this mana only to cast " + filter.getMessage() + "."; + return "Spend this mana only to cast " + filter.getMessage() + '.'; } } @@ -46,7 +46,7 @@ class SpellCastConditionalMana extends ConditionalMana { SpellCastConditionalMana(Mana mana, FilterSpell filter) { super(mana); - staticText = "Spend this mana only to cast " + filter.getMessage() + "."; + staticText = "Spend this mana only to cast " + filter.getMessage() + '.'; addCondition(new SpellCastManaCondition(filter)); } } diff --git a/Mage/src/main/java/mage/actions/MageDrawAction.java b/Mage/src/main/java/mage/actions/MageDrawAction.java index f2513cc5e1..ba7922b590 100644 --- a/Mage/src/main/java/mage/actions/MageDrawAction.java +++ b/Mage/src/main/java/mage/actions/MageDrawAction.java @@ -83,7 +83,7 @@ public class MageDrawAction extends MageAction { drawnCards.add(card); card.moveToZone(Zone.HAND, null, game, false); if (player.isTopCardRevealed()) { - game.fireInformEvent(player.getLogName() + " draws a revealed card (" + card.getLogName() + ")"); + game.fireInformEvent(player.getLogName() + " draws a revealed card (" + card.getLogName() + ')'); } game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DREW_CARD, card.getId(), player.getId())); diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 10a0aa8d12..29aa92eb2f 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -483,7 +483,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { default: MageObject sourceObject = game.getObject(sourceId); logger.fatal("Invalid from zone [" + fromZone + "] for card [" + this.getIdName() - + "] source [" + (sourceObject != null ? sourceObject.getName() : "null") + "]"); + + "] source [" + (sourceObject != null ? sourceObject.getName() : "null") + ']'); break; } if (removed) { diff --git a/Mage/src/main/java/mage/cards/CardsImpl.java b/Mage/src/main/java/mage/cards/CardsImpl.java index c7228776be..49e0622ccd 100644 --- a/Mage/src/main/java/mage/cards/CardsImpl.java +++ b/Mage/src/main/java/mage/cards/CardsImpl.java @@ -206,7 +206,7 @@ public class CardsImpl extends LinkedHashSet implements Cards, Serializabl } Collections.sort(cards); for (String name : cards) { - sb.append(name).append(":"); + sb.append(name).append(':'); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/cards/Sets.java b/Mage/src/main/java/mage/cards/Sets.java index 4ea294f199..7fc0e1374e 100644 --- a/Mage/src/main/java/mage/cards/Sets.java +++ b/Mage/src/main/java/mage/cards/Sets.java @@ -193,7 +193,7 @@ public class Sets extends HashMap { List>> cardGrid = layout.getCards(); int height = cardGrid.size(); int width = (height > 0) ? cardGrid.get(0).size() : 0; - out.print("(" + height + "," + width + ")"); + out.print("(" + height + ',' + width + ')'); out.print(layout.getSettings()); out.print("|"); for (List> row : cardGrid) { diff --git a/Mage/src/main/java/mage/cards/decks/Deck.java b/Mage/src/main/java/mage/cards/decks/Deck.java index 7af38ed879..923d90b30e 100644 --- a/Mage/src/main/java/mage/cards/decks/Deck.java +++ b/Mage/src/main/java/mage/cards/decks/Deck.java @@ -122,7 +122,7 @@ public class Deck implements Serializable { cardInfo = CardRepository.instance.findCard("Silvercoat Lion"); Logger.getLogger(Deck.class).error("Tried to restart the DB: " + (cardInfo == null ? "not successful" : "successful")); } - return new GameException("Card not found - " + deckCardInfo.getCardName() + " - " + deckCardInfo.getSetCode() + " for deck - " + deckName + "\n" + return new GameException("Card not found - " + deckCardInfo.getCardName() + " - " + deckCardInfo.getSetCode() + " for deck - " + deckName + '\n' + "Possible reason is, that you use cards in your deck, that are only supported in newer versions of the server.\n" + "So it can help to use the same card from another set, that's already supported from this server."); diff --git a/Mage/src/main/java/mage/cards/decks/InvalidDeckException.java b/Mage/src/main/java/mage/cards/decks/InvalidDeckException.java index c67c7491d0..c4e70bcb68 100644 --- a/Mage/src/main/java/mage/cards/decks/InvalidDeckException.java +++ b/Mage/src/main/java/mage/cards/decks/InvalidDeckException.java @@ -52,9 +52,9 @@ public class InvalidDeckException extends GameException { @Override public String getMessage() { StringBuilder sb = new StringBuilder(); - sb.append(super.getMessage()).append("\n"); + sb.append(super.getMessage()).append('\n'); for (Entry entry: invalid.entrySet()) { - sb.append(entry.getKey()).append(" ").append(entry.getValue()).append("\n"); + sb.append(entry.getKey()).append(' ').append(entry.getValue()).append('\n'); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java index 9b042dc48c..6593401fc1 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java @@ -93,7 +93,7 @@ public class DckDeckImporter extends DeckImporter { } } } else { - sbMessage.append("Could not find card '").append("' at line ").append(lineCount).append(": ").append(line).append("\n"); + sbMessage.append("Could not find card '").append("' at line ").append(lineCount).append(": ").append(line).append('\n'); } } else if (line.startsWith("NAME:")) { deckList.setName(line.substring(5, line.length())); diff --git a/Mage/src/main/java/mage/cards/decks/importer/DecDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/DecDeckImporter.java index 0dee3e9980..89a4b4d085 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/DecDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/DecDeckImporter.java @@ -57,7 +57,7 @@ public class DecDeckImporter extends DeckImporter { int num = Integer.parseInt(lineNum); CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(lineName, true); if (cardInfo == null) { - sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append("\n"); + sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append('\n'); } else { for (int i = 0; i < num; i++) { if (!sideboard) { @@ -68,7 +68,7 @@ public class DecDeckImporter extends DeckImporter { } } } catch (NumberFormatException nfe) { - sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append("\n"); + sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append('\n'); } } diff --git a/Mage/src/main/java/mage/cards/decks/importer/DekDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/DekDeckImporter.java index f66158ff34..36e3a3c5f3 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/DekDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/DekDeckImporter.java @@ -23,7 +23,7 @@ public class DekDeckImporter extends DeckImporter { Boolean isSideboard = "true".equals(extractAttribute(line, "Sideboard")); CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(cardName, true); if (cardInfo == null) { - sbMessage.append("Could not find card: '").append(cardName).append("' at line ").append(lineCount).append("\n"); + sbMessage.append("Could not find card: '").append(cardName).append("' at line ").append(lineCount).append('\n'); } else { for (int i = 0; i < cardCount; i++) { DeckCardInfo deckCardInfo = new DeckCardInfo(cardInfo.getName(), cardInfo.getCardNumber(), cardInfo.getSetCode()); @@ -35,7 +35,7 @@ public class DekDeckImporter extends DeckImporter { } } }catch (NumberFormatException nfe) { - sbMessage.append("Invalid number: ").append(extractAttribute(line, "Quantity")).append(" at line ").append(lineCount).append("\n"); + sbMessage.append("Invalid number: ").append(extractAttribute(line, "Quantity")).append(" at line ").append(lineCount).append('\n'); } } @@ -43,7 +43,7 @@ public class DekDeckImporter extends DeckImporter { private String extractAttribute(String line, String name) { String searchString = name+"=\""; int startDelim = line.indexOf(searchString)+searchString.length(); - int endDelim = line.substring(startDelim).indexOf("\""); + int endDelim = line.substring(startDelim).indexOf('\"'); return line.substring(startDelim, startDelim+endDelim); } diff --git a/Mage/src/main/java/mage/cards/decks/importer/MWSDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/MWSDeckImporter.java index fed0aa179f..797ff47ea5 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/MWSDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/MWSDeckImporter.java @@ -79,7 +79,7 @@ public class MWSDeckImporter extends DeckImporter { } if (cardInfo == null) { - sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append("\n"); + sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append('\n'); } else { for (int i = 0; i < num; i++) { if (!sideboard) { @@ -90,7 +90,7 @@ public class MWSDeckImporter extends DeckImporter { } } } catch (NumberFormatException nfe) { - sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append("\n"); + sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append('\n'); } } } diff --git a/Mage/src/main/java/mage/cards/decks/importer/TxtDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/TxtDeckImporter.java index 420553f0a9..089fbb1a6d 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/TxtDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/TxtDeckImporter.java @@ -89,7 +89,7 @@ public class TxtDeckImporter extends DeckImporter { int num = Integer.parseInt(lineNum.replaceAll("\\D+", "")); CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(lineName, true); if (cardInfo == null) { - sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append("\n"); + sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append('\n'); } else { for (int i = 0; i < num; i++) { if (!sideboard) { @@ -100,7 +100,7 @@ public class TxtDeckImporter extends DeckImporter { } } } catch (NumberFormatException nfe) { - sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append("\n"); + sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append('\n'); } } diff --git a/Mage/src/main/java/mage/cards/repository/CardInfo.java b/Mage/src/main/java/mage/cards/repository/CardInfo.java index 3358bfa1fe..36f106eee9 100644 --- a/Mage/src/main/java/mage/cards/repository/CardInfo.java +++ b/Mage/src/main/java/mage/cards/repository/CardInfo.java @@ -183,7 +183,7 @@ public class CardInfo { if (spellAbility != null) { SpellAbilityType spellAbilityType = spellAbility.getSpellAbilityType(); if (spellAbilityType == SpellAbilityType.SPLIT_LEFT || spellAbilityType == SpellAbilityType.SPLIT_RIGHT) { - this.className = this.setCode + "." + this.name; + this.className = this.setCode + '.' + this.name; this.splitCardHalf = true; } } diff --git a/Mage/src/main/java/mage/cards/repository/CardRepository.java b/Mage/src/main/java/mage/cards/repository/CardRepository.java index 0662049895..0c9ef48cdd 100644 --- a/Mage/src/main/java/mage/cards/repository/CardRepository.java +++ b/Mage/src/main/java/mage/cards/repository/CardRepository.java @@ -400,7 +400,7 @@ public enum CardRepository { try { String sqlName = name.toLowerCase().replaceAll("\'", "\'\'"); GenericRawResults rawResults = cardDao.queryRaw( - "select * from " + CardRepository.VERSION_ENTITY_NAME + " where lower(name) = '" + sqlName + "'", + "select * from " + CardRepository.VERSION_ENTITY_NAME + " where lower(name) = '" + sqlName + '\'', cardDao.getRawRowMapper()); List result = new ArrayList<>(); for (CardInfo cardinfo : rawResults) { diff --git a/Mage/src/main/java/mage/designations/Designation.java b/Mage/src/main/java/mage/designations/Designation.java index 81e5682194..5636a0a295 100644 --- a/Mage/src/main/java/mage/designations/Designation.java +++ b/Mage/src/main/java/mage/designations/Designation.java @@ -71,7 +71,7 @@ public abstract class Designation implements MageObject { @Override public String getIdName() { - return getName() + " [" + getId().toString().substring(0, 3) + "]"; + return getName() + " [" + getId().toString().substring(0, 3) + ']'; } @Override diff --git a/Mage/src/main/java/mage/filter/FilterAbility.java b/Mage/src/main/java/mage/filter/FilterAbility.java index 6051f26f58..d1d8db8870 100644 --- a/Mage/src/main/java/mage/filter/FilterAbility.java +++ b/Mage/src/main/java/mage/filter/FilterAbility.java @@ -80,7 +80,7 @@ public class FilterAbility extends FilterImpl { @Override public String toString() { - return "Zone(" + zone.toString() + ")"; + return "Zone(" + zone.toString() + ')'; } } diff --git a/Mage/src/main/java/mage/filter/predicate/Predicates.java b/Mage/src/main/java/mage/filter/predicate/Predicates.java index 103217fbf8..30ad5956a4 100644 --- a/Mage/src/main/java/mage/filter/predicate/Predicates.java +++ b/Mage/src/main/java/mage/filter/predicate/Predicates.java @@ -150,7 +150,7 @@ public final class Predicates { @Override public String toString() { - return "Not(" + predicate.toString() + ")"; + return "Not(" + predicate.toString() + ')'; } private static final long serialVersionUID = 0; } @@ -178,7 +178,7 @@ public final class Predicates { @Override public String toString() { - return "And(" + commaJoin(components) + ")"; + return "And(" + commaJoin(components) + ')'; } private static final long serialVersionUID = 0; } @@ -206,7 +206,7 @@ public final class Predicates { @Override public String toString() { - return "Or(" + commaJoin(components) + ")"; + return "Or(" + commaJoin(components) + ')'; } private static final long serialVersionUID = 0; } diff --git a/Mage/src/main/java/mage/filter/predicate/mageobject/CardIdPredicate.java b/Mage/src/main/java/mage/filter/predicate/mageobject/CardIdPredicate.java index 9eecf20a6d..34de046c35 100644 --- a/Mage/src/main/java/mage/filter/predicate/mageobject/CardIdPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/mageobject/CardIdPredicate.java @@ -51,6 +51,6 @@ public class CardIdPredicate implements Predicate { @Override public String toString() { - return "CardId(" + cardId.toString() + ")"; + return "CardId(" + cardId.toString() + ')'; } } diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/CanBeEnchantedByPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/CanBeEnchantedByPredicate.java index f9441f84d0..1852eca541 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/CanBeEnchantedByPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/CanBeEnchantedByPredicate.java @@ -50,6 +50,6 @@ public class CanBeEnchantedByPredicate implements Predicate { @Override public String toString() { - return "CanBeEnchanted(" + auraEnchantment.toString() + ")"; + return "CanBeEnchanted(" + auraEnchantment.toString() + ')'; } } diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/PermanentIdPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/PermanentIdPredicate.java index 268bcc305a..ec3b1231e4 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/PermanentIdPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/PermanentIdPredicate.java @@ -51,6 +51,6 @@ public class PermanentIdPredicate implements Predicate { @Override public String toString() { - return "PermanentId(" + permanentId + ")"; + return "PermanentId(" + permanentId + ')'; } } diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 68133f69ed..f24110ca59 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -780,19 +780,19 @@ public abstract class GameImpl implements Game, Serializable { } if (gameOver(null) && !isSimulation()) { winnerId = findWinnersAndLosers(); - StringBuilder sb = new StringBuilder("GAME END gameId: ").append(this.getId()).append(" "); + StringBuilder sb = new StringBuilder("GAME END gameId: ").append(this.getId()).append(' '); int count = 0; for (Player player : this.getState().getPlayers().values()) { if (count > 0) { sb.append(" - "); } - sb.append("[").append(player.getName()).append(" => "); + sb.append('[').append(player.getName()).append(" => "); sb.append(player.hasWon() ? "W" : ""); sb.append(player.hasLost() ? "L" : ""); sb.append(player.hasQuit() ? "Q" : ""); sb.append(player.hasIdleTimeout() ? "I" : ""); sb.append(player.hasTimerTimeout() ? "T" : ""); - sb.append("]"); + sb.append(']'); count++; } logger.info(sb.toString()); diff --git a/Mage/src/main/java/mage/game/GameTinyLeadersImpl.java b/Mage/src/main/java/mage/game/GameTinyLeadersImpl.java index 2a9405332f..70038ac643 100644 --- a/Mage/src/main/java/mage/game/GameTinyLeadersImpl.java +++ b/Mage/src/main/java/mage/game/GameTinyLeadersImpl.java @@ -94,7 +94,7 @@ public abstract class GameTinyLeadersImpl extends GameImpl { getState().getWatchers().add(watcher); watcher.addCardInfoToCommander(this); } else { - throw new UnknownError("Commander card could not be created. Name: [" + player.getMatchPlayer().getDeck().getName() + "]"); + throw new UnknownError("Commander card could not be created. Name: [" + player.getMatchPlayer().getDeck().getName() + ']'); } } diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java index 8156532bed..edd139d5ab 100644 --- a/Mage/src/main/java/mage/game/combat/Combat.java +++ b/Mage/src/main/java/mage/game/combat/Combat.java @@ -399,7 +399,7 @@ public class Combat implements Serializable, Copyable { if (!effect.canAttackCheckAfter(numberAttackers, ability, game)) { MageObject sourceObject = ability.getSourceObject(game); if (attackingPlayer.isHuman()) { - game.informPlayer(attackingPlayer, attackingCreature.getIdName() + " can't attack this way (" + (sourceObject == null ? "null" : sourceObject.getIdName()) + ")"); + game.informPlayer(attackingPlayer, attackingCreature.getIdName() + " can't attack this way (" + (sourceObject == null ? "null" : sourceObject.getIdName()) + ')'); return false; } else { // remove attacking creatures for AI that are not allowed to attack @@ -504,7 +504,7 @@ public class Combat implements Serializable, Copyable { if (attackingCreature != null) { sb.append("Attacker: "); sb.append(attackingCreature.getLogName()).append(" ("); - sb.append(attackingCreature.getPower().getValue()).append("/").append(attackingCreature.getToughness().getValue()).append(") "); + sb.append(attackingCreature.getPower().getValue()).append('/').append(attackingCreature.getToughness().getValue()).append(") "); } else { // creature left battlefield attackingCreature = (Permanent) game.getLastKnownInformation(attackingCreatureId, Zone.BATTLEFIELD); @@ -520,7 +520,7 @@ public class Combat implements Serializable, Copyable { Permanent blockingCreature = game.getPermanent(blockingCreatureId); if (blockingCreature != null) { sb.append(blockingCreature.getLogName()).append(" ("); - sb.append(blockingCreature.getPower().getValue()).append("/").append(blockingCreature.getToughness().getValue()).append(") "); + sb.append(blockingCreature.getPower().getValue()).append('/').append(blockingCreature.getToughness().getValue()).append(") "); } } @@ -782,7 +782,7 @@ public class Combat implements Serializable, Copyable { possibleBlockerId, toBeBlockedCreatureId, mustBeBlockedByAtLeastOne, game); if (blockRequiredMessage != null) { // message means not required removeBlocker(possibleBlockerId, game); - game.informPlayer(controller, blockRequiredMessage + " Existing block removed. It's a requirement to block " + toBeBlockedCreature.getIdName() + "."); + game.informPlayer(controller, blockRequiredMessage + " Existing block removed. It's a requirement to block " + toBeBlockedCreature.getIdName() + '.'); return false; } } @@ -894,7 +894,7 @@ public class Combat implements Serializable, Copyable { } if (!blockIsValid) { - sb.append(" ").append(creatureForcedToBlock.getIdName()); + sb.append(' ').append(creatureForcedToBlock.getIdName()); } } if (sb.length() > 0) { diff --git a/Mage/src/main/java/mage/game/command/Commander.java b/Mage/src/main/java/mage/game/command/Commander.java index d31721b97b..2c77772d72 100644 --- a/Mage/src/main/java/mage/game/command/Commander.java +++ b/Mage/src/main/java/mage/game/command/Commander.java @@ -96,7 +96,7 @@ public class Commander implements CommandObject { @Override public String getIdName() { - return sourceObject.getName() + " [" + sourceObject.getId().toString().substring(0, 3) + "]"; + return sourceObject.getName() + " [" + sourceObject.getId().toString().substring(0, 3) + ']'; } @Override diff --git a/Mage/src/main/java/mage/game/command/Emblem.java b/Mage/src/main/java/mage/game/command/Emblem.java index 8501b2ea72..debb77a5bc 100644 --- a/Mage/src/main/java/mage/game/command/Emblem.java +++ b/Mage/src/main/java/mage/game/command/Emblem.java @@ -129,7 +129,7 @@ public class Emblem implements CommandObject { @Override public String getIdName() { - return getName() + " [" + getId().toString().substring(0, 3) + "]"; + return getName() + " [" + getId().toString().substring(0, 3) + ']'; } @Override diff --git a/Mage/src/main/java/mage/game/draft/DraftCube.java b/Mage/src/main/java/mage/game/draft/DraftCube.java index dc72fb3cf0..b120bb0a94 100644 --- a/Mage/src/main/java/mage/game/draft/DraftCube.java +++ b/Mage/src/main/java/mage/game/draft/DraftCube.java @@ -119,11 +119,11 @@ public abstract class DraftCube { booster.add(cardInfo.getCard()); done = true; } else { - logger.warn(new StringBuilder(this.getName()).append(" - Card not found: ").append(cardId.getName()).append(":").append(cardId.extension)); + logger.warn(new StringBuilder(this.getName()).append(" - Card not found: ").append(cardId.getName()).append(':').append(cardId.extension)); notValid++; } } else { - logger.error(new StringBuilder(this.getName()).append(" - Empty card name: ").append(cardId.getName()).append(":").append(cardId.extension)); + logger.error(new StringBuilder(this.getName()).append(" - Empty card name: ").append(cardId.getName()).append(':').append(cardId.extension)); notValid++; } diff --git a/Mage/src/main/java/mage/game/match/MatchImpl.java b/Mage/src/main/java/mage/game/match/MatchImpl.java index 28118e7548..4f52db281e 100644 --- a/Mage/src/main/java/mage/game/match/MatchImpl.java +++ b/Mage/src/main/java/mage/game/match/MatchImpl.java @@ -290,13 +290,13 @@ public abstract class MatchImpl implements Match { String duelingTime = ""; 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) + ')'; } state = "Finished" + duelingTime; 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) + ')'; } state = "Dueling" + duelingTime; result = ""; diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index b8a2194209..3d93c69198 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -189,7 +189,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { @Override public String toString() { StringBuilder sb = threadLocalBuilder.get(); - sb.append(this.name).append("-").append(this.expansionSetCode); + sb.append(this.name).append('-').append(this.expansionSetCode); if (copy) { sb.append(" [Copy]"); } diff --git a/Mage/src/main/java/mage/game/permanent/token/Token.java b/Mage/src/main/java/mage/game/permanent/token/Token.java index 1c7845f5f0..ef5f13c824 100644 --- a/Mage/src/main/java/mage/game/permanent/token/Token.java +++ b/Mage/src/main/java/mage/game/permanent/token/Token.java @@ -130,7 +130,7 @@ public class Token extends MageObjectImpl { String subtype = this.subtype.toString().replaceAll("[^a-zA-Z0-9]", ""); String cardType = this.cardType.toString().replaceAll("[^a-zA-Z0-9]", ""); String originalset = this.getOriginalExpansionSetCode(); - String descriptor = name + "." + color + "." + subtype + "." + cardType + "." + this.power + "." + this.toughness; + String descriptor = name + '.' + color + '.' + subtype + '.' + cardType + '.' + this.power + '.' + this.toughness; descriptor = descriptor.toUpperCase(); return descriptor; } diff --git a/Mage/src/main/java/mage/game/permanent/token/ZombieToken2.java b/Mage/src/main/java/mage/game/permanent/token/ZombieToken2.java index 0b6967692e..fa95c4f401 100644 --- a/Mage/src/main/java/mage/game/permanent/token/ZombieToken2.java +++ b/Mage/src/main/java/mage/game/permanent/token/ZombieToken2.java @@ -41,7 +41,7 @@ public class ZombieToken2 extends Token { } public ZombieToken2(int zPower, int zToughness) { - super("Zombie", String.valueOf(zPower) + "/" + String.valueOf(zToughness) + " black Zombie creature token"); + super("Zombie", String.valueOf(zPower) + '/' + String.valueOf(zToughness) + " black Zombie creature token"); cardType.add(CardType.CREATURE); color.setBlack(true); subtype.add("Zombie"); diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index bd421709e6..38c49d6ded 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -427,7 +427,7 @@ public class Spell extends StackObjImpl implements Card { } else { idName = getId().toString().substring(0, 3); } - return getName() + " [" + idName + "]"; + return getName() + " [" + idName + ']'; } @Override diff --git a/Mage/src/main/java/mage/game/stack/StackAbility.java b/Mage/src/main/java/mage/game/stack/StackAbility.java index 98a45a40ad..2ba1f248d6 100644 --- a/Mage/src/main/java/mage/game/stack/StackAbility.java +++ b/Mage/src/main/java/mage/game/stack/StackAbility.java @@ -87,7 +87,7 @@ public class StackAbility extends StackObjImpl implements Ability { public StackAbility(Ability ability, UUID controllerId) { this.ability = ability; this.controllerId = controllerId; - this.name = "stack ability (" + ability.getRule() + ")"; + this.name = "stack ability (" + ability.getRule() + ')'; } public StackAbility(final StackAbility stackAbility) { @@ -142,7 +142,7 @@ public class StackAbility extends StackObjImpl implements Ability { @Override public String getIdName() { - return getName() + " [" + getId().toString().substring(0, 3) + "]"; + return getName() + " [" + getId().toString().substring(0, 3) + ']'; } @Override diff --git a/Mage/src/main/java/mage/game/stack/StackObjImpl.java b/Mage/src/main/java/mage/game/stack/StackObjImpl.java index d0012217a7..9d175b0599 100644 --- a/Mage/src/main/java/mage/game/stack/StackObjImpl.java +++ b/Mage/src/main/java/mage/game/stack/StackObjImpl.java @@ -165,7 +165,7 @@ public abstract class StackObjImpl implements StackObject { // change the target? Outcome outcome = mode.getEffects().isEmpty() ? Outcome.Detriment : mode.getEffects().get(0).getOutcome(); if (targetNames != null - && (forceChange || targetController.chooseUse(outcome, "Change this target: " + targetNames + "?", ability, game))) { + && (forceChange || targetController.chooseUse(outcome, "Change this target: " + targetNames + '?', ability, game))) { Set possibleTargets = target.possibleTargets(this.getSourceId(), getControllerId(), game); // choose exactly one other target - already targeted objects are not counted if (forceChange && possibleTargets != null && possibleTargets.size() > 1) { // controller of spell must be used (e.g. TargetOpponent) @@ -182,7 +182,7 @@ public abstract class StackObjImpl implements StackObject { if (newTarget.getFirstTarget() != null && filterNewTarget != null) { Permanent newTargetPermanent = game.getPermanent(newTarget.getFirstTarget()); if (newTargetPermanent == null || !filterNewTarget.match(newTargetPermanent, game)) { - game.informPlayer(targetController, "Target does not fullfil the target requirements (" + filterNewTarget.getMessage() + ")"); + game.informPlayer(targetController, "Target does not fullfil the target requirements (" + filterNewTarget.getMessage() + ')'); newTarget.clearChosen(); } } @@ -235,7 +235,7 @@ public abstract class StackObjImpl implements StackObject { } else if (newTarget.getFirstTarget() != null && filterNewTarget != null) { Permanent newTargetPermanent = game.getPermanent(newTarget.getFirstTarget()); if (newTargetPermanent == null || !filterNewTarget.match(newTargetPermanent, game)) { - game.informPlayer(targetController, "This target does not fullfil the target requirements (" + filterNewTarget.getMessage() + ")"); + game.informPlayer(targetController, "This target does not fullfil the target requirements (" + filterNewTarget.getMessage() + ')'); again = true; } } else { diff --git a/Mage/src/main/java/mage/game/tournament/TournamentImpl.java b/Mage/src/main/java/mage/game/tournament/TournamentImpl.java index eecd485654..a227b82421 100644 --- a/Mage/src/main/java/mage/game/tournament/TournamentImpl.java +++ b/Mage/src/main/java/mage/game/tournament/TournamentImpl.java @@ -329,7 +329,7 @@ public abstract class TournamentImpl implements Tournament { } } for (TournamentPlayer tp : round.getPlayerByes()) { - tp.setResults(new StringBuilder(tp.getResults()).append("R").append(round.getRoundNumber()).append(" ").append("Bye ").toString()); + tp.setResults(new StringBuilder(tp.getResults()).append('R').append(round.getRoundNumber()).append(' ').append("Bye ").toString()); tp.setPoints(tp.getPoints() + 3); } } @@ -337,7 +337,7 @@ public abstract class TournamentImpl implements Tournament { private static String addRoundResult(int round, TournamentPairing pair, TournamentPlayer tournamentPlayer, TournamentPlayer opponentPlayer) { StringBuilder playerResult = new StringBuilder(tournamentPlayer.getResults()); - playerResult.append("R").append(round).append(" "); + playerResult.append('R').append(round).append(' '); playerResult.append(getMatchResultString(tournamentPlayer, opponentPlayer, pair.getMatch())); return playerResult.toString(); } @@ -352,9 +352,9 @@ public abstract class TournamentImpl implements Tournament { matchResult.append(mp1.getPlayer().hasIdleTimeout() ? "I" : (mp1.getPlayer().hasTimerTimeout() ? "T" : "Q")); } if (match.getDraws() > 0) { - matchResult.append("-").append(match.getDraws()); + matchResult.append('-').append(match.getDraws()); } - matchResult.append("-").append(mp2.getWins()); + matchResult.append('-').append(mp2.getWins()); if (mp2.hasQuit()) { matchResult.append(mp2.getPlayer().hasIdleTimeout() ? "I" : (mp2.getPlayer().hasTimerTimeout() ? "T" : "Q")); } diff --git a/Mage/src/main/java/mage/game/turn/Turn.java b/Mage/src/main/java/mage/game/turn/Turn.java index bf2dc0a872..c4c635b278 100644 --- a/Mage/src/main/java/mage/game/turn/Turn.java +++ b/Mage/src/main/java/mage/game/turn/Turn.java @@ -328,17 +328,17 @@ public class Turn implements Serializable { public String getValue(int turnNum) { StringBuilder sb = threadLocalBuilder.get(); - sb.append("[").append(turnNum) - .append(":").append(currentPhase.getType()) - .append(":").append(currentPhase.getStep().getType()) - .append("]"); + sb.append('[').append(turnNum) + .append(':').append(currentPhase.getType()) + .append(':').append(currentPhase.getStep().getType()) + .append(']'); return sb.toString(); } private void logStartOfTurn(Game game, Player player) { StringBuilder sb = new StringBuilder(game.getState().isExtraTurn() ? "Extra turn" : "Turn "); - sb.append(game.getState().getTurnNum()).append(" "); + sb.append(game.getState().getTurnNum()).append(' '); sb.append(player.getLogName()); sb.append(" ("); int delimiter = game.getPlayers().size() - 1; @@ -346,14 +346,14 @@ public class Turn implements Serializable { sb.append(gamePlayer.getLife()); int poison = gamePlayer.getCounters().getCount(CounterType.POISON); if (poison > 0) { - sb.append("[P:").append(poison).append("]"); + sb.append("[P:").append(poison).append(']'); } if (delimiter > 0) { sb.append(" - "); delimiter--; } } - sb.append(")"); + sb.append(')'); game.fireStatusEvent(sb.toString(), true); } } diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 0b84f713b1..f9bc0cb6ae 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -944,7 +944,7 @@ public abstract class PlayerImpl implements Player, Serializable { result = cast(card.getSpellAbility(), game, noMana); } if (!result) { - game.informPlayer(this, "You can't play " + card.getIdName() + "."); + game.informPlayer(this, "You can't play " + card.getIdName() + '.'); } return result; } @@ -1504,7 +1504,7 @@ public abstract class PlayerImpl implements Player, Serializable { if (effectSource != null) { sb.append(" from ").append(effectSource.getLogName()); } - sb.append(")"); + sb.append(')'); filter.setMessage(sb.toString()); Target target = new TargetPermanent(1, 1, filter, true); if (!this.chooseTarget(Outcome.Untap, target, ability, game)) { @@ -3217,7 +3217,7 @@ public abstract class PlayerImpl implements Player, Serializable { if (!game.isSimulation()) { game.informPlayers(getLogName() + " puts " + (withName ? card.getLogName() : (card.isFaceDown(game) ? "a face down card" : "a card")) - + " from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + " " + + " from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + ' ' + (card.getOwnerId().equals(this.getId()) ? "into his or her hand" : "into its owner's hand") ); } @@ -3306,8 +3306,8 @@ public abstract class PlayerImpl implements Player, Serializable { card = game.getCard(card.getId()); } StringBuilder sb = new StringBuilder(this.getLogName()) - .append(" puts ").append(card.getLogName()).append(" ").append(card.isCopy() ? "(Copy) " : "") - .append(fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + " " : ""); + .append(" puts ").append(card.getLogName()).append(' ').append(card.isCopy() ? "(Copy) " : "") + .append(fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + ' ' : ""); if (card.getOwnerId().equals(getId())) { sb.append("into his or her graveyard"); } else { @@ -3332,9 +3332,9 @@ public abstract class PlayerImpl implements Player, Serializable { card = game.getCard(card.getId()); } StringBuilder sb = new StringBuilder(this.getLogName()) - .append(" puts ").append(withName ? card.getLogName() : "a card").append(" "); + .append(" puts ").append(withName ? card.getLogName() : "a card").append(' '); if (fromZone != null) { - sb.append("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" "); + sb.append("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(' '); } sb.append("to the ").append(toTop ? "top" : "bottom"); if (card.getOwnerId().equals(getId())) { @@ -3367,8 +3367,8 @@ public abstract class PlayerImpl implements Player, Serializable { card = basicCard; } } - game.informPlayers(this.getLogName() + " moves " + (withName ? card.getLogName() + (card.isCopy() ? " (Copy)" : "") : "a card face down") + " " - + (fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + " " : "") + "to the exile zone"); + game.informPlayers(this.getLogName() + " moves " + (withName ? card.getLogName() + (card.isCopy() ? " (Copy)" : "") : "a card face down") + ' ' + + (fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + ' ' : "") + "to the exile zone"); } result = true; } diff --git a/Mage/src/main/java/mage/target/TargetImpl.java b/Mage/src/main/java/mage/target/TargetImpl.java index 0bd012dd1b..38996f4128 100644 --- a/Mage/src/main/java/mage/target/TargetImpl.java +++ b/Mage/src/main/java/mage/target/TargetImpl.java @@ -132,9 +132,9 @@ public abstract class TargetImpl implements Target { StringBuilder sb = new StringBuilder(); sb.append("Select ").append(targetName); if (getMaxNumberOfTargets() > 0 && getMaxNumberOfTargets() != Integer.MAX_VALUE) { - sb.append(" (").append(targets.size()).append("/").append(getMaxNumberOfTargets()).append(")"); + sb.append(" (").append(targets.size()).append('/').append(getMaxNumberOfTargets()).append(')'); } else { - sb.append(" (").append(targets.size()).append(")"); + sb.append(" (").append(targets.size()).append(')'); } sb.append(suffix); return sb.toString(); diff --git a/Mage/src/main/java/mage/target/TargetObject.java b/Mage/src/main/java/mage/target/TargetObject.java index bc34fea778..1066f80d14 100644 --- a/Mage/src/main/java/mage/target/TargetObject.java +++ b/Mage/src/main/java/mage/target/TargetObject.java @@ -69,7 +69,7 @@ public abstract class TargetObject extends TargetImpl { for (UUID targetId: getTargets()) { MageObject object = game.getObject(targetId); if (object != null) { - sb.append(object.getLogName()).append(" "); + sb.append(object.getLogName()).append(' '); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/target/TargetPlayer.java b/Mage/src/main/java/mage/target/TargetPlayer.java index 64430423e6..d70085d98a 100644 --- a/Mage/src/main/java/mage/target/TargetPlayer.java +++ b/Mage/src/main/java/mage/target/TargetPlayer.java @@ -197,7 +197,7 @@ public class TargetPlayer extends TargetImpl { for (UUID targetId : getTargets()) { Player player = game.getPlayer(targetId); if (player != null) { - sb.append(player.getLogName()).append(" "); + sb.append(player.getLogName()).append(' '); } else { sb.append("[target missing]"); } diff --git a/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java b/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java index 1ed9374721..5056610f74 100644 --- a/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java +++ b/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java @@ -115,10 +115,10 @@ public class TargetActivatedAbility extends TargetObject { for (UUID targetId : getTargets()) { StackAbility object = (StackAbility) game.getObject(targetId); if (object != null) { - sb.append(object.getRule()).append(" "); + sb.append(object.getRule()).append(' '); } } - sb.append(")"); + sb.append(')'); return sb.toString(); } } diff --git a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlaneswalkerAmount.java b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlaneswalkerAmount.java index 1cefb2098f..b373715695 100644 --- a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlaneswalkerAmount.java +++ b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlaneswalkerAmount.java @@ -165,7 +165,7 @@ for (UUID targetId : getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append("(").append(getTargetAmount(targetId)).append(") "); + sb.append(permanent.getLogName()).append('(').append(getTargetAmount(targetId)).append(") "); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayer.java b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayer.java index a7a3b87318..54151a5b88 100644 --- a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayer.java +++ b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayer.java @@ -229,11 +229,11 @@ public class TargetCreatureOrPlayer extends TargetImpl { for (UUID targetId : getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append(" "); + sb.append(permanent.getLogName()).append(' '); } else { Player player = game.getPlayer(targetId); if (player != null) { - sb.append(player.getLogName()).append(" "); + sb.append(player.getLogName()).append(' '); } } } diff --git a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayerAmount.java b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayerAmount.java index 1c7d8b970e..60a8d04ee7 100644 --- a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayerAmount.java +++ b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayerAmount.java @@ -201,10 +201,10 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount { for (UUID targetId : getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append("(").append(getTargetAmount(targetId)).append(") "); + sb.append(permanent.getLogName()).append('(').append(getTargetAmount(targetId)).append(") "); } else { Player player = game.getPlayer(targetId); - sb.append(player.getLogName()).append("(").append(getTargetAmount(targetId)).append(") "); + sb.append(player.getLogName()).append('(').append(getTargetAmount(targetId)).append(") "); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/target/common/TargetCreaturePermanentAmount.java b/Mage/src/main/java/mage/target/common/TargetCreaturePermanentAmount.java index 430126b7db..06491ad922 100644 --- a/Mage/src/main/java/mage/target/common/TargetCreaturePermanentAmount.java +++ b/Mage/src/main/java/mage/target/common/TargetCreaturePermanentAmount.java @@ -163,7 +163,7 @@ public class TargetCreaturePermanentAmount extends TargetAmount { for (UUID targetId : getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append("(").append(getTargetAmount(targetId)).append(") "); + sb.append(permanent.getLogName()).append('(').append(getTargetAmount(targetId)).append(") "); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/target/common/TargetDefender.java b/Mage/src/main/java/mage/target/common/TargetDefender.java index 55717c19ac..24f8ace2c2 100644 --- a/Mage/src/main/java/mage/target/common/TargetDefender.java +++ b/Mage/src/main/java/mage/target/common/TargetDefender.java @@ -170,11 +170,11 @@ public class TargetDefender extends TargetImpl { for (UUID targetId: getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getName()).append(" "); + sb.append(permanent.getName()).append(' '); } else { Player player = game.getPlayer(targetId); - sb.append(player.getLogName()).append(" "); + sb.append(player.getLogName()).append(' '); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java index c7317b02c4..0555610187 100644 --- a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java +++ b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java @@ -242,11 +242,11 @@ public class TargetPermanentOrPlayer extends TargetImpl { for (UUID targetId: getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append(" "); + sb.append(permanent.getLogName()).append(' '); } else { Player player = game.getPlayer(targetId); - sb.append(player.getLogName()).append(" "); + sb.append(player.getLogName()).append(' '); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/target/common/TargetPermanentOrSuspendedCard.java b/Mage/src/main/java/mage/target/common/TargetPermanentOrSuspendedCard.java index 40022b8909..470472c495 100644 --- a/Mage/src/main/java/mage/target/common/TargetPermanentOrSuspendedCard.java +++ b/Mage/src/main/java/mage/target/common/TargetPermanentOrSuspendedCard.java @@ -158,11 +158,11 @@ public class TargetPermanentOrSuspendedCard extends TargetImpl { for (UUID targetId : this.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append(" "); + sb.append(permanent.getLogName()).append(' '); } else { Card card = game.getExile().getCard(targetId, game); if (card != null) { - sb.append(card.getLogName()).append(" "); + sb.append(card.getLogName()).append(' '); } } } diff --git a/Mage/src/main/java/mage/target/common/TargetSpellOrPermanent.java b/Mage/src/main/java/mage/target/common/TargetSpellOrPermanent.java index 95e612cd82..50ced1b860 100644 --- a/Mage/src/main/java/mage/target/common/TargetSpellOrPermanent.java +++ b/Mage/src/main/java/mage/target/common/TargetSpellOrPermanent.java @@ -245,13 +245,13 @@ public class TargetSpellOrPermanent extends TargetImpl { for (UUID targetId : getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append(" "); + sb.append(permanent.getLogName()).append(' '); } else { Spell spell = game.getStack().getSpell(targetId); if (spell.isFaceDown(game)) { sb.append(GameLog.getNeutralColoredText("face down spell")); } else { - sb.append(spell.getLogName()).append(" "); + sb.append(spell.getLogName()).append(' '); } } } diff --git a/Mage/src/main/java/mage/util/ClassScanner.java b/Mage/src/main/java/mage/util/ClassScanner.java index ad672ca1a7..dd1987b542 100644 --- a/Mage/src/main/java/mage/util/ClassScanner.java +++ b/Mage/src/main/java/mage/util/ClassScanner.java @@ -69,7 +69,7 @@ public class ClassScanner { URL resource = resources.nextElement(); String filePath = resource.getFile(); if (filePath.startsWith("file:")) { - filePath = filePath.substring("file:".length(), filePath.lastIndexOf("!")); + filePath = filePath.substring("file:".length(), filePath.lastIndexOf('!')); jars.add(filePath); } else { dirs.put(filePath, packageName); diff --git a/Mage/src/main/java/mage/util/DateFormat.java b/Mage/src/main/java/mage/util/DateFormat.java index 83252544df..2bd324e85c 100644 --- a/Mage/src/main/java/mage/util/DateFormat.java +++ b/Mage/src/main/java/mage/util/DateFormat.java @@ -61,13 +61,13 @@ public class DateFormat { 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(); diff --git a/Mage/src/main/java/mage/util/ManaUtil.java b/Mage/src/main/java/mage/util/ManaUtil.java index b617d82a04..2221ebf406 100644 --- a/Mage/src/main/java/mage/util/ManaUtil.java +++ b/Mage/src/main/java/mage/util/ManaUtil.java @@ -468,7 +468,7 @@ public class ManaUtil { // Combine the cost back as a mana string StringBuilder sb = new StringBuilder(); for (String s : finalCost) { - sb.append("{" + s + "}"); + sb.append('{' + s + '}'); } // Return the condensed string return sb.toString(); diff --git a/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java b/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java index e458b1d756..3f4b4f90fd 100644 --- a/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java @@ -110,15 +110,15 @@ public class CommanderInfoWatcher extends Watcher { sb.append("Commander"); Integer castCount = (Integer) game.getState().getValue(sourceId + "_castCount"); if (castCount != null) { - sb.append(" ").append(castCount).append(castCount == 1 ? " time" : " times").append(" casted from the command zone."); + sb.append(' ').append(castCount).append(castCount == 1 ? " time" : " times").append(" casted from the command zone."); } this.addInfo(object, "Commander", sb.toString(), game); if (checkCommanderDamage) { for (Map.Entry entry : damageToPlayer.entrySet()) { Player damagedPlayer = game.getPlayer(entry.getKey()); - sb.append("Commander did ").append(entry.getValue()).append(" combat damage to player ").append(damagedPlayer.getLogName()).append("."); + sb.append("Commander did ").append(entry.getValue()).append(" combat damage to player ").append(damagedPlayer.getLogName()).append('.'); this.addInfo(object, "Commander" + entry.getKey(), - "Commander did " + entry.getValue() + " combat damage to player " + damagedPlayer.getLogName() + ".", game); + "Commander did " + entry.getValue() + " combat damage to player " + damagedPlayer.getLogName() + '.', game); } } } From fc54c0156ca75af3c0bacadbd2cba7da2338e906 Mon Sep 17 00:00:00 2001 From: vraskulin Date: Fri, 27 Jan 2017 16:04:56 +0300 Subject: [PATCH 04/12] list.size > 0 changed to !list.isEmpty We care about if it's empty or not, not about it's size --- .../src/main/java/mage/client/cards/Card.java | 12 +++--- .../main/java/mage/client/cards/CardArea.java | 2 +- .../main/java/mage/client/cards/Cards.java | 2 +- .../java/mage/client/cards/CardsList.java | 2 +- .../java/mage/client/cards/DragCardGrid.java | 6 +-- .../java/mage/client/cards/Permanent.java | 4 +- .../mage/client/components/MageTextArea.java | 2 +- .../components/ability/AbilityPicker.java | 2 +- .../client/deckeditor/table/CardHelper.java | 2 +- .../client/dialog/CardInfoWindowDialog.java | 2 +- .../mage/client/dialog/NewTableDialog.java | 2 +- .../client/dialog/NewTournamentDialog.java | 4 +- .../main/java/mage/client/game/GamePanel.java | 8 ++-- .../java/mage/client/table/TablesPanel.java | 2 +- .../java/mage/client/util/ImageHelper.java | 2 +- .../mage/client/util/MageTableRowSorter.java | 2 +- .../mage/client/util/gui/ArrowBuilder.java | 2 +- .../mage/client/util/gui/GuiDisplayUtil.java | 6 +-- .../client/util/stats/UpdateMemUsageTask.java | 2 +- .../java/org/mage/card/arcane/CardPanel.java | 6 +-- .../org/mage/card/arcane/CardRenderer.java | 2 +- .../org/mage/card/arcane/TextboxRule.java | 2 +- .../org/mage/plugins/card/CardPluginImpl.java | 4 +- Mage.Common/src/mage/constants/Constants.java | 2 +- Mage.Common/src/mage/view/CardView.java | 2 +- Mage.Common/src/mage/view/CardsView.java | 2 +- Mage.Common/src/mage/view/ChatMessage.java | 6 +-- Mage.Common/src/mage/view/GameView.java | 2 +- Mage.Common/src/mage/view/MatchView.java | 2 +- Mage.Common/src/mage/view/PermanentView.java | 2 +- Mage.Common/src/mage/view/PlayerView.java | 2 +- .../src/mage/view/StackAbilityView.java | 4 +- .../src/mage/player/ai/ComputerPlayer6.java | 22 +++++----- .../src/mage/player/ai/ComputerPlayer7.java | 14 +++---- .../src/mage/player/ai/SimulatedAction2.java | 2 +- .../src/mage/player/ai/SimulatedPlayer2.java | 6 +-- .../java/mage/player/ai/ComputerPlayer.java | 40 +++++++++---------- .../src/mage/player/ai/MCTSPlayer.java | 6 +-- .../mage/player/ai/SimulatedPlayerMCTS.java | 4 +- .../src/mage/player/ai/ComputerPlayer2.java | 16 ++++---- .../src/mage/player/ai/ComputerPlayer3.java | 10 ++--- .../src/mage/player/ai/SimulatedAction.java | 2 +- .../src/mage/player/ai/SimulatedPlayer.java | 4 +- .../src/mage/player/human/HumanPlayer.java | 10 ++--- .../src/main/java/mage/server/User.java | 6 +-- .../java/mage/server/game/GameController.java | 4 +- .../mage/server/game/GameSessionPlayer.java | 3 +- Mage.Sets/src/mage/cards/a/ActOnImpulse.java | 2 +- .../src/mage/cards/a/AgonizingMemories.java | 2 +- Mage.Sets/src/mage/cards/a/AladdinsLamp.java | 2 +- .../src/mage/cards/a/AltarOfDementia.java | 2 +- .../src/mage/cards/a/AmassTheComponents.java | 2 +- .../src/mage/cards/a/AncestralMemories.java | 2 +- .../src/mage/cards/a/AngelOfSerenity.java | 6 +-- .../src/mage/cards/a/AngelicArbiter.java | 2 +- .../src/mage/cards/a/AnimalBoneyard.java | 2 +- .../src/mage/cards/a/AnimationModule.java | 4 +- .../src/mage/cards/a/AnimistsAwakening.java | 2 +- .../src/mage/cards/a/AnyaMercilessAngel.java | 2 +- .../src/mage/cards/b/BaneAlleyBroker.java | 4 +- Mage.Sets/src/mage/cards/b/BirthingPod.java | 2 +- .../src/mage/cards/b/BitterRevelation.java | 2 +- .../mage/cards/b/BlessedReincarnation.java | 2 +- .../src/mage/cards/b/BorderlandExplorer.java | 2 +- Mage.Sets/src/mage/cards/b/BrionStoutarm.java | 2 +- Mage.Sets/src/mage/cards/b/Browse.java | 2 +- .../src/mage/cards/c/ChandraPyromaster.java | 2 +- Mage.Sets/src/mage/cards/c/ChimneyImp.java | 2 +- .../src/mage/cards/c/ChitteringRats.java | 2 +- Mage.Sets/src/mage/cards/c/ChromeMox.java | 6 +-- .../mage/cards/c/CircleOfProtectionWhite.java | 2 +- Mage.Sets/src/mage/cards/c/CitanulFlute.java | 2 +- Mage.Sets/src/mage/cards/c/Clockspinning.java | 4 +- Mage.Sets/src/mage/cards/c/CloneShell.java | 4 +- Mage.Sets/src/mage/cards/c/CobraTrap.java | 2 +- Mage.Sets/src/mage/cards/c/Conflux.java | 10 ++--- .../src/mage/cards/c/CongregationAtDawn.java | 2 +- .../src/mage/cards/c/CorpseConnoisseur.java | 2 +- .../src/mage/cards/c/CorruptedGrafstone.java | 2 +- Mage.Sets/src/mage/cards/c/Cultivate.java | 2 +- Mage.Sets/src/mage/cards/c/CurseOfChaos.java | 2 +- Mage.Sets/src/mage/cards/c/CurseOfEchoes.java | 2 +- Mage.Sets/src/mage/cards/c/CursedScroll.java | 2 +- .../src/mage/cards/d/DanceOfTheDead.java | 2 +- .../src/mage/cards/d/DarkSupplicant.java | 2 +- Mage.Sets/src/mage/cards/d/DarthTyranus.java | 2 +- .../src/mage/cards/d/DementiaSliver.java | 2 +- .../src/mage/cards/d/DeployTheGatewatch.java | 2 +- .../mage/cards/d/DescendantOfMasumaro.java | 4 +- .../src/mage/cards/d/DevoutInvocation.java | 2 +- Mage.Sets/src/mage/cards/d/DimirCharm.java | 2 +- .../src/mage/cards/d/DimirMachinations.java | 2 +- .../cards/d/DivergentTransformations.java | 2 +- Mage.Sets/src/mage/cards/d/Dracoplasm.java | 2 +- Mage.Sets/src/mage/cards/d/DralnusPet.java | 2 +- Mage.Sets/src/mage/cards/d/Duplicant.java | 2 +- .../src/mage/cards/e/EldritchEvolution.java | 2 +- Mage.Sets/src/mage/cards/e/EliteArcanist.java | 2 +- .../src/mage/cards/e/EndlessHorizons.java | 2 +- .../src/mage/cards/e/EpicExperiment.java | 2 +- Mage.Sets/src/mage/cards/e/Excavator.java | 4 +- .../src/mage/cards/e/ExclusionRitual.java | 2 +- Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java | 2 +- Mage.Sets/src/mage/cards/f/Firestorm.java | 2 +- .../src/mage/cards/f/FlamesOfRemembrance.java | 2 +- Mage.Sets/src/mage/cards/f/Fleshwrither.java | 2 +- Mage.Sets/src/mage/cards/f/Fling.java | 2 +- .../src/mage/cards/f/ForbiddenAlchemy.java | 2 +- Mage.Sets/src/mage/cards/f/ForkInTheRoad.java | 4 +- Mage.Sets/src/mage/cards/f/FriendlyFire.java | 2 +- Mage.Sets/src/mage/cards/f/FromTheAshes.java | 2 +- Mage.Sets/src/mage/cards/g/GaeasCradle.java | 2 - .../src/mage/cards/g/GallowsAtWillowHill.java | 2 +- .../src/mage/cards/g/GarrukTheVeilCursed.java | 2 +- Mage.Sets/src/mage/cards/g/GatherThePack.java | 4 +- Mage.Sets/src/mage/cards/g/GenesisHydra.java | 2 +- Mage.Sets/src/mage/cards/g/GenesisWave.java | 2 +- Mage.Sets/src/mage/cards/g/GhastlyDemise.java | 2 +- Mage.Sets/src/mage/cards/g/GiftsUngiven.java | 2 +- .../src/mage/cards/g/GlimpseTheFuture.java | 2 +- Mage.Sets/src/mage/cards/g/Godsend.java | 2 +- Mage.Sets/src/mage/cards/g/GrinningTotem.java | 2 +- Mage.Sets/src/mage/cards/g/GripOfChaos.java | 2 +- Mage.Sets/src/mage/cards/g/Grozoth.java | 2 +- Mage.Sets/src/mage/cards/g/GurmagDrowner.java | 2 +- .../src/mage/cards/h/HarmonyOfNature.java | 2 +- Mage.Sets/src/mage/cards/h/HeartOfKiran.java | 2 +- .../src/mage/cards/h/HellcarverDemon.java | 2 +- Mage.Sets/src/mage/cards/h/HeroesPodium.java | 2 +- Mage.Sets/src/mage/cards/h/HiredTorturer.java | 2 +- Mage.Sets/src/mage/cards/h/HisokasGuard.java | 2 +- .../src/mage/cards/h/HoardingDragon.java | 2 +- .../src/mage/cards/h/HopeOfGhirapur.java | 2 +- .../src/mage/cards/i/IgniteMemories.java | 2 +- .../src/mage/cards/i/InameDeathAspect.java | 2 +- .../src/mage/cards/i/IncreasingAmbition.java | 2 +- .../mage/cards/i/IndomitableCreativity.java | 2 +- Mage.Sets/src/mage/cards/i/InfernalKirin.java | 2 +- Mage.Sets/src/mage/cards/i/InfernalTutor.java | 2 +- .../src/mage/cards/i/InvaderParasite.java | 2 +- .../src/mage/cards/i/IsochronScepter.java | 2 +- .../src/mage/cards/j/JacesMindseeker.java | 2 +- Mage.Sets/src/mage/cards/j/JaradsOrders.java | 2 +- .../src/mage/cards/j/JestersScepter.java | 2 +- .../src/mage/cards/k/KaaliaOfTheVast.java | 2 +- .../src/mage/cards/k/KahoMinamoHistorian.java | 4 +- .../src/mage/cards/k/KangeeAerieKeeper.java | 4 +- Mage.Sets/src/mage/cards/k/KodamasReach.java | 2 +- .../src/mage/cards/k/KrovikanSorcerer.java | 2 +- Mage.Sets/src/mage/cards/l/Leashling.java | 2 +- Mage.Sets/src/mage/cards/l/LifesLegacy.java | 2 +- Mage.Sets/src/mage/cards/l/LordOfTheVoid.java | 2 +- .../src/mage/cards/m/MadcapExperiment.java | 2 +- .../src/mage/cards/m/MagneticMountain.java | 2 +- Mage.Sets/src/mage/cards/m/MagusOfTheJar.java | 2 +- .../src/mage/cards/m/MagusOfTheScroll.java | 2 +- Mage.Sets/src/mage/cards/m/ManaSeverance.java | 2 +- .../src/mage/cards/m/ManifoldInsights.java | 2 +- .../src/mage/cards/m/MarshalingTheTroops.java | 2 +- .../mage/cards/m/MasterOfPredicaments.java | 2 +- Mage.Sets/src/mage/cards/m/MemoryJar.java | 2 +- Mage.Sets/src/mage/cards/m/MerfolkSpy.java | 2 +- Mage.Sets/src/mage/cards/m/Metamorphosis.java | 2 +- Mage.Sets/src/mage/cards/m/MeteorBlast.java | 2 +- Mage.Sets/src/mage/cards/m/MeteorCrater.java | 2 +- Mage.Sets/src/mage/cards/m/MimicVat.java | 2 +- .../src/mage/cards/m/MindclawShaman.java | 2 +- Mage.Sets/src/mage/cards/m/MindleechMass.java | 4 +- .../src/mage/cards/m/MizzixsMastery.java | 2 +- Mage.Sets/src/mage/cards/m/MomentousFall.java | 2 +- .../src/mage/cards/m/MoonringMirror.java | 2 +- .../src/mage/cards/m/MyrBattlesphere.java | 2 +- .../src/mage/cards/n/NahiriTheHarbinger.java | 2 +- .../src/mage/cards/n/NezumiShortfang.java | 3 +- .../src/mage/cards/n/NissaNaturesArtisan.java | 2 +- .../src/mage/cards/n/NissaWorldwaker.java | 2 +- .../src/mage/cards/o/OrcishLibrarian.java | 6 +-- .../src/mage/cards/p/PainfulMemories.java | 2 +- .../src/mage/cards/p/PanopticMirror.java | 2 +- Mage.Sets/src/mage/cards/p/Peregrination.java | 2 +- .../src/mage/cards/p/PerishTheThought.java | 2 +- .../src/mage/cards/p/PhyrexianDelver.java | 2 +- .../src/mage/cards/p/PhyrexianGrimoire.java | 2 +- .../src/mage/cards/p/PlaneswalkersFavor.java | 2 +- .../src/mage/cards/p/PlaneswalkersFury.java | 2 +- .../src/mage/cards/p/PlaneswalkersMirth.java | 2 +- .../src/mage/cards/p/PlaneswalkersScorn.java | 2 +- .../mage/cards/p/PolukranosWorldEater.java | 2 +- Mage.Sets/src/mage/cards/p/Polymorph.java | 2 +- .../src/mage/cards/p/PreeminentCaptain.java | 2 +- Mage.Sets/src/mage/cards/p/ProteusStaff.java | 2 +- .../src/mage/cards/p/PrototypePortal.java | 6 +-- .../src/mage/cards/p/PryingQuestions.java | 2 +- .../src/mage/cards/q/QasaliAmbusher.java | 4 +- .../src/mage/cards/q/QuietSpeculation.java | 2 +- .../src/mage/cards/r/RealmsUncharted.java | 2 +- .../src/mage/cards/r/ReflectingPool.java | 2 +- .../src/mage/cards/r/RenownedWeaponsmith.java | 2 +- Mage.Sets/src/mage/cards/r/Reweave.java | 2 +- Mage.Sets/src/mage/cards/r/RiseFall.java | 2 +- Mage.Sets/src/mage/cards/r/RoninWarclub.java | 2 +- .../src/mage/cards/r/RootwaterThief.java | 2 +- .../src/mage/cards/s/SadisticAugermage.java | 2 +- .../src/mage/cards/s/SanguinePraetor.java | 2 +- .../mage/cards/s/SasayaOrochiAscendant.java | 2 +- .../src/mage/cards/s/SavageSummoning.java | 1 - Mage.Sets/src/mage/cards/s/SecretSalvage.java | 2 +- Mage.Sets/src/mage/cards/s/SeeBeyond.java | 2 +- .../src/mage/cards/s/SemblanceAnvil.java | 4 +- Mage.Sets/src/mage/cards/s/SerrasSanctum.java | 2 +- .../mage/cards/s/ShimatsuTheBloodcloaked.java | 2 +- .../src/mage/cards/s/SignalTheClans.java | 2 +- .../src/mage/cards/s/SilentBladeOni.java | 2 +- .../src/mage/cards/s/SkyshipWeatherlight.java | 2 +- .../src/mage/cards/s/SlumberingTora.java | 2 +- Mage.Sets/src/mage/cards/s/SoldeviSage.java | 2 +- Mage.Sets/src/mage/cards/s/SoulFoundry.java | 4 +- Mage.Sets/src/mage/cards/s/Spellbinder.java | 2 +- Mage.Sets/src/mage/cards/s/Spellshift.java | 2 +- .../src/mage/cards/s/SpiritOfResistance.java | 2 +- .../src/mage/cards/s/SquanderedResources.java | 4 +- Mage.Sets/src/mage/cards/s/StarCompass.java | 2 +- .../src/mage/cards/s/StarlitSanctum.java | 4 +- .../src/mage/cards/s/SteelcladSerpent.java | 2 +- Mage.Sets/src/mage/cards/s/StompingSlabs.java | 2 +- Mage.Sets/src/mage/cards/s/StrataScythe.java | 4 +- .../src/mage/cards/s/StrategicPlanning.java | 2 +- Mage.Sets/src/mage/cards/s/StripBare.java | 2 +- .../src/mage/cards/s/StrongholdGambit.java | 2 +- .../src/mage/cards/s/SuddenDisappearance.java | 2 +- .../src/mage/cards/s/SultaiSoothsayer.java | 2 +- Mage.Sets/src/mage/cards/s/SummonersEgg.java | 2 +- Mage.Sets/src/mage/cards/s/SummoningTrap.java | 2 +- Mage.Sets/src/mage/cards/s/SuturedGhoul.java | 2 +- Mage.Sets/src/mage/cards/s/SyphonMind.java | 2 +- .../src/mage/cards/t/TalentOfTheTelepath.java | 4 +- .../mage/cards/t/TemptWithReflections.java | 2 +- .../src/mage/cards/t/TestamentOfFaith.java | 6 +-- .../src/mage/cards/t/ThadaAdelAcquisitor.java | 2 +- Mage.Sets/src/mage/cards/t/ThoughtGorger.java | 2 +- .../src/mage/cards/t/ThoughtpickerWitch.java | 2 +- .../src/mage/cards/t/TransmuteArtifact.java | 2 +- Mage.Sets/src/mage/cards/v/VastwoodHydra.java | 2 +- .../src/mage/cards/v/VerdelothTheAncient.java | 4 +- .../src/mage/cards/v/VeteranExplorer.java | 2 +- Mage.Sets/src/mage/cards/w/WaveOfVitriol.java | 2 +- Mage.Sets/src/mage/cards/w/WeirdHarvest.java | 2 +- .../src/mage/cards/w/WerewolfRansacker.java | 2 +- .../src/mage/cards/w/WidespreadPanic.java | 2 +- Mage.Sets/src/mage/cards/w/WildEvocation.java | 2 +- Mage.Sets/src/mage/cards/w/WildPair.java | 2 +- Mage.Sets/src/mage/cards/w/WildResearch.java | 2 +- .../src/mage/cards/w/WoodlandBellower.java | 2 +- .../src/mage/cards/x/XenagosTheReveler.java | 2 +- Mage.Sets/src/mage/cards/y/YavimayaDryad.java | 2 +- .../abilities/equipped/HeavyArbalestTest.java | 2 +- .../org/mage/test/player/RandomPlayer.java | 4 +- .../java/org/mage/test/player/TestPlayer.java | 4 +- .../base/impl/CardTestPlayerAPIImpl.java | 2 +- .../java/mage/abilities/AbilitiesImpl.java | 4 +- .../main/java/mage/abilities/AbilityImpl.java | 12 +++--- .../abilities/DelayedTriggeredAbility.java | 2 - Mage/src/main/java/mage/abilities/Modes.java | 2 +- .../common/EntersBattlefieldAbility.java | 2 +- .../common/CardsInHandCondition.java | 2 +- .../condition/common/FerociousCondition.java | 2 +- .../OpponentControlsPermanentCondition.java | 4 +- .../common/PermanentHasCounterCondition.java | 2 +- .../PermanentsOnTheBattlefieldCondition.java | 3 +- .../common/TenOrLessLifeCondition.java | 2 +- .../common/TopLibraryCardTypeCondition.java | 2 +- .../abilities/costs/AlternativeCost2Impl.java | 2 - .../java/mage/abilities/costs/CostsImpl.java | 2 +- .../costs/OptionalAdditionalCostImpl.java | 8 ---- .../costs/common/PutCountersSourceCost.java | 2 +- .../costs/common/RemoveCounterCost.java | 2 +- .../abilities/costs/mana/ManaCostsImpl.java | 2 +- .../dynamicvalue/common/MultikickerCount.java | 6 +-- .../abilities/effects/ContinuousEffects.java | 4 +- .../AddManaOfAnyTypeProducedEffect.java | 2 +- .../CopySpellForEachItCouldTargetEffect.java | 2 +- .../effects/common/CreateTokenEffect.java | 2 +- .../common/CreateTokenTargetEffect.java | 2 +- .../effects/common/DamageAllEffect.java | 2 +- .../common/DamageControllerEffect.java | 2 +- .../effects/common/DamageMultiEffect.java | 2 +- .../effects/common/DamageTargetEffect.java | 4 +- .../effects/common/DevourEffect.java | 2 +- .../effects/common/DoIfCostPaid.java | 2 +- ...nControllersNextUntapStepTargetEffect.java | 2 +- .../DrawCardSourceControllerEffect.java | 2 +- .../effects/common/DrawCardTargetEffect.java | 4 +- ...ExileAndReturnTransformedSourceEffect.java | 2 +- .../effects/common/GainLifeEffect.java | 2 +- .../effects/common/GainLifeTargetEffect.java | 4 +- .../LoseLifeControllerAttachedEffect.java | 2 +- .../common/LoseLifeOpponentsEffect.java | 2 +- .../LoseLifeSourceControllerEffect.java | 2 +- .../effects/common/LoseLifeTargetEffect.java | 4 +- .../effects/common/PhaseOutTargetEffect.java | 2 +- .../PlayTargetWithoutPayingManaEffect.java | 2 +- .../effects/common/PopulateEffect.java | 2 +- .../PutLibraryIntoGraveTargetEffect.java | 2 +- .../effects/common/RecruiterEffect.java | 2 +- .../RevealCardsFromLibraryUntilEffect.java | 4 +- .../common/SkipNextPlayerUntapStepEffect.java | 4 +- .../effects/common/TapTargetEffect.java | 2 +- .../effects/common/TransformTargetEffect.java | 2 +- .../AddCardSubTypeTargetEffect.java | 2 +- .../AssignNoCombatDamageSourceEffect.java | 2 +- .../BecomesColorOrColorsTargetEffect.java | 4 +- .../continuous/BecomesCreatureAllEffect.java | 8 ++-- .../BecomesCreatureAttachedEffect.java | 10 ++--- .../BecomesCreatureSourceEffect.java | 8 ++-- .../BecomesCreatureTargetEffect.java | 6 +-- .../continuous/BoostEquippedEffect.java | 2 +- .../continuous/GainAbilityAllEffect.java | 2 +- .../continuous/GainAbilityTargetEffect.java | 2 +- .../MaximumHandSizeControllerEffect.java | 2 +- .../counter/AddCountersAttachedEffect.java | 2 +- .../counter/AddCountersTargetEffect.java | 4 +- .../counter/DistributeCountersEffect.java | 4 +- .../common/counter/ProliferateEffect.java | 4 +- .../counter/RemoveCounterTargetEffect.java | 2 +- .../discard/DiscardControllerEffect.java | 2 +- .../discard/DiscardHandTargetEffect.java | 2 +- .../common/discard/DiscardTargetEffect.java | 2 +- ...SearchLibraryGraveyardPutInHandEffect.java | 4 +- .../search/SearchLibraryPutInHandEffect.java | 2 +- .../search/SearchLibraryPutInPlayEffect.java | 2 +- ...rchLibraryPutInPlayTargetPlayerEffect.java | 2 +- ...archLibraryWithLessCMCPutInPlayEffect.java | 2 +- .../effects/keyword/FatesealEffect.java | 2 +- .../abilities/keyword/CascadeAbility.java | 2 +- .../abilities/keyword/ConvokeAbility.java | 2 +- .../mage/abilities/keyword/DelveAbility.java | 6 +-- .../abilities/keyword/FlashbackAbility.java | 8 ++-- .../abilities/keyword/HideawayAbility.java | 2 +- .../abilities/keyword/TransmuteAbility.java | 2 +- .../mana/ActivatedManaAbilityImpl.java | 2 +- .../mana/AnyColorLandsProduceManaAbility.java | 2 +- .../CommanderColorIdentityManaAbility.java | 2 +- .../java/mage/abilities/mana/ManaOptions.java | 2 - .../abilities/mana/TriggeredManaAbility.java | 2 +- Mage/src/main/java/mage/cards/Sets.java | 4 +- .../cards/decks/importer/DckDeckImporter.java | 2 +- .../src/main/java/mage/filter/FilterCard.java | 2 +- .../java/mage/game/GameCommanderImpl.java | 2 +- Mage/src/main/java/mage/game/GameImpl.java | 2 +- Mage/src/main/java/mage/game/GameStates.java | 6 +-- .../src/main/java/mage/game/ZonesHandler.java | 2 +- .../main/java/mage/game/combat/Combat.java | 2 +- .../java/mage/game/combat/CombatGroup.java | 6 +-- .../main/java/mage/game/draft/DraftCube.java | 2 +- .../mage/game/draft/RandomBoosterDraft.java | 2 +- .../java/mage/game/match/MatchPlayer.java | 2 +- .../java/mage/game/permanent/token/Token.java | 2 +- Mage/src/main/java/mage/game/stack/Spell.java | 2 +- .../java/mage/game/stack/StackAbility.java | 2 +- .../mage/game/tournament/TournamentImpl.java | 2 +- .../pairing/SwissPairingSimple.java | 2 +- .../main/java/mage/players/PlayerImpl.java | 22 +++++----- .../src/main/java/mage/target/TargetImpl.java | 6 +-- .../targetpointer/FirstTargetPointer.java | 4 +- .../main/java/mage/util/TournamentUtil.java | 2 +- .../main/java/mage/util/trace/TraceUtil.java | 2 +- 366 files changed, 532 insertions(+), 548 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/cards/Card.java b/Mage.Client/src/main/java/mage/client/cards/Card.java index 96aff7602a..b3ddbadeec 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Card.java +++ b/Mage.Client/src/main/java/mage/client/cards/Card.java @@ -181,7 +181,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis gImage.setColor(Color.BLACK); gImage.drawImage(background, 0, 0, this); - if (card.getManaCost().size() > 0) { + if (!card.getManaCost().isEmpty()) { ImageHelper.drawCosts(card.getManaCost(), gImage, FRAME_MAX_WIDTH - SYMBOL_MAX_XOFFSET, SYMBOL_MAX_YOFFSET, this); } @@ -197,7 +197,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis gImage.drawString(card.getLoyalty(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP); } - if (card.getCardTypes().size() > 0) { + if (!card.getCardTypes().isEmpty()) { gImage.drawString(cardType, CONTENT_MAX_XOFFSET, TYPE_MAX_YOFFSET); } @@ -211,7 +211,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis gSmall.drawString(card.getLoyalty(), Config.dimensions.powBoxTextLeft, Config.dimensions.powBoxTextTop); } - if (card.getCardTypes().size() > 0) { + if (!card.getCardTypes().isEmpty()) { gSmall.drawString(cardType, Config.dimensions.contentXOffset, Config.dimensions.typeYOffset); } drawText(); @@ -232,7 +232,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis } } else { sb.append(card.getName()); - if (card.getManaCost().size() > 0) { + if (!card.getManaCost().isEmpty()) { sb.append('\n').append(card.getManaCost()); } sb.append('\n').append(cardType); @@ -247,7 +247,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis for (String rule : getRules()) { sb.append('\n').append(rule); } - if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) { + if (card.getExpansionSetCode() != null && !card.getExpansionSetCode().isEmpty()) { sb.append('\n').append(card.getCardNumber()).append(" - "); sb.append(Sets.getInstance().get(card.getExpansionSetCode()).getName()).append(" - "); sb.append(card.getRarity().toString()); @@ -308,7 +308,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis sbType.append(cardType.toString()).append(' '); } - if (card.getSubTypes().size() > 0) { + if (!card.getSubTypes().isEmpty()) { sbType.append("- "); for (String subType : card.getSubTypes()) { sbType.append(subType).append(' '); diff --git a/Mage.Client/src/main/java/mage/client/cards/CardArea.java b/Mage.Client/src/main/java/mage/client/cards/CardArea.java index 531cf10eb2..4ead4cf4dd 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardArea.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardArea.java @@ -163,7 +163,7 @@ public class CardArea extends JPanel implements MouseListener { private void loadCardsMany(CardsView showCards, BigCard bigCard, UUID gameId) { int rowsOfCards = 20; int columns = 1; - if (showCards != null && showCards.size() > 0) { + if (showCards != null && !showCards.isEmpty()) { Rectangle rectangle = new Rectangle(cardDimension.width, cardDimension.height); int count = 0; for (CardView card : showCards.values()) { diff --git a/Mage.Client/src/main/java/mage/client/cards/Cards.java b/Mage.Client/src/main/java/mage/client/cards/Cards.java index d6a3363db7..6996657d74 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Cards.java +++ b/Mage.Client/src/main/java/mage/client/cards/Cards.java @@ -225,7 +225,7 @@ public class Cards extends javax.swing.JPanel { } if (!isVisibleIfEmpty) { - cardArea.setVisible(cards.size() > 0); + cardArea.setVisible(!cards.isEmpty()); } sizeCards(getCardDimension()); diff --git a/Mage.Client/src/main/java/mage/client/cards/CardsList.java b/Mage.Client/src/main/java/mage/client/cards/CardsList.java index bec809a416..5c16d1c9bb 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardsList.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardsList.java @@ -322,7 +322,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar cardArea.remove(card); } - if (cards != null && cards.size() > 0) { + if (cards != null && !cards.isEmpty()) { Rectangle rectangle = new Rectangle(cardDimension.width, cardDimension.height); List sortedCards = new ArrayList<>(cards.values()); switch (sortSetting.getSortBy()) { diff --git a/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java b/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java index 8a4d3a1771..83dd8bc9da 100644 --- a/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java +++ b/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java @@ -1077,7 +1077,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg for (Sort s : sortMenuItems.keySet()) { sortMenuItems.get(s).setSelected(cardSort == s); } - hideSelected.setEnabled(dragCardList().size() > 0); + hideSelected.setEnabled(!dragCardList().isEmpty()); separateButton.setSelected(separateCreatures); menu.show(e.getComponent(), e.getX(), e.getY()); } @@ -1534,7 +1534,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg List cardPool = CardRepository.instance.findCards(cardCriteria); - if (cardPool.size() > 0) { + if (!cardPool.isEmpty()) { Card acard = cardPool.get(RandomUtil.nextInt(cardPool.size())).getMockCard(); if (acard.getName().equals(card.getName())) { @@ -1656,7 +1656,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg if (trackedCards.containsKey(info.getSetCode()) && trackedCards.get(info.getSetCode()).containsKey(info.getCardNum())) { ArrayList candidates = trackedCards.get(info.getSetCode()).get(info.getCardNum()); - if (candidates.size() > 0) { + if (!candidates.isEmpty()) { gridStack.add(candidates.remove(0)); thisMaxStackSize = Math.max(thisMaxStackSize, gridStack.size()); } diff --git a/Mage.Client/src/main/java/mage/client/cards/Permanent.java b/Mage.Client/src/main/java/mage/client/cards/Permanent.java index f9f8fa9b96..f23c01cc88 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Permanent.java +++ b/Mage.Client/src/main/java/mage/client/cards/Permanent.java @@ -106,7 +106,7 @@ public class Permanent extends Card { if (permanent.getOriginal() != null) { sb.append("\n----- Originally -------\n"); sb.append(permanent.getOriginal().getName()); - if (permanent.getOriginal().getManaCost().size() > 0) { + if (!permanent.getOriginal().getManaCost().isEmpty()) { sb.append('\n').append(permanent.getOriginal().getManaCost()); } sb.append('\n').append(getType(permanent.getOriginal())); @@ -122,7 +122,7 @@ public class Permanent extends Card { for (String rule: getRules()) { sb.append('\n').append(rule); } - if (permanent.getOriginal().getExpansionSetCode().length() > 0) { + if (!permanent.getOriginal().getExpansionSetCode().isEmpty()) { 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()); diff --git a/Mage.Client/src/main/java/mage/client/components/MageTextArea.java b/Mage.Client/src/main/java/mage/client/components/MageTextArea.java index 9f2f6975df..6928297878 100644 --- a/Mage.Client/src/main/java/mage/client/components/MageTextArea.java +++ b/Mage.Client/src/main/java/mage/client/components/MageTextArea.java @@ -51,7 +51,7 @@ public class MageTextArea extends JEditorPane { text = text.replace("\r\n", "
"); final String basicText = ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.DIALOG); - if (text.length() > 0) { + if (!text.isEmpty()) { buffer.append(basicText); } diff --git a/Mage.Client/src/main/java/mage/client/components/ability/AbilityPicker.java b/Mage.Client/src/main/java/mage/client/components/ability/AbilityPicker.java index 574b6036c9..fa4e43e60d 100644 --- a/Mage.Client/src/main/java/mage/client/components/ability/AbilityPicker.java +++ b/Mage.Client/src/main/java/mage/client/components/ability/AbilityPicker.java @@ -296,7 +296,7 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener { text = text.replace("\r\n", "
"); //text += "
"; - if (text.length() > 0) { + if (!text.isEmpty()) { buffer.append(ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.DIALOG)); } diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java index fce95ec0f8..67126f9170 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java @@ -62,7 +62,7 @@ public class CardHelper { type.append(cardType.toString()); type.append(' '); } - if (c.getSubTypes().size() > 0) { + if (!c.getSubTypes().isEmpty()) { type.append("- "); for (String subType : c.getSubTypes()) { type.append(subType); diff --git a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java index 71ad41544e..4141d4832b 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java @@ -137,7 +137,7 @@ public class CardInfoWindowDialog extends MageDialog { String titel = name + " (" + exile.size() + ')'; setTitle(titel); this.setTitelBarToolTip(titel); - if (exile.size() > 0) { + if (!exile.isEmpty()) { show(); if (changed) { try { diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java index 9cb6b7a3ee..be43daee88 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java @@ -507,7 +507,7 @@ public class NewTableDialog extends MageDialog { while (players.size() != numPlayers) { TablePlayerPanel playerPanel = new TablePlayerPanel(); String playerType = "Human"; - if (prefPlayerTypes.size() >= players.size() && players.size() > 0) { + if (prefPlayerTypes.size() >= players.size() && !players.isEmpty()) { playerType = prefPlayerTypes.get(players.size() - 1); } playerPanel.init(players.size() + 2, playerType); diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java index a67491bd0f..bc7584eed9 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java @@ -826,7 +826,7 @@ public class NewTournamentDialog extends MageDialog { txtRandomPacks.setEnabled(false); txtRandomPacks.setLineWrap(true); String randomPrefs = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT, ""); - if (randomPrefs.length() > 0) { + if (!randomPrefs.isEmpty()) { txtRandomPacks.setText(randomPrefs); ArrayList theList = new ArrayList<>(); theList.addAll(Arrays.asList(randomPrefs.split(";"))); @@ -1026,7 +1026,7 @@ public class NewTournamentDialog extends MageDialog { } private void loadBoosterPacks(String packString) { - if (packString.length()>0) { + if (!packString.isEmpty()) { String[] packsArray = packString.substring(1, packString.length() - 1).split(","); int packNumber = 0; for (String pack : packsArray ){ diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index 966e036ae6..85435f2fe3 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -723,7 +723,7 @@ public final class GamePanel extends javax.swing.JPanel { if (!handCards.containsKey(chosenHandKey)) { chosenHandKey = YOUR_HAND; } - } else if (chosenHandKey.isEmpty() && handCards.size() > 0) { + } else if (chosenHandKey.isEmpty() && !handCards.isEmpty()) { chosenHandKey = handCards.keySet().iterator().next(); } if (chosenHandKey != null && handCards.containsKey(chosenHandKey)) { @@ -854,7 +854,7 @@ public final class GamePanel extends javax.swing.JPanel { showRevealed(game); showLookedAt(game); - if (game.getCombat().size() > 0) { + if (!game.getCombat().isEmpty()) { CombatManager.getInstance().showCombat(game.getCombat(), gameId); } else { CombatManager.getInstance().hideCombat(gameId); @@ -1164,7 +1164,7 @@ public final class GamePanel extends javax.swing.JPanel { updateGame(gameView); Map options0 = options == null ? new HashMap<>() : options; ShowCardsDialog dialog = null; - if (cardView != null && cardView.size() > 0) { + if (cardView != null && !cardView.isEmpty()) { dialog = showCards(message, cardView, required, options0, popupMenuType); options0.put("dialog", dialog); } @@ -2130,7 +2130,7 @@ public final class GamePanel extends javax.swing.JPanel { choices, this.chosenHandKey); - if (newChosenHandKey != null && newChosenHandKey.length() > 0) { + if (newChosenHandKey != null && !newChosenHandKey.isEmpty()) { this.chosenHandKey = newChosenHandKey; CardsView cards = handCards.get(chosenHandKey); handContainer.loadCards(cards, bigCard, gameId); diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index 72cc9d9e94..731e5cff2b 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -259,7 +259,7 @@ public class TablesPanel extends javax.swing.JPanel { switch (action) { case "Replay": List gameList = matchesModel.getListofGames(modelRow); - if (gameList != null && gameList.size() > 0) { + if (gameList != null && !gameList.isEmpty()) { if (gameList.size() == 1) { SessionHandler.replayGame(gameList.get(0)); } else { diff --git a/Mage.Client/src/main/java/mage/client/util/ImageHelper.java b/Mage.Client/src/main/java/mage/client/util/ImageHelper.java index 64c727257f..dfb6340b33 100644 --- a/Mage.Client/src/main/java/mage/client/util/ImageHelper.java +++ b/Mage.Client/src/main/java/mage/client/util/ImageHelper.java @@ -86,7 +86,7 @@ public class ImageHelper { } public static void drawCosts(List costs, Graphics2D g, int xOffset, int yOffset, ImageObserver o) { - if (costs.size() > 0) { + if (!costs.isEmpty()) { int costLeft = xOffset; for (int i = costs.size() - 1; i >= 0; i--) { String symbol = costs.get(i); diff --git a/Mage.Client/src/main/java/mage/client/util/MageTableRowSorter.java b/Mage.Client/src/main/java/mage/client/util/MageTableRowSorter.java index 43f74c7a80..b8b182940c 100644 --- a/Mage.Client/src/main/java/mage/client/util/MageTableRowSorter.java +++ b/Mage.Client/src/main/java/mage/client/util/MageTableRowSorter.java @@ -49,7 +49,7 @@ public class MageTableRowSorter extends TableRowSorter { @Override public void toggleSortOrder(int column) { List sortKeys = getSortKeys(); - if (sortKeys.size() > 0) { + if (!sortKeys.isEmpty()) { if (sortKeys.get(0).getSortOrder() == SortOrder.DESCENDING) { setSortKeys(null); return; diff --git a/Mage.Client/src/main/java/mage/client/util/gui/ArrowBuilder.java b/Mage.Client/src/main/java/mage/client/util/gui/ArrowBuilder.java index 1f0c3d6764..f8760c5165 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/ArrowBuilder.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/ArrowBuilder.java @@ -135,7 +135,7 @@ public class ArrowBuilder { if (map.containsKey(gameId)) { Map> innerMap = map.get(gameId); java.util.List arrows = innerMap.get(type); - if (arrows != null && arrows.size() > 0) { + if (arrows != null && !arrows.isEmpty()) { JPanel p = getArrowsPanel(gameId); synchronized (map) { for (Arrow arrow : arrows) { diff --git a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java index 9dbdb8e3a7..f70bd5ec0e 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java @@ -330,7 +330,7 @@ public class GuiDisplayUtil { } } } - if (textLines.lines.size() > 0) { + if (!textLines.lines.isEmpty()) { for (String textLine : textLines.lines) { if (textLine != null && !textLine.replace(".", "").trim().isEmpty()) { rule.append("

").append(textLine).append("

"); @@ -339,7 +339,7 @@ public class GuiDisplayUtil { } String legal = rule.toString(); - if (legal.length() > 0) { + if (!legal.isEmpty()) { legal = legal.replaceAll("\\{this\\}", card.getName().isEmpty() ? "this" : card.getName()); legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this" : card.getName()); buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.TOOLTIP)); @@ -366,7 +366,7 @@ public class GuiDisplayUtil { for (CardType cardType : card.getCardTypes()) { types += cardType.toString() + ' '; } - if (card.getSubTypes().size() > 0) { + if (!card.getSubTypes().isEmpty()) { types += "- "; } for (String subType : card.getSubTypes()) { diff --git a/Mage.Client/src/main/java/mage/client/util/stats/UpdateMemUsageTask.java b/Mage.Client/src/main/java/mage/client/util/stats/UpdateMemUsageTask.java index b3c6366b56..cc6907b614 100644 --- a/Mage.Client/src/main/java/mage/client/util/stats/UpdateMemUsageTask.java +++ b/Mage.Client/src/main/java/mage/client/util/stats/UpdateMemUsageTask.java @@ -36,7 +36,7 @@ public class UpdateMemUsageTask extends SwingWorker { @Override protected void process(List chunks) { - if (chunks != null && chunks.size() > 0) { + if (chunks != null && !chunks.isEmpty()) { Float memUsage = chunks.get(chunks.size() - 1); if (memUsage != null) { jLabelToDisplayInfo.setText(Math.round(memUsage) + "% Mem free"); diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java index 81dfd06989..f55acc778c 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java @@ -688,7 +688,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener, sbType.append(cardType.toString()).append(' '); } - if (card.getSubTypes().size() > 0) { + if (!card.getSubTypes().isEmpty()) { sbType.append("- "); for (String subType : card.getSubTypes()) { sbType.append(subType).append(' '); @@ -706,7 +706,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener, } } else { sb.append(card.getName()); - if (card.getManaCost().size() > 0) { + if (!card.getManaCost().isEmpty()) { sb.append('\n').append(card.getManaCost()); } sb.append('\n').append(cardType); @@ -724,7 +724,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener, for (String rule : card.getRules()) { sb.append('\n').append(rule); } - if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) { + if (card.getExpansionSetCode() != null && !card.getExpansionSetCode().isEmpty()) { sb.append('\n').append(card.getCardNumber()).append(" - "); sb.append(card.getExpansionSetCode()).append(" - "); sb.append(card.getRarity().toString()); diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java index fb883c04c9..fa568e13b7 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java @@ -385,7 +385,7 @@ public abstract class CardRenderer { for (CardType cardType : cardView.getCardTypes()) { sbType.append(cardType.toString()).append(' '); } - if (cardView.getSubTypes().size() > 0) { + if (!cardView.getSubTypes().isEmpty()) { sbType.append("- "); for (String subType : cardView.getSubTypes()) { sbType.append(subType).append(' '); diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/TextboxRule.java b/Mage.Client/src/main/java/org/mage/card/arcane/TextboxRule.java index 807e03d654..0e4b836042 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/TextboxRule.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/TextboxRule.java @@ -87,7 +87,7 @@ public class TextboxRule { // Do it in reverse order for proper handling of regions where // there are multiple attributes stacked (EG: bold + italic) AttributedString attributedRule = new AttributedString(text); - if (text.length() != 0) { + if (!text.isEmpty()) { attributedRule.addAttribute(TextAttribute.FONT, normal); for (int i = regions.size() - 1; i >= 0; --i) { regions.get(i).applyToAttributedString(attributedRule, normal, italic); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java b/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java index 29195aa2f0..f41304525f 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java @@ -179,7 +179,7 @@ public class CardPluginImpl implements CardPlugin { break; } List counters = firstPanel.getOriginalPermanent().getCounters(); - if (counters != null && counters.size() > 0) { + if (counters != null && !counters.isEmpty()) { // don't put to first panel if it has counters insertIndex = i; break; @@ -191,7 +191,7 @@ public class CardPluginImpl implements CardPlugin { continue; } counters = permanent.getOriginalPermanent().getCounters(); - if (counters != null && counters.size() > 0) { + if (counters != null && !counters.isEmpty()) { // if a land has counter, put it to the right insertIndex = i + 1; continue; diff --git a/Mage.Common/src/mage/constants/Constants.java b/Mage.Common/src/mage/constants/Constants.java index fd8bf95052..c2617b522b 100644 --- a/Mage.Common/src/mage/constants/Constants.java +++ b/Mage.Common/src/mage/constants/Constants.java @@ -78,7 +78,7 @@ public final class Constants { public enum SessionState { - DISCONNECTED, CONNECTED, CONNECTING, DISCONNECTING, SERVER_STARTING; + DISCONNECTED, CONNECTED, CONNECTING, DISCONNECTING, SERVER_STARTING } public enum Option { diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index 0548837a35..e20c27d4a1 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -397,7 +397,7 @@ public class CardView extends SimpleCardView { for (SpellAbility spellAbility : spell.getSpellAbilities()) { for (UUID modeId : spellAbility.getModes().getSelectedModes()) { Mode mode = spellAbility.getModes().get(modeId); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { setTargets(mode.getTargets()); } } diff --git a/Mage.Common/src/mage/view/CardsView.java b/Mage.Common/src/mage/view/CardsView.java index 4d8518493d..e37b9801a6 100644 --- a/Mage.Common/src/mage/view/CardsView.java +++ b/Mage.Common/src/mage/view/CardsView.java @@ -133,7 +133,7 @@ public class CardsView extends LinkedHashMap { } abilityView = new AbilityView(ability, sourceObject.getName(), sourceCardView); } - if (ability.getTargets().size() > 0) { + if (!ability.getTargets().isEmpty()) { abilityView.setTargets(ability.getTargets()); } else { List abilityTargets = new ArrayList<>(); diff --git a/Mage.Common/src/mage/view/ChatMessage.java b/Mage.Common/src/mage/view/ChatMessage.java index 487e2fbf1c..d13dccddb3 100644 --- a/Mage.Common/src/mage/view/ChatMessage.java +++ b/Mage.Common/src/mage/view/ChatMessage.java @@ -45,15 +45,15 @@ public class ChatMessage implements Serializable { private MessageType messageType; public enum MessageColor { - BLACK, RED, GREEN, BLUE, ORANGE, YELLOW; + BLACK, RED, GREEN, BLUE, ORANGE, YELLOW } public enum MessageType { - USER_INFO, STATUS, GAME, TALK, WHISPER; + USER_INFO, STATUS, GAME, TALK, WHISPER } public enum SoundToPlay { - PlayerLeft, PlayerQuitTournament, PlayerSubmittedDeck, PlayerWhispered; + PlayerLeft, PlayerQuitTournament, PlayerSubmittedDeck, PlayerWhispered } public ChatMessage(String username, String message, String time, MessageColor color) { diff --git a/Mage.Common/src/mage/view/GameView.java b/Mage.Common/src/mage/view/GameView.java index 1c55dac842..a9f7bfa9ee 100644 --- a/Mage.Common/src/mage/view/GameView.java +++ b/Mage.Common/src/mage/view/GameView.java @@ -191,7 +191,7 @@ public class GameView implements Serializable { if (priorityPlayer != null && createdForPlayer != null && createdForPlayerId != null && createdForPlayer.isGameUnderControl() && (createdForPlayerId.equals(priorityPlayer.getId()) // player controls the turn || createdForPlayer.getPlayersUnderYourControl().contains(priorityPlayer.getId()))) { // player controls active players turn - this.special = state.getSpecialActions().getControlledBy(priorityPlayer.getId(), priorityPlayer.isInPayManaMode()).size() > 0; + this.special = !state.getSpecialActions().getControlledBy(priorityPlayer.getId(), priorityPlayer.isInPayManaMode()).isEmpty(); } } else { this.special = false; diff --git a/Mage.Common/src/mage/view/MatchView.java b/Mage.Common/src/mage/view/MatchView.java index 47fc3d6625..23cf644ff5 100644 --- a/Mage.Common/src/mage/view/MatchView.java +++ b/Mage.Common/src/mage/view/MatchView.java @@ -143,7 +143,7 @@ public class MatchView implements Serializable { } this.players = sb1.toString(); StringBuilder sb2 = new StringBuilder(); - if (table.getTournament().getRounds().size() > 0) { + if (!table.getTournament().getRounds().isEmpty()) { for (TournamentPlayer tPlayer : table.getTournament().getPlayers()) { sb2.append(tPlayer.getPlayer().getName()).append(": ").append(tPlayer.getResults()).append(' '); } diff --git a/Mage.Common/src/mage/view/PermanentView.java b/Mage.Common/src/mage/view/PermanentView.java index 9e44be6169..003af1f693 100644 --- a/Mage.Common/src/mage/view/PermanentView.java +++ b/Mage.Common/src/mage/view/PermanentView.java @@ -72,7 +72,7 @@ public class PermanentView extends CardView { this.morphed = permanent.isMorphed(); this.manifested = permanent.isManifested(); this.damage = permanent.getDamage(); - if (permanent.getAttachments().size() > 0) { + if (!permanent.getAttachments().isEmpty()) { attachments = new ArrayList<>(); attachments.addAll(permanent.getAttachments()); } diff --git a/Mage.Common/src/mage/view/PlayerView.java b/Mage.Common/src/mage/view/PlayerView.java index 86f87c0a70..0d08ff3cf3 100644 --- a/Mage.Common/src/mage/view/PlayerView.java +++ b/Mage.Common/src/mage/view/PlayerView.java @@ -258,7 +258,7 @@ public class PlayerView implements Serializable { } public boolean hasAttachments() { - return attachments != null && attachments.size() > 0; + return attachments != null && !attachments.isEmpty(); } public int getStatesSavedSize() { diff --git a/Mage.Common/src/mage/view/StackAbilityView.java b/Mage.Common/src/mage/view/StackAbilityView.java index 1c5c6914d5..a34de5abf5 100644 --- a/Mage.Common/src/mage/view/StackAbilityView.java +++ b/Mage.Common/src/mage/view/StackAbilityView.java @@ -101,7 +101,7 @@ public class StackAbilityView extends CardView { List names = new ArrayList<>(); for (UUID modeId : ability.getModes().getSelectedModes()) { Mode mode = ability.getModes().get(modeId); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { setTargets(mode.getTargets()); } else { List targetList = new ArrayList<>(); @@ -111,7 +111,7 @@ public class StackAbilityView extends CardView { targetList.add(((FixedTarget) targetPointer).getTarget()); } } - if (targetList.size() > 0) { + if (!targetList.isEmpty()) { overrideTargets(targetList); for (UUID uuid : targetList) { diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java index 17b7cf9a50..cb5a449746 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java @@ -272,7 +272,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { while (actions.peek() != null) { Ability ability = actions.poll(); logger.info(new StringBuilder("===> Act [").append(game.getPlayer(playerId).getName()).append("] Action: ").append(ability.toString()).toString()); - if (ability.getTargets().size() > 0) { + if (!ability.getTargets().isEmpty()) { for (Target target : ability.getTargets()) { for (UUID id : target.getTargets()) { target.updateTarget(id, game); @@ -318,7 +318,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { //int bestScore = addActionsTimed(new FilterAbility()); currentScore = GameStateEvaluator2.evaluate(playerId, game); addActionsTimed(); - if (root.children.size() > 0) { + if (!root.children.isEmpty()) { root = root.children.get(0); //GameStateEvaluator2.evaluate(playerId, root.getGame()); int bestScore = root.getScore(); @@ -335,10 +335,10 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { } protected boolean getNextAction(Game game) { - if (root != null && root.children.size() > 0) { + if (root != null && !root.children.isEmpty()) { SimulationNode2 test = root; root = root.children.get(0); - while (root.children.size() > 0 && !root.playerId.equals(playerId)) { + while (!root.children.isEmpty() && !root.playerId.equals(playerId)) { test = root; root = root.children.get(0); } @@ -525,7 +525,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { UUID currentPlayerId = node.getGame().getPlayerList().get(); //logger.info("reached - " + val + ", playerId=" + playerId + ", node.pid="+currentPlayerId); return val; - } else if (node.getChildren().size() > 0) { + } else if (!node.getChildren().isEmpty()) { logger.trace("Add actions -- something added children:" + node.getChildren().size()); val = minimaxAB(node, depth - 1, alpha, beta); return val; @@ -542,7 +542,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { if (game.gameOver(null)) { val = GameStateEvaluator2.evaluate(playerId, game); - } else if (node.getChildren().size() > 0) { + } else if (!node.getChildren().isEmpty()) { //declared attackers or blockers or triggered abilities logger.debug("Add actions -- attack/block/trigger added children:" + node.getChildren().size()); val = minimaxAB(node, depth - 1, alpha, beta); @@ -568,7 +568,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { SimulationNode2 bestNode = null; List allActions = currentPlayer.simulatePriority(game); optimize(game, allActions); - if (logger.isInfoEnabled() && allActions.size() > 0 && depth == maxDepth) { + if (logger.isInfoEnabled() && !allActions.isEmpty() && depth == maxDepth) { logger.info("ADDED ACTIONS (" + allActions.size() + ") " + ' ' + allActions); } int counter = 0; @@ -614,9 +614,9 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { .append(listTargets(game, action.getTargets())).append(')') .append(logger.isTraceEnabled() ? " #" + newNode.hashCode() : ""); SimulationNode2 logNode = newNode; - while (logNode.getChildren() != null && logNode.getChildren().size() > 0) { + while (logNode.getChildren() != null && !logNode.getChildren().isEmpty()) { logNode = logNode.getChildren().get(0); - if (logNode.getAbilities() != null && logNode.getAbilities().size() > 0) { + if (logNode.getAbilities() != null && !logNode.getAbilities().isEmpty()) { sb.append(" -> [").append(logNode.getDepth()).append(']').append(logNode.getAbilities().toString()).append('<').append(logNode.getScore()).append('>'); } } @@ -634,7 +634,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { alpha = val; bestNode = newNode; bestNode.setScore(val); - if (newNode.getChildren().size() > 0) { + if (!newNode.getChildren().isEmpty()) { bestNode.setCombat(newNode.getChildren().get(0).getCombat()); } /* @@ -660,7 +660,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { beta = val; bestNode = newNode; bestNode.setScore(val); - if (newNode.getChildren().size() > 0) { + if (!newNode.getChildren().isEmpty()) { bestNode.setCombat(newNode.getChildren().get(0).getCombat()); } } diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java index 9dc9c24766..99bce93ce8 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java @@ -164,7 +164,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { addActionsTimed(); logger.trace("After add actions timed: root.children.size = " + root.children.size()); - if (root.children.size() > 0) { + if (!root.children.isEmpty()) { root = root.children.get(0); // int bestScore = root.getScore(); // if (bestScore > currentScore || allowBadMoves) { @@ -204,7 +204,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { logger.debug("Sim Calculate post combat actions ----------------------------------------------------------------------------------------"); addActionsTimed(); - if (root != null && root.children.size() > 0) { + if (root != null && !root.children.isEmpty()) { root = root.children.get(0); int bestScore = root.getScore(); if (bestScore > currentScore || allowBadMoves) { @@ -244,7 +244,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { } while ((logNode.getParent() != null)); logger.trace(sb); } - } else if (node.getChildren().size() > 0) { + } else if (!node.getChildren().isEmpty()) { if (logger.isDebugEnabled()) { StringBuilder sb = new StringBuilder("Add Action [").append(depth) .append("] -- something added children ") @@ -299,7 +299,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { val = GameStateEvaluator2.evaluate(playerId, game); */ } - } else if (node.getChildren().size() > 0) { + } else if (!node.getChildren().isEmpty()) { if (logger.isDebugEnabled()) { StringBuilder sb = new StringBuilder("Add Action [").append(depth) .append("] -- trigger ") @@ -411,7 +411,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { beta = val; bestNode = newNode; bestNode.setScore(val); - if (newNode.getChildren().size() > 0) { + if (!newNode.getChildren().isEmpty()) { bestNode.setCombat(newNode.getChildren().get(0).getCombat()); } } @@ -419,7 +419,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { alpha = val; bestNode = newNode; bestNode.setScore(val); - if (newNode.getChildren().size() > 0) { + if (!newNode.getChildren().isEmpty()) { bestNode.setCombat(newNode.getChildren().get(0).getCombat()); } } @@ -460,7 +460,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { } Game sim = game.copy(); for (CombatGroup group : engagement.getGroups()) { - if (group.getAttackers().size() > 0) { + if (!group.getAttackers().isEmpty()) { UUID attackerId = group.getAttackers().get(0); for (UUID blockerId : group.getBlockers()) { sim.getPlayer(defenderId).declareBlocker(defenderId, blockerId, attackerId, sim); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedAction2.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedAction2.java index 521070a183..d9ffaea922 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedAction2.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedAction2.java @@ -60,7 +60,7 @@ public class SimulatedAction2 { } public boolean usesStack() { - if (abilities != null && abilities.size() > 0) { + if (abilities != null && !abilities.isEmpty()) { return abilities.get(abilities.size() -1).isUsesStack(); } return true; diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java index 8699ba43a4..dc113944d3 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java @@ -103,7 +103,7 @@ public class SimulatedPlayer2 extends ComputerPlayer { if (logger.isTraceEnabled()) { for (Ability a : allActions) { logger.info("ability==" + a); - if (a.getTargets().size() > 0) { + if (!a.getTargets().isEmpty()) { MageObject mageObject = game.getObject(a.getFirstTarget()); if (mageObject != null) { logger.info(" target=" + mageObject.getName()); @@ -177,7 +177,7 @@ public class SimulatedPlayer2 extends ComputerPlayer { } card.adjustTargets(newAbility, game); // add the different possible target option for the specific X value - if (newAbility.getTargets().getUnchosen().size() > 0) { + if (!newAbility.getTargets().getUnchosen().isEmpty()) { addTargetOptions(options, newAbility, targetNum, game); } } @@ -240,7 +240,7 @@ public class SimulatedPlayer2 extends ComputerPlayer { } List filtered = new ArrayList<>(); for (Ability option : options) { - if (option.getTargets().size() > 0 && option.getTargets().get(0).getMaxNumberOfTargets() == 1) { + if (!option.getTargets().isEmpty() && option.getTargets().get(0).getMaxNumberOfTargets() == 1) { Card card = game.getCard(ability.getSourceId()); for (String s : suggested) { String[] groups = s.split(";"); diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index 2ec47e1f00..4d285b8e27 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -212,7 +212,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } if (target.getOriginalTarget() instanceof TargetDiscard) { findPlayables(game); - if (unplayable.size() > 0) { + if (!unplayable.isEmpty()) { for (int i = unplayable.size() - 1; i >= 0; i--) { if (target.canTarget(unplayable.values().toArray(new Card[0])[i].getId(), game)) { target.add(unplayable.values().toArray(new Card[0])[i].getId(), game); @@ -222,7 +222,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } } } - if (hand.size() > 0) { + if (!hand.isEmpty()) { for (int i = 0; i < hand.size(); i++) { if (target.canTarget(hand.toArray(new UUID[0])[i], game)) { target.add(hand.toArray(new UUID[0])[i], game); @@ -467,7 +467,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { Cards cards = new CardsImpl(target.possibleTargets(source.getSourceId(), getId(), game)); ArrayList cardsInHand = new ArrayList<>(cards.getCards(game)); while (!target.isChosen() - && target.possibleTargets(source.getSourceId(), getId(), game).size() > 0 + && !target.possibleTargets(source.getSourceId(), getId(), game).isEmpty() && target.getMaxNumberOfTargets() > target.getTargets().size()) { Card card = pickBestCard(cardsInHand, null, target, source, game); if (card != null) { @@ -482,7 +482,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } } else { findPlayables(game); - if (unplayable.size() > 0) { + if (!unplayable.isEmpty()) { for (int i = unplayable.size() - 1; i >= 0; i--) { if (target.canTarget(getId(), unplayable.values().toArray(new Card[0])[i].getId(), source, game)) { target.addTarget(unplayable.values().toArray(new Card[0])[i].getId(), source, game); @@ -492,7 +492,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } } } - if (hand.size() > 0) { + if (!hand.isEmpty()) { for (int i = 0; i < hand.size(); i++) { if (target.canTarget(getId(), hand.toArray(new UUID[0])[i], source, game)) { target.addTarget(hand.toArray(new UUID[0])[i], source, game); @@ -674,7 +674,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { return target.isChosen(); } if (target.getOriginalTarget() instanceof TargetSpell) { - if (game.getStack().size() > 0) { + if (!game.getStack().isEmpty()) { Iterator it = game.getStack().iterator(); while (it.hasNext()) { StackObject o = it.next(); @@ -708,7 +708,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } } } - if (game.getStack().size() > 0) { + if (!game.getStack().isEmpty()) { Iterator it = game.getStack().iterator(); while (it.hasNext()) { StackObject stackObject = it.next(); @@ -878,7 +878,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { break; case PRECOMBAT_MAIN: findPlayables(game); - if (playableAbilities.size() > 0) { + if (!playableAbilities.isEmpty()) { for (ActivatedAbility ability : playableAbilities) { if (ability.canActivate(playerId, game)) { if (ability.getEffects().hasOutcome(Outcome.PutLandInPlay)) { @@ -909,7 +909,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { case POSTCOMBAT_MAIN: findPlayables(game); if (game.getStack().isEmpty()) { - if (playableNonInstant.size() > 0) { + if (!playableNonInstant.isEmpty()) { for (Card card : playableNonInstant) { if (card.getSpellAbility().canActivate(playerId, game)) { if (this.activateAbility(card.getSpellAbility(), game)) { @@ -918,7 +918,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } } } - if (playableAbilities.size() > 0) { + if (!playableAbilities.isEmpty()) { for (ActivatedAbility ability : playableAbilities) { if (ability.canActivate(playerId, game)) { if (!(ability.getEffects().get(0) instanceof BecomesCreatureSourceEffect)) { @@ -975,7 +975,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } lands.add(landCard); } - while (lands.size() > 0 && this.canPlayLand()) { + while (!lands.isEmpty() && this.canPlayLand()) { if (lands.size() == 1) { this.playLand(lands.iterator().next(), game, false); } else { @@ -1030,7 +1030,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { for (Card card : nonLands) { ManaOptions options = card.getManaCost().getOptions(); - if (card.getManaCost().getVariableCosts().size() > 0) { + if (!card.getManaCost().getVariableCosts().isEmpty()) { //don't use variable mana costs unless there is at least 3 extra mana for X for (Mana option : options) { option.add(Mana.GenericMana(3)); @@ -1062,7 +1062,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { continue; } ManaOptions abilityOptions = ability.getManaCosts().getOptions(); - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { //don't use variable mana costs unless there is at least 3 extra mana for X for (Mana option : abilityOptions) { option.add(Mana.GenericMana(3)); @@ -1386,7 +1386,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { for (Permanent permanent : game.getBattlefield().getActivePermanents(this.getId(), game)) { if (game.getOpponents(this.getId()).contains(permanent.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE) - && permanent.getSubtype(game).size() > 0) { + && !permanent.getSubtype(game).isEmpty()) { if (choice.getChoices().contains(permanent.getSubtype(game).get(0))) { choice.setChoice(permanent.getSubtype(game).get(0)); break; @@ -1398,7 +1398,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { for (UUID opponentId : game.getOpponents(this.getId())) { Player opponent = game.getPlayer(opponentId); for (Card card : opponent.getGraveyard().getCards(game)) { - if (card != null && card.getCardType().contains(CardType.CREATURE) && card.getSubtype(game).size() > 0) { + if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) { if (choice.getChoices().contains(card.getSubtype(game).get(0))) { choice.setChoice(card.getSubtype(game).get(0)); break; @@ -1414,7 +1414,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { // choose a creature type of hand or library for (UUID cardId : this.getHand()) { Card card = game.getCard(cardId); - if (card != null && card.getCardType().contains(CardType.CREATURE) && card.getSubtype(game).size() > 0) { + if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) { if (choice.getChoices().contains(card.getSubtype(game).get(0))) { choice.setChoice(card.getSubtype(game).get(0)); break; @@ -1424,7 +1424,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { if (!choice.isChosen()) { for (UUID cardId : this.getLibrary().getCardList()) { Card card = game.getCard(cardId); - if (card != null && card.getCardType().contains(CardType.CREATURE) && card.getSubtype(game).size() > 0) { + if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) { if (choice.getChoices().contains(card.getSubtype(game).get(0))) { choice.setChoice(card.getSubtype(game).get(0)); break; @@ -1545,7 +1545,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { MageObject object = game.getObject(ability.getSourceId()); if (object != null) { LinkedHashMap useableAbilities = getSpellAbilities(object, game.getState().getZone(object.getId()), game); - if (useableAbilities != null && useableAbilities.size() > 0) { + if (useableAbilities != null && !useableAbilities.isEmpty()) { game.fireGetChoiceEvent(playerId, name, object, new ArrayList<>(useableAbilities.values())); // TODO: Improve this return (SpellAbility) useableAbilities.values().iterator().next(); @@ -1584,7 +1584,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { public TriggeredAbility chooseTriggeredAbility(List abilities, Game game) { log.debug("chooseTriggeredAbility: " + abilities.toString()); //TODO: improve this - if (abilities.size() > 0) { + if (!abilities.isEmpty()) { return abilities.get(0); } return null; @@ -1729,7 +1729,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { @Override public void construct(Tournament tournament, Deck deck) { - if (deck != null && deck.getCards().size() < 40 && deck.getSideboard().size() > 0) { + if (deck != null && deck.getCards().size() < 40 && !deck.getSideboard().isEmpty()) { //pick the top 23 cards if (chosenColors == null) { for (Card card : deck.getSideboard()) { diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java index d7589f2636..ad07de128b 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java @@ -52,7 +52,7 @@ public class MCTSPlayer extends ComputerPlayer { private NextAction nextAction; public enum NextAction { - PRIORITY, SELECT_ATTACKERS, SELECT_BLOCKERS; + PRIORITY, SELECT_ATTACKERS, SELECT_BLOCKERS } public MCTSPlayer(UUID id) { @@ -83,7 +83,7 @@ public class MCTSPlayer extends ComputerPlayer { for (Ability ability: playables) { List options = game.getPlayer(playerId).getPlayableOptions(ability, game); if (options.isEmpty()) { - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { simulateVariableCosts(ability, all, game); } else { @@ -92,7 +92,7 @@ public class MCTSPlayer extends ComputerPlayer { } else { for (Ability option: options) { - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { simulateVariableCosts(option, all, game); } else { diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java index 344964fb75..f2b59669e4 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java @@ -124,7 +124,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer { ability = options.get(RandomUtil.nextInt(options.size())); } } - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { int amount = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost(); if (amount > 0) { ability = ability.copy(); @@ -221,7 +221,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer { int check = RandomUtil.nextInt(numGroups + 1); if (check < numGroups) { CombatGroup group = game.getCombat().getGroups().get(check); - if (group.getAttackers().size() > 0) { + if (!group.getAttackers().isEmpty()) { this.declareBlocker(this.getId(), blocker.getId(), group.getAttackers().get(0), game); } } diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java index 3cba31ffd9..d37112a665 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java @@ -161,7 +161,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { else addActions(root, Integer.MIN_VALUE, Integer.MAX_VALUE); logger.info(name + " simulated " + nodeCount + " nodes in " + thinkTime/1000000000.0 + "s - average " + nodeCount/(thinkTime/1000000000.0) + " nodes/s"); - if (root.children.size() > 0) { + if (!root.children.isEmpty()) { root = root.children.get(0); actions = new LinkedList(root.abilities); combat = root.combat; @@ -174,10 +174,10 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { } protected boolean getNextAction(Game game) { - if (root != null && root.children.size() > 0) { + if (root != null && !root.children.isEmpty()) { SimulationNode test = root; root = root.children.get(0); - while (root.children.size() > 0 && !root.playerId.equals(playerId)) { + while (!root.children.isEmpty() && !root.playerId.equals(playerId)) { test = root; root = root.children.get(0); } @@ -335,7 +335,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { logger.debug(indent(node.depth) + "simulating -- reached end state"); val = GameStateEvaluator.evaluate(playerId, game); } - else if (node.getChildren().size() > 0) { + else if (!node.getChildren().isEmpty()) { logger.debug(indent(node.depth) + "simulating -- somthing added children:" + node.getChildren().size()); val = minimaxAB(node, alpha, beta); } @@ -361,7 +361,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { if (game.gameOver(null)) { val = GameStateEvaluator.evaluate(playerId, game); } - else if (node.getChildren().size() > 0) { + else if (!node.getChildren().isEmpty()) { //declared attackers or blockers or triggered abilities logger.debug(indent(node.depth) + "simulating -- attack/block/trigger added children:" + node.getChildren().size()); val = minimaxAB(node, alpha, beta); @@ -430,9 +430,9 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { alpha = val; bestNode = newNode; node.setCombat(newNode.getCombat()); - if (node.getTargets().size() > 0) + if (!node.getTargets().isEmpty()) targets = node.getTargets(); - if (node.getChoices().size() > 0) + if (!node.getChoices().isEmpty()) choices = node.getChoices(); } if (val == GameStateEvaluator.WIN_SCORE) { @@ -673,7 +673,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { @Override public void selectBlockers(Game game, UUID defendingPlayerId) { logger.debug("selectBlockers"); - if (combat != null && combat.getGroups().size() > 0) { + if (combat != null && !combat.getGroups().isEmpty()) { List groups = game.getCombat().getGroups(); for (int i = 0; i < groups.size(); i++) { if (i < combat.getGroups().size()) { diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer3.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer3.java index 2ceb791e15..c38a835d74 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer3.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer3.java @@ -139,7 +139,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player { else addActions(root, Integer.MIN_VALUE, Integer.MAX_VALUE); logger.info(name + " simulated " + nodeCount + " nodes in " + thinkTime/1000000000.0 + "s - average " + nodeCount/(thinkTime/1000000000.0) + " nodes/s"); - if (root.children.size() > 0) { + if (!root.children.isEmpty()) { root = root.children.get(0); actions = new LinkedList(root.abilities); combat = root.combat; @@ -163,7 +163,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player { else addActions(root, Integer.MIN_VALUE, Integer.MAX_VALUE); logger.info(name + " simulated " + nodeCount + " nodes in " + thinkTime/1000000000.0 + "s - average " + nodeCount/(thinkTime/1000000000.0) + " nodes/s"); - if (root.children.size() > 0) { + if (!root.children.isEmpty()) { root = root.children.get(0); actions = new LinkedList(root.abilities); combat = root.combat; @@ -189,7 +189,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player { logger.debug(indent(node.depth) + "simulating -- reached end state"); val = GameStateEvaluator.evaluate(playerId, game); } - else if (node.getChildren().size() > 0) { + else if (!node.getChildren().isEmpty()) { logger.debug(indent(node.depth) + "simulating -- somthing added children:" + node.getChildren().size()); val = minimaxAB(node, alpha, beta); } @@ -238,7 +238,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player { val = GameStateEvaluator.evaluate(playerId, game); } } - else if (node.getChildren().size() > 0) { + else if (!node.getChildren().isEmpty()) { logger.debug(indent(node.depth) + "simulating -- trigger added children:" + node.getChildren().size()); val = minimaxAB(node, alpha, beta); } @@ -388,7 +388,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player { } Game sim = game.copy(); for (CombatGroup group: engagement.getGroups()) { - if (group.getAttackers().size() > 0) { + if (!group.getAttackers().isEmpty()) { UUID attackerId = group.getAttackers().get(0); for (UUID blockerId: group.getBlockers()) { sim.getPlayer(defenderId).declareBlocker(defenderId, blockerId, attackerId, sim); diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedAction.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedAction.java index 855fa0c568..11fac9f264 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedAction.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedAction.java @@ -60,7 +60,7 @@ public class SimulatedAction { } public boolean usesStack() { - if (abilities != null && abilities.size() > 0) { + if (abilities != null && !abilities.isEmpty()) { return abilities.get(abilities.size() -1).isUsesStack(); } return true; diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java index fdefaa68d2..fb43fcb694 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java @@ -90,7 +90,7 @@ public class SimulatedPlayer extends ComputerPlayer { for (Ability ability: playables) { List options = game.getPlayer(playerId).getPlayableOptions(ability, game); if (options.isEmpty()) { - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { simulateVariableCosts(ability, game); } else { @@ -101,7 +101,7 @@ public class SimulatedPlayer extends ComputerPlayer { else { // ExecutorService simulationExecutor = Executors.newFixedThreadPool(4); for (Ability option: options) { - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { simulateVariableCosts(option, game); } else { diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index c199fda2c5..d5749dce83 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -726,7 +726,7 @@ public class HumanPlayer extends PlayerImpl { } if (actingPlayer != null) { LinkedHashMap useableAbilities = actingPlayer.getUseableActivatedAbilities(object, zone, game); - if (useableAbilities != null && useableAbilities.size() > 0) { + if (useableAbilities != null && !useableAbilities.isEmpty()) { activateAbility(useableAbilities, object, game); result = true; } @@ -912,7 +912,7 @@ public class HumanPlayer extends PlayerImpl { Zone zone = game.getState().getZone(object.getId()); if (zone != null) { LinkedHashMap useableAbilities = getUseableManaAbilities(object, zone, game); - if (useableAbilities != null && useableAbilities.size() > 0) { + if (useableAbilities != null && !useableAbilities.isEmpty()) { useableAbilities = ManaUtil.tryToAutoPay(unpaid, useableAbilities); // eliminates other abilities if one fits perfectly currentlyUnpaidMana = unpaid; activateAbility(useableAbilities, object, game); @@ -940,7 +940,7 @@ public class HumanPlayer extends PlayerImpl { } } options.put(Constants.Option.POSSIBLE_ATTACKERS, (Serializable) possibleAttackers); - if (possibleAttackers.size() > 0) { + if (!possibleAttackers.isEmpty()) { options.put(Constants.Option.SPECIAL_BUTTON, (Serializable) "All attack"); } @@ -1330,7 +1330,7 @@ public class HumanPlayer extends PlayerImpl { LinkedHashMap useableAbilities = getSpellAbilities(object, game.getState().getZone(object.getId()), game); if (useableAbilities != null && useableAbilities.size() == 1) { return (SpellAbility) useableAbilities.values().iterator().next(); - } else if (useableAbilities != null && useableAbilities.size() > 0) { + } else if (useableAbilities != null && !useableAbilities.isEmpty()) { game.fireGetChoiceEvent(playerId, name, object, new ArrayList<>(useableAbilities.values())); waitForResponse(game); if (response.getUUID() != null) { @@ -1378,7 +1378,7 @@ public class HumanPlayer extends PlayerImpl { modeMap.put(mode.getId(), modeText); } } - if (modeMap.size() > 0) { + if (!modeMap.isEmpty()) { boolean done = false; while (!done) { game.fireGetModeEvent(playerId, "Choose Mode", modeMap); diff --git a/Mage.Server/src/main/java/mage/server/User.java b/Mage.Server/src/main/java/mage/server/User.java index ec97db3753..ed71a256cf 100644 --- a/Mage.Server/src/main/java/mage/server/User.java +++ b/Mage.Server/src/main/java/mage/server/User.java @@ -554,7 +554,7 @@ public class User { if (tournament > 0) { sb.append("Tourn: ").append(tournament).append(' '); } - if (watchedGames.size() > 0) { + if (!watchedGames.isEmpty()) { sb.append("Watch: ").append(watchedGames.size()).append(' '); } return sb.toString(); @@ -655,7 +655,7 @@ public class User { if (proto.getMatchesQuit() > 0) { quit.add("Q:" + Integer.toString(proto.getMatchesQuit())); } - if (quit.size() > 0) { + if (!quit.isEmpty()) { builder.append(" ("); joinStrings(builder, quit, " "); builder.append(')'); @@ -687,7 +687,7 @@ public class User { if (proto.getTourneysQuitDuringRound() > 0) { quit.add("R:" + Integer.toString(proto.getTourneysQuitDuringRound())); } - if (quit.size() > 0) { + if (!quit.isEmpty()) { builder.append(" ("); joinStrings(builder, quit, " "); builder.append(')'); diff --git a/Mage.Server/src/main/java/mage/server/game/GameController.java b/Mage.Server/src/main/java/mage/server/game/GameController.java index 710a6cd8b4..0dd85984d4 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameController.java +++ b/Mage.Server/src/main/java/mage/server/game/GameController.java @@ -237,7 +237,7 @@ public class GameController implements GameCallback { break; case CHOOSE_ABILITY: String objectName = null; - if (event.getChoices() != null && event.getChoices().size() > 0) { + if (event.getChoices() != null && !event.getChoices().isEmpty()) { objectName = event.getChoices().iterator().next(); } chooseAbility(event.getPlayerId(), objectName, event.getAbilities()); @@ -816,7 +816,7 @@ public class GameController implements GameCallback { private void informOthers(List players) throws MageException { // first player is always original controller Player controller = null; - if (players != null && players.size() > 0) { + if (players != null && !players.isEmpty()) { controller = game.getPlayer(players.get(0)); } if (controller == null || game.getStep() == null || game.getStep().getType() == null) { diff --git a/Mage.Server/src/main/java/mage/server/game/GameSessionPlayer.java b/Mage.Server/src/main/java/mage/server/game/GameSessionPlayer.java index 3c85d08ce8..c595ae1647 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameSessionPlayer.java +++ b/Mage.Server/src/main/java/mage/server/game/GameSessionPlayer.java @@ -87,7 +87,6 @@ public class GameSessionPlayer extends GameSessionWatcher { if (!killed) { UserManager.getInstance().getUser(userId).ifPresent(user -> user.fireCallback(new ClientCallback("gameSelect", game.getId(), new GameClientMessage(getGameView(), message, options)))); } - ; } public void chooseAbility(final AbilityPickerView abilities) { @@ -233,7 +232,7 @@ public class GameSessionPlayer extends GameSessionWatcher { } private void processControlledPlayers(Player player, GameView gameView) { - if (player.getPlayersUnderYourControl().size() > 0) { + if (!player.getPlayersUnderYourControl().isEmpty()) { Map handCards = new HashMap<>(); for (UUID controlledPlayerId : player.getPlayersUnderYourControl()) { Player opponent = game.getPlayer(controlledPlayerId); diff --git a/Mage.Sets/src/mage/cards/a/ActOnImpulse.java b/Mage.Sets/src/mage/cards/a/ActOnImpulse.java index 67e5ac1587..8fba52dd91 100644 --- a/Mage.Sets/src/mage/cards/a/ActOnImpulse.java +++ b/Mage.Sets/src/mage/cards/a/ActOnImpulse.java @@ -98,7 +98,7 @@ class ActOnImpulseExileEffect extends OneShotEffect { cards.add(card); } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { List cardsId = new ArrayList<>(); for (Card card : cards) { card.moveToExile(source.getSourceId(), "Act on Impulse", source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/a/AgonizingMemories.java b/Mage.Sets/src/mage/cards/a/AgonizingMemories.java index 16ec49dc2b..afc34c70fd 100644 --- a/Mage.Sets/src/mage/cards/a/AgonizingMemories.java +++ b/Mage.Sets/src/mage/cards/a/AgonizingMemories.java @@ -96,7 +96,7 @@ class AgonizingMemoriesEffect extends OneShotEffect { } private void chooseCardInHandAndPutOnTopOfLibrary(Game game, Ability source, Player you, Player targetPlayer) { - if (targetPlayer.getHand().size() > 0) { + if (!targetPlayer.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, new FilterCard("card to put on the top of library (last chosen will be on top)")); if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) { Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/a/AladdinsLamp.java b/Mage.Sets/src/mage/cards/a/AladdinsLamp.java index 0d24ffb4b4..608529408c 100644 --- a/Mage.Sets/src/mage/cards/a/AladdinsLamp.java +++ b/Mage.Sets/src/mage/cards/a/AladdinsLamp.java @@ -121,7 +121,7 @@ class AladdinsLampEffect extends ReplacementEffectImpl { // Put the rest on the bottom of your library in a random order - while (cards.size() > 0) { + while (!cards.isEmpty()) { Card card = cards.getRandom(game); if (card != null) { cards.remove(card); diff --git a/Mage.Sets/src/mage/cards/a/AltarOfDementia.java b/Mage.Sets/src/mage/cards/a/AltarOfDementia.java index 6355c03189..a4467f071e 100644 --- a/Mage.Sets/src/mage/cards/a/AltarOfDementia.java +++ b/Mage.Sets/src/mage/cards/a/AltarOfDementia.java @@ -95,7 +95,7 @@ class AltarOfDementiaEffect extends OneShotEffect { if (player != null) { int amount = 0; for (Cost cost: source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue(); break; } diff --git a/Mage.Sets/src/mage/cards/a/AmassTheComponents.java b/Mage.Sets/src/mage/cards/a/AmassTheComponents.java index d7deb9ef33..48944049f8 100644 --- a/Mage.Sets/src/mage/cards/a/AmassTheComponents.java +++ b/Mage.Sets/src/mage/cards/a/AmassTheComponents.java @@ -90,7 +90,7 @@ class AmassTheComponentsEffect extends OneShotEffect { } player.drawCards(3, game); - if (player.getHand().size() > 0) { + if (!player.getHand().isEmpty()) { FilterCard filter = new FilterCard("card from your hand to put on the bottom of your library"); TargetCard target = new TargetCard(Zone.HAND, filter); diff --git a/Mage.Sets/src/mage/cards/a/AncestralMemories.java b/Mage.Sets/src/mage/cards/a/AncestralMemories.java index 5929f9e5d2..5041fb9b37 100644 --- a/Mage.Sets/src/mage/cards/a/AncestralMemories.java +++ b/Mage.Sets/src/mage/cards/a/AncestralMemories.java @@ -98,7 +98,7 @@ class AncestralMemoriesEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { player.lookAtCards("Ancestral Memories", cards, game); TargetCard target = new TargetCard(Math.min(2, cards.size()), Zone.LIBRARY, new FilterCard("two cards to put in your hand")); diff --git a/Mage.Sets/src/mage/cards/a/AngelOfSerenity.java b/Mage.Sets/src/mage/cards/a/AngelOfSerenity.java index c2890bec7f..9d17814815 100644 --- a/Mage.Sets/src/mage/cards/a/AngelOfSerenity.java +++ b/Mage.Sets/src/mage/cards/a/AngelOfSerenity.java @@ -106,7 +106,7 @@ class AngelOfSerenityTriggeredAbility extends ZoneChangeTriggeredAbility { filter.add(new AnotherPredicate()); TargetCreaturePermanent target1 = new TargetCreaturePermanent(0, 3, filter, false); game.getPlayer(getControllerId()).chooseTarget(Outcome.Exile, target1, this, game); - if (target1.getTargets().size() > 0) { + if (!target1.getTargets().isEmpty()) { getTargets().add(target1); } @@ -115,7 +115,7 @@ class AngelOfSerenityTriggeredAbility extends ZoneChangeTriggeredAbility { FilterCard filter2 = new FilterCreatureCard("up to " + leftTargets + " target creature card" + (leftTargets > 1 ? "s" : "") + " from graveyards"); TargetCardInGraveyard target2 = new TargetCardInGraveyard(0, leftTargets, filter2); game.getPlayer(getControllerId()).chooseTarget(Outcome.Exile, target2, this, game); - if (target2.getTargets().size() > 0) { + if (!target2.getTargets().isEmpty()) { getTargets().add(target2); } } @@ -152,7 +152,7 @@ class AngelOfSerenityEnterEffect extends OneShotEffect { boolean result = true; Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); - if (controller != null && sourceObject != null && source.getTargets().size() > 0) { + if (controller != null && sourceObject != null && !source.getTargets().isEmpty()) { UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); for (Target target : source.getTargets()) { if (target instanceof TargetCreaturePermanent) { diff --git a/Mage.Sets/src/mage/cards/a/AngelicArbiter.java b/Mage.Sets/src/mage/cards/a/AngelicArbiter.java index 3763f19620..4c61d2ad67 100644 --- a/Mage.Sets/src/mage/cards/a/AngelicArbiter.java +++ b/Mage.Sets/src/mage/cards/a/AngelicArbiter.java @@ -109,7 +109,7 @@ class AngelicArbiterWatcher2 extends Watcher { && game.getActivePlayerId().equals(event.getPlayerId()) && game.getOpponents(controllerId).contains(event.getPlayerId()) && game.getCombat().getAttackerId().equals(event.getPlayerId()) - && game.getCombat().getAttackers().size() > 0) { + && !game.getCombat().getAttackers().isEmpty()) { playersThatAttackedThisTurn.add(event.getPlayerId()); } } diff --git a/Mage.Sets/src/mage/cards/a/AnimalBoneyard.java b/Mage.Sets/src/mage/cards/a/AnimalBoneyard.java index c66f39e4fe..07f19f2005 100644 --- a/Mage.Sets/src/mage/cards/a/AnimalBoneyard.java +++ b/Mage.Sets/src/mage/cards/a/AnimalBoneyard.java @@ -105,7 +105,7 @@ class AnimalBoneyardEffect extends OneShotEffect { int toughness = 0; for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { toughness = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue(); break; } diff --git a/Mage.Sets/src/mage/cards/a/AnimationModule.java b/Mage.Sets/src/mage/cards/a/AnimationModule.java index aec546a8a0..8b041211fb 100644 --- a/Mage.Sets/src/mage/cards/a/AnimationModule.java +++ b/Mage.Sets/src/mage/cards/a/AnimationModule.java @@ -143,7 +143,7 @@ class AnimationModuleEffect extends OneShotEffect { if (controller != null) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { - if (permanent.getCounters(game).size() > 0) { + if (!permanent.getCounters(game).isEmpty()) { if (permanent.getCounters(game).size() == 1) { for (Counter counter : permanent.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName()); @@ -172,7 +172,7 @@ class AnimationModuleEffect extends OneShotEffect { else { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { - if (player.getCounters().size() > 0) { + if (!player.getCounters().isEmpty()) { if (player.getCounters().size() == 1) { for (Counter counter : player.getCounters().values()) { Counter newCounter = new Counter(counter.getName()); diff --git a/Mage.Sets/src/mage/cards/a/AnimistsAwakening.java b/Mage.Sets/src/mage/cards/a/AnimistsAwakening.java index ea757d6945..fdd8295e4f 100644 --- a/Mage.Sets/src/mage/cards/a/AnimistsAwakening.java +++ b/Mage.Sets/src/mage/cards/a/AnimistsAwakening.java @@ -93,7 +93,7 @@ class AnimistsAwakeningEffect extends OneShotEffect { Cards cards = new CardsImpl(); int xValue = source.getManaCostsToPay().getX(); cards.addAll(controller.getLibrary().getTopCards(game, xValue)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.revealCards(sourceObject.getIdName(), cards, game); Set toBattlefield = new LinkedHashSet<>(); for (Card card : cards.getCards(new FilterLandCard(), source.getSourceId(), source.getControllerId(), game)) { diff --git a/Mage.Sets/src/mage/cards/a/AnyaMercilessAngel.java b/Mage.Sets/src/mage/cards/a/AnyaMercilessAngel.java index b233744046..66f9bdd063 100644 --- a/Mage.Sets/src/mage/cards/a/AnyaMercilessAngel.java +++ b/Mage.Sets/src/mage/cards/a/AnyaMercilessAngel.java @@ -127,7 +127,7 @@ class AnyaMercilessAngelCondition implements Condition { public static AnyaMercilessAngelCondition getInstance() { return fInstance; - }; + } private AnyaMercilessAngelCondition() {} diff --git a/Mage.Sets/src/mage/cards/b/BaneAlleyBroker.java b/Mage.Sets/src/mage/cards/b/BaneAlleyBroker.java index bcd2df53f4..3226e3cd65 100644 --- a/Mage.Sets/src/mage/cards/b/BaneAlleyBroker.java +++ b/Mage.Sets/src/mage/cards/b/BaneAlleyBroker.java @@ -176,7 +176,7 @@ class TargetCardInBaneAlleyBrokerExile extends TargetCardInExile { if (sourceCard != null) { UUID exileId = CardUtil.getCardExileZoneId(game, sourceId); ExileZone exile = game.getExile().getExileZone(exileId); - if (exile != null && exile.size() > 0) { + if (exile != null && !exile.isEmpty()) { possibleTargets.addAll(exile); } } @@ -189,7 +189,7 @@ class TargetCardInBaneAlleyBrokerExile extends TargetCardInExile { if (sourceCard != null) { UUID exileId = CardUtil.getCardExileZoneId(game, sourceId); ExileZone exile = game.getExile().getExileZone(exileId); - if (exile != null && exile.size() > 0) { + if (exile != null && !exile.isEmpty()) { return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BirthingPod.java b/Mage.Sets/src/mage/cards/b/BirthingPod.java index 3233b1eb1f..2ede7fdac7 100644 --- a/Mage.Sets/src/mage/cards/b/BirthingPod.java +++ b/Mage.Sets/src/mage/cards/b/BirthingPod.java @@ -95,7 +95,7 @@ class BirthingPodEffect extends OneShotEffect { for (Cost cost : source.getCosts()) { if (cost instanceof SacrificeTargetCost) { SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; - if (sacrificeCost.getPermanents().size() > 0) { + if (!sacrificeCost.getPermanents().isEmpty()) { sacrificedPermanent = sacrificeCost.getPermanents().get(0); } break; diff --git a/Mage.Sets/src/mage/cards/b/BitterRevelation.java b/Mage.Sets/src/mage/cards/b/BitterRevelation.java index b5341a5ec4..d5f7c2ca83 100644 --- a/Mage.Sets/src/mage/cards/b/BitterRevelation.java +++ b/Mage.Sets/src/mage/cards/b/BitterRevelation.java @@ -97,7 +97,7 @@ class BitterRevelationEffect extends OneShotEffect { cards.add(card); } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { Cards cardsToHand = new CardsImpl(); player.lookAtCards("Bitter Revelation", cards, game); TargetCard target = new TargetCard(Math.min(2, cards.size()), Zone.LIBRARY, new FilterCard("two cards to put in your hand")); diff --git a/Mage.Sets/src/mage/cards/b/BlessedReincarnation.java b/Mage.Sets/src/mage/cards/b/BlessedReincarnation.java index 590761adf9..71f68f65af 100644 --- a/Mage.Sets/src/mage/cards/b/BlessedReincarnation.java +++ b/Mage.Sets/src/mage/cards/b/BlessedReincarnation.java @@ -127,7 +127,7 @@ class BlessedReincarnationEffect extends OneShotEffect { card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId()); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { player.revealCards("BlessedReincarnation", cards, game); Set cardsToShuffle = cards.getCards(game); cardsToShuffle.remove(card); diff --git a/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java b/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java index ae0a9ac04a..5d7eee81fe 100644 --- a/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java +++ b/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java @@ -136,7 +136,7 @@ class BorderlandExplorerEffect extends OneShotEffect { if (cardsPlayer != null) { TargetCardInLibrary target = new TargetCardInLibrary(0, 1, new FilterBasicLandCard()); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(target.getTargets()); cards.addAll(target.getTargets()); cardsToReveal.put(playerId, cards); diff --git a/Mage.Sets/src/mage/cards/b/BrionStoutarm.java b/Mage.Sets/src/mage/cards/b/BrionStoutarm.java index f021847a79..83a6d95488 100644 --- a/Mage.Sets/src/mage/cards/b/BrionStoutarm.java +++ b/Mage.Sets/src/mage/cards/b/BrionStoutarm.java @@ -110,7 +110,7 @@ class BrionStoutarmEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = 0; for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue(); break; } diff --git a/Mage.Sets/src/mage/cards/b/Browse.java b/Mage.Sets/src/mage/cards/b/Browse.java index 5dddb79372..a31cedc640 100644 --- a/Mage.Sets/src/mage/cards/b/Browse.java +++ b/Mage.Sets/src/mage/cards/b/Browse.java @@ -99,7 +99,7 @@ class BrowseEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { player.lookAtCards("Browse", cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand")); diff --git a/Mage.Sets/src/mage/cards/c/ChandraPyromaster.java b/Mage.Sets/src/mage/cards/c/ChandraPyromaster.java index 76b5a3ca94..6c39693cf3 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraPyromaster.java +++ b/Mage.Sets/src/mage/cards/c/ChandraPyromaster.java @@ -278,7 +278,7 @@ class ChandraPyromasterEffect3 extends OneShotEffect { cards.addAll(controller.getLibrary().getTopCards(game, 10)); controller.moveCardsToExile(cards.getCards(game), source, game, true, source.getSourceId(), sourceObject.getIdName()); - if (cards.getCards(new FilterInstantOrSorceryCard(), game).size() > 0) { + if (!cards.getCards(new FilterInstantOrSorceryCard(), game).isEmpty()) { TargetCard target = new TargetCard(Zone.EXILED, new FilterInstantOrSorceryCard()); if (controller.chooseTarget(Outcome.PlayForFree, cards, target, source, game)) { Card card = cards.get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/c/ChimneyImp.java b/Mage.Sets/src/mage/cards/c/ChimneyImp.java index 6386f9f2f5..f18e96d11f 100644 --- a/Mage.Sets/src/mage/cards/c/ChimneyImp.java +++ b/Mage.Sets/src/mage/cards/c/ChimneyImp.java @@ -96,7 +96,7 @@ class ChimneyImpEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetOpponent = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetOpponent != null) { - if (targetOpponent.getHand().size() > 0) { + if (!targetOpponent.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); target.setNotTarget(true); target.setTargetName("a card from your hand to put on top of your library"); diff --git a/Mage.Sets/src/mage/cards/c/ChitteringRats.java b/Mage.Sets/src/mage/cards/c/ChitteringRats.java index 5364f9b99f..2cb26c0903 100644 --- a/Mage.Sets/src/mage/cards/c/ChitteringRats.java +++ b/Mage.Sets/src/mage/cards/c/ChitteringRats.java @@ -93,7 +93,7 @@ class ChitteringRatsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetOpponent = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetOpponent != null) { - if (targetOpponent.getHand().size() > 0) { + if (!targetOpponent.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); target.setNotTarget(true); target.setTargetName("a card from your hand to put on top of your library"); diff --git a/Mage.Sets/src/mage/cards/c/ChromeMox.java b/Mage.Sets/src/mage/cards/c/ChromeMox.java index a7c8406e39..292d9cd2a5 100644 --- a/Mage.Sets/src/mage/cards/c/ChromeMox.java +++ b/Mage.Sets/src/mage/cards/c/ChromeMox.java @@ -107,7 +107,7 @@ class ChromeMoxEffect extends OneShotEffect { target.setNotTarget(true); Card cardToImprint = null; Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (controller.getHand().size() > 0 && controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) { + if (!controller.getHand().isEmpty() && controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) { cardToImprint = controller.getHand().get(target.getFirstTarget(), game); } if (sourcePermanent != null) { @@ -154,7 +154,7 @@ class ChromeMoxManaEffect extends ManaEffect { Player player = game.getPlayer(source.getControllerId()); if (permanent != null && player != null) { List imprinted = permanent.getImprinted(); - if (imprinted.size() > 0) { + if (!imprinted.isEmpty()) { Card imprintedCard = game.getCard(imprinted.get(0)); if (imprintedCard != null) { Choice choice = new ChoiceColor(true); @@ -177,7 +177,7 @@ class ChromeMoxManaEffect extends ManaEffect { choice.getChoices().add("White"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Mana mana = new Mana(); if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); diff --git a/Mage.Sets/src/mage/cards/c/CircleOfProtectionWhite.java b/Mage.Sets/src/mage/cards/c/CircleOfProtectionWhite.java index 05cc85c8d5..d1d84a009e 100644 --- a/Mage.Sets/src/mage/cards/c/CircleOfProtectionWhite.java +++ b/Mage.Sets/src/mage/cards/c/CircleOfProtectionWhite.java @@ -60,7 +60,7 @@ public class CircleOfProtectionWhite extends CardImpl { // {1}: The next time a white source of your choice would deal damage to you this turn, prevent that damage. Effect effect = new PreventNextDamageFromChosenSourceToYouEffect(Duration.EndOfTurn, filter); - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("1")));; + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("1"))); } public CircleOfProtectionWhite(final CircleOfProtectionWhite card) { diff --git a/Mage.Sets/src/mage/cards/c/CitanulFlute.java b/Mage.Sets/src/mage/cards/c/CitanulFlute.java index 013e9fbf5f..81504b425a 100644 --- a/Mage.Sets/src/mage/cards/c/CitanulFlute.java +++ b/Mage.Sets/src/mage/cards/c/CitanulFlute.java @@ -106,7 +106,7 @@ class CitanulFluteSearchEffect extends OneShotEffect { TargetCardInLibrary target = new TargetCardInLibrary(filter); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = player.getLibrary().getCard(target.getFirstTarget(), game); Cards cards = new CardsImpl(); if (card != null){ diff --git a/Mage.Sets/src/mage/cards/c/Clockspinning.java b/Mage.Sets/src/mage/cards/c/Clockspinning.java index 198b50ddbc..e8aab7e550 100644 --- a/Mage.Sets/src/mage/cards/c/Clockspinning.java +++ b/Mage.Sets/src/mage/cards/c/Clockspinning.java @@ -94,7 +94,7 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect { private Counter selectCounterType(Game game, Ability source, Permanent permanent) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && permanent.getCounters(game).size() > 0) { + if (controller != null && !permanent.getCounters(game).isEmpty()) { String counterName = null; if (permanent.getCounters(game).size() > 1) { Choice choice = new ChoiceImpl(true); @@ -122,7 +122,7 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect { private Counter selectCounterType(Game game, Ability source, Card card) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && card.getCounters(game).size() > 0) { + if (controller != null && !card.getCounters(game).isEmpty()) { String counterName = null; if (card.getCounters(game).size() > 1) { Choice choice = new ChoiceImpl(true); diff --git a/Mage.Sets/src/mage/cards/c/CloneShell.java b/Mage.Sets/src/mage/cards/c/CloneShell.java index cc61165c32..0293a4e79a 100644 --- a/Mage.Sets/src/mage/cards/c/CloneShell.java +++ b/Mage.Sets/src/mage/cards/c/CloneShell.java @@ -120,7 +120,7 @@ class CloneShellEffect extends OneShotEffect { target1.clearChosen(); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { TargetCard target2 = new TargetCard(Zone.LIBRARY, filter2); while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Benefit, cards, target2, game); @@ -163,7 +163,7 @@ class CloneShellDiesEffect extends OneShotEffect { Permanent permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); if (permanent != null) { List imprinted = permanent.getImprinted(); - if (imprinted.size() > 0) { + if (!imprinted.isEmpty()) { Card imprintedCard = game.getCard(imprinted.get(0)); imprintedCard.setFaceDown(false, game); if (imprintedCard.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/cards/c/CobraTrap.java b/Mage.Sets/src/mage/cards/c/CobraTrap.java index 08ca3436f7..7bc5b0ba42 100644 --- a/Mage.Sets/src/mage/cards/c/CobraTrap.java +++ b/Mage.Sets/src/mage/cards/c/CobraTrap.java @@ -117,7 +117,7 @@ class CobraTrapWatcher extends Watcher { if (event.getType() == EventType.DESTROYED_PERMANENT) { Permanent perm = (Permanent) game.getPermanentOrLKIBattlefield(event.getTargetId()); // can regenerate or be indestructible if (perm != null && !perm.getCardType().contains(CardType.CREATURE)) { - if (game.getStack().size() > 0) { + if (!game.getStack().isEmpty()) { StackObject spell = game.getStack().getStackObject(event.getSourceId()); if (spell != null && game.getOpponents(perm.getControllerId()).contains(spell.getControllerId())) { players.add(perm.getControllerId()); diff --git a/Mage.Sets/src/mage/cards/c/Conflux.java b/Mage.Sets/src/mage/cards/c/Conflux.java index aa5d0003a8..a39557b81c 100644 --- a/Mage.Sets/src/mage/cards/c/Conflux.java +++ b/Mage.Sets/src/mage/cards/c/Conflux.java @@ -109,7 +109,7 @@ class ConfluxEffect extends OneShotEffect { if (you != null && you.getLibrary().size() > 0) { if (you.searchLibrary(targetWhite, game)) { - if (targetWhite.getTargets().size() > 0) { + if (!targetWhite.getTargets().isEmpty()) { for (UUID cardId : (List) targetWhite.getTargets()) { Card card = you.getLibrary().remove(cardId, game); if (card != null) { @@ -121,7 +121,7 @@ class ConfluxEffect extends OneShotEffect { } if (you != null && you.getLibrary().size() > 0) { if (you.searchLibrary(targetBlue, game)) { - if (targetBlue.getTargets().size() > 0) { + if (!targetBlue.getTargets().isEmpty()) { for (UUID cardId : (List) targetBlue.getTargets()) { Card card = you.getLibrary().remove(cardId, game); if (card != null) { @@ -133,7 +133,7 @@ class ConfluxEffect extends OneShotEffect { } if (you != null && you.getLibrary().size() > 0) { if (you.searchLibrary(targetBlack, game)) { - if (targetBlack.getTargets().size() > 0) { + if (!targetBlack.getTargets().isEmpty()) { for (UUID cardId : (List) targetBlack.getTargets()) { Card card = you.getLibrary().remove(cardId, game); if (card != null) { @@ -145,7 +145,7 @@ class ConfluxEffect extends OneShotEffect { } if (you != null && you.getLibrary().size() > 0) { if (you.searchLibrary(targetRed, game)) { - if (targetRed.getTargets().size() > 0) { + if (!targetRed.getTargets().isEmpty()) { for (UUID cardId : (List) targetRed.getTargets()) { Card card = you.getLibrary().remove(cardId, game); if (card != null) { @@ -157,7 +157,7 @@ class ConfluxEffect extends OneShotEffect { } if (you != null && you.getLibrary().size() > 0) { if (you.searchLibrary(targetGreen, game)) { - if (targetGreen.getTargets().size() > 0) { + if (!targetGreen.getTargets().isEmpty()) { for (UUID cardId : (List) targetGreen.getTargets()) { Card card = you.getLibrary().remove(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/c/CongregationAtDawn.java b/Mage.Sets/src/mage/cards/c/CongregationAtDawn.java index 3521efde2b..596c2ff250 100644 --- a/Mage.Sets/src/mage/cards/c/CongregationAtDawn.java +++ b/Mage.Sets/src/mage/cards/c/CongregationAtDawn.java @@ -95,7 +95,7 @@ class CongregationAtDawnEffect extends OneShotEffect { if (controller != null && sourceObject != null) { TargetCardInLibrary target = new TargetCardInLibrary(0, 3, new FilterCreatureCard("creature cards")); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(); for (UUID cardId : (List) target.getTargets()) { Card card = controller.getLibrary().remove(cardId, game); diff --git a/Mage.Sets/src/mage/cards/c/CorpseConnoisseur.java b/Mage.Sets/src/mage/cards/c/CorpseConnoisseur.java index c654819659..9917868bd9 100644 --- a/Mage.Sets/src/mage/cards/c/CorpseConnoisseur.java +++ b/Mage.Sets/src/mage/cards/c/CorpseConnoisseur.java @@ -97,7 +97,7 @@ class SearchLibraryPutInGraveyard extends SearchEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); if (card != null) { controller.moveCards(card, Zone.GRAVEYARD, source, game); diff --git a/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java b/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java index 0f91cdd892..5d2668e8f0 100644 --- a/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java +++ b/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java @@ -136,7 +136,7 @@ class CorruptedGrafstoneManaEffect extends ManaEffect { if (types.getWhite() > 0) { choice.getChoices().add("White"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { diff --git a/Mage.Sets/src/mage/cards/c/Cultivate.java b/Mage.Sets/src/mage/cards/c/Cultivate.java index 7d29dd2a16..b50d86bba9 100644 --- a/Mage.Sets/src/mage/cards/c/Cultivate.java +++ b/Mage.Sets/src/mage/cards/c/Cultivate.java @@ -98,7 +98,7 @@ class CultivateEffect extends OneShotEffect { } TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard()); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); diff --git a/Mage.Sets/src/mage/cards/c/CurseOfChaos.java b/Mage.Sets/src/mage/cards/c/CurseOfChaos.java index 3b6eabf41b..3889b540bc 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfChaos.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfChaos.java @@ -140,7 +140,7 @@ class CurseOfChaosEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player attacker = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (attacker != null) { - if (attacker.getHand().size() > 0 && attacker.chooseUse(outcome, "Discard a card and draw a card?", source, game)){ + if (!attacker.getHand().isEmpty() && attacker.chooseUse(outcome, "Discard a card and draw a card?", source, game)){ attacker.discard(1, false, source, game); attacker.drawCards(1, game); } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfEchoes.java b/Mage.Sets/src/mage/cards/c/CurseOfEchoes.java index 49d85b43b4..f936fb3513 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfEchoes.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfEchoes.java @@ -166,7 +166,7 @@ class CurseOfEchoesEffect extends OneShotEffect { @Override public String getText(Mode mode) { - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { return "Copy target " + mode.getTargets().get(0).getTargetName() + ". You may choose new targets for the copy"; } return "No target"; diff --git a/Mage.Sets/src/mage/cards/c/CursedScroll.java b/Mage.Sets/src/mage/cards/c/CursedScroll.java index 18bbb0f067..8b58b4984d 100644 --- a/Mage.Sets/src/mage/cards/c/CursedScroll.java +++ b/Mage.Sets/src/mage/cards/c/CursedScroll.java @@ -93,7 +93,7 @@ class CursedScrollEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY); if (sourceObject != null && controller != null && cardName != null && !cardName.isEmpty()) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = controller.getHand().getRandom(game); revealed.add(card); diff --git a/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java b/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java index 4c84b49886..990e3ca775 100644 --- a/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java +++ b/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java @@ -261,7 +261,7 @@ class DanceOfTheDeadChangeAbilityEffect extends ContinuousEffectImpl implements @Override public boolean apply(Game game, Ability source) { - Permanent permanent = affectedObjectList.get(0).getPermanent(game);; + Permanent permanent = affectedObjectList.get(0).getPermanent(game); if (permanent != null) { Ability abilityToRemove = null; for (Ability ability : permanent.getAbilities()) { diff --git a/Mage.Sets/src/mage/cards/d/DarkSupplicant.java b/Mage.Sets/src/mage/cards/d/DarkSupplicant.java index 70cc2e33dc..bde1f4d55f 100644 --- a/Mage.Sets/src/mage/cards/d/DarkSupplicant.java +++ b/Mage.Sets/src/mage/cards/d/DarkSupplicant.java @@ -116,7 +116,7 @@ class DarkSupplicantEffect extends OneShotEffect { // Library check if (player.chooseUse(Outcome.Benefit, "Do you want to search your library for Scion of Darkness?", source, game)) { if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId : (List) target.getTargets()) { Card card = player.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/d/DarthTyranus.java b/Mage.Sets/src/mage/cards/d/DarthTyranus.java index f80e8a5184..18766d2ec6 100644 --- a/Mage.Sets/src/mage/cards/d/DarthTyranus.java +++ b/Mage.Sets/src/mage/cards/d/DarthTyranus.java @@ -148,7 +148,7 @@ class TransmuteArtifactEffect extends SearchEffect { } } if (sacrifice && controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/d/DementiaSliver.java b/Mage.Sets/src/mage/cards/d/DementiaSliver.java index 73b15fc748..f1ba7513f5 100644 --- a/Mage.Sets/src/mage/cards/d/DementiaSliver.java +++ b/Mage.Sets/src/mage/cards/d/DementiaSliver.java @@ -107,7 +107,7 @@ class DementiaSliverEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY); if (opponent != null && sourceObject != null && !cardName.isEmpty()) { - if (opponent.getHand().size() > 0) { + if (!opponent.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = opponent.getHand().getRandom(game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/d/DeployTheGatewatch.java b/Mage.Sets/src/mage/cards/d/DeployTheGatewatch.java index 9bdef7feba..d9042c27e7 100644 --- a/Mage.Sets/src/mage/cards/d/DeployTheGatewatch.java +++ b/Mage.Sets/src/mage/cards/d/DeployTheGatewatch.java @@ -123,7 +123,7 @@ class DeployTheGatewatchEffect extends OneShotEffect { } // Put the rest on the bottom of your library in a random order - while (cards.size() > 0) { + while (!cards.isEmpty()) { Card card = cards.getRandom(game); if (card != null) { cards.remove(card); diff --git a/Mage.Sets/src/mage/cards/d/DescendantOfMasumaro.java b/Mage.Sets/src/mage/cards/d/DescendantOfMasumaro.java index 448e94ffb9..5412a84808 100644 --- a/Mage.Sets/src/mage/cards/d/DescendantOfMasumaro.java +++ b/Mage.Sets/src/mage/cards/d/DescendantOfMasumaro.java @@ -95,11 +95,11 @@ class DescendantOfMasumaroEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (controller != null && sourcePermanent != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { new AddCountersSourceEffect(CounterType.P1P1.createInstance(controller.getHand().size()), true).apply(game, source); } Player targetOpponent = game.getPlayer(getTargetPointer().getFirst(game, source)); - if (targetOpponent != null && targetOpponent.getHand().size() > 0) { + if (targetOpponent != null && !targetOpponent.getHand().isEmpty()) { sourcePermanent.removeCounters(CounterType.P1P1.getName(), targetOpponent.getHand().size(), game); game.informPlayers(controller.getLogName() + " removes " + targetOpponent.getHand().size() + " +1/+1 counters from " + sourcePermanent.getLogName()); } diff --git a/Mage.Sets/src/mage/cards/d/DevoutInvocation.java b/Mage.Sets/src/mage/cards/d/DevoutInvocation.java index d145307397..0585406735 100644 --- a/Mage.Sets/src/mage/cards/d/DevoutInvocation.java +++ b/Mage.Sets/src/mage/cards/d/DevoutInvocation.java @@ -98,7 +98,7 @@ class DevoutInvocationEffect extends OneShotEffect { Map options = new HashMap<>(); options.put("UI.right.btn.text", "Tapping complete"); controller.choose(outcome, target, source.getControllerId(), game, options); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID creature = target.getFirstTarget(); if (creature != null) { game.getPermanent(creature).tap(game); diff --git a/Mage.Sets/src/mage/cards/d/DimirCharm.java b/Mage.Sets/src/mage/cards/d/DimirCharm.java index 0d005c0fba..0d4f999b50 100644 --- a/Mage.Sets/src/mage/cards/d/DimirCharm.java +++ b/Mage.Sets/src/mage/cards/d/DimirCharm.java @@ -120,7 +120,7 @@ class DimirCharmEffect extends OneShotEffect { cards.add(card); } } - if(cards.size() > 0){ + if(!cards.isEmpty()){ TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("Card to put back on top of library")); if(controller.chooseTarget(Outcome.Benefit, cards, target, source, game)){ Card card = cards.get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/d/DimirMachinations.java b/Mage.Sets/src/mage/cards/d/DimirMachinations.java index 5f9be567a6..7493efb190 100644 --- a/Mage.Sets/src/mage/cards/d/DimirMachinations.java +++ b/Mage.Sets/src/mage/cards/d/DimirMachinations.java @@ -108,7 +108,7 @@ class DimirMachinationsEffect extends OneShotEffect { cards.remove(card); } } - while (cards.size() > 0) { + while (!cards.isEmpty()) { if (cards.size() == 1) { Card card = cards.get(cards.iterator().next(), game); controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false); diff --git a/Mage.Sets/src/mage/cards/d/DivergentTransformations.java b/Mage.Sets/src/mage/cards/d/DivergentTransformations.java index f82fec795c..05ab36fc93 100644 --- a/Mage.Sets/src/mage/cards/d/DivergentTransformations.java +++ b/Mage.Sets/src/mage/cards/d/DivergentTransformations.java @@ -125,7 +125,7 @@ class DivergentTransformationsEffect extends OneShotEffect { card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId()); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { player.revealCards(sourceObject.getIdName(), cards, game); Set cardsToShuffle = cards.getCards(game); cardsToShuffle.remove(card); diff --git a/Mage.Sets/src/mage/cards/d/Dracoplasm.java b/Mage.Sets/src/mage/cards/d/Dracoplasm.java index 36f6dd28e3..8609d41e87 100644 --- a/Mage.Sets/src/mage/cards/d/Dracoplasm.java +++ b/Mage.Sets/src/mage/cards/d/Dracoplasm.java @@ -130,7 +130,7 @@ class DracoplasmEffect extends ReplacementEffectImpl { return false; } controller.chooseTarget(Outcome.Detriment, target, source, game); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { int power = 0; int toughness = 0; for (UUID targetId : target.getTargets()) { diff --git a/Mage.Sets/src/mage/cards/d/DralnusPet.java b/Mage.Sets/src/mage/cards/d/DralnusPet.java index 2e6f2b9296..943197b875 100644 --- a/Mage.Sets/src/mage/cards/d/DralnusPet.java +++ b/Mage.Sets/src/mage/cards/d/DralnusPet.java @@ -121,7 +121,7 @@ class DralnusPetEffect extends OneShotEffect { && permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) { int cmc = 0; for (Cost cost : spellAbility.getCosts()) { - if (cost instanceof DiscardCardCost && ((DiscardCardCost) cost).getCards().size() > 0) { + if (cost instanceof DiscardCardCost && !((DiscardCardCost) cost).getCards().isEmpty()) { cmc = ((DiscardCardCost) cost).getCards().get(0).getConvertedManaCost(); } if (cmc > 0) { diff --git a/Mage.Sets/src/mage/cards/d/Duplicant.java b/Mage.Sets/src/mage/cards/d/Duplicant.java index 2132a893d4..8f0b960c65 100644 --- a/Mage.Sets/src/mage/cards/d/Duplicant.java +++ b/Mage.Sets/src/mage/cards/d/Duplicant.java @@ -143,7 +143,7 @@ class DuplicantContinuousEffect extends ContinuousEffectImpl { public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - if(permanent.getImprinted().size() > 0){ + if(!permanent.getImprinted().isEmpty()){ Card card = game.getCard(permanent.getImprinted().get(0)); if(card != null && card.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/cards/e/EldritchEvolution.java b/Mage.Sets/src/mage/cards/e/EldritchEvolution.java index 1fe9634ae4..b78f3cda7f 100644 --- a/Mage.Sets/src/mage/cards/e/EldritchEvolution.java +++ b/Mage.Sets/src/mage/cards/e/EldritchEvolution.java @@ -96,7 +96,7 @@ class EldritchEvolutionEffect extends OneShotEffect { for (Cost cost : source.getCosts()) { if (cost instanceof SacrificeTargetCost) { SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; - if (sacrificeCost.getPermanents().size() > 0) { + if (!sacrificeCost.getPermanents().isEmpty()) { sacrificedPermanent = sacrificeCost.getPermanents().get(0); } break; diff --git a/Mage.Sets/src/mage/cards/e/EliteArcanist.java b/Mage.Sets/src/mage/cards/e/EliteArcanist.java index f4fa74b99b..1e3f659ed6 100644 --- a/Mage.Sets/src/mage/cards/e/EliteArcanist.java +++ b/Mage.Sets/src/mage/cards/e/EliteArcanist.java @@ -118,7 +118,7 @@ class EliteArcanistImprintEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - if (player.getHand().size() > 0) { + if (!player.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, filter); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && player.choose(Outcome.Benefit, player.getHand(), target, game)) { diff --git a/Mage.Sets/src/mage/cards/e/EndlessHorizons.java b/Mage.Sets/src/mage/cards/e/EndlessHorizons.java index 79f3d125f8..7e10d7e92e 100644 --- a/Mage.Sets/src/mage/cards/e/EndlessHorizons.java +++ b/Mage.Sets/src/mage/cards/e/EndlessHorizons.java @@ -105,7 +105,7 @@ class EndlessHorizonsEffect extends SearchEffect { if (you != null) { if (you.searchLibrary(target, game)) { UUID exileZone = CardUtil.getCardExileZoneId(game, source); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId : target.getTargets()) { Card card = you.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/e/EpicExperiment.java b/Mage.Sets/src/mage/cards/e/EpicExperiment.java index 3a5ef26ea4..a2e8d0670a 100644 --- a/Mage.Sets/src/mage/cards/e/EpicExperiment.java +++ b/Mage.Sets/src/mage/cards/e/EpicExperiment.java @@ -101,7 +101,7 @@ class EpicExperimentEffect extends OneShotEffect { return true; } cardsToCast.addAll(epicExperimentExileZone.getCards(filter, source.getSourceId(), source.getControllerId(), game)); - while (cardsToCast.size() > 0) { + while (!cardsToCast.isEmpty()) { if (!controller.chooseUse(Outcome.PlayForFree, "Cast (another) a card exiled with " + sourceObject.getLogName() + " without paying its mana cost?", source, game)) { break; } diff --git a/Mage.Sets/src/mage/cards/e/Excavator.java b/Mage.Sets/src/mage/cards/e/Excavator.java index 460035023a..818f42ebc6 100644 --- a/Mage.Sets/src/mage/cards/e/Excavator.java +++ b/Mage.Sets/src/mage/cards/e/Excavator.java @@ -91,8 +91,8 @@ public class Excavator extends CardImpl { class ExcavatorEffect extends ContinuousEffectImpl implements SourceEffect { - private Abilities abilities = new AbilitiesImpl();; - + private Abilities abilities = new AbilitiesImpl(); + public ExcavatorEffect() { super(Duration.EndOfTurn, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); setText("Target creature gains landwalk of each of the land types of the sacrificed land until end of turn"); diff --git a/Mage.Sets/src/mage/cards/e/ExclusionRitual.java b/Mage.Sets/src/mage/cards/e/ExclusionRitual.java index 0579771edf..ba5b6c5834 100644 --- a/Mage.Sets/src/mage/cards/e/ExclusionRitual.java +++ b/Mage.Sets/src/mage/cards/e/ExclusionRitual.java @@ -128,7 +128,7 @@ class ExclusionRitualReplacementEffect extends ContinuousRuleModifyingEffectImpl Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Card card = game.getCard(event.getSourceId()); if (sourcePermanent != null && card != null) { - if (sourcePermanent.getImprinted().size() > 0) { + if (!sourcePermanent.getImprinted().isEmpty()) { Card imprintedCard = game.getCard(sourcePermanent.getImprinted().get(0)); if (imprintedCard != null) { return card.getName().equals(imprintedCard.getName()); diff --git a/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java b/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java index eb6f64355b..5029bfca0d 100644 --- a/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java +++ b/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java @@ -154,7 +154,7 @@ class EyeOfTheStormEffect1 extends OneShotEffect { if (spellController.moveCardsToExile(spell, source, game, true, exileZoneId, eyeOfTheStorm.getIdName())) { eyeOfTheStorm.imprint(card.getId(), game); - if (eyeOfTheStorm.getImprinted() != null && eyeOfTheStorm.getImprinted().size() > 0) { + if (eyeOfTheStorm.getImprinted() != null && !eyeOfTheStorm.getImprinted().isEmpty()) { CardsImpl copiedCards = new CardsImpl(); for (UUID uuid : eyeOfTheStorm.getImprinted()) { card = game.getCard(uuid); diff --git a/Mage.Sets/src/mage/cards/f/Firestorm.java b/Mage.Sets/src/mage/cards/f/Firestorm.java index 1210525ca7..67e1dc7e07 100644 --- a/Mage.Sets/src/mage/cards/f/Firestorm.java +++ b/Mage.Sets/src/mage/cards/f/Firestorm.java @@ -95,7 +95,7 @@ class FirestormEffect extends OneShotEffect { Player you = game.getPlayer(source.getControllerId()); int amount = (new GetXValue()).calculate(game, source, this); if (you != null) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { for (UUID targetId : this.getTargetPointer().getTargets(game, source)) { Permanent creature = game.getPermanent(targetId); if (creature != null) { diff --git a/Mage.Sets/src/mage/cards/f/FlamesOfRemembrance.java b/Mage.Sets/src/mage/cards/f/FlamesOfRemembrance.java index 9846be0847..6b9314a12b 100644 --- a/Mage.Sets/src/mage/cards/f/FlamesOfRemembrance.java +++ b/Mage.Sets/src/mage/cards/f/FlamesOfRemembrance.java @@ -115,7 +115,7 @@ class FlamesOfRemembranceExileEffect extends OneShotEffect { cards.add(card); } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { List cardsId = new ArrayList<>(); for (Card card : cards) { card.moveToExile(source.getSourceId(), "Flames of Remembrance", source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/f/Fleshwrither.java b/Mage.Sets/src/mage/cards/f/Fleshwrither.java index 4f92fb5690..580ef74b32 100644 --- a/Mage.Sets/src/mage/cards/f/Fleshwrither.java +++ b/Mage.Sets/src/mage/cards/f/Fleshwrither.java @@ -100,7 +100,7 @@ class FleshwritherEffect extends OneShotEffect { filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, sourceObject.getConvertedManaCost())); TargetCardInLibrary target = new TargetCardInLibrary(1, filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards chosen = new CardsImpl(target.getTargets()); controller.moveCards(chosen, Zone.BATTLEFIELD, source, game); } diff --git a/Mage.Sets/src/mage/cards/f/Fling.java b/Mage.Sets/src/mage/cards/f/Fling.java index 7d4526fc34..1286b38e26 100644 --- a/Mage.Sets/src/mage/cards/f/Fling.java +++ b/Mage.Sets/src/mage/cards/f/Fling.java @@ -82,7 +82,7 @@ class FlingEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = 0; for (Cost cost: source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue(); break; } diff --git a/Mage.Sets/src/mage/cards/f/ForbiddenAlchemy.java b/Mage.Sets/src/mage/cards/f/ForbiddenAlchemy.java index 5c9e37f0f7..8ef5b97a97 100644 --- a/Mage.Sets/src/mage/cards/f/ForbiddenAlchemy.java +++ b/Mage.Sets/src/mage/cards/f/ForbiddenAlchemy.java @@ -102,7 +102,7 @@ class ForbiddenAlchemyEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { player.lookAtCards("Forbidden Alchemy", cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand")); diff --git a/Mage.Sets/src/mage/cards/f/ForkInTheRoad.java b/Mage.Sets/src/mage/cards/f/ForkInTheRoad.java index 97b1143ea3..066266ec64 100644 --- a/Mage.Sets/src/mage/cards/f/ForkInTheRoad.java +++ b/Mage.Sets/src/mage/cards/f/ForkInTheRoad.java @@ -96,7 +96,7 @@ class ForkInTheRoadEffect extends OneShotEffect { } TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard()); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = game.getCard(cardId); @@ -105,7 +105,7 @@ class ForkInTheRoadEffect extends OneShotEffect { } } controller.revealCards(sourceObject.getIdName(), revealed, game); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { TargetCard target2 = new TargetCard(Zone.LIBRARY, filter); controller.choose(Outcome.Benefit, revealed, target2, game); Card card = revealed.get(target2.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/f/FriendlyFire.java b/Mage.Sets/src/mage/cards/f/FriendlyFire.java index 49ca81bfdd..f72eb127a9 100644 --- a/Mage.Sets/src/mage/cards/f/FriendlyFire.java +++ b/Mage.Sets/src/mage/cards/f/FriendlyFire.java @@ -93,7 +93,7 @@ class FriendlyFireEffect extends OneShotEffect { if (targetCreature != null) { Player controllerOfTargetCreature = game.getPlayer(targetCreature.getControllerId()); if (controllerOfTargetCreature != null) { - if (controllerOfTargetCreature.getHand().size() > 0) { + if (!controllerOfTargetCreature.getHand().isEmpty()) { Cards cards = new CardsImpl(); Card card = controllerOfTargetCreature.getHand().getRandom(game); cards.add(card); diff --git a/Mage.Sets/src/mage/cards/f/FromTheAshes.java b/Mage.Sets/src/mage/cards/f/FromTheAshes.java index 61b5f307e1..397d6c1fa2 100644 --- a/Mage.Sets/src/mage/cards/f/FromTheAshes.java +++ b/Mage.Sets/src/mage/cards/f/FromTheAshes.java @@ -108,7 +108,7 @@ class FromTheAshesEffect extends OneShotEffect { if (player != null) { TargetCardInLibrary target = new TargetCardInLibrary(0, entry.getValue(), new FilterBasicLandCard()); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId: target.getTargets()) { Card card = player.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/g/GaeasCradle.java b/Mage.Sets/src/mage/cards/g/GaeasCradle.java index f5251cee50..f854815edd 100644 --- a/Mage.Sets/src/mage/cards/g/GaeasCradle.java +++ b/Mage.Sets/src/mage/cards/g/GaeasCradle.java @@ -45,8 +45,6 @@ public class GaeasCradle extends CardImpl { private static final FilterControlledPermanent filter = new FilterControlledPermanent("creature you control"); - ; - static { filter.add(new CardTypePredicate(CardType.CREATURE)); } diff --git a/Mage.Sets/src/mage/cards/g/GallowsAtWillowHill.java b/Mage.Sets/src/mage/cards/g/GallowsAtWillowHill.java index c606c022f1..bc1b3f797e 100644 --- a/Mage.Sets/src/mage/cards/g/GallowsAtWillowHill.java +++ b/Mage.Sets/src/mage/cards/g/GallowsAtWillowHill.java @@ -103,7 +103,7 @@ class GallowsAtWillowHillEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { int affectedTargets = 0; - if (targetPointer.getTargets(game, source).size() > 0) { + if (!targetPointer.getTargets(game, source).isEmpty()) { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java b/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java index 1708f3fa98..b2497bfad8 100644 --- a/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java +++ b/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java @@ -179,7 +179,7 @@ class GarrukTheVeilCursedEffect extends OneShotEffect { } } // reveal - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.revealCards("Garruk, the Veil-Cursed", cards, game); } // shuffle diff --git a/Mage.Sets/src/mage/cards/g/GatherThePack.java b/Mage.Sets/src/mage/cards/g/GatherThePack.java index b252689598..cb9f66ad2a 100644 --- a/Mage.Sets/src/mage/cards/g/GatherThePack.java +++ b/Mage.Sets/src/mage/cards/g/GatherThePack.java @@ -100,13 +100,13 @@ class GatherThePackEffect extends OneShotEffect { TargetCard target = new TargetCard(0, max, Zone.LIBRARY, new FilterCreatureCard("creature card" + (max > 1 ? "s" : "") + " to put into your hand")); if (controller.choose(Outcome.PutCreatureInPlay, cards, target, game)) { Cards cardsToHand = new CardsImpl(target.getTargets()); - if (cardsToHand.size() > 0) { + if (!cardsToHand.isEmpty()) { cards.removeAll(cardsToHand); controller.moveCards(cardsToHand, Zone.HAND, source, game); } } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.moveCards(cards, Zone.GRAVEYARD, source, game); } } diff --git a/Mage.Sets/src/mage/cards/g/GenesisHydra.java b/Mage.Sets/src/mage/cards/g/GenesisHydra.java index 73194b72df..244fe9ec2f 100644 --- a/Mage.Sets/src/mage/cards/g/GenesisHydra.java +++ b/Mage.Sets/src/mage/cards/g/GenesisHydra.java @@ -116,7 +116,7 @@ class GenesisHydraPutOntoBattlefieldEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.revealCards("Genesis Hydra", cards, game); } diff --git a/Mage.Sets/src/mage/cards/g/GenesisWave.java b/Mage.Sets/src/mage/cards/g/GenesisWave.java index 183df0353e..858acc2c07 100644 --- a/Mage.Sets/src/mage/cards/g/GenesisWave.java +++ b/Mage.Sets/src/mage/cards/g/GenesisWave.java @@ -101,7 +101,7 @@ class GenesisWaveEffect extends OneShotEffect { Card card = controller.getLibrary().removeFromTop(game); cards.add(card); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.revealCards(sourceObject.getIdName(), cards, game); FilterCard filter = new FilterCard("cards with converted mana cost " + xValue + " or less to put onto the battlefield"); filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, xValue + 1)); diff --git a/Mage.Sets/src/mage/cards/g/GhastlyDemise.java b/Mage.Sets/src/mage/cards/g/GhastlyDemise.java index 94cbed67e1..dd644caf35 100644 --- a/Mage.Sets/src/mage/cards/g/GhastlyDemise.java +++ b/Mage.Sets/src/mage/cards/g/GhastlyDemise.java @@ -107,7 +107,7 @@ class GhastlyDemiseEffect extends OneShotEffect { } } } - } else if (targetPointer.getTargets(game, source).size() > 0) { + } else if (!targetPointer.getTargets(game, source).isEmpty()) { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null && permanent.getToughness().getValue() <= game.getPlayer(source.getControllerId()).getGraveyard().size()) { diff --git a/Mage.Sets/src/mage/cards/g/GiftsUngiven.java b/Mage.Sets/src/mage/cards/g/GiftsUngiven.java index 10cdeca2ff..4b4db14aa8 100644 --- a/Mage.Sets/src/mage/cards/g/GiftsUngiven.java +++ b/Mage.Sets/src/mage/cards/g/GiftsUngiven.java @@ -98,7 +98,7 @@ class GiftsUngivenEffect extends OneShotEffect { } GiftsUngivenTarget target = new GiftsUngivenTarget(); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = player.getLibrary().remove(cardId, game); diff --git a/Mage.Sets/src/mage/cards/g/GlimpseTheFuture.java b/Mage.Sets/src/mage/cards/g/GlimpseTheFuture.java index cc35524d20..73ce9ae8a4 100644 --- a/Mage.Sets/src/mage/cards/g/GlimpseTheFuture.java +++ b/Mage.Sets/src/mage/cards/g/GlimpseTheFuture.java @@ -97,7 +97,7 @@ class GlimpseTheFutureEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.lookAtCards("Glimpse the Future", cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand")); diff --git a/Mage.Sets/src/mage/cards/g/Godsend.java b/Mage.Sets/src/mage/cards/g/Godsend.java index f0743615e1..209aa26341 100644 --- a/Mage.Sets/src/mage/cards/g/Godsend.java +++ b/Mage.Sets/src/mage/cards/g/Godsend.java @@ -139,7 +139,7 @@ class GodsendTriggeredAbility extends TriggeredAbilityImpl { } targetName = "a creature blocked by creature "; } - if (possibleTargets.size() > 0) { + if (!possibleTargets.isEmpty()) { this.getTargets().clear(); if (possibleTargets.size() == 1) { this.getEffects().get(0).setTargetPointer(new FixedTarget(possibleTargets.iterator().next())); diff --git a/Mage.Sets/src/mage/cards/g/GrinningTotem.java b/Mage.Sets/src/mage/cards/g/GrinningTotem.java index d9512b0b62..039ce0bd4a 100644 --- a/Mage.Sets/src/mage/cards/g/GrinningTotem.java +++ b/Mage.Sets/src/mage/cards/g/GrinningTotem.java @@ -189,7 +189,7 @@ class GrinningTotemDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkInterveningIfClause(Game game) { ExileZone exileZone = game.getExile().getExileZone(exileZoneId); - return exileZone != null && exileZone.getCards(game).size() > 0; + return exileZone != null && !exileZone.getCards(game).isEmpty(); } @Override diff --git a/Mage.Sets/src/mage/cards/g/GripOfChaos.java b/Mage.Sets/src/mage/cards/g/GripOfChaos.java index 33a5f086aa..545f620cba 100644 --- a/Mage.Sets/src/mage/cards/g/GripOfChaos.java +++ b/Mage.Sets/src/mage/cards/g/GripOfChaos.java @@ -153,7 +153,7 @@ class GripOfChaosEffect extends OneShotEffect { for (Target target : mode.getTargets()) { UUID oldTargetId = target.getFirstTarget(); Set possibleTargets = target.possibleTargets(stackObject.getSourceId(), stackObject.getControllerId(), game); - if (possibleTargets.size() > 0) { + if (!possibleTargets.isEmpty()) { int i = 0; int rnd = RandomUtil.nextInt(possibleTargets.size()); Iterator it = possibleTargets.iterator(); diff --git a/Mage.Sets/src/mage/cards/g/Grozoth.java b/Mage.Sets/src/mage/cards/g/Grozoth.java index 813fab3682..def98cb16b 100644 --- a/Mage.Sets/src/mage/cards/g/Grozoth.java +++ b/Mage.Sets/src/mage/cards/g/Grozoth.java @@ -118,7 +118,7 @@ class GrozothEffect extends SearchEffect { Player player = game.getPlayer(source.getControllerId()); Card sourceCard = game.getCard(source.getSourceId()); if (sourceCard != null && player != null && player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = player.getLibrary().remove(cardId, game); diff --git a/Mage.Sets/src/mage/cards/g/GurmagDrowner.java b/Mage.Sets/src/mage/cards/g/GurmagDrowner.java index 2b8798788e..af4e2cfee9 100644 --- a/Mage.Sets/src/mage/cards/g/GurmagDrowner.java +++ b/Mage.Sets/src/mage/cards/g/GurmagDrowner.java @@ -100,7 +100,7 @@ class GurmagDrownerEffect extends OneShotEffect { if (controller != null && sourceObject != null) { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 4)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.lookAtCards(sourceObject.getName(), cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand")); if (controller.choose(Outcome.Benefit, cards, target, game)) { diff --git a/Mage.Sets/src/mage/cards/h/HarmonyOfNature.java b/Mage.Sets/src/mage/cards/h/HarmonyOfNature.java index 87ebd0c15e..253f807c78 100644 --- a/Mage.Sets/src/mage/cards/h/HarmonyOfNature.java +++ b/Mage.Sets/src/mage/cards/h/HarmonyOfNature.java @@ -99,7 +99,7 @@ class HarmonyOfNatureEffect extends OneShotEffect { Map options = new HashMap<>(); options.put("UI.right.btn.text", "Tapping complete"); controller.choose(outcome, target, source.getControllerId(), game, options); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID creature = target.getFirstTarget(); if (creature != null) { game.getPermanent(creature).tap(game); diff --git a/Mage.Sets/src/mage/cards/h/HeartOfKiran.java b/Mage.Sets/src/mage/cards/h/HeartOfKiran.java index fe0875e982..96741ab7e2 100644 --- a/Mage.Sets/src/mage/cards/h/HeartOfKiran.java +++ b/Mage.Sets/src/mage/cards/h/HeartOfKiran.java @@ -137,7 +137,7 @@ class HeartOfKiranAlternateCrewCost extends CostImpl { @Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return game.getBattlefield().getAllActivePermanents(filter, game).size() > 0; + return !game.getBattlefield().getAllActivePermanents(filter, game).isEmpty(); } @Override diff --git a/Mage.Sets/src/mage/cards/h/HellcarverDemon.java b/Mage.Sets/src/mage/cards/h/HellcarverDemon.java index 760dca3e2e..0c8feae870 100644 --- a/Mage.Sets/src/mage/cards/h/HellcarverDemon.java +++ b/Mage.Sets/src/mage/cards/h/HellcarverDemon.java @@ -100,7 +100,7 @@ class HellcarverDemonEffect extends OneShotEffect { } } - if (player != null && player.getHand().size() > 0) { + if (player != null && !player.getHand().isEmpty()) { int cardsInHand = player.getHand().size(); player.discard(cardsInHand, source, game); } diff --git a/Mage.Sets/src/mage/cards/h/HeroesPodium.java b/Mage.Sets/src/mage/cards/h/HeroesPodium.java index 883483e22d..dc9f3c4e89 100644 --- a/Mage.Sets/src/mage/cards/h/HeroesPodium.java +++ b/Mage.Sets/src/mage/cards/h/HeroesPodium.java @@ -188,7 +188,7 @@ class HeroesPodiumEffect extends OneShotEffect { } // Put the rest on the bottom of your library in a random order - while (cards.size() > 0) { + while (!cards.isEmpty()) { Card card = cards.getRandom(game); if (card != null) { cards.remove(card); diff --git a/Mage.Sets/src/mage/cards/h/HiredTorturer.java b/Mage.Sets/src/mage/cards/h/HiredTorturer.java index 71176b413b..ed955f4a01 100644 --- a/Mage.Sets/src/mage/cards/h/HiredTorturer.java +++ b/Mage.Sets/src/mage/cards/h/HiredTorturer.java @@ -101,7 +101,7 @@ class HiredTorturerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); - if (player != null && player.getHand().size() > 0) { + if (player != null && !player.getHand().isEmpty()) { Cards revealed = new CardsImpl(); revealed.add(player.getHand().getRandom(game)); player.revealCards("Hired Torturer", revealed, game); diff --git a/Mage.Sets/src/mage/cards/h/HisokasGuard.java b/Mage.Sets/src/mage/cards/h/HisokasGuard.java index bbcdd1d19f..235531f887 100644 --- a/Mage.Sets/src/mage/cards/h/HisokasGuard.java +++ b/Mage.Sets/src/mage/cards/h/HisokasGuard.java @@ -122,7 +122,7 @@ class HisokasGuardGainAbilityTargetEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { Permanent hisokasGuard = game.getPermanent(source.getSourceId()); - if (hisokasGuard != null && hisokasGuard.getConnectedCards("HisokasGuard").size() > 0) { + if (hisokasGuard != null && !hisokasGuard.getConnectedCards("HisokasGuard").isEmpty()) { Permanent guardedCreature = game.getPermanent(hisokasGuard.getConnectedCards("HisokasGuard").get(0)); if (guardedCreature != null && hisokasGuard.isTapped()) { guardedCreature.addAbility(ability, game); diff --git a/Mage.Sets/src/mage/cards/h/HoardingDragon.java b/Mage.Sets/src/mage/cards/h/HoardingDragon.java index fd21d13219..6f378c83f1 100644 --- a/Mage.Sets/src/mage/cards/h/HoardingDragon.java +++ b/Mage.Sets/src/mage/cards/h/HoardingDragon.java @@ -105,7 +105,7 @@ class HoardingDragonEffect extends OneShotEffect { if (controller != null && sourceObject != null) { TargetCardInLibrary target = new TargetCardInLibrary(new FilterArtifactCard()); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); if (card != null) { controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); diff --git a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java index a34d13da76..c69e10b666 100644 --- a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java +++ b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java @@ -84,7 +84,7 @@ public class HopeOfGhirapur extends CardImpl { @Override public void adjustTargets(Ability ability, Game game) { if (ability instanceof SimpleActivatedAbility) { - if (ability.getEffects().size() > 0 && (ability.getEffects().get(0) instanceof HopeOfGhirapurCantCastEffect)) { + if (!ability.getEffects().isEmpty() && (ability.getEffects().get(0) instanceof HopeOfGhirapurCantCastEffect)) { MageObject sourceObject = ability.getSourceObject(game); if (sourceObject != null) { ability.getTargets().clear(); diff --git a/Mage.Sets/src/mage/cards/i/IgniteMemories.java b/Mage.Sets/src/mage/cards/i/IgniteMemories.java index 616f6f3590..54329cb74e 100644 --- a/Mage.Sets/src/mage/cards/i/IgniteMemories.java +++ b/Mage.Sets/src/mage/cards/i/IgniteMemories.java @@ -85,7 +85,7 @@ class IgniteMemoriesEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); - if (player != null && player.getHand().size() > 0) { + if (player != null && !player.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = player.getHand().getRandom(game); revealed.add(card); diff --git a/Mage.Sets/src/mage/cards/i/InameDeathAspect.java b/Mage.Sets/src/mage/cards/i/InameDeathAspect.java index cdd3b385e3..808d84c9fc 100644 --- a/Mage.Sets/src/mage/cards/i/InameDeathAspect.java +++ b/Mage.Sets/src/mage/cards/i/InameDeathAspect.java @@ -96,7 +96,7 @@ class InameDeathAspectEffect extends SearchEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { player.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game); } player.shuffleLibrary(source, game); diff --git a/Mage.Sets/src/mage/cards/i/IncreasingAmbition.java b/Mage.Sets/src/mage/cards/i/IncreasingAmbition.java index b7d934ad75..7046603a20 100644 --- a/Mage.Sets/src/mage/cards/i/IncreasingAmbition.java +++ b/Mage.Sets/src/mage/cards/i/IncreasingAmbition.java @@ -103,7 +103,7 @@ class IncreasingAmbitionEffect extends SearchEffect { target = new TargetCardInLibrary(); } if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId: (List)target.getTargets()) { Card card = player.getLibrary().remove(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/i/IndomitableCreativity.java b/Mage.Sets/src/mage/cards/i/IndomitableCreativity.java index c1b9e70a5c..ce5746db67 100644 --- a/Mage.Sets/src/mage/cards/i/IndomitableCreativity.java +++ b/Mage.Sets/src/mage/cards/i/IndomitableCreativity.java @@ -147,7 +147,7 @@ class IndomitableCreativityEffect extends OneShotEffect { controllerOfDestroyedCreature.moveCards(card, Zone.BATTLEFIELD, source, game); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { revealCards.addAll(cards); Set cardsToShuffle = cards.getCards(game); cardsToShuffle.remove(card); diff --git a/Mage.Sets/src/mage/cards/i/InfernalKirin.java b/Mage.Sets/src/mage/cards/i/InfernalKirin.java index c4dd60d086..3051106b59 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalKirin.java +++ b/Mage.Sets/src/mage/cards/i/InfernalKirin.java @@ -108,7 +108,7 @@ class InfernalKirinEffect extends OneShotEffect { } } if (targetPlayer != null) { - if (targetPlayer.getHand().size() > 0) { + if (!targetPlayer.getHand().isEmpty()) { targetPlayer.revealCards("Infernal Kirin", targetPlayer.getHand(), game); for (UUID uuid: targetPlayer.getHand().copy()) { Card card = game.getCard(uuid); diff --git a/Mage.Sets/src/mage/cards/i/InfernalTutor.java b/Mage.Sets/src/mage/cards/i/InfernalTutor.java index 11e8cc98ee..070aae33cb 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalTutor.java +++ b/Mage.Sets/src/mage/cards/i/InfernalTutor.java @@ -101,7 +101,7 @@ class InfernalTutorEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { Card cardToReveal = null; if (controller.getHand().size() > 1) { Target target = new TargetCardInHand(new FilterCard()); diff --git a/Mage.Sets/src/mage/cards/i/InvaderParasite.java b/Mage.Sets/src/mage/cards/i/InvaderParasite.java index 9f9197a62b..96995cc295 100644 --- a/Mage.Sets/src/mage/cards/i/InvaderParasite.java +++ b/Mage.Sets/src/mage/cards/i/InvaderParasite.java @@ -133,7 +133,7 @@ class InvaderParasiteTriggeredAbility extends TriggeredAbilityImpl { Permanent targetPermanent = game.getPermanent(event.getTargetId()); Permanent sourcePermanent = game.getPermanent(getSourceId()); if (targetPermanent != null && sourcePermanent != null) { - if (sourcePermanent.getImprinted().size() > 0) { + if (!sourcePermanent.getImprinted().isEmpty()) { Card imprintedCard = game.getCard(sourcePermanent.getImprinted().get(0)); if (imprintedCard != null && targetPermanent.getName().equals(imprintedCard.getName())) { for (Effect effect : this.getEffects()) { diff --git a/Mage.Sets/src/mage/cards/i/IsochronScepter.java b/Mage.Sets/src/mage/cards/i/IsochronScepter.java index 96407d8af2..1ff39c48c8 100644 --- a/Mage.Sets/src/mage/cards/i/IsochronScepter.java +++ b/Mage.Sets/src/mage/cards/i/IsochronScepter.java @@ -103,7 +103,7 @@ class IsochronScepterImprintEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, filter); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.Benefit, controller.getHand(), target, game)) { diff --git a/Mage.Sets/src/mage/cards/j/JacesMindseeker.java b/Mage.Sets/src/mage/cards/j/JacesMindseeker.java index e29c9725b1..c4d89b23ff 100644 --- a/Mage.Sets/src/mage/cards/j/JacesMindseeker.java +++ b/Mage.Sets/src/mage/cards/j/JacesMindseeker.java @@ -122,7 +122,7 @@ class JaceMindseekerEffect extends OneShotEffect { } // cast an instant or sorcery for free - if (cardsToCast.size() > 0) { + if (!cardsToCast.isEmpty()) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { TargetCard target = new TargetCard(Zone.GRAVEYARD, filter); // zone should be ignored here diff --git a/Mage.Sets/src/mage/cards/j/JaradsOrders.java b/Mage.Sets/src/mage/cards/j/JaradsOrders.java index 949bc6fadd..f9a2c5a8e0 100644 --- a/Mage.Sets/src/mage/cards/j/JaradsOrders.java +++ b/Mage.Sets/src/mage/cards/j/JaradsOrders.java @@ -92,7 +92,7 @@ class JaradsOrdersEffect extends OneShotEffect { if (controller != null) { TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterCreatureCard("creature cards")); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(); for (UUID cardId: (List)target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); diff --git a/Mage.Sets/src/mage/cards/j/JestersScepter.java b/Mage.Sets/src/mage/cards/j/JestersScepter.java index cdf0ba8a8a..ac65cbeec8 100644 --- a/Mage.Sets/src/mage/cards/j/JestersScepter.java +++ b/Mage.Sets/src/mage/cards/j/JestersScepter.java @@ -191,7 +191,7 @@ class JestersScepterCost extends CostImpl { TargetCardInExile target = new TargetCardInExile(new FilterCard(), CardUtil.getCardExileZoneId(game, ability)); target.setNotTarget(true); Cards cards = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, ability)); - if (cards.size() > 0 + if (!cards.isEmpty() && controller.choose(Outcome.Benefit, cards, target, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/k/KaaliaOfTheVast.java b/Mage.Sets/src/mage/cards/k/KaaliaOfTheVast.java index e17ecfa1c4..8ef906ed08 100644 --- a/Mage.Sets/src/mage/cards/k/KaaliaOfTheVast.java +++ b/Mage.Sets/src/mage/cards/k/KaaliaOfTheVast.java @@ -153,7 +153,7 @@ class KaaliaOfTheVastEffect extends OneShotEffect { } TargetCardInHand target = new TargetCardInHand(filter); if (target.canChoose(controller.getId(), game) && target.choose(getOutcome(), controller.getId(), source.getSourceId(), game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID cardId = target.getFirstTarget(); Card card = game.getCard(cardId); if (card != null && game.getCombat() != null) { diff --git a/Mage.Sets/src/mage/cards/k/KahoMinamoHistorian.java b/Mage.Sets/src/mage/cards/k/KahoMinamoHistorian.java index b3aa1ddbc5..1a1620da81 100644 --- a/Mage.Sets/src/mage/cards/k/KahoMinamoHistorian.java +++ b/Mage.Sets/src/mage/cards/k/KahoMinamoHistorian.java @@ -117,7 +117,7 @@ class KahoMinamoHistorianEffect extends SearchEffect { if (controller != null && sourceObject != null) { if (controller.searchLibrary(target, game)) { UUID exileZone = CardUtil.getCardExileZoneId(game, source); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { controller.moveCardsToExile(new CardsImpl(target.getTargets()).getCards(game), source, game, true, exileZone, sourceObject.getIdName()); } } @@ -153,7 +153,7 @@ class KahoMinamoHistorianCastEffect extends OneShotEffect { filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, source.getManaCostsToPay().getX())); TargetCardInExile target = new TargetCardInExile(filter, CardUtil.getCardExileZoneId(game, source)); Cards cards = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source)); - if (cards.size() > 0 && controller.choose(Outcome.PlayForFree, cards, target, game)) { + if (!cards.isEmpty() && controller.choose(Outcome.PlayForFree, cards, target, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { controller.cast(card.getSpellAbility(), game, true); diff --git a/Mage.Sets/src/mage/cards/k/KangeeAerieKeeper.java b/Mage.Sets/src/mage/cards/k/KangeeAerieKeeper.java index e97a890b5b..f257303cb8 100644 --- a/Mage.Sets/src/mage/cards/k/KangeeAerieKeeper.java +++ b/Mage.Sets/src/mage/cards/k/KangeeAerieKeeper.java @@ -127,10 +127,10 @@ class KangeeAerieKeeperGetKickerXValue implements DynamicValue { @Override public String toString() { return "X"; - }; + } @Override public String getMessage() { return "X"; - }; + } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/k/KodamasReach.java b/Mage.Sets/src/mage/cards/k/KodamasReach.java index cfe8e345ae..3a5563c709 100644 --- a/Mage.Sets/src/mage/cards/k/KodamasReach.java +++ b/Mage.Sets/src/mage/cards/k/KodamasReach.java @@ -97,7 +97,7 @@ class KodamasReachEffect extends OneShotEffect { } TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard()); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); diff --git a/Mage.Sets/src/mage/cards/k/KrovikanSorcerer.java b/Mage.Sets/src/mage/cards/k/KrovikanSorcerer.java index 8d94ccdfd7..c4135aeb14 100644 --- a/Mage.Sets/src/mage/cards/k/KrovikanSorcerer.java +++ b/Mage.Sets/src/mage/cards/k/KrovikanSorcerer.java @@ -121,7 +121,7 @@ class KrovikanSorcererEffect extends OneShotEffect { drawnCards.add(cardId); } } - if (drawnCards.size() > 0) { + if (!drawnCards.isEmpty()) { TargetCard cardToDiscard = new TargetCard(Zone.HAND, new FilterCard("card to discard")); cardToDiscard.setNotTarget(true); if (player.choose(Outcome.Discard, drawnCards, cardToDiscard, game)) { diff --git a/Mage.Sets/src/mage/cards/l/Leashling.java b/Mage.Sets/src/mage/cards/l/Leashling.java index 502becf9fc..0dc1975c39 100644 --- a/Mage.Sets/src/mage/cards/l/Leashling.java +++ b/Mage.Sets/src/mage/cards/l/Leashling.java @@ -98,7 +98,7 @@ class PutCardFromHandOnTopOfLibrary extends CostImpl { public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { - return controller.getHand().size() > 0; + return !controller.getHand().isEmpty(); } return false; } diff --git a/Mage.Sets/src/mage/cards/l/LifesLegacy.java b/Mage.Sets/src/mage/cards/l/LifesLegacy.java index b583144215..154414cdbc 100644 --- a/Mage.Sets/src/mage/cards/l/LifesLegacy.java +++ b/Mage.Sets/src/mage/cards/l/LifesLegacy.java @@ -87,7 +87,7 @@ class LifesLegacyEffect extends OneShotEffect { } int power = 0; for (Cost cost: source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { power = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue(); break; } diff --git a/Mage.Sets/src/mage/cards/l/LordOfTheVoid.java b/Mage.Sets/src/mage/cards/l/LordOfTheVoid.java index 7b3c30be4d..44bf64d920 100644 --- a/Mage.Sets/src/mage/cards/l/LordOfTheVoid.java +++ b/Mage.Sets/src/mage/cards/l/LordOfTheVoid.java @@ -104,7 +104,7 @@ class LordOfTheVoidEffect extends OneShotEffect { Cards cards = new CardsImpl(); cards.addAll(player.getLibrary().getTopCards(game, 7)); controller.moveCards(cards, Zone.EXILED, source, game); - if (cards.getCards(new FilterCreatureCard(), game).size() > 0) { + if (!cards.getCards(new FilterCreatureCard(), game).isEmpty()) { TargetCard target = new TargetCard(Zone.EXILED, new FilterCreatureCard()); if (controller.chooseTarget(outcome, cards, target, source, game)) { Card card = cards.get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/m/MadcapExperiment.java b/Mage.Sets/src/mage/cards/m/MadcapExperiment.java index 380e4956cc..df5a0f7a38 100644 --- a/Mage.Sets/src/mage/cards/m/MadcapExperiment.java +++ b/Mage.Sets/src/mage/cards/m/MadcapExperiment.java @@ -107,7 +107,7 @@ class MadcapExperimentEffect extends OneShotEffect { cards.remove(card); } // Put the rest on the bottom of your library in a random order - while (cards.size() > 0) { + while (!cards.isEmpty()) { card = cards.getRandom(game); if (card != null) { cards.remove(card); diff --git a/Mage.Sets/src/mage/cards/m/MagneticMountain.java b/Mage.Sets/src/mage/cards/m/MagneticMountain.java index 5d5fedaaec..cc0e843740 100644 --- a/Mage.Sets/src/mage/cards/m/MagneticMountain.java +++ b/Mage.Sets/src/mage/cards/m/MagneticMountain.java @@ -116,7 +116,7 @@ class MagneticMountainEffect extends DoIfCostPaid { filter.add(new ColorPredicate(ObjectColor.BLUE)); filter.add(new MagneticMountainPredicate()); - if (game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).size()>0){ + if (!game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).isEmpty()){ this.copy(); } return true; diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheJar.java b/Mage.Sets/src/mage/cards/m/MagusOfTheJar.java index dd06363b97..221cf6a6b3 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheJar.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheJar.java @@ -99,7 +99,7 @@ class MagusoftheJarEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { Cards hand = player.getHand(); - while (hand.size() > 0) { + while (!hand.isEmpty()) { Card card = hand.get(hand.iterator().next(), game); if (card != null) { card.moveToExile(getId(), "Magus of the Jar", source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheScroll.java b/Mage.Sets/src/mage/cards/m/MagusOfTheScroll.java index 4cbe91aaf8..4de52b4a1a 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheScroll.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheScroll.java @@ -97,7 +97,7 @@ class MagusOfTheScrollEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY); if (sourceObject != null && you != null && cardName != null && !cardName.isEmpty()) { - if (you.getHand().size() > 0) { + if (!you.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = you.getHand().getRandom(game); revealed.add(card); diff --git a/Mage.Sets/src/mage/cards/m/ManaSeverance.java b/Mage.Sets/src/mage/cards/m/ManaSeverance.java index e5b7012cd0..a923481dff 100644 --- a/Mage.Sets/src/mage/cards/m/ManaSeverance.java +++ b/Mage.Sets/src/mage/cards/m/ManaSeverance.java @@ -65,7 +65,7 @@ class ManaSeveranceEffect extends SearchEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/m/ManifoldInsights.java b/Mage.Sets/src/mage/cards/m/ManifoldInsights.java index a0aa5f2b82..019bbbbc91 100644 --- a/Mage.Sets/src/mage/cards/m/ManifoldInsights.java +++ b/Mage.Sets/src/mage/cards/m/ManifoldInsights.java @@ -113,7 +113,7 @@ class ManifoldInsightsEffect extends OneShotEffect { } } controller.moveCards(chosenCards, Zone.HAND, source, game); - while (topLib.size() > 0 && controller.isInGame()) { + while (!topLib.isEmpty() && controller.isInGame()) { Card card = topLib.getRandom(game); if (card != null) { topLib.remove(card); diff --git a/Mage.Sets/src/mage/cards/m/MarshalingTheTroops.java b/Mage.Sets/src/mage/cards/m/MarshalingTheTroops.java index 038ed6e99d..214b130c2f 100644 --- a/Mage.Sets/src/mage/cards/m/MarshalingTheTroops.java +++ b/Mage.Sets/src/mage/cards/m/MarshalingTheTroops.java @@ -99,7 +99,7 @@ class MarshalingTheTroopsEffect extends OneShotEffect { Map options = new HashMap<>(); options.put("UI.right.btn.text", "Tapping complete"); controller.choose(outcome, target, source.getControllerId(), game, options); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID creature = target.getFirstTarget(); if (creature != null) { game.getPermanent(creature).tap(game); diff --git a/Mage.Sets/src/mage/cards/m/MasterOfPredicaments.java b/Mage.Sets/src/mage/cards/m/MasterOfPredicaments.java index 4edce4a979..7815eca796 100644 --- a/Mage.Sets/src/mage/cards/m/MasterOfPredicaments.java +++ b/Mage.Sets/src/mage/cards/m/MasterOfPredicaments.java @@ -93,7 +93,7 @@ class MasterOfPredicamentsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { Card cardFromHand = null; if (controller.getHand().size() > 1) { TargetCard target = new TargetCardInHand(new FilterCard()); diff --git a/Mage.Sets/src/mage/cards/m/MemoryJar.java b/Mage.Sets/src/mage/cards/m/MemoryJar.java index 2071f7c386..e4461295e0 100644 --- a/Mage.Sets/src/mage/cards/m/MemoryJar.java +++ b/Mage.Sets/src/mage/cards/m/MemoryJar.java @@ -96,7 +96,7 @@ class MemoryJarEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { Cards hand = player.getHand(); - while (hand.size() > 0) { + while (!hand.isEmpty()) { Card card = hand.get(hand.iterator().next(), game); if (card != null) { card.moveToExile(getId(), "Memory Jar", source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/m/MerfolkSpy.java b/Mage.Sets/src/mage/cards/m/MerfolkSpy.java index 2ab3c1f059..8ff48fa1a2 100644 --- a/Mage.Sets/src/mage/cards/m/MerfolkSpy.java +++ b/Mage.Sets/src/mage/cards/m/MerfolkSpy.java @@ -87,7 +87,7 @@ class MerfolkSpyEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); - if (player != null && player.getHand().size() > 0) { + if (player != null && !player.getHand().isEmpty()) { Cards revealed = new CardsImpl(); revealed.add(player.getHand().getRandom(game)); player.revealCards("Merfolk Spy", revealed, game); diff --git a/Mage.Sets/src/mage/cards/m/Metamorphosis.java b/Mage.Sets/src/mage/cards/m/Metamorphosis.java index 116ff7f009..cd3a5e68d2 100644 --- a/Mage.Sets/src/mage/cards/m/Metamorphosis.java +++ b/Mage.Sets/src/mage/cards/m/Metamorphosis.java @@ -84,7 +84,7 @@ class MetamorphosisEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = 0; for (Cost cost: source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost)cost).getPermanents().get(0).getConvertedManaCost()+1; break; } diff --git a/Mage.Sets/src/mage/cards/m/MeteorBlast.java b/Mage.Sets/src/mage/cards/m/MeteorBlast.java index 508e1121ea..f872e2e6fd 100644 --- a/Mage.Sets/src/mage/cards/m/MeteorBlast.java +++ b/Mage.Sets/src/mage/cards/m/MeteorBlast.java @@ -87,7 +87,7 @@ class MeteorBlastEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { for (UUID targetId : this.getTargetPointer().getTargets(game, source)) { Permanent creature = game.getPermanent(targetId); if (creature != null) { diff --git a/Mage.Sets/src/mage/cards/m/MeteorCrater.java b/Mage.Sets/src/mage/cards/m/MeteorCrater.java index 40d5f321de..5140e0e7ff 100644 --- a/Mage.Sets/src/mage/cards/m/MeteorCrater.java +++ b/Mage.Sets/src/mage/cards/m/MeteorCrater.java @@ -118,7 +118,7 @@ class MeteorCraterEffect extends ManaEffect { choice.getChoices().add("White"); } } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); diff --git a/Mage.Sets/src/mage/cards/m/MimicVat.java b/Mage.Sets/src/mage/cards/m/MimicVat.java index eb3e2df711..f78fc358f6 100644 --- a/Mage.Sets/src/mage/cards/m/MimicVat.java +++ b/Mage.Sets/src/mage/cards/m/MimicVat.java @@ -198,7 +198,7 @@ class MimicVatCreateTokenEffect extends OneShotEffect { return false; } - if (permanent.getImprinted().size() > 0) { + if (!permanent.getImprinted().isEmpty()) { Card card = game.getCard(permanent.getImprinted().get(0)); if (card != null) { PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(source.getControllerId(), null, true); diff --git a/Mage.Sets/src/mage/cards/m/MindclawShaman.java b/Mage.Sets/src/mage/cards/m/MindclawShaman.java index 6565ea86e7..65ef519ba8 100644 --- a/Mage.Sets/src/mage/cards/m/MindclawShaman.java +++ b/Mage.Sets/src/mage/cards/m/MindclawShaman.java @@ -107,7 +107,7 @@ class MindclawShamanEffect extends OneShotEffect { Player targetOpponent = game.getPlayer(source.getFirstTarget()); MageObject sourceObject = source.getSourceObject(game); if (targetOpponent != null && sourceObject != null) { - if (targetOpponent.getHand().size() > 0) { + if (!targetOpponent.getHand().isEmpty()) { targetOpponent.revealCards(sourceObject.getName(), targetOpponent.getHand(), game); Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { diff --git a/Mage.Sets/src/mage/cards/m/MindleechMass.java b/Mage.Sets/src/mage/cards/m/MindleechMass.java index 3ee2cb7299..7c76532829 100644 --- a/Mage.Sets/src/mage/cards/m/MindleechMass.java +++ b/Mage.Sets/src/mage/cards/m/MindleechMass.java @@ -100,8 +100,8 @@ class MindleechMassEffect extends OneShotEffect { Cards cardsInHand = new CardsImpl(); cardsInHand.addAll(opponent.getHand()); opponent.revealCards("Opponents hand", cardsInHand, game); - if (cardsInHand.size() > 0 - && cardsInHand.getCards(new FilterNonlandCard(), game).size() > 0) { + if (!cardsInHand.isEmpty() + && !cardsInHand.getCards(new FilterNonlandCard(), game).isEmpty()) { TargetCard target = new TargetCard(1, Zone.HAND, new FilterNonlandCard()); if (you.chooseTarget(Outcome.PlayForFree, cardsInHand, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/m/MizzixsMastery.java b/Mage.Sets/src/mage/cards/m/MizzixsMastery.java index 91f8c07348..665830c4e7 100644 --- a/Mage.Sets/src/mage/cards/m/MizzixsMastery.java +++ b/Mage.Sets/src/mage/cards/m/MizzixsMastery.java @@ -155,7 +155,7 @@ class MizzixsMasteryOverloadEffect extends OneShotEffect { } } } - continueCasting = copiedCards.size() > 0 + continueCasting = !copiedCards.isEmpty() && controller.chooseUse(outcome, "Cast one of the copied cards without paying its mana cost?", source, game); } } diff --git a/Mage.Sets/src/mage/cards/m/MomentousFall.java b/Mage.Sets/src/mage/cards/m/MomentousFall.java index ebfff8a3a7..6696a2256e 100644 --- a/Mage.Sets/src/mage/cards/m/MomentousFall.java +++ b/Mage.Sets/src/mage/cards/m/MomentousFall.java @@ -87,7 +87,7 @@ class MomentousFallEffect extends OneShotEffect { int toughness = 0; for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { power = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue(); toughness = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue(); break; diff --git a/Mage.Sets/src/mage/cards/m/MoonringMirror.java b/Mage.Sets/src/mage/cards/m/MoonringMirror.java index a29182d6fa..6f0c7f78ff 100644 --- a/Mage.Sets/src/mage/cards/m/MoonringMirror.java +++ b/Mage.Sets/src/mage/cards/m/MoonringMirror.java @@ -139,7 +139,7 @@ class MoonringMirrorEffect extends OneShotEffect { if (controller != null && sourceObject != null) { UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); Cards cardsToHand = null; - if (game.getExile().getExileZone(exileZoneId) != null && game.getExile().getExileZone(exileZoneId).size() > 0) { + if (game.getExile().getExileZone(exileZoneId) != null && !game.getExile().getExileZone(exileZoneId).isEmpty()) { cardsToHand = new CardsImpl(game.getExile().getExileZone(exileZoneId)); } for (Card card : controller.getHand().getCards(game)) { diff --git a/Mage.Sets/src/mage/cards/m/MyrBattlesphere.java b/Mage.Sets/src/mage/cards/m/MyrBattlesphere.java index d83fe1e9a2..183dc20def 100644 --- a/Mage.Sets/src/mage/cards/m/MyrBattlesphere.java +++ b/Mage.Sets/src/mage/cards/m/MyrBattlesphere.java @@ -114,7 +114,7 @@ class MyrBattlesphereEffect extends OneShotEffect { Map options = new HashMap<>(); options.put("UI.right.btn.text", "Myr tapping complete"); controller.choose(outcome, target, source.getControllerId(), game, options); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID creature = target.getFirstTarget(); if (creature != null) { game.getPermanent(creature).tap(game); diff --git a/Mage.Sets/src/mage/cards/n/NahiriTheHarbinger.java b/Mage.Sets/src/mage/cards/n/NahiriTheHarbinger.java index fd22afd9ae..d7a89fd850 100644 --- a/Mage.Sets/src/mage/cards/n/NahiriTheHarbinger.java +++ b/Mage.Sets/src/mage/cards/n/NahiriTheHarbinger.java @@ -135,7 +135,7 @@ class NahiriTheHarbingerEffect extends SearchEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); controller.moveCards(card, Zone.BATTLEFIELD, source, game); Permanent permanent = game.getPermanent(card.getId()); diff --git a/Mage.Sets/src/mage/cards/n/NezumiShortfang.java b/Mage.Sets/src/mage/cards/n/NezumiShortfang.java index 2ae123ad16..a40a7193df 100644 --- a/Mage.Sets/src/mage/cards/n/NezumiShortfang.java +++ b/Mage.Sets/src/mage/cards/n/NezumiShortfang.java @@ -137,7 +137,8 @@ class StabwhiskerLoseLifeEffect extends OneShotEffect { class CardsInTargetOpponentHandCondition implements Condition { - public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO }; + public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO } + private Condition condition; private CountType type; private int count; diff --git a/Mage.Sets/src/mage/cards/n/NissaNaturesArtisan.java b/Mage.Sets/src/mage/cards/n/NissaNaturesArtisan.java index 9bffb54a45..170befcb90 100644 --- a/Mage.Sets/src/mage/cards/n/NissaNaturesArtisan.java +++ b/Mage.Sets/src/mage/cards/n/NissaNaturesArtisan.java @@ -109,7 +109,7 @@ class NissaNaturesArtisanEffect extends OneShotEffect { } Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 2)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.revealCards(sourceObject.getIdName(), cards, game); Set toBattlefield = new LinkedHashSet<>(); for (Card card : cards.getCards(new FilterLandCard(), source.getSourceId(), source.getControllerId(), game)) { diff --git a/Mage.Sets/src/mage/cards/n/NissaWorldwaker.java b/Mage.Sets/src/mage/cards/n/NissaWorldwaker.java index 22a4d7a10f..7cb8b2589a 100644 --- a/Mage.Sets/src/mage/cards/n/NissaWorldwaker.java +++ b/Mage.Sets/src/mage/cards/n/NissaWorldwaker.java @@ -117,7 +117,7 @@ class NissaWorldwakerSearchEffect extends OneShotEffect { } TargetCardInLibrary target = new TargetCardInLibrary(0, Integer.MAX_VALUE, new FilterBasicLandCard()); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/o/OrcishLibrarian.java b/Mage.Sets/src/mage/cards/o/OrcishLibrarian.java index 19327eb1ff..1c374256af 100644 --- a/Mage.Sets/src/mage/cards/o/OrcishLibrarian.java +++ b/Mage.Sets/src/mage/cards/o/OrcishLibrarian.java @@ -107,10 +107,10 @@ class OrcishLibrarianEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { for (int i = 0; i < 4; i++) { - if (cards.size() > 0) + if (!cards.isEmpty()) { Card card = cards.getRandom(game); player.moveCardToExileWithInfo(card, null, null, source.getId(), game, Zone.LIBRARY, true); @@ -119,7 +119,7 @@ class OrcishLibrarianEffect extends OneShotEffect { } player.lookAtCards("OrcishLibrarian", cards, game); TargetCard target = new TargetCard (Zone.LIBRARY, new FilterCard("card to put on the top of target player's library")); - while (player.canRespond() && cards.size() > 0) { + while (player.canRespond() && !cards.isEmpty()) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/PainfulMemories.java b/Mage.Sets/src/mage/cards/p/PainfulMemories.java index 35610e2544..f4d91414b5 100644 --- a/Mage.Sets/src/mage/cards/p/PainfulMemories.java +++ b/Mage.Sets/src/mage/cards/p/PainfulMemories.java @@ -90,7 +90,7 @@ class PainfulMemoriesEffect extends OneShotEffect { if (targetPlayer != null && you != null) { targetPlayer.revealCards("Painful Memories", targetPlayer.getHand(), game); - if (targetPlayer.getHand().size() > 0) { + if (!targetPlayer.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, new FilterCard()); if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) { Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/p/PanopticMirror.java b/Mage.Sets/src/mage/cards/p/PanopticMirror.java index aea3ef21da..9b200b3410 100644 --- a/Mage.Sets/src/mage/cards/p/PanopticMirror.java +++ b/Mage.Sets/src/mage/cards/p/PanopticMirror.java @@ -151,7 +151,7 @@ class PanopticMirrorCastEffect extends OneShotEffect { if (PanopticMirror == null) { PanopticMirror = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } - if (PanopticMirror != null && PanopticMirror.getImprinted() != null && PanopticMirror.getImprinted().size() > 0 && controller != null) { + if (PanopticMirror != null && PanopticMirror.getImprinted() != null && !PanopticMirror.getImprinted().isEmpty() && controller != null) { CardsImpl cards = new CardsImpl(); for(UUID uuid : PanopticMirror.getImprinted()){ Card card = game.getCard(uuid); diff --git a/Mage.Sets/src/mage/cards/p/Peregrination.java b/Mage.Sets/src/mage/cards/p/Peregrination.java index e6720de47b..207b133d07 100644 --- a/Mage.Sets/src/mage/cards/p/Peregrination.java +++ b/Mage.Sets/src/mage/cards/p/Peregrination.java @@ -101,7 +101,7 @@ class PeregrinationEffect extends OneShotEffect { } TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard()); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); diff --git a/Mage.Sets/src/mage/cards/p/PerishTheThought.java b/Mage.Sets/src/mage/cards/p/PerishTheThought.java index 2b55118e8d..aad7daa150 100644 --- a/Mage.Sets/src/mage/cards/p/PerishTheThought.java +++ b/Mage.Sets/src/mage/cards/p/PerishTheThought.java @@ -89,7 +89,7 @@ class PerishTheThoughtEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetOpponent = game.getPlayer(source.getFirstTarget()); if (targetOpponent != null) { - if (targetOpponent.getHand().size() > 0) { + if (!targetOpponent.getHand().isEmpty()) { targetOpponent.revealCards("Perish the Thought", targetOpponent.getHand(), game); Player you = game.getPlayer(source.getControllerId()); if (you != null) { diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java b/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java index 1e86090338..6af4f923ee 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java @@ -97,7 +97,7 @@ class PhyrexianDelverEffect extends OneShotEffect { if (creatureCard != null && controller != null) { boolean result = false; if (game.getState().getZone(creatureCard.getId()).equals(Zone.GRAVEYARD)) { - result = controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game);; + result = controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game); } controller.loseLife(creatureCard.getConvertedManaCost(), game, false); return result; diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianGrimoire.java b/Mage.Sets/src/mage/cards/p/PhyrexianGrimoire.java index b397e58158..bc9f1e3f85 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianGrimoire.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianGrimoire.java @@ -96,7 +96,7 @@ class PhyrexianGrimoireEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Player opponent = game.getPlayer(source.getFirstTarget()); if (controller != null && opponent != null) { - if(controller.getGraveyard().size() > 0) + if(!controller.getGraveyard().isEmpty()) { Cards cards = new CardsImpl(); diff --git a/Mage.Sets/src/mage/cards/p/PlaneswalkersFavor.java b/Mage.Sets/src/mage/cards/p/PlaneswalkersFavor.java index 4d8b53a07a..bfdc0a2bf9 100644 --- a/Mage.Sets/src/mage/cards/p/PlaneswalkersFavor.java +++ b/Mage.Sets/src/mage/cards/p/PlaneswalkersFavor.java @@ -92,7 +92,7 @@ class PlaneswalkersFavorEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(source.getTargets().get(0).getFirstTarget()); - if (opponent != null && opponent.getHand().size() > 0) { + if (opponent != null && !opponent.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = opponent.getHand().getRandom(game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/PlaneswalkersFury.java b/Mage.Sets/src/mage/cards/p/PlaneswalkersFury.java index 3b4fb8a6d7..ca92fba3da 100644 --- a/Mage.Sets/src/mage/cards/p/PlaneswalkersFury.java +++ b/Mage.Sets/src/mage/cards/p/PlaneswalkersFury.java @@ -83,7 +83,7 @@ class PlaneswalkersFuryEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(targetPointer.getFirst(game, source)); - if (opponent != null && opponent.getHand().size() > 0) { + if (opponent != null && !opponent.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = opponent.getHand().getRandom(game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/PlaneswalkersMirth.java b/Mage.Sets/src/mage/cards/p/PlaneswalkersMirth.java index 3c7b62b2bf..0e4783a325 100644 --- a/Mage.Sets/src/mage/cards/p/PlaneswalkersMirth.java +++ b/Mage.Sets/src/mage/cards/p/PlaneswalkersMirth.java @@ -84,7 +84,7 @@ class PlaneswalkersMirthEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(targetPointer.getFirst(game, source)); Player player = game.getPlayer(source.getControllerId()); - if (opponent != null && player!= null && opponent.getHand().size() > 0) { + if (opponent != null && player!= null && !opponent.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = opponent.getHand().getRandom(game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/PlaneswalkersScorn.java b/Mage.Sets/src/mage/cards/p/PlaneswalkersScorn.java index e5784acbb4..0d20028aee 100644 --- a/Mage.Sets/src/mage/cards/p/PlaneswalkersScorn.java +++ b/Mage.Sets/src/mage/cards/p/PlaneswalkersScorn.java @@ -92,7 +92,7 @@ class PlaneswalkersScornEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(source.getTargets().get(0).getFirstTarget()); - if (opponent != null && opponent.getHand().size() > 0) { + if (opponent != null && !opponent.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = opponent.getHand().getRandom(game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/PolukranosWorldEater.java b/Mage.Sets/src/mage/cards/p/PolukranosWorldEater.java index 5a4afb473f..420a70e748 100644 --- a/Mage.Sets/src/mage/cards/p/PolukranosWorldEater.java +++ b/Mage.Sets/src/mage/cards/p/PolukranosWorldEater.java @@ -129,7 +129,7 @@ class PolukranosWorldEaterEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { Target multiTarget = source.getTargets().get(0); Set permanents = new HashSet<>(); for (UUID target: multiTarget.getTargets()) { diff --git a/Mage.Sets/src/mage/cards/p/Polymorph.java b/Mage.Sets/src/mage/cards/p/Polymorph.java index bbdd68b73c..83c62f1d5b 100644 --- a/Mage.Sets/src/mage/cards/p/Polymorph.java +++ b/Mage.Sets/src/mage/cards/p/Polymorph.java @@ -109,7 +109,7 @@ class PolymorphEffect extends OneShotEffect { card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId()); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { player.revealCards("Polymorph", cards, game); Set cardsToShuffle = cards.getCards(game); cardsToShuffle.remove(card); diff --git a/Mage.Sets/src/mage/cards/p/PreeminentCaptain.java b/Mage.Sets/src/mage/cards/p/PreeminentCaptain.java index fc678157cc..4b059077ce 100644 --- a/Mage.Sets/src/mage/cards/p/PreeminentCaptain.java +++ b/Mage.Sets/src/mage/cards/p/PreeminentCaptain.java @@ -98,7 +98,7 @@ class PreeminentCaptainEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); TargetCardInHand target = new TargetCardInHand(filter); if (target.canChoose(player.getId(), game) && target.choose(getOutcome(), player.getId(), source.getSourceId(), game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID cardId = target.getFirstTarget(); Card card = player.getHand().get(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/ProteusStaff.java b/Mage.Sets/src/mage/cards/p/ProteusStaff.java index 89279bdc4b..257dea02e7 100644 --- a/Mage.Sets/src/mage/cards/p/ProteusStaff.java +++ b/Mage.Sets/src/mage/cards/p/ProteusStaff.java @@ -117,7 +117,7 @@ class ProteusStaffEffect extends OneShotEffect { controller.revealCards("Proteus Staff", cards, game); // and the rest on the bottom of his or her library in any order. - while (cards.size() > 0 && controller.canRespond()) { + while (!cards.isEmpty() && controller.canRespond()) { if (cards.size() == 1) { Card card = cards.get(cards.iterator().next(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/PrototypePortal.java b/Mage.Sets/src/mage/cards/p/PrototypePortal.java index a6e710e4da..2335153ab5 100644 --- a/Mage.Sets/src/mage/cards/p/PrototypePortal.java +++ b/Mage.Sets/src/mage/cards/p/PrototypePortal.java @@ -77,7 +77,7 @@ public class PrototypePortal extends CardImpl { public void adjustCosts(Ability ability, Game game) { Permanent card = game.getPermanent(ability.getSourceId()); if (card != null) { - if (card.getImprinted().size() > 0) { + if (!card.getImprinted().isEmpty()) { Card imprinted = game.getCard(card.getImprinted().get(0)); if (imprinted != null) { ability.getManaCostsToPay().add(0, new GenericManaCost(imprinted.getConvertedManaCost())); @@ -115,7 +115,7 @@ class PrototypePortalEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, StaticFilters.FILTER_CARD_ARTIFACT); controller.choose(Outcome.Benefit, controller.getHand(), target, game); Card card = controller.getHand().get(target.getFirstTarget(), game); @@ -162,7 +162,7 @@ class PrototypePortalCreateTokenEffect extends OneShotEffect { return false; } - if (permanent.getImprinted().size() > 0) { + if (!permanent.getImprinted().isEmpty()) { Card card = game.getCard(permanent.getImprinted().get(0)); if (card != null) { EmptyToken token = new EmptyToken(); diff --git a/Mage.Sets/src/mage/cards/p/PryingQuestions.java b/Mage.Sets/src/mage/cards/p/PryingQuestions.java index f5375d6990..dd4d76eaa1 100644 --- a/Mage.Sets/src/mage/cards/p/PryingQuestions.java +++ b/Mage.Sets/src/mage/cards/p/PryingQuestions.java @@ -88,7 +88,7 @@ class PryingQuestionsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetOpponent = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetOpponent != null) { - if (targetOpponent.getHand().size() > 0) { + if (!targetOpponent.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); target.setNotTarget(true); target.setTargetName("a card from your hand to put on top of your library"); diff --git a/Mage.Sets/src/mage/cards/q/QasaliAmbusher.java b/Mage.Sets/src/mage/cards/q/QasaliAmbusher.java index 4d83300785..a229767c96 100644 --- a/Mage.Sets/src/mage/cards/q/QasaliAmbusher.java +++ b/Mage.Sets/src/mage/cards/q/QasaliAmbusher.java @@ -107,8 +107,8 @@ class QasaliAmbusherAbility extends ActivatedAbilityImpl { @Override public boolean canActivate(UUID playerId, Game game) { if (super.canActivate(playerId, game)) { - if (game.getBattlefield().getActivePermanents(filterPlains, this.getControllerId(), this.getSourceId(), game).size() > 0 - && game.getBattlefield().getActivePermanents(filterForest, this.getControllerId(), this.getSourceId(), game).size() > 0) { + if (!game.getBattlefield().getActivePermanents(filterPlains, this.getControllerId(), this.getSourceId(), game).isEmpty() + && !game.getBattlefield().getActivePermanents(filterForest, this.getControllerId(), this.getSourceId(), game).isEmpty()) { for (CombatGroup group : game.getCombat().getGroups()) { if (getControllerId().equals(group.getDefenderId())) { return true; diff --git a/Mage.Sets/src/mage/cards/q/QuietSpeculation.java b/Mage.Sets/src/mage/cards/q/QuietSpeculation.java index 96b1aaeeec..1eb466e8ae 100644 --- a/Mage.Sets/src/mage/cards/q/QuietSpeculation.java +++ b/Mage.Sets/src/mage/cards/q/QuietSpeculation.java @@ -97,7 +97,7 @@ class SearchLibraryPutInGraveEffect extends SearchEffect { Player controller = game.getPlayer(source.getControllerId()); UUID targetPlayerID = source.getFirstTarget(); if (controller != null && targetPlayerID != null && controller.searchLibrary(target, game, targetPlayerID)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(target.getTargets()); controller.revealCards("Quiet Speculation", cards, game); controller.moveCards(cards, Zone.GRAVEYARD, source, game); diff --git a/Mage.Sets/src/mage/cards/r/RealmsUncharted.java b/Mage.Sets/src/mage/cards/r/RealmsUncharted.java index bc14505632..274d366bb7 100644 --- a/Mage.Sets/src/mage/cards/r/RealmsUncharted.java +++ b/Mage.Sets/src/mage/cards/r/RealmsUncharted.java @@ -98,7 +98,7 @@ class RealmsUnchartedEffect extends OneShotEffect { RealmsUnchartedTarget target = new RealmsUnchartedTarget(); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); diff --git a/Mage.Sets/src/mage/cards/r/ReflectingPool.java b/Mage.Sets/src/mage/cards/r/ReflectingPool.java index f9326c079a..11f6e8f7a8 100644 --- a/Mage.Sets/src/mage/cards/r/ReflectingPool.java +++ b/Mage.Sets/src/mage/cards/r/ReflectingPool.java @@ -139,7 +139,7 @@ class ReflectingPoolEffect extends ManaEffect { choice.getChoices().add("White"); choice.getChoices().add("Colorless"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); diff --git a/Mage.Sets/src/mage/cards/r/RenownedWeaponsmith.java b/Mage.Sets/src/mage/cards/r/RenownedWeaponsmith.java index f66539f6af..11dec6ef28 100644 --- a/Mage.Sets/src/mage/cards/r/RenownedWeaponsmith.java +++ b/Mage.Sets/src/mage/cards/r/RenownedWeaponsmith.java @@ -144,7 +144,7 @@ class RenownedWeaponsmithEffect extends OneShotEffect { if (sourceObject != null && controller != null) { TargetCardInLibrary target = new TargetCardInLibrary(filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = game.getCard(target.getFirstTarget()); Cards revealed = new CardsImpl(); revealed.add(card); diff --git a/Mage.Sets/src/mage/cards/r/Reweave.java b/Mage.Sets/src/mage/cards/r/Reweave.java index 224d657aad..edee2c3a17 100644 --- a/Mage.Sets/src/mage/cards/r/Reweave.java +++ b/Mage.Sets/src/mage/cards/r/Reweave.java @@ -125,7 +125,7 @@ class ReweaveEffect extends OneShotEffect { permanentController.moveCards(card, Zone.BATTLEFIELD, source, game); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { permanentController.revealCards(sourceObject.getIdName(), cards, game); if (cardFound && card != null) { cards.remove(card); diff --git a/Mage.Sets/src/mage/cards/r/RiseFall.java b/Mage.Sets/src/mage/cards/r/RiseFall.java index 3616f693d3..6c8f8bd8e5 100644 --- a/Mage.Sets/src/mage/cards/r/RiseFall.java +++ b/Mage.Sets/src/mage/cards/r/RiseFall.java @@ -137,7 +137,7 @@ class FallEffect extends OneShotEffect { if (controller != null) { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { - if (targetPlayer.getHand().size() > 0) { + if (!targetPlayer.getHand().isEmpty()) { Cards cards = new CardsImpl(); Card card = targetPlayer.getHand().getRandom(game); cards.add(card); diff --git a/Mage.Sets/src/mage/cards/r/RoninWarclub.java b/Mage.Sets/src/mage/cards/r/RoninWarclub.java index cddbdadda7..a6684af41e 100644 --- a/Mage.Sets/src/mage/cards/r/RoninWarclub.java +++ b/Mage.Sets/src/mage/cards/r/RoninWarclub.java @@ -100,7 +100,7 @@ public class RoninWarclub extends CardImpl { if (!this.getTargets().isEmpty()) { // remove previous target - if (this.getTargets().get(0).getTargets().size() > 0) { + if (!this.getTargets().get(0).getTargets().isEmpty()) { this.getTargets().clear(); this.addTarget(new TargetCreaturePermanent()); } diff --git a/Mage.Sets/src/mage/cards/r/RootwaterThief.java b/Mage.Sets/src/mage/cards/r/RootwaterThief.java index 99b4037829..efbdd7ffdd 100644 --- a/Mage.Sets/src/mage/cards/r/RootwaterThief.java +++ b/Mage.Sets/src/mage/cards/r/RootwaterThief.java @@ -102,7 +102,7 @@ class RootwaterThiefEffect extends OneShotEffect { { TargetCardInLibrary target = new TargetCardInLibrary(); if (controller.searchLibrary(target, game, damagedPlayer.getId())) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = damagedPlayer.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true); diff --git a/Mage.Sets/src/mage/cards/s/SadisticAugermage.java b/Mage.Sets/src/mage/cards/s/SadisticAugermage.java index 1e2c4033e1..25512c88b5 100644 --- a/Mage.Sets/src/mage/cards/s/SadisticAugermage.java +++ b/Mage.Sets/src/mage/cards/s/SadisticAugermage.java @@ -92,7 +92,7 @@ class WidespreadPanicEffect extends OneShotEffect { for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - if (player.getHand().size() > 0) { + if (!player.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); target.setTargetName("a card from your hand to put on top of your library"); player.choose(Outcome.Detriment, target, source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/s/SanguinePraetor.java b/Mage.Sets/src/mage/cards/s/SanguinePraetor.java index b30de0ca5a..ab972b0fc4 100644 --- a/Mage.Sets/src/mage/cards/s/SanguinePraetor.java +++ b/Mage.Sets/src/mage/cards/s/SanguinePraetor.java @@ -92,7 +92,7 @@ class SanguinePraetorEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int cmc = 0; for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { cmc = ((SacrificeTargetCost) cost).getPermanents().get(0).getConvertedManaCost(); break; } diff --git a/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java b/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java index 4a90ae0a6c..bd1bc9cf55 100644 --- a/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java +++ b/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java @@ -183,7 +183,7 @@ class SasayasEssenceManaEffectEffect extends ManaEffect { choice.getChoices().add("Colorless"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Mana newMana = new Mana(); for (int i = 0; i < count; i++) { choice.clearChoice(); diff --git a/Mage.Sets/src/mage/cards/s/SavageSummoning.java b/Mage.Sets/src/mage/cards/s/SavageSummoning.java index 1633ecd3f6..5923ea13f3 100644 --- a/Mage.Sets/src/mage/cards/s/SavageSummoning.java +++ b/Mage.Sets/src/mage/cards/s/SavageSummoning.java @@ -151,7 +151,6 @@ class SavageSummoningAsThoughEffect extends AsThoughEffectImpl { class SavageSummoningWatcher extends Watcher { private Set savageSummoningSpells = new HashSet<>(); - ; private Map> spellsCastWithSavageSummoning = new LinkedHashMap<>(); private Map> cardsCastWithSavageSummoning = new LinkedHashMap<>(); diff --git a/Mage.Sets/src/mage/cards/s/SecretSalvage.java b/Mage.Sets/src/mage/cards/s/SecretSalvage.java index 113581f721..bb8e34288e 100644 --- a/Mage.Sets/src/mage/cards/s/SecretSalvage.java +++ b/Mage.Sets/src/mage/cards/s/SecretSalvage.java @@ -101,7 +101,7 @@ class SecretSalvageEffect extends OneShotEffect { nameFilter.add(new NamePredicate(targetCard.getName())); TargetCardInLibrary target = new TargetCardInLibrary(0, Integer.MAX_VALUE, nameFilter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().remove(cardId, game); diff --git a/Mage.Sets/src/mage/cards/s/SeeBeyond.java b/Mage.Sets/src/mage/cards/s/SeeBeyond.java index c0db7992f8..bc2c47236b 100644 --- a/Mage.Sets/src/mage/cards/s/SeeBeyond.java +++ b/Mage.Sets/src/mage/cards/s/SeeBeyond.java @@ -79,7 +79,7 @@ class SeeBeyondEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); controller.drawCards(2, game); - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, new FilterCard("card to shuffle into your library")); controller.choose(Outcome.Detriment, controller.getHand(), target, game); Card card = controller.getHand().get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/s/SemblanceAnvil.java b/Mage.Sets/src/mage/cards/s/SemblanceAnvil.java index f514d966f2..a1c0dee10e 100644 --- a/Mage.Sets/src/mage/cards/s/SemblanceAnvil.java +++ b/Mage.Sets/src/mage/cards/s/SemblanceAnvil.java @@ -90,7 +90,7 @@ class SemblanceAnvilEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - if (player.getHand().size() > 0) { + if (!player.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, filter); player.choose(Outcome.Benefit, player.getHand(), target, game); Card card = player.getHand().get(target.getFirstTarget(), game); @@ -141,7 +141,7 @@ class SemblanceAnvilCostReductionEffect extends CostModificationEffectImpl { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { List imprinted = permanent.getImprinted(); - if (imprinted.size() > 0) { + if (!imprinted.isEmpty()) { Card imprintedCard = game.getCard(imprinted.get(0)); if (imprintedCard != null && CardUtil.shareTypes(imprintedCard, sourceCard)) { return true; diff --git a/Mage.Sets/src/mage/cards/s/SerrasSanctum.java b/Mage.Sets/src/mage/cards/s/SerrasSanctum.java index 0f6c12cc3d..f29332aa91 100644 --- a/Mage.Sets/src/mage/cards/s/SerrasSanctum.java +++ b/Mage.Sets/src/mage/cards/s/SerrasSanctum.java @@ -45,7 +45,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate; public class SerrasSanctum extends CardImpl { - private static final FilterControlledPermanent filter = new FilterControlledPermanent("enchantment you control");; + private static final FilterControlledPermanent filter = new FilterControlledPermanent("enchantment you control"); static { filter.add(new CardTypePredicate(CardType.ENCHANTMENT)); diff --git a/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java b/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java index 0e6b52f772..3128c1187f 100644 --- a/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java +++ b/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java @@ -113,7 +113,7 @@ class ShimatsuTheBloodcloakedEffect extends ReplacementEffectImpl { return false; } controller.chooseTarget(Outcome.Detriment, target, source, game); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { int sacrificedCreatures = target.getTargets().size(); game.informPlayers(controller.getLogName() + " sacrifices " + sacrificedCreatures + " creatures for " + creature.getLogName()); for (UUID targetId : target.getTargets()) { diff --git a/Mage.Sets/src/mage/cards/s/SignalTheClans.java b/Mage.Sets/src/mage/cards/s/SignalTheClans.java index e244e8912e..3841b82410 100644 --- a/Mage.Sets/src/mage/cards/s/SignalTheClans.java +++ b/Mage.Sets/src/mage/cards/s/SignalTheClans.java @@ -94,7 +94,7 @@ class SignalTheClansEffect extends SearchEffect { } //Search your library for three creature cards if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(); for (UUID cardId: (List)target.getTargets()) { Card card = player.getLibrary().remove(cardId, game); diff --git a/Mage.Sets/src/mage/cards/s/SilentBladeOni.java b/Mage.Sets/src/mage/cards/s/SilentBladeOni.java index 6ce471816e..b34542386e 100644 --- a/Mage.Sets/src/mage/cards/s/SilentBladeOni.java +++ b/Mage.Sets/src/mage/cards/s/SilentBladeOni.java @@ -101,7 +101,7 @@ class SilentBladeOniEffect extends OneShotEffect { if (opponent != null && controller != null) { Cards cardsInHand = new CardsImpl(); cardsInHand.addAll(opponent.getHand()); - if (cardsInHand.size() > 0) { + if (!cardsInHand.isEmpty()) { TargetCard target = new TargetCard(1, Zone.HAND, new FilterNonlandCard()); if (controller.chooseTarget(outcome, cardsInHand, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java b/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java index 4e1f706e01..35ac026dc9 100644 --- a/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java +++ b/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java @@ -92,7 +92,7 @@ class SkyshipWeatherlightEffect extends SearchEffect { if (sourceObject != null && controller != null) { if (controller.searchLibrary(target, game)) { UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardID : target.getTargets()) { Card card = controller.getLibrary().getCard(cardID, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/s/SlumberingTora.java b/Mage.Sets/src/mage/cards/s/SlumberingTora.java index 8b6c8ed60d..5cfbe12df7 100644 --- a/Mage.Sets/src/mage/cards/s/SlumberingTora.java +++ b/Mage.Sets/src/mage/cards/s/SlumberingTora.java @@ -106,7 +106,7 @@ public class SlumberingTora extends CardImpl { if (sublayer == SubLayer.SetPT_7b) { int convManaCosts = 0; for (Cost cost: source.getCosts()) { - if (cost instanceof DiscardTargetCost && ((DiscardTargetCost)cost).getCards().size() > 0) { + if (cost instanceof DiscardTargetCost && !((DiscardTargetCost) cost).getCards().isEmpty()) { convManaCosts = ((DiscardTargetCost)cost).getCards().get(0).getConvertedManaCost(); break; } diff --git a/Mage.Sets/src/mage/cards/s/SoldeviSage.java b/Mage.Sets/src/mage/cards/s/SoldeviSage.java index fbc56bb837..cffd08ee12 100644 --- a/Mage.Sets/src/mage/cards/s/SoldeviSage.java +++ b/Mage.Sets/src/mage/cards/s/SoldeviSage.java @@ -108,7 +108,7 @@ class SoldeviSageEffect extends OneShotEffect { } } - if (drawnCards.size() > 0) { + if (!drawnCards.isEmpty()) { TargetCard cardToDiscard = new TargetCard(Zone.HAND, new FilterCard("card to discard")); cardToDiscard.setNotTarget(true); if (player.choose(Outcome.Discard, drawnCards, cardToDiscard, game)) { diff --git a/Mage.Sets/src/mage/cards/s/SoulFoundry.java b/Mage.Sets/src/mage/cards/s/SoulFoundry.java index 1b2c712dba..c2cf92f80f 100644 --- a/Mage.Sets/src/mage/cards/s/SoulFoundry.java +++ b/Mage.Sets/src/mage/cards/s/SoulFoundry.java @@ -81,7 +81,7 @@ public class SoulFoundry extends CardImpl { if (ability instanceof SimpleActivatedAbility) { Permanent sourcePermanent = game.getPermanent(ability.getSourceId()); if (sourcePermanent != null) { - if (sourcePermanent.getImprinted().size() > 0) { + if (!sourcePermanent.getImprinted().isEmpty()) { Card imprinted = game.getCard(sourcePermanent.getImprinted().get(0)); if (imprinted != null) { ability.getManaCostsToPay().clear(); @@ -127,7 +127,7 @@ class SoulFoundryImprintEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, filter); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.Benefit, controller.getHand(), target, game)) { diff --git a/Mage.Sets/src/mage/cards/s/Spellbinder.java b/Mage.Sets/src/mage/cards/s/Spellbinder.java index 482c7e4d19..1134a3b661 100644 --- a/Mage.Sets/src/mage/cards/s/Spellbinder.java +++ b/Mage.Sets/src/mage/cards/s/Spellbinder.java @@ -137,7 +137,7 @@ class SpellbinderImprintEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, filter); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.Benefit, controller.getHand(), target, game)) { diff --git a/Mage.Sets/src/mage/cards/s/Spellshift.java b/Mage.Sets/src/mage/cards/s/Spellshift.java index b33b9200fe..ca5d31fb2a 100644 --- a/Mage.Sets/src/mage/cards/s/Spellshift.java +++ b/Mage.Sets/src/mage/cards/s/Spellshift.java @@ -111,7 +111,7 @@ class SpellshiftEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { library.addAll(cards.getCards(game), game); } } diff --git a/Mage.Sets/src/mage/cards/s/SpiritOfResistance.java b/Mage.Sets/src/mage/cards/s/SpiritOfResistance.java index b7aad6b8fb..0cde764d31 100644 --- a/Mage.Sets/src/mage/cards/s/SpiritOfResistance.java +++ b/Mage.Sets/src/mage/cards/s/SpiritOfResistance.java @@ -79,7 +79,7 @@ class SpiritOfResistanceCondition implements Condition { public static SpiritOfResistanceCondition getInstance() { return fInstance; - }; + } private SpiritOfResistanceCondition() {} diff --git a/Mage.Sets/src/mage/cards/s/SquanderedResources.java b/Mage.Sets/src/mage/cards/s/SquanderedResources.java index 4d6f3b42fd..89893b24c2 100644 --- a/Mage.Sets/src/mage/cards/s/SquanderedResources.java +++ b/Mage.Sets/src/mage/cards/s/SquanderedResources.java @@ -128,7 +128,7 @@ class SquanderedResourcesEffect extends ManaEffect { choice.getChoices().add("White"); choice.getChoices().add("Colorless"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); @@ -194,7 +194,7 @@ class SquanderedResourcesEffect extends ManaEffect { Mana types = new Mana(); for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { Permanent land = ((SacrificeTargetCost) cost).getPermanents().get(0); if (land != null) { Abilities manaAbilities = land.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD); diff --git a/Mage.Sets/src/mage/cards/s/StarCompass.java b/Mage.Sets/src/mage/cards/s/StarCompass.java index 0a699f3807..1bf4c6f8c9 100644 --- a/Mage.Sets/src/mage/cards/s/StarCompass.java +++ b/Mage.Sets/src/mage/cards/s/StarCompass.java @@ -146,7 +146,7 @@ class StarCompassManaEffect extends ManaEffect { choice.getChoices().add("White"); choice.getChoices().add("Colorless"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); diff --git a/Mage.Sets/src/mage/cards/s/StarlitSanctum.java b/Mage.Sets/src/mage/cards/s/StarlitSanctum.java index 1efbe9f249..1caded637b 100644 --- a/Mage.Sets/src/mage/cards/s/StarlitSanctum.java +++ b/Mage.Sets/src/mage/cards/s/StarlitSanctum.java @@ -96,7 +96,7 @@ class StarlitSanctumWhiteEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = 0; for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue(); break; } @@ -132,7 +132,7 @@ class StarlitSanctumBlackEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = 0; for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue(); break; } diff --git a/Mage.Sets/src/mage/cards/s/SteelcladSerpent.java b/Mage.Sets/src/mage/cards/s/SteelcladSerpent.java index 731a104d4b..88b6413f6b 100644 --- a/Mage.Sets/src/mage/cards/s/SteelcladSerpent.java +++ b/Mage.Sets/src/mage/cards/s/SteelcladSerpent.java @@ -102,7 +102,7 @@ class SteelcladSerpentEffect extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.getId().equals(source.getSourceId())) { - if (game.getBattlefield().getActivePermanents(filter, source.getControllerId(), permanent.getId(), game).size() > 0) { + if (!game.getBattlefield().getActivePermanents(filter, source.getControllerId(), permanent.getId(), game).isEmpty()) { return false; } return true; diff --git a/Mage.Sets/src/mage/cards/s/StompingSlabs.java b/Mage.Sets/src/mage/cards/s/StompingSlabs.java index c75f72b98e..e40c876495 100644 --- a/Mage.Sets/src/mage/cards/s/StompingSlabs.java +++ b/Mage.Sets/src/mage/cards/s/StompingSlabs.java @@ -90,7 +90,7 @@ class StompingSlabsEffect extends OneShotEffect { if (controller != null) { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 7)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.revealCards("Stomping Slabs", cards, game); boolean stompingSlabsFound = false; for (UUID cardId : cards) { diff --git a/Mage.Sets/src/mage/cards/s/StrataScythe.java b/Mage.Sets/src/mage/cards/s/StrataScythe.java index 83ca064d59..54d661c597 100644 --- a/Mage.Sets/src/mage/cards/s/StrataScythe.java +++ b/Mage.Sets/src/mage/cards/s/StrataScythe.java @@ -95,7 +95,7 @@ class StrataScytheImprintEffect extends OneShotEffect { return false; TargetCardInLibrary target = new TargetCardInLibrary(new FilterLandCard()); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID cardId = target.getTargets().get(0); Card card = player.getLibrary().remove(cardId, game); if (card != null) { @@ -132,7 +132,7 @@ class SameNameAsExiledCountValue implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { int value = 0; Permanent permanent = game.getPermanent(sourceAbility.getSourceId()); - if (permanent != null && permanent.getImprinted().size() > 0) { + if (permanent != null && !permanent.getImprinted().isEmpty()) { FilterPermanent filterPermanent = new FilterPermanent(); filterPermanent.add(new NamePredicate(game.getCard(permanent.getImprinted().get(0)).getName())); value = game.getBattlefield().count(filterPermanent, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); diff --git a/Mage.Sets/src/mage/cards/s/StrategicPlanning.java b/Mage.Sets/src/mage/cards/s/StrategicPlanning.java index d4717c34cd..3318cba98e 100644 --- a/Mage.Sets/src/mage/cards/s/StrategicPlanning.java +++ b/Mage.Sets/src/mage/cards/s/StrategicPlanning.java @@ -90,7 +90,7 @@ class StrategicPlanningEffect extends OneShotEffect { if (controller != null) { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 3)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.lookAtCards("Strategic Planning", cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand")); if (controller.choose(Outcome.Benefit, cards, target, game)) { diff --git a/Mage.Sets/src/mage/cards/s/StripBare.java b/Mage.Sets/src/mage/cards/s/StripBare.java index 13e8a81d5e..e62468c9ed 100644 --- a/Mage.Sets/src/mage/cards/s/StripBare.java +++ b/Mage.Sets/src/mage/cards/s/StripBare.java @@ -92,7 +92,7 @@ class StripBareEffect extends OneShotEffect { new SubtypePredicate("Aura"))); Permanent targetCreature = game.getPermanent(source.getFirstTarget()); if (targetCreature != null - && targetCreature.getAttachments().size() > 0) { + && !targetCreature.getAttachments().isEmpty()) { for (Permanent attachment : game.getBattlefield().getAllActivePermanents(filter, game)) { if (attachment != null && targetCreature.getAttachments().contains(attachment.getId())) { diff --git a/Mage.Sets/src/mage/cards/s/StrongholdGambit.java b/Mage.Sets/src/mage/cards/s/StrongholdGambit.java index f1b9620544..13301cdcdd 100644 --- a/Mage.Sets/src/mage/cards/s/StrongholdGambit.java +++ b/Mage.Sets/src/mage/cards/s/StrongholdGambit.java @@ -92,7 +92,7 @@ class StrongholdGambitEffect extends OneShotEffect { Map choosenCard = new LinkedHashMap<>(); for (UUID playerId : game.getState().getPlayerList(controller.getId())) { Player player = game.getPlayer(playerId); - if (player != null && player.getHand().size() > 0) { + if (player != null && !player.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); if (player.choose(Outcome.Benefit, target, source.getSourceId(), game)) { choosenCard.put(playerId, target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/s/SuddenDisappearance.java b/Mage.Sets/src/mage/cards/s/SuddenDisappearance.java index 4a4581d7c2..3deff653c2 100644 --- a/Mage.Sets/src/mage/cards/s/SuddenDisappearance.java +++ b/Mage.Sets/src/mage/cards/s/SuddenDisappearance.java @@ -93,7 +93,7 @@ class SuddenDisappearanceEffect extends OneShotEffect { MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { Set permsSet = new HashSet<>(game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget(), game)); - if (permsSet.size() > 0) { + if (!permsSet.isEmpty()) { controller.moveCardsToExile(permsSet, source, game, true, source.getSourceId(), sourceObject.getIdName()); Cards targets = new CardsImpl(); for (Card card : permsSet) { diff --git a/Mage.Sets/src/mage/cards/s/SultaiSoothsayer.java b/Mage.Sets/src/mage/cards/s/SultaiSoothsayer.java index fa4ea972a6..4a49263699 100644 --- a/Mage.Sets/src/mage/cards/s/SultaiSoothsayer.java +++ b/Mage.Sets/src/mage/cards/s/SultaiSoothsayer.java @@ -97,7 +97,7 @@ class SultaiSoothsayerEffect extends OneShotEffect { if (controller != null && sourceObject != null) { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 4)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.lookAtCards(sourceObject.getName(), cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand")); if (controller.choose(Outcome.Benefit, cards, target, game)) { diff --git a/Mage.Sets/src/mage/cards/s/SummonersEgg.java b/Mage.Sets/src/mage/cards/s/SummonersEgg.java index e371ae4940..e92603be7d 100644 --- a/Mage.Sets/src/mage/cards/s/SummonersEgg.java +++ b/Mage.Sets/src/mage/cards/s/SummonersEgg.java @@ -90,7 +90,7 @@ class SummonersEggImprintEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, new FilterCard()); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.Benefit, controller.getHand(), target, game)) { diff --git a/Mage.Sets/src/mage/cards/s/SummoningTrap.java b/Mage.Sets/src/mage/cards/s/SummoningTrap.java index e56ca4b7c9..28829addab 100644 --- a/Mage.Sets/src/mage/cards/s/SummoningTrap.java +++ b/Mage.Sets/src/mage/cards/s/SummoningTrap.java @@ -183,7 +183,7 @@ class SummoningTrapEffect extends OneShotEffect { controller.moveCards(card, Zone.BATTLEFIELD, source, game); } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.putCardsOnBottomOfLibrary(cards, game, source, true); } } diff --git a/Mage.Sets/src/mage/cards/s/SuturedGhoul.java b/Mage.Sets/src/mage/cards/s/SuturedGhoul.java index eb2dd94dcd..58eb9dda62 100644 --- a/Mage.Sets/src/mage/cards/s/SuturedGhoul.java +++ b/Mage.Sets/src/mage/cards/s/SuturedGhoul.java @@ -106,7 +106,7 @@ class SuturedGhoulEffect extends OneShotEffect { if (permanent == null) { return false; } - if (controller.getGraveyard().size() > 0) { + if (!controller.getGraveyard().isEmpty()) { TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, new FilterCreatureCard("creature cards from your graveyard")); if (controller.chooseTarget(Outcome.Benefit, target, source, game)) { int count = 0; diff --git a/Mage.Sets/src/mage/cards/s/SyphonMind.java b/Mage.Sets/src/mage/cards/s/SyphonMind.java index 2639d65a90..6c4622419f 100644 --- a/Mage.Sets/src/mage/cards/s/SyphonMind.java +++ b/Mage.Sets/src/mage/cards/s/SyphonMind.java @@ -89,7 +89,7 @@ class SyphonMindEffect extends OneShotEffect { for (UUID playerId : you.getInRange()) { if (!playerId.equals(source.getControllerId())) { Player otherPlayer = game.getPlayer(playerId); - if (otherPlayer != null && otherPlayer.getHand().size() > 0) { + if (otherPlayer != null && !otherPlayer.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); if (otherPlayer.choose(Outcome.Discard, target, source.getSourceId(), game)) { Card card = game.getCard(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/t/TalentOfTheTelepath.java b/Mage.Sets/src/mage/cards/t/TalentOfTheTelepath.java index 7294433ad6..67d4da6078 100644 --- a/Mage.Sets/src/mage/cards/t/TalentOfTheTelepath.java +++ b/Mage.Sets/src/mage/cards/t/TalentOfTheTelepath.java @@ -111,7 +111,7 @@ class TalentOfTheTelepathEffect extends OneShotEffect { } } // cast an instant or sorcery for free - if (cardsToCast.size() > 0) { + if (!cardsToCast.isEmpty()) { int numberOfSpells = 1; if (SpellMasteryCondition.getInstance().apply(game, source)) { numberOfSpells++; @@ -122,7 +122,7 @@ class TalentOfTheTelepathEffect extends OneShotEffect { TargetCard target = new TargetCard(Zone.LIBRARY, filter); // zone should be ignored here target.setNotTarget(true); while (numberOfSpells > 0 - && cardsToCast.size() > 0 + && !cardsToCast.isEmpty() && controller.chooseUse(outcome, "Cast an instant or sorcery card from among them for free?", source, game) && controller.choose(outcome, cardsToCast, target, game)) { Card card = cardsToCast.get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/t/TemptWithReflections.java b/Mage.Sets/src/mage/cards/t/TemptWithReflections.java index 5c2ae9ed00..ad80e9bc86 100644 --- a/Mage.Sets/src/mage/cards/t/TemptWithReflections.java +++ b/Mage.Sets/src/mage/cards/t/TemptWithReflections.java @@ -116,7 +116,7 @@ class TemptWithReflectionsEffect extends OneShotEffect { effect.apply(game, source); } - if (playersSaidYes.size() > 0) { + if (!playersSaidYes.isEmpty()) { effect = new PutTokenOntoBattlefieldCopyTargetEffect(); effect.setTargetPointer(getTargetPointer()); effect.apply(game, source); diff --git a/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java b/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java index e03ce71e6b..7cc2779d3c 100644 --- a/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java +++ b/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java @@ -109,7 +109,7 @@ class TestamentOfFaithBecomesCreatureSourceEffect extends ContinuousEffectImpl i switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { - if (token.getCardType().size() > 0) { + if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); @@ -119,7 +119,7 @@ class TestamentOfFaithBecomesCreatureSourceEffect extends ContinuousEffectImpl i if ("".equals(type) || type == null) { permanent.getSubtype(game).clear(); } - if (token.getSubtype(game).size() > 0) { + if (!token.getSubtype(game).isEmpty()) { permanent.getSubtype(game).addAll(token.getSubtype(game)); } } @@ -133,7 +133,7 @@ class TestamentOfFaithBecomesCreatureSourceEffect extends ContinuousEffectImpl i break; case AbilityAddingRemovingEffects_6: if (sublayer == SubLayer.NA) { - if (token.getAbilities().size() > 0) { + if (!token.getAbilities().isEmpty()) { for (Ability ability: token.getAbilities()) { permanent.addAbility(ability, source.getSourceId(), game, false); } diff --git a/Mage.Sets/src/mage/cards/t/ThadaAdelAcquisitor.java b/Mage.Sets/src/mage/cards/t/ThadaAdelAcquisitor.java index b25cdc5950..c9a9bf02f6 100644 --- a/Mage.Sets/src/mage/cards/t/ThadaAdelAcquisitor.java +++ b/Mage.Sets/src/mage/cards/t/ThadaAdelAcquisitor.java @@ -103,7 +103,7 @@ class ThadaAdelAcquisitorEffect extends OneShotEffect { } TargetCardInLibrary target = new TargetCardInLibrary(new FilterArtifactCard()); if (controller.searchLibrary(target, game, damagedPlayer.getId())) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = damagedPlayer.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); diff --git a/Mage.Sets/src/mage/cards/t/ThoughtGorger.java b/Mage.Sets/src/mage/cards/t/ThoughtGorger.java index 30901e7944..e5f460f1d7 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtGorger.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtGorger.java @@ -99,7 +99,7 @@ class ThoughtGorgerEffectEnters extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent thoughtGorger = game.getPermanent(source.getSourceId()); - if (player != null && player.getHand().size() > 0 && thoughtGorger != null ) { + if (player != null && !player.getHand().isEmpty() && thoughtGorger != null ) { int cardsInHand = player.getHand().size(); thoughtGorger.addCounters(CounterType.P1P1.createInstance(cardsInHand), source, game); player.discard(cardsInHand, false, source, game); diff --git a/Mage.Sets/src/mage/cards/t/ThoughtpickerWitch.java b/Mage.Sets/src/mage/cards/t/ThoughtpickerWitch.java index f0dd5f9c50..44345b0320 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtpickerWitch.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtpickerWitch.java @@ -105,7 +105,7 @@ class ThoughtpickerWitchEffect extends OneShotEffect { if (controller != null && opponent != null) { Cards cards = new CardsImpl(); cards.addAll(opponent.getLibrary().getTopCards(game, 2)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { TargetCard target = new TargetCardInLibrary(new FilterCard("card to exile")); if (controller.choose(Outcome.Exile, cards, target, game)) { Card card = cards.get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/t/TransmuteArtifact.java b/Mage.Sets/src/mage/cards/t/TransmuteArtifact.java index deefc68378..9372da3348 100644 --- a/Mage.Sets/src/mage/cards/t/TransmuteArtifact.java +++ b/Mage.Sets/src/mage/cards/t/TransmuteArtifact.java @@ -105,7 +105,7 @@ class TransmuteArtifactEffect extends SearchEffect { } //If you do, search your library for an artifact card. if (sacrifice && controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/v/VastwoodHydra.java b/Mage.Sets/src/mage/cards/v/VastwoodHydra.java index b3245f7864..59a59a5223 100644 --- a/Mage.Sets/src/mage/cards/v/VastwoodHydra.java +++ b/Mage.Sets/src/mage/cards/v/VastwoodHydra.java @@ -104,7 +104,7 @@ class VastwoodHydraDistributeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { Target multiTarget = source.getTargets().get(0); for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); diff --git a/Mage.Sets/src/mage/cards/v/VerdelothTheAncient.java b/Mage.Sets/src/mage/cards/v/VerdelothTheAncient.java index 2f2bc85cc6..a2424fdb7d 100644 --- a/Mage.Sets/src/mage/cards/v/VerdelothTheAncient.java +++ b/Mage.Sets/src/mage/cards/v/VerdelothTheAncient.java @@ -124,10 +124,10 @@ class GetKickerXValue implements DynamicValue { @Override public String toString() { return "X"; - }; + } @Override public String getMessage() { return "X"; - }; + } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/v/VeteranExplorer.java b/Mage.Sets/src/mage/cards/v/VeteranExplorer.java index 958639aa48..f0c740eda3 100644 --- a/Mage.Sets/src/mage/cards/v/VeteranExplorer.java +++ b/Mage.Sets/src/mage/cards/v/VeteranExplorer.java @@ -117,7 +117,7 @@ class VeteranExplorerEffect extends OneShotEffect { usingPlayers.add(player); TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard()); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId: (List)target.getTargets()) { Card card = player.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/w/WaveOfVitriol.java b/Mage.Sets/src/mage/cards/w/WaveOfVitriol.java index a79673bde5..e4addada03 100644 --- a/Mage.Sets/src/mage/cards/w/WaveOfVitriol.java +++ b/Mage.Sets/src/mage/cards/w/WaveOfVitriol.java @@ -131,7 +131,7 @@ class WaveOfVitriolEffect extends OneShotEffect { TargetCardInLibrary target = new TargetCardInLibrary(0, entry.getValue(), new FilterBasicLandCard()); if (entry.getKey().searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { toBattlefield.addAll(target.getTargets()); playersToShuffle.add(entry.getKey()); } diff --git a/Mage.Sets/src/mage/cards/w/WeirdHarvest.java b/Mage.Sets/src/mage/cards/w/WeirdHarvest.java index 96091a99d6..ffc88e8a92 100644 --- a/Mage.Sets/src/mage/cards/w/WeirdHarvest.java +++ b/Mage.Sets/src/mage/cards/w/WeirdHarvest.java @@ -115,7 +115,7 @@ class WeirdHarvestEffect extends OneShotEffect { usingPlayers.add(player); TargetCardInLibrary target = new TargetCardInLibrary(0, xValue, new FilterCreatureCard()); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(target.getTargets()); player.moveCards(cards, Zone.HAND, source, game); player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', cards, game); diff --git a/Mage.Sets/src/mage/cards/w/WerewolfRansacker.java b/Mage.Sets/src/mage/cards/w/WerewolfRansacker.java index 0d6f76f1f1..c15582d68d 100644 --- a/Mage.Sets/src/mage/cards/w/WerewolfRansacker.java +++ b/Mage.Sets/src/mage/cards/w/WerewolfRansacker.java @@ -145,7 +145,7 @@ class WerewolfRansackerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { int affectedTargets = 0; - if (targetPointer.getTargets(game, source).size() > 0) { + if (!targetPointer.getTargets(game, source).isEmpty()) { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/w/WidespreadPanic.java b/Mage.Sets/src/mage/cards/w/WidespreadPanic.java index 4e8900ee53..9020117af3 100644 --- a/Mage.Sets/src/mage/cards/w/WidespreadPanic.java +++ b/Mage.Sets/src/mage/cards/w/WidespreadPanic.java @@ -125,7 +125,7 @@ class WidespreadPanicEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player shuffler = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (shuffler != null) { - if (shuffler.getHand().size() > 0) { + if (!shuffler.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); target.setNotTarget(true); target.setTargetName("a card from your hand to put on top of your library"); diff --git a/Mage.Sets/src/mage/cards/w/WildEvocation.java b/Mage.Sets/src/mage/cards/w/WildEvocation.java index 9a075eba55..90399ae0a1 100644 --- a/Mage.Sets/src/mage/cards/w/WildEvocation.java +++ b/Mage.Sets/src/mage/cards/w/WildEvocation.java @@ -84,7 +84,7 @@ class WildEvocationEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); - if (player != null && player.getHand().size() > 0) { + if (player != null && !player.getHand().isEmpty()) { Card card = player.getHand().getRandom(game); Cards cards = new CardsImpl(); cards.add(card); diff --git a/Mage.Sets/src/mage/cards/w/WildPair.java b/Mage.Sets/src/mage/cards/w/WildPair.java index 9adad2f38b..3813014b4d 100644 --- a/Mage.Sets/src/mage/cards/w/WildPair.java +++ b/Mage.Sets/src/mage/cards/w/WildPair.java @@ -114,7 +114,7 @@ class WildPairEffect extends OneShotEffect { filter.add(new TotalPowerAndToughnessPredicate(Filter.ComparisonType.Equal, totalPT)); TargetCardInLibrary target = new TargetCardInLibrary(1, filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { controller.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game); } } diff --git a/Mage.Sets/src/mage/cards/w/WildResearch.java b/Mage.Sets/src/mage/cards/w/WildResearch.java index ec74952991..e70a4aa59b 100644 --- a/Mage.Sets/src/mage/cards/w/WildResearch.java +++ b/Mage.Sets/src/mage/cards/w/WildResearch.java @@ -109,7 +109,7 @@ class WildResearchEffect extends OneShotEffect { if (controller != null && sourceObject != null) { TargetCardInLibrary target = new TargetCardInLibrary(filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { controller.moveCards(card, Zone.HAND, source, game); diff --git a/Mage.Sets/src/mage/cards/w/WoodlandBellower.java b/Mage.Sets/src/mage/cards/w/WoodlandBellower.java index a230e94042..84b0cfac0a 100644 --- a/Mage.Sets/src/mage/cards/w/WoodlandBellower.java +++ b/Mage.Sets/src/mage/cards/w/WoodlandBellower.java @@ -100,7 +100,7 @@ class WoodlandBellowerEffect extends OneShotEffect { filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, 4)); TargetCardInLibrary target = new TargetCardInLibrary(filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); controller.moveCards(card, Zone.BATTLEFIELD, source, game); } diff --git a/Mage.Sets/src/mage/cards/x/XenagosTheReveler.java b/Mage.Sets/src/mage/cards/x/XenagosTheReveler.java index bf5f0f5422..0a761cd441 100644 --- a/Mage.Sets/src/mage/cards/x/XenagosTheReveler.java +++ b/Mage.Sets/src/mage/cards/x/XenagosTheReveler.java @@ -186,7 +186,7 @@ class XenagosExileEffect extends OneShotEffect { filter.add(Predicates.or(new CardTypePredicate(CardType.CREATURE), new CardTypePredicate(CardType.LAND))); TargetCard target1 = new TargetCard(0, Integer.MAX_VALUE, Zone.EXILED, filter); - if (exiledCards.size() > 0 + if (!exiledCards.isEmpty() && target1.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.PutCardInPlay, exiledCards, target1, game)) { controller.moveCards(new CardsImpl(target1.getTargets()), Zone.BATTLEFIELD, source, game); diff --git a/Mage.Sets/src/mage/cards/y/YavimayaDryad.java b/Mage.Sets/src/mage/cards/y/YavimayaDryad.java index 12cf702b40..ccab7b91e9 100644 --- a/Mage.Sets/src/mage/cards/y/YavimayaDryad.java +++ b/Mage.Sets/src/mage/cards/y/YavimayaDryad.java @@ -106,7 +106,7 @@ class YavimayaDryadEffect extends SearchEffect { return false; } if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { targetPlayer.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/equipped/HeavyArbalestTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/equipped/HeavyArbalestTest.java index d86589240d..42fdaf9ab3 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/equipped/HeavyArbalestTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/equipped/HeavyArbalestTest.java @@ -33,7 +33,7 @@ public class HeavyArbalestTest extends CardTestPlayerBase { assertLife(playerB, 18); Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA.getId()); - Assert.assertTrue(eliteVanguard.getAttachments().size() > 0); + Assert.assertTrue(!eliteVanguard.getAttachments().isEmpty()); Assert.assertTrue(eliteVanguard.isTapped()); } diff --git a/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java index 821954e2d9..ff3efe5d65 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java @@ -125,7 +125,7 @@ public class RandomPlayer extends ComputerPlayer { ability = options.get(rnd.nextInt(options.size())); } } - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { int amount = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost(); if (amount > 0) { ability = ability.copy(); @@ -225,7 +225,7 @@ public class RandomPlayer extends ComputerPlayer { int check = rnd.nextInt(numGroups + 1); if (check < numGroups) { CombatGroup group = game.getCombat().getGroups().get(check); - if (group.getAttackers().size() > 0) { + if (!group.getAttackers().isEmpty()) { this.declareBlocker(this.getId(), blocker.getId(), group.getAttackers().get(0), game); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 5d98013248..f3cd2172f3 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -175,7 +175,7 @@ public class TestPlayer implements Player { protected Permanent findPermanent(FilterPermanent filter, UUID controllerId, Game game) { List permanents = game.getBattlefield().getAllActivePermanents(filter, controllerId, game); - if (permanents.size() > 0) { + if (!permanents.isEmpty()) { return permanents.get(0); } return null; @@ -200,7 +200,7 @@ public class TestPlayer implements Player { return true; } else if (groups[2].startsWith("spellOnTopOfStack=")) { String spellOnTopOFStack = groups[2].substring(18); - if (game.getStack().size() > 0) { + if (!game.getStack().isEmpty()) { StackObject stackObject = game.getStack().getFirst(); if (stackObject != null && stackObject.getStackAbility().toString().contains(spellOnTopOFStack)) { return true; diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index 9aa176560d..8892244611 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -987,7 +987,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement public enum StackClause { WHILE_ON_STACK, - WHILE_NOT_ON_STACK; + WHILE_NOT_ON_STACK } /** diff --git a/Mage/src/main/java/mage/abilities/AbilitiesImpl.java b/Mage/src/main/java/mage/abilities/AbilitiesImpl.java index f2406cf8ce..ffe5fff8e3 100644 --- a/Mage/src/main/java/mage/abilities/AbilitiesImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilitiesImpl.java @@ -93,7 +93,7 @@ public class AbilitiesImpl extends ArrayList implements Ab continue; } if (ability instanceof SpellAbility) { - if (ability.getAdditionalCostsRuleVisible() && ability.getCosts().size() > 0) { + if (ability.getAdditionalCostsRuleVisible() && !ability.getCosts().isEmpty()) { StringBuilder sbRule = threadLocalBuilder.get(); for (Cost cost : ability.getCosts()) { if (cost.getText() != null && !cost.getText().isEmpty()) { @@ -107,7 +107,7 @@ public class AbilitiesImpl extends ArrayList implements Ab } String rule = ability.getRule(); if (rule != null) { - if (rule.length() > 0) { + if (!rule.isEmpty()) { rules.add(Character.toUpperCase(rule.charAt(0)) + rule.substring(1)); } } else { // logging so we can still can be made aware of rule problems a card has diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index 41e362a34c..ae5c5cf61e 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -274,7 +274,7 @@ public abstract class AbilityImpl implements Ability { // if ability can be cast for no mana, clear the mana costs now, because additional mana costs must be paid. // For Flashback ability can be set X before, so the X costs have to be restored for the flashbacked ability if (noMana) { - if (this.getManaCostsToPay().getVariableCosts().size() > 0) { + if (!this.getManaCostsToPay().getVariableCosts().isEmpty()) { int xValue = this.getManaCostsToPay().getX(); this.getManaCostsToPay().clear(); VariableManaCost xCosts = new VariableManaCost(); @@ -330,7 +330,7 @@ public abstract class AbilityImpl implements Ability { } // Flashback abilities haven't made the choices the underlying spell might need for targeting. if (!(this instanceof FlashbackAbility) - && getTargets().size() > 0) { + && !getTargets().isEmpty()) { Outcome outcome = getEffects().isEmpty() ? Outcome.Detriment : getEffects().get(0).getOutcome(); if (getTargets().chooseTargets(outcome, this.controllerId, this, noMana, game) == false) { if ((variableManaCost != null || announceString != null) && !game.isSimulation()) { @@ -737,10 +737,10 @@ public abstract class AbilityImpl implements Ability { public String getRule(boolean all) { StringBuilder sbRule = threadLocalBuilder.get(); if (all || this.abilityType != AbilityType.SPELL) { - if (manaCosts.size() > 0) { + if (!manaCosts.isEmpty()) { sbRule.append(manaCosts.getText()); } - if (costs.size() > 0) { + if (!costs.isEmpty()) { if (sbRule.length() > 0) { sbRule.append(','); } @@ -1035,7 +1035,7 @@ public abstract class AbilityImpl implements Ability { } else { half = " right"; } - if (spellAbility.getTargets().size() > 0) { + if (!spellAbility.getTargets().isEmpty()) { sb.append(half).append(" half targeting "); for (Target target : spellAbility.getTargets()) { sb.append(target.getTargetedName(game)); @@ -1085,7 +1085,7 @@ public abstract class AbilityImpl implements Ability { protected String getTargetDescriptionForLog(Targets targets, Game game) { StringBuilder sb = new StringBuilder(); // threadLocal StringBuilder can't be used because calling method already uses it - if (targets.size() > 0) { + if (!targets.isEmpty()) { String usedVerb = null; for (Target target : targets) { if (!target.getTargets().isEmpty()) { diff --git a/Mage/src/main/java/mage/abilities/DelayedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/DelayedTriggeredAbility.java index a4bef097ef..8183a81bb8 100644 --- a/Mage/src/main/java/mage/abilities/DelayedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/DelayedTriggeredAbility.java @@ -92,8 +92,6 @@ public abstract class DelayedTriggeredAbility extends TriggeredAbilityImpl { } } - ; - public boolean isInactive(Game game) { return false; } diff --git a/Mage/src/main/java/mage/abilities/Modes.java b/Mage/src/main/java/mage/abilities/Modes.java index a10edeba12..8daf432f4b 100644 --- a/Mage/src/main/java/mage/abilities/Modes.java +++ b/Mage/src/main/java/mage/abilities/Modes.java @@ -205,7 +205,7 @@ public class Modes extends LinkedHashMap { if (isEachModeOnlyOnce()) { setAlreadySelectedModes(selectedModes, source, game); } - return selectedModes.size() > 0; + return !selectedModes.isEmpty(); } // 700.2d diff --git a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAbility.java b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAbility.java index 1c064ddfc5..a7cb368a6c 100644 --- a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAbility.java +++ b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAbility.java @@ -88,7 +88,7 @@ public class EntersBattlefieldAbility extends StaticAbility { @Override public void addEffect(Effect effect) { - if (getEffects().size() > 0) { + if (!getEffects().isEmpty()) { Effect entersBattlefieldEffect = this.getEffects().get(0); if (entersBattlefieldEffect instanceof EntersBattlefieldEffect) { ((EntersBattlefieldEffect) entersBattlefieldEffect).addEffect(effect); diff --git a/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java b/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java index 34fa110bb9..ebb6bf0aa4 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java @@ -46,7 +46,7 @@ public class CardsInHandCondition implements Condition { public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO - }; + } private Condition condition; private CountType type; diff --git a/Mage/src/main/java/mage/abilities/condition/common/FerociousCondition.java b/Mage/src/main/java/mage/abilities/condition/common/FerociousCondition.java index 3df1138743..c0a93cd97a 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/FerociousCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/FerociousCondition.java @@ -49,7 +49,7 @@ public class FerociousCondition implements Condition { private static final FerociousCondition fInstance = new FerociousCondition(); - private FerociousCondition() {}; + private FerociousCondition() {} public static FerociousCondition getInstance() { return fInstance; diff --git a/Mage/src/main/java/mage/abilities/condition/common/OpponentControlsPermanentCondition.java b/Mage/src/main/java/mage/abilities/condition/common/OpponentControlsPermanentCondition.java index e09e0ed915..681b9a9c9b 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/OpponentControlsPermanentCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/OpponentControlsPermanentCondition.java @@ -44,8 +44,8 @@ import mage.game.Game; public class OpponentControlsPermanentCondition implements Condition { - public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO }; - + public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO } + private FilterPermanent filter; private CountType type; private int count; diff --git a/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java b/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java index 91609cc857..2deef0afb1 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java @@ -43,7 +43,7 @@ public class PermanentHasCounterCondition implements Condition { public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO - }; + } private CounterType counterType; private int amount; diff --git a/Mage/src/main/java/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java b/Mage/src/main/java/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java index c23a98553e..67ee9d4b7b 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java @@ -45,7 +45,8 @@ import mage.game.Game; */ public class PermanentsOnTheBattlefieldCondition implements Condition { - public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO }; + public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO } + private FilterPermanent filter; private Condition condition; private CountType type; diff --git a/Mage/src/main/java/mage/abilities/condition/common/TenOrLessLifeCondition.java b/Mage/src/main/java/mage/abilities/condition/common/TenOrLessLifeCondition.java index 8b727aa593..c65ab45368 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/TenOrLessLifeCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/TenOrLessLifeCondition.java @@ -40,7 +40,7 @@ import mage.players.PlayerList; */ public class TenOrLessLifeCondition implements Condition { - public static enum CheckType { AN_OPPONENT, CONTROLLER, TARGET_OPPONENT, EACH_PLAYER }; + public static enum CheckType { AN_OPPONENT, CONTROLLER, TARGET_OPPONENT, EACH_PLAYER } private final CheckType type; diff --git a/Mage/src/main/java/mage/abilities/condition/common/TopLibraryCardTypeCondition.java b/Mage/src/main/java/mage/abilities/condition/common/TopLibraryCardTypeCondition.java index e9f92e58ec..1e9a9d5356 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/TopLibraryCardTypeCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/TopLibraryCardTypeCondition.java @@ -41,7 +41,7 @@ public class TopLibraryCardTypeCondition implements Condition { public static enum CheckType { CREATURE, LAND, SORCERY, INSTANT - }; + } private TopLibraryCardTypeCondition.CheckType type; diff --git a/Mage/src/main/java/mage/abilities/costs/AlternativeCost2Impl.java b/Mage/src/main/java/mage/abilities/costs/AlternativeCost2Impl.java index 4a4e251444..28e7aa9e4f 100644 --- a/Mage/src/main/java/mage/abilities/costs/AlternativeCost2Impl.java +++ b/Mage/src/main/java/mage/abilities/costs/AlternativeCost2Impl.java @@ -145,8 +145,6 @@ public class AlternativeCost2Impl> extends Cos return activated; } - ; - @Override public AlternativeCost2Impl copy() { return new AlternativeCost2Impl(this); diff --git a/Mage/src/main/java/mage/abilities/costs/CostsImpl.java b/Mage/src/main/java/mage/abilities/costs/CostsImpl.java index f17c7b9b2f..538ca56b09 100644 --- a/Mage/src/main/java/mage/abilities/costs/CostsImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/CostsImpl.java @@ -152,7 +152,7 @@ public class CostsImpl extends ArrayList implements Costs protected T getFirstUnpaid() { Costs unpaid = getUnpaid(); - if (unpaid.size() > 0) { + if (!unpaid.isEmpty()) { return unpaid.get(0); } return null; diff --git a/Mage/src/main/java/mage/abilities/costs/OptionalAdditionalCostImpl.java b/Mage/src/main/java/mage/abilities/costs/OptionalAdditionalCostImpl.java index 649ca77384..5a4fda252e 100644 --- a/Mage/src/main/java/mage/abilities/costs/OptionalAdditionalCostImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/OptionalAdditionalCostImpl.java @@ -130,8 +130,6 @@ public class OptionalAdditionalCostImpl ex ++activatedCounter; } - ; - /** * Reset the activate and count information * @@ -162,8 +160,6 @@ public class OptionalAdditionalCostImpl ex return repeatable; } - ; - /** * Returns if the cost was activated * @@ -174,8 +170,6 @@ public class OptionalAdditionalCostImpl ex return activated; } - ; - /** * Returns the number of times the cost was activated * @return @@ -185,8 +179,6 @@ public class OptionalAdditionalCostImpl ex return activatedCounter; } - ; - @Override public OptionalAdditionalCostImpl copy() { diff --git a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java index 336dddaabb..87061d8696 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java @@ -72,7 +72,7 @@ public class PutCountersSourceCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { - this.paid = permanent.addCounters(counter, null, game);; + this.paid = permanent.addCounters(counter, null, game); } return paid; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java index f24a5dbf47..3e7c557e8e 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java @@ -93,7 +93,7 @@ public class RemoveCounterCost extends CostImpl { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - if (permanent.getCounters(game).size() > 0 && (counterTypeToRemove == null || permanent.getCounters(game).containsKey(counterTypeToRemove))) { + if (!permanent.getCounters(game).isEmpty() && (counterTypeToRemove == null || permanent.getCounters(game).containsKey(counterTypeToRemove))) { String counterName = null; if (counterTypeToRemove != null) { diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java index 2d14c311a7..1e541429cc 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java @@ -326,7 +326,7 @@ public class ManaCostsImpl extends ArrayList implements M String[] symbols = mana.split("^\\{|\\}\\{|\\}$"); int modifierForX = 0; for (String symbol : symbols) { - if (symbol.length() > 0) { + if (!symbol.isEmpty()) { if (symbol.length() == 1 || isNumeric(symbol)) { if (Character.isDigit(symbol.charAt(0))) { this.add(new GenericManaCost(Integer.valueOf(symbol))); diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/MultikickerCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/MultikickerCount.java index 6846c52d14..51c0562924 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/MultikickerCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/MultikickerCount.java @@ -65,10 +65,10 @@ public class MultikickerCount implements DynamicValue { @Override public String toString() { return "a"; - }; - + } + @Override public String getMessage() { return "time it was kicked"; - }; + } } diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java index 3450de2385..c5da9a1849 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java @@ -688,7 +688,7 @@ public class ContinuousEffects implements Serializable { } // check if player wants to use splice - if (spliceAbilities.size() > 0) { + if (!spliceAbilities.isEmpty()) { Player controller = game.getPlayer(abilityToModify.getControllerId()); if (controller.chooseUse(Outcome.Benefit, "Splice a card?", abilityToModify, game)) { Cards cardsToReveal = new CardsImpl(); @@ -899,7 +899,7 @@ public class ContinuousEffects implements Serializable { } } //Reload layerEffect if copy effects were applied - if (layer.size() > 0) { + if (!layer.isEmpty()) { activeLayerEffects = getLayeredEffects(game); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyTypeProducedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyTypeProducedEffect.java index da0143299f..a07f02e8d8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyTypeProducedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyTypeProducedEffect.java @@ -80,7 +80,7 @@ public class AddManaOfAnyTypeProducedEffect extends ManaEffect { if (types.getColorless() > 0) { choice.getChoices().add("Colorless"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java index 955ed8c3c4..05bbaaf28e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java @@ -170,7 +170,7 @@ public abstract class CopySpellForEachItCouldTargetEffect ex if (playerTargetCopyMap.containsKey(player.getId())) { Map targetCopyMap = playerTargetCopyMap.get(player.getId()); if (targetCopyMap != null) { - while (targetCopyMap.size() > 0) { + while (!targetCopyMap.isEmpty()) { FilterInPlay setFilter = filter.copy(); setFilter.add(new FromSetPredicate(targetCopyMap.keySet())); Target target = new TargetWithAdditionalFilter(sampleTarget, setFilter); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java index 28a8e93b1c..72d6841715 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java @@ -134,7 +134,7 @@ public class CreateTokenEffect extends OneShotEffect { sb.append(" attacking"); } String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { if (amount.toString().equals("X")) { sb.append(", where X is "); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java index 5243e83300..863528dbbe 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java @@ -80,7 +80,7 @@ public class CreateTokenTargetEffect extends OneShotEffect { sb.append(" attacking"); } String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageAllEffect.java index e537e7b304..320440e48d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageAllEffect.java @@ -81,7 +81,7 @@ public class DamageAllEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("{source} deals ").append(amount.toString()).append(" damage to each ").append(filter.getMessage()); String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { if (amount.toString().equals("X")) { sb.append(", where X is "); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java index 0cf6291395..3e863503a1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java @@ -103,7 +103,7 @@ public class DamageControllerEffect extends OneShotEffect { sb.append(amount); } sb.append(" damage to you"); - if (message.length() > 0) { + if (!message.isEmpty()) { if (message.equals("1")) { sb.append(" equal to the number of "); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageMultiEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageMultiEffect.java index 61baaaa19d..a03689a13b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageMultiEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageMultiEffect.java @@ -68,7 +68,7 @@ public class DamageMultiEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { Target multiTarget = source.getTargets().get(0); for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java index 017ba21128..8bd6b77230 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java @@ -152,12 +152,12 @@ public class DamageTargetEffect extends OneShotEffect { sb.append(amount); } sb.append(" damage to "); - if (targetDescription.length() > 0) { + if (!targetDescription.isEmpty()) { sb.append(targetDescription); } else { sb.append("target ").append(mode.getTargets().get(0).getTargetName()); } - if (message.length() > 0) { + if (!message.isEmpty()) { if (message.equals("1")) { sb.append(" equal to the number of "); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java index fdadf86629..2ff1d23aad 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java @@ -112,7 +112,7 @@ public class DevourEffect extends ReplacementEffectImpl { } if (controller.chooseUse(Outcome.Detriment, "Devour creatures?", source, game)) { controller.chooseTarget(Outcome.Detriment, target, source, game); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { List> cardSubtypes = new ArrayList<>(); int devouredCreatures = target.getTargets().size(); if (!game.isSimulation()) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java index cc27e9ca5c..02a31543f2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java @@ -56,7 +56,7 @@ public class DoIfCostPaid extends OneShotEffect { String message; if (chooseUseText == null) { String effectText = executingEffects.getText(source.getModes().getMode()); - if (effectText.length() > 0 && effectText.charAt(effectText.length() - 1) == '.') { + if (!effectText.isEmpty() && effectText.charAt(effectText.length() - 1) == '.') { effectText = effectText.substring(0, effectText.length() - 1); } message = getCostText() + " and " + effectText + '?'; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java index d77a8abdb9..9cda89ce6b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java @@ -158,7 +158,7 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR if (staticText != null && !staticText.isEmpty()) { return staticText; } - if (targetName != null && targetName.length() > 0) { + if (targetName != null && !targetName.isEmpty()) { if (targetName.equals("Those creatures") || targetName.equals("They")) { return targetName + " don't untap during their controller's next untap step"; } else diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java index 62da3f0a0d..bdc6a254cb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java @@ -83,7 +83,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect { sb.append('s'); } String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java index ae0c85ec39..0068c5a701 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java @@ -108,7 +108,7 @@ public class DrawCardTargetEffect extends OneShotEffect { return staticText; } StringBuilder sb = new StringBuilder(); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { Target target; if (targetPointer instanceof SecondTargetPointer && mode.getTargets().size() > 1) { target = mode.getTargets().get(1); @@ -136,7 +136,7 @@ public class DrawCardTargetEffect extends OneShotEffect { sb.append('s'); } String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java index 1734937692..e4ae7ecb0d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java @@ -26,7 +26,7 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect { public static enum Gender { MALE, FEMAL - }; + } protected Effect additionalEffect; diff --git a/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java index af86ff288c..fc30f8ad1d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java @@ -92,7 +92,7 @@ public class GainLifeEffect extends OneShotEffect { sb.append(life).append(' '); } sb.append("life"); - if (message.length() > 0 && !message.startsWith("that")) { + if (!message.isEmpty() && !message.startsWith("that")) { sb.append(message.equals("1") ? " equal to the number of " : " for each "); sb.append(message); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java index 3e965d01ee..b9c694dd7c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java @@ -85,7 +85,7 @@ public class GainLifeTargetEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); String message = life.getMessage(); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { sb.append("Target ").append(mode.getTargets().get(0).getTargetName()); } else { sb.append("that player"); @@ -95,7 +95,7 @@ public class GainLifeTargetEffect extends OneShotEffect { sb.append(life.toString()).append(' '); } sb.append("life"); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(message.equals("1") ? " equal to the number of " : " for each "); sb.append(message); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java index 5cb76793a6..dd22576549 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java @@ -88,7 +88,7 @@ public class LoseLifeControllerAttachedEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("its controller loses ").append(amount.toString()).append(" life"); String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); sb.append(message); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java index 7537b12f15..7a9eb8ae37 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java @@ -87,7 +87,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect { sb.append(amount).append(' '); } sb.append("life"); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(message.equals("1") || message.startsWith("the ") ? " equal to the number of " : " for each "); sb.append(message); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java index 83b9fa7b7f..7e5dbad663 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java @@ -78,7 +78,7 @@ public class LoseLifeSourceControllerEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("you lose ").append(amount.toString()).append(" life"); String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java index 2909da13cb..1e0069a9e4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java @@ -81,7 +81,7 @@ public class LoseLifeTargetEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); String message = amount.getMessage(); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { sb.append("target ").append(mode.getTargets().get(0).getTargetName()); } else { sb.append("that player"); @@ -91,7 +91,7 @@ public class LoseLifeTargetEffect extends OneShotEffect { sb.append(amount).append(' '); } sb.append("life"); - if (message.length() > 0) { + if (!message.isEmpty()) { if (amount.toString().equals("X")) { sb.append(", where X is "); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PhaseOutTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PhaseOutTargetEffect.java index 6584922a1c..79dce240e2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PhaseOutTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PhaseOutTargetEffect.java @@ -73,7 +73,7 @@ public class PhaseOutTargetEffect extends OneShotEffect { } StringBuilder sb = new StringBuilder(); - if (targetDescription != null && targetDescription.length() > 0) { + if (targetDescription != null && !targetDescription.isEmpty()) { sb.append(targetDescription); } else { sb.append("Target ").append(mode.getTargets().get(0).getTargetName()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PlayTargetWithoutPayingManaEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PlayTargetWithoutPayingManaEffect.java index 2042d607c5..08612e5e18 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PlayTargetWithoutPayingManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PlayTargetWithoutPayingManaEffect.java @@ -70,7 +70,7 @@ public class PlayTargetWithoutPayingManaEffect extends OneShotEffect { @Override public String getText(Mode mode) { StringBuilder sb = new StringBuilder(); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { Target target = mode.getTargets().get(0); if (mode.getTargets().get(0).getZone() == Zone.HAND) { sb.append("you may put ").append(target.getTargetName()).append(" from your hand onto the battlefield"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java index 46cf419611..4a61c9e6db 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java @@ -70,7 +70,7 @@ public class PopulateEffect extends OneShotEffect { public PopulateEffect(String prefixText) { super(Outcome.Copy); - this.staticText = (prefixText.length() > 0 ? prefixText + " p" : "P") + "opulate (Put a token onto the battlefield that's a copy of a creature token you control.)"; + this.staticText = (!prefixText.isEmpty() ? prefixText + " p" : "P") + "opulate (Put a token onto the battlefield that's a copy of a creature token you control.)"; } public PopulateEffect(final PopulateEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PutLibraryIntoGraveTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PutLibraryIntoGraveTargetEffect.java index 8caeff03b8..08eafb24e7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PutLibraryIntoGraveTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PutLibraryIntoGraveTargetEffect.java @@ -101,7 +101,7 @@ public class PutLibraryIntoGraveTargetEffect extends OneShotEffect { } sb.append("of his or her library into his or her graveyard"); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(", where X is the number of "); sb.append(message); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java index 5394ae0137..c21f31c9e1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java @@ -73,7 +73,7 @@ public class RecruiterEffect extends OneShotEffect { controller.revealCards(staticText, cards, game); controller.shuffleLibrary(source, game); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.putCardsOnTopOfLibrary(cards, game, source, true); } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java index aff6df4dab..d7cd05e914 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java @@ -111,7 +111,7 @@ public class RevealCardsFromLibraryUntilEffect extends OneShotEffect { // Put the rest in correct zone switch (zoneToPutRest) { case LIBRARY: { - if (cards.size() > 0) { + if (!cards.isEmpty()) { if (shuffleRestInto) { library.addAll(cards.getCards(game), game); } else { @@ -121,7 +121,7 @@ public class RevealCardsFromLibraryUntilEffect extends OneShotEffect { break; } default: - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.moveCards(cards, zoneToPutRest, source, game); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SkipNextPlayerUntapStepEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SkipNextPlayerUntapStepEffect.java index 0e1269c1af..2aadf12f97 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SkipNextPlayerUntapStepEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SkipNextPlayerUntapStepEffect.java @@ -61,7 +61,7 @@ public class SkipNextPlayerUntapStepEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = null; if (targetPointer != null) { - if (targetPointer.getTargets(game, source).size() > 0) { + if (!targetPointer.getTargets(game, source).isEmpty()) { player = game.getPlayer(targetPointer.getFirst(game, source)); } else { player = game.getPlayer(source.getControllerId()); @@ -82,7 +82,7 @@ public class SkipNextPlayerUntapStepEffect extends OneShotEffect { @Override public String getText(Mode mode) { StringBuilder sb = new StringBuilder(); - if (staticText.length() > 0) { + if (!staticText.isEmpty()) { sb.append(staticText).append(" player skips his or her next untap step"); } else { sb.append("You skip your next untap step"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java index d92c01d4c7..764ac42531 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java @@ -76,7 +76,7 @@ public class TapTargetEffect extends OneShotEffect { @Override public String getText(Mode mode) { - if (staticText.length() > 0) { + if (!staticText.isEmpty()) { return "tap " + staticText; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/TransformTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TransformTargetEffect.java index 1508c07afc..e23df12250 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TransformTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TransformTargetEffect.java @@ -73,7 +73,7 @@ public class TransformTargetEffect extends OneShotEffect { @Override public String getText(Mode mode) { - if (staticText != null && staticText.length() > 0) { + if (staticText != null && !staticText.isEmpty()) { return staticText; } if (mode.getTargets().isEmpty()) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardSubTypeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardSubTypeTargetEffect.java index 7a988a5bbc..f58836f257 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardSubTypeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardSubTypeTargetEffect.java @@ -77,7 +77,7 @@ public class AddCardSubTypeTargetEffect extends ContinuousEffectImpl { @Override public String getText(Mode mode) { StringBuilder sb = new StringBuilder(); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { sb.append("Target ").append(mode.getTargets().get(0).getTargetName()); } else { sb.append("It "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java index 9961a6f614..39f4519160 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java @@ -106,7 +106,7 @@ public class AssignNoCombatDamageSourceEffect extends ReplacementEffectImpl { text += " this combat"; break; default: - if (duration.toString().length() > 0) { + if (!duration.toString().isEmpty()) { text += ' ' + duration.toString(); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java index a9312c85d3..d7be01a950 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java @@ -118,11 +118,11 @@ public class BecomesColorOrColorsTargetEffect extends OneShotEffect { return staticText; } StringBuilder sb = new StringBuilder(); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { sb.append("target "); sb.append(mode.getTargets().get(0).getFilter().getMessage()); sb.append(" becomes the color or colors of your choice"); - if (duration.toString().length() > 0) { + if (!duration.toString().isEmpty()) { sb.append(' ').append(duration.toString()); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java index 13610ddd45..c249c52eec 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java @@ -76,7 +76,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { - if (token.getCardType().size() > 0) { + if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); @@ -86,7 +86,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { if (type == null) { permanent.getSubtype(game).clear(); } - if (token.getSubtype(game).size() > 0) { + if (!token.getSubtype(game).isEmpty()) { permanent.getSubtype(game).addAll(token.getSubtype(game)); } } @@ -100,7 +100,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { break; case AbilityAddingRemovingEffects_6: if (sublayer == SubLayer.NA) { - if (token.getAbilities().size() > 0) { + if (!token.getAbilities().isEmpty()) { for (Ability ability : token.getAbilities()) { permanent.addAbility(ability, source.getSourceId(), game); } @@ -146,7 +146,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { sb.append(" become "); } sb.append(token.getDescription()); - if (type != null && type.length() > 0) { + if (type != null && !type.isEmpty()) { sb.append(". They are still ").append(type); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java index 454f0000e6..d946b6869f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java @@ -48,7 +48,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { public enum LoseType { NONE, ALL, ALL_BUT_COLOR, ABILITIES, ABILITIES_SUBTYPE_AND_PT - }; + } protected Token token; protected String type; @@ -86,7 +86,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { - if (token.getSupertype().size() > 0) { + if (!token.getSupertype().isEmpty()) { for (String t : token.getSupertype()) { if (!permanent.getSupertype().contains(t)) { permanent.getSupertype().add(t); @@ -100,7 +100,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { permanent.getCardType().clear(); break; } - if (token.getCardType().size() > 0) { + if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); @@ -115,7 +115,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes()); break; } - if (token.getSubtype(game).size() > 0) { + if (!token.getSubtype(game).isEmpty()) { for (String t : token.getSubtype(game)) { if (!permanent.getSubtype(game).contains(t)) { permanent.getSubtype(game).add(t); @@ -148,7 +148,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { permanent.removeAllAbilities(source.getSourceId(), game); break; } - if (token.getAbilities().size() > 0) { + if (!token.getAbilities().isEmpty()) { for (Ability ability : token.getAbilities()) { permanent.addAbility(ability, source.getSourceId(), game); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java index 23c90cd686..de5a79aff9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java @@ -113,7 +113,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements if (losePreviousTypes) { permanent.getCardType().clear(); } - if (token.getCardType().size() > 0) { + if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); @@ -123,7 +123,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements if ("".equals(type) || type == null && permanent.getCardType().contains(CardType.LAND)) { permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes()); } - if (token.getSubtype(game).size() > 0) { + if (!token.getSubtype(game).isEmpty()) { permanent.getSubtype(game).addAll(token.getSubtype(game)); } } @@ -137,7 +137,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements break; case AbilityAddingRemovingEffects_6: if (sublayer == SubLayer.NA) { - if (token.getAbilities().size() > 0) { + if (!token.getAbilities().isEmpty()) { for (Ability ability : token.getAbilities()) { permanent.addAbility(ability, source.getSourceId(), game); } @@ -172,7 +172,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements } private void setText() { - if (type != null && type.length() > 0) { + if (type != null && !type.isEmpty()) { staticText = duration.toString() + " {this} becomes a " + token.getDescription() + " that's still a " + this.type; } else { staticText = duration.toString() + " {this} becomes a " + token.getDescription(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java index e16b52adcc..833597d81a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java @@ -91,7 +91,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes()); permanent.getSubtype(game).addAll(token.getSubtype(game)); } else { - if (token.getSubtype(game).size() > 0) { + if (!token.getSubtype(game).isEmpty()) { for (String subtype : token.getSubtype(game)) { if (!permanent.getSubtype(game).contains(subtype)) { permanent.getSubtype(game).add(subtype); @@ -100,7 +100,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { } } - if (token.getCardType().size() > 0) { + if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); @@ -128,7 +128,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { permanent.removeAllAbilities(source.getSourceId(), game); } if (sublayer == SubLayer.NA) { - if (token.getAbilities().size() > 0) { + if (!token.getAbilities().isEmpty()) { for (Ability ability : token.getAbilities()) { permanent.addAbility(ability, source.getSourceId(), game); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java index 33eff81c6a..796fa3060c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java @@ -132,7 +132,7 @@ public class BoostEquippedEffect extends ContinuousEffectImpl { if (duration != Duration.WhileOnBattlefield) sb.append(' ').append(duration.toString()); String message = power.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java index 66320f7a27..513fe0f5ae 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java @@ -197,7 +197,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl { if (quotes) { sb.append('"'); } - if (duration.toString().length() > 0) { + if (!duration.toString().isEmpty()) { sb.append(' ').append(duration.toString()); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java index b689d1224d..19ef23b8fb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java @@ -71,7 +71,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl { public GainAbilityTargetEffect(Ability ability, Duration duration, String rule, boolean onCard, Layer layer, SubLayer subLayer) { super(duration, layer, subLayer, - ability.getEffects().size() > 0 ? ability.getEffects().get(0).getOutcome() : Outcome.AddAbility); + !ability.getEffects().isEmpty() ? ability.getEffects().get(0).getOutcome() : Outcome.AddAbility); this.ability = ability; staticText = rule; this.onCard = onCard; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java index e479cfaa5c..8ea40207d6 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java @@ -48,7 +48,7 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl { public static enum HandSizeModification { SET, INCREASE, REDUCE - }; + } protected DynamicValue handSize; protected HandSizeModification handSizeModification; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java index 20554668e2..2824f7f5e7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java @@ -101,7 +101,7 @@ public class AddCountersAttachedEffect extends OneShotEffect { } sb.append(counter.getName().toLowerCase()).append(" counter on "); sb.append(textEnchanted); - if (amount.getMessage().length() > 0) { + if (!amount.getMessage().isEmpty()) { sb.append(" for each ").append(amount.getMessage()); } staticText = sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index f2f40afefd..de633168c2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -146,7 +146,7 @@ public class AddCountersTargetEffect extends OneShotEffect { } sb.append(" on "); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { Target target = mode.getTargets().get(0); if (target.getNumberOfTargets() == 0) { sb.append("up to "); @@ -164,7 +164,7 @@ public class AddCountersTargetEffect extends OneShotEffect { sb.append("that creature"); } - if (amount.getMessage().length() > 0) { + if (!amount.getMessage().isEmpty()) { sb.append(" for each ").append(amount.getMessage()); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java index 6cb3f44bb1..9a02457659 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java @@ -74,7 +74,7 @@ public class DistributeCountersEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { Target multiTarget = source.getTargets().get(0); for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); @@ -135,7 +135,7 @@ class RemoveCountersAtEndOfTurn extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { Target multiTarget = source.getTargets().get(0); for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java index b67caad706..c18d4030f0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java @@ -75,7 +75,7 @@ public class ProliferateEffect extends OneShotEffect { UUID chosen = (UUID) target.getTargets().get(idx); Permanent permanent = game.getPermanent(chosen); if (permanent != null) { - if (permanent.getCounters(game).size() > 0) { + if (!permanent.getCounters(game).isEmpty()) { if (permanent.getCounters(game).size() == 1) { for (Counter counter : permanent.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName()); @@ -102,7 +102,7 @@ public class ProliferateEffect extends OneShotEffect { } else { Player player = game.getPlayer(chosen); if (player != null) { - if (player.getCounters().size() > 0) { + if (!player.getCounters().isEmpty()) { if (player.getCounters().size() == 1) { for (Counter counter : player.getCounters().values()) { Counter newCounter = new Counter(counter.getName()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java index 3647644a9d..5820f6166d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java @@ -93,7 +93,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { private Counter selectCounterType(Game game, Ability source, Permanent permanent) { Player controller = game.getPlayer(source.getControllerId()); - if(controller != null && permanent.getCounters(game).size() > 0) { + if(controller != null && !permanent.getCounters(game).isEmpty()) { String counterName = null; if(permanent.getCounters(game).size() > 1) { Choice choice = new ChoiceImpl(true); diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java index e21c7574d8..69297f115d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java @@ -116,7 +116,7 @@ public class DiscardControllerEffect extends OneShotEffect { sb.append(" at random"); } String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandTargetEffect.java index 83d5d9526c..22bee765e9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandTargetEffect.java @@ -84,7 +84,7 @@ public class DiscardHandTargetEffect extends OneShotEffect { return staticText; } StringBuilder sb = new StringBuilder(); - if (targetDescription.length() > 0) { + if (!targetDescription.isEmpty()) { sb.append(targetDescription); } else { sb.append("target ").append(mode.getTargets().get(0).getTargetName()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardTargetEffect.java index 65a390a537..a053e6f256 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardTargetEffect.java @@ -116,7 +116,7 @@ public class DiscardTargetEffect extends OneShotEffect { sb.append(" at random"); } String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java index 656a47b3e7..2d5d1769de 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java @@ -82,7 +82,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect { TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter); target.clearChosen(); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { cardFound = game.getCard(target.getFirstTarget()); } } @@ -93,7 +93,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect { TargetCard target = new TargetCard(0, 1, Zone.GRAVEYARD, filter); target.clearChosen(); if (controller.choose(outcome, controller.getGraveyard(), target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { cardFound = game.getCard(target.getFirstTarget()); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java index 8ce316cfc5..f456b96dfd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java @@ -90,7 +90,7 @@ public class SearchLibraryPutInHandEffect extends SearchEffect { } target.clearChosen(); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = game.getCard(cardId); diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java index 39d26abaf5..52f45373b0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java @@ -88,7 +88,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect { return false; } if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, tapped, false, false, null); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java index 0b851ee858..0d3c6776b0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java @@ -71,7 +71,7 @@ public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect { Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); if (player != null) { if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, tapped, false, ownerIsController, null); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryWithLessCMCPutInPlayEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryWithLessCMCPutInPlayEffect.java index 2096e43843..75e156a20d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryWithLessCMCPutInPlayEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryWithLessCMCPutInPlayEffect.java @@ -69,7 +69,7 @@ public class SearchLibraryWithLessCMCPutInPlayEffect extends OneShotEffect { filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, source.getManaCostsToPay().getX() + 1)); TargetCardInLibrary target = new TargetCardInLibrary(filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); if (card != null) { controller.moveCards(card, Zone.BATTLEFIELD, source, game); diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/FatesealEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/FatesealEffect.java index 03ca5be0ca..f4b8c95e87 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/FatesealEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/FatesealEffect.java @@ -89,7 +89,7 @@ public class FatesealEffect extends OneShotEffect { TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1); target1.setRequired(false); // move cards to the bottom of the library - while (cards.size() > 0 && controller.choose(Outcome.Detriment, cards, target1, game)) { + while (!cards.isEmpty() && controller.choose(Outcome.Detriment, cards, target1, game)) { if (!controller.canRespond() || !opponent.canRespond()) { return false; } diff --git a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java index dbe8a87d8d..45125e1d96 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java @@ -134,7 +134,7 @@ class CascadeEffect extends OneShotEffect { Cards cardsFromExile = new CardsImpl(); Cards cardsToLibrary = new CardsImpl(); cardsFromExile.addAll(exile); - while (cardsFromExile.size() > 0) { + while (!cardsFromExile.isEmpty()) { card = cardsFromExile.getRandom(game); cardsFromExile.remove(card.getId()); cardsToLibrary.add(card); diff --git a/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java b/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java index f155d53c44..fd3f408d60 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java @@ -208,7 +208,7 @@ class ConvokeEffect extends OneShotEffect { if (!perm.isTapped() && perm.tap(game)) { ManaPool manaPool = controller.getManaPool(); Choice chooseManaType = buildChoice(perm.getColor(game), unpaid.getMana()); - if (chooseManaType.getChoices().size() > 0) { + if (!chooseManaType.getChoices().isEmpty()) { if (chooseManaType.getChoices().size() > 1) { chooseManaType.getChoices().add("Colorless"); chooseManaType.setMessage("Choose mana color to reduce from " + perm.getName()); diff --git a/Mage/src/main/java/mage/abilities/keyword/DelveAbility.java b/Mage/src/main/java/mage/abilities/keyword/DelveAbility.java index 69b0adcb46..a50e1bf0d4 100644 --- a/Mage/src/main/java/mage/abilities/keyword/DelveAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/DelveAbility.java @@ -93,13 +93,13 @@ public class DelveAbility extends SimpleStaticAbility implements AlternateManaPa @Override public String getRule() { - return "Delve (Each card you exile from your graveyard while casting this spell pays for {1}.)"; + return "Delve (Each card you exile from your graveyard while casting this spell pays for {1}.)"; } @Override public void addSpecialAction(Ability source, Game game, ManaCost unpaid) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && controller.getGraveyard().size() > 0) { + if (controller != null && !controller.getGraveyard().isEmpty()) { if (unpaid.getMana().getGeneric() > 0 && source.getAbilityType().equals(AbilityType.SPELL)) { SpecialAction specialAction = new DelveSpecialAction(); specialAction.setControllerId(source.getControllerId()); @@ -159,7 +159,7 @@ class DelveEffect extends OneShotEffect { ExileFromGraveCost exileFromGraveCost = (ExileFromGraveCost) source.getCosts().get(0); List exiledCards = exileFromGraveCost.getExiledCards(); - if (exiledCards.size() > 0) { + if (!exiledCards.isEmpty()) { Cards toDelve = new CardsImpl(); for (Card card : exiledCards) { toDelve.add(card); diff --git a/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java b/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java index 350cc8e517..3667b59832 100644 --- a/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java @@ -123,16 +123,16 @@ public class FlashbackAbility extends SpellAbility { @Override public String getRule() { StringBuilder sbRule = new StringBuilder("Flashback"); - if (costs.size() > 0) { + if (!costs.isEmpty()) { sbRule.append(" - "); } else { sbRule.append(' '); } - if (manaCosts.size() > 0) { + if (!manaCosts.isEmpty()) { sbRule.append(manaCosts.getText()); } - if (costs.size() > 0) { - if (manaCosts.size() > 0) { + if (!costs.isEmpty()) { + if (!manaCosts.isEmpty()) { sbRule.append(", "); } sbRule.append(costs.getText()); diff --git a/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java b/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java index bd839096a4..30e8ef3914 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java @@ -118,7 +118,7 @@ class HideawayExileEffect extends OneShotEffect { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 4)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1); if (controller.choose(Outcome.Detriment, cards, target1, game)) { Card card = cards.get(target1.getFirstTarget(), game); diff --git a/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java b/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java index 100c0e7473..5dc86dada7 100644 --- a/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java @@ -82,7 +82,7 @@ class TransmuteEffect extends OneShotEffect { filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, sourceObject.getConvertedManaCost())); TargetCardInLibrary target = new TargetCardInLibrary(1, filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(target.getTargets()); controller.revealCards(sourceObject.getIdName(), revealed, game); controller.moveCards(revealed, Zone.HAND, source, game); diff --git a/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java b/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java index 1c7b4d6874..000aa8bdf5 100644 --- a/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java @@ -95,7 +95,7 @@ public abstract class ActivatedManaAbilityImpl extends ActivatedAbilityImpl impl */ @Override public boolean definesMana() { - return netMana.size() > 0; + return !netMana.isEmpty(); } /** diff --git a/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java b/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java index 8081221808..ea94f06ffc 100644 --- a/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java @@ -124,7 +124,7 @@ class AnyColorLandsProduceManaEffect extends ManaEffect { choice.getChoices().add("Green"); choice.getChoices().add("White"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); diff --git a/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java b/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java index d344dcfc96..8e2a7c2330 100644 --- a/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java @@ -148,7 +148,7 @@ class CommanderIdentityManaEffect extends ManaEffect { } } } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); } else { diff --git a/Mage/src/main/java/mage/abilities/mana/ManaOptions.java b/Mage/src/main/java/mage/abilities/mana/ManaOptions.java index 03e8bcd4ee..f5402422dc 100644 --- a/Mage/src/main/java/mage/abilities/mana/ManaOptions.java +++ b/Mage/src/main/java/mage/abilities/mana/ManaOptions.java @@ -46,8 +46,6 @@ public class ManaOptions extends ArrayList { public ManaOptions() { } - ; - public ManaOptions(final ManaOptions options) { for (Mana mana : options) { this.add(mana.copy()); diff --git a/Mage/src/main/java/mage/abilities/mana/TriggeredManaAbility.java b/Mage/src/main/java/mage/abilities/mana/TriggeredManaAbility.java index 4ef715e220..ab686c04d6 100644 --- a/Mage/src/main/java/mage/abilities/mana/TriggeredManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/TriggeredManaAbility.java @@ -97,6 +97,6 @@ public abstract class TriggeredManaAbility extends TriggeredAbilityImpl implemen */ @Override public boolean definesMana() { - return netMana.size() > 0; + return !netMana.isEmpty(); } } diff --git a/Mage/src/main/java/mage/cards/Sets.java b/Mage/src/main/java/mage/cards/Sets.java index 7fc0e1374e..afa3a1d565 100644 --- a/Mage/src/main/java/mage/cards/Sets.java +++ b/Mage/src/main/java/mage/cards/Sets.java @@ -146,10 +146,10 @@ public class Sets extends HashMap { Map deckCards = new HashMap<>(); Map sideboard = new HashMap<>(); try (PrintWriter out = new PrintWriter(file)) { - if (deck.getName() != null && deck.getName().length() > 0) { + if (deck.getName() != null && !deck.getName().isEmpty()) { out.println("NAME:" + deck.getName()); } - if (deck.getAuthor() != null && deck.getAuthor().length() > 0) { + if (deck.getAuthor() != null && !deck.getAuthor().isEmpty()) { out.println("AUTHOR:" + deck.getAuthor()); } for (DeckCardInfo deckCardInfo : deck.getCards()) { diff --git a/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java index 6593401fc1..67837022b8 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java @@ -73,7 +73,7 @@ public class DckDeckImporter extends DeckImporter { if (cardInfo == null) { // Try alternate based on name String cardName = m.group(5); - if (cardName != null && cardName.length() > 0) { + if (cardName != null && !cardName.isEmpty()) { cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(cardName, false); sbMessage.append("Could not find card '").append(cardName).append("' in set ").append(setCode).append(" of number ").append(cardNum).append(".\n"); if (cardInfo != null) { diff --git a/Mage/src/main/java/mage/filter/FilterCard.java b/Mage/src/main/java/mage/filter/FilterCard.java index a59885e990..035d6e8809 100644 --- a/Mage/src/main/java/mage/filter/FilterCard.java +++ b/Mage/src/main/java/mage/filter/FilterCard.java @@ -115,7 +115,7 @@ public class FilterCard extends FilterObject { } public boolean hasPredicates() { - return predicates.size() > 0; + return !predicates.isEmpty(); } @Override diff --git a/Mage/src/main/java/mage/game/GameCommanderImpl.java b/Mage/src/main/java/mage/game/GameCommanderImpl.java index 3be3b93eb9..44c61134d5 100644 --- a/Mage/src/main/java/mage/game/GameCommanderImpl.java +++ b/Mage/src/main/java/mage/game/GameCommanderImpl.java @@ -72,7 +72,7 @@ public abstract class GameCommanderImpl extends GameImpl { for (UUID playerId : state.getPlayerList(startingPlayerId)) { Player player = getPlayer(playerId); if (player != null) { - while (player.getSideboard().size() > 0) { + while (!player.getSideboard().isEmpty()) { Card commander = this.getCard(player.getSideboard().iterator().next()); if (commander != null) { player.addCommanderId(commander.getId()); diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index f24110ca59..c85f5f2550 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -1898,7 +1898,7 @@ public abstract class GameImpl implements Game, Serializable { //20091005 - 704.5q If a creature is attached to an object or player, it becomes unattached and remains on the battlefield. // Similarly, if a permanent thatÂ’s neither an Aura, an Equipment, nor a Fortification is attached to an object or player, // it becomes unattached and remains on the battlefield. - if (perm.getAttachments().size() > 0) { + if (!perm.getAttachments().isEmpty()) { for (UUID attachmentId : perm.getAttachments()) { Permanent attachment = getPermanent(attachmentId); if (attachment != null diff --git a/Mage/src/main/java/mage/game/GameStates.java b/Mage/src/main/java/mage/game/GameStates.java index b65cbccea3..e4e82b2efb 100644 --- a/Mage/src/main/java/mage/game/GameStates.java +++ b/Mage/src/main/java/mage/game/GameStates.java @@ -60,7 +60,7 @@ public class GameStates implements Serializable { } public GameState rollback(int index) { - if (states.size() > 0 && index < states.size()) { + if (!states.isEmpty() && index < states.size()) { while (states.size() > index + 1) { states.remove(states.size() - 1); } @@ -72,8 +72,8 @@ public class GameStates implements Serializable { } public int remove(int index) { - if (states.size() > 0 && index < states.size()) { - while (states.size() > index && states.size() > 0) { + if (!states.isEmpty() && index < states.size()) { + while (states.size() > index && !states.isEmpty()) { states.remove(states.size() - 1); } } diff --git a/Mage/src/main/java/mage/game/ZonesHandler.java b/Mage/src/main/java/mage/game/ZonesHandler.java index fc733a970b..9f293231bd 100644 --- a/Mage/src/main/java/mage/game/ZonesHandler.java +++ b/Mage/src/main/java/mage/game/ZonesHandler.java @@ -34,7 +34,7 @@ public class ZonesHandler { public static boolean moveCard(ZoneChangeInfo info, Game game) { List list = new ArrayList<>(); list.add(info); - return moveCards(list, game).size() > 0; + return !moveCards(list, game).isEmpty(); } public static List moveCards(List zoneChangeInfos, Game game) { diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java index edd139d5ab..fdf52a3d69 100644 --- a/Mage/src/main/java/mage/game/combat/Combat.java +++ b/Mage/src/main/java/mage/game/combat/Combat.java @@ -514,7 +514,7 @@ public class Combat implements Serializable, Copyable { } } if (attackerExists) { - if (group.getBlockers().size() > 0) { + if (!group.getBlockers().isEmpty()) { sb.append("blocked by "); for (UUID blockingCreatureId : group.getBlockerOrder()) { Permanent blockingCreature = game.getPermanent(blockingCreatureId); diff --git a/Mage/src/main/java/mage/game/combat/CombatGroup.java b/Mage/src/main/java/mage/game/combat/CombatGroup.java index b18d6f7610..ca898f12bf 100644 --- a/Mage/src/main/java/mage/game/combat/CombatGroup.java +++ b/Mage/src/main/java/mage/game/combat/CombatGroup.java @@ -134,7 +134,7 @@ public class CombatGroup implements Serializable, Copyable { } public void assignDamageToBlockers(boolean first, Game game) { - if (attackers.size() > 0 && (!first || hasFirstOrDoubleStrike(game))) { + if (!attackers.isEmpty() && (!first || hasFirstOrDoubleStrike(game))) { if (blockers.isEmpty()) { unblockedDamage(first, game); } else { @@ -156,7 +156,7 @@ public class CombatGroup implements Serializable, Copyable { } public void assignDamageToAttackers(boolean first, Game game) { - if (blockers.size() > 0 && (!first || hasFirstOrDoubleStrike(game))) { + if (!blockers.isEmpty() && (!first || hasFirstOrDoubleStrike(game))) { if (attackers.size() == 1) { singleAttackerDamage(first, game); } else { @@ -581,7 +581,7 @@ public class CombatGroup implements Serializable, Copyable { for (UUID uuid : attackers) { Permanent attacker = game.getPermanent(uuid); // Check if there are enough blockers to have a legal block - if (attacker != null && this.blocked && attacker.getMinBlockedBy() > 1 && blockers.size() > 0 && blockers.size() < attacker.getMinBlockedBy()) { + if (attacker != null && this.blocked && attacker.getMinBlockedBy() > 1 && !blockers.isEmpty() && blockers.size() < attacker.getMinBlockedBy()) { for (UUID blockerId : blockers) { Permanent blocker = game.getPermanent(blockerId); if (blocker != null) { diff --git a/Mage/src/main/java/mage/game/draft/DraftCube.java b/Mage/src/main/java/mage/game/draft/DraftCube.java index b120bb0a94..8a9c1cb647 100644 --- a/Mage/src/main/java/mage/game/draft/DraftCube.java +++ b/Mage/src/main/java/mage/game/draft/DraftCube.java @@ -108,7 +108,7 @@ public abstract class DraftCube { if (!cardId.getExtension().isEmpty()) { CardCriteria criteria = new CardCriteria().name(cardId.getName()).setCodes(cardId.extension); List cardList = CardRepository.instance.findCards(criteria); - if (cardList != null && cardList.size() > 0) { + if (cardList != null && !cardList.isEmpty()) { cardInfo = cardList.get(0); } } else { diff --git a/Mage/src/main/java/mage/game/draft/RandomBoosterDraft.java b/Mage/src/main/java/mage/game/draft/RandomBoosterDraft.java index bc50b7a72f..887f1bed3d 100644 --- a/Mage/src/main/java/mage/game/draft/RandomBoosterDraft.java +++ b/Mage/src/main/java/mage/game/draft/RandomBoosterDraft.java @@ -63,7 +63,7 @@ public class RandomBoosterDraft extends BoosterDraft { } private ExpansionSet getNextBooster() { - if (0 == useBoosters.size()){ + if (useBoosters.isEmpty()){ resetBoosters(); } ExpansionSet theBooster = useBoosters.get(0); diff --git a/Mage/src/main/java/mage/game/match/MatchPlayer.java b/Mage/src/main/java/mage/game/match/MatchPlayer.java index f2c5d483dd..3bc8a66edd 100644 --- a/Mage/src/main/java/mage/game/match/MatchPlayer.java +++ b/Mage/src/main/java/mage/game/match/MatchPlayer.java @@ -105,7 +105,7 @@ public class MatchPlayer implements Serializable { public Deck generateDeck() { //TODO: improve this - while (deck.getCards().size() < 40 && deck.getSideboard().size() > 0) { + while (deck.getCards().size() < 40 && !deck.getSideboard().isEmpty()) { Card card = deck.getSideboard().iterator().next(); deck.getCards().add(card); deck.getSideboard().remove(card); diff --git a/Mage/src/main/java/mage/game/permanent/token/Token.java b/Mage/src/main/java/mage/game/permanent/token/Token.java index ef5f13c824..46b7fd4918 100644 --- a/Mage/src/main/java/mage/game/permanent/token/Token.java +++ b/Mage/src/main/java/mage/game/permanent/token/Token.java @@ -284,7 +284,7 @@ public class Token extends MageObjectImpl { } public void setExpansionSetCodeForImage(String code) { - if (availableImageSetCodes.size() > 0) { + if (!availableImageSetCodes.isEmpty()) { if (availableImageSetCodes.contains(code)) { setOriginalExpansionSetCode(code); } else // we should not set random set if appropriate set is already used diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index 38c49d6ded..2f2871b641 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -315,7 +315,7 @@ public class Spell extends StackObjImpl implements Card { boolean legalTargetedMode = false; for (UUID modeId : spellAbility.getModes().getSelectedModes()) { Mode mode = spellAbility.getModes().get(modeId); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { targetedMode = true; if (mode.getTargets().stillLegal(spellAbility, game)) { legalTargetedMode = true; diff --git a/Mage/src/main/java/mage/game/stack/StackAbility.java b/Mage/src/main/java/mage/game/stack/StackAbility.java index 2ba1f248d6..430820956f 100644 --- a/Mage/src/main/java/mage/game/stack/StackAbility.java +++ b/Mage/src/main/java/mage/game/stack/StackAbility.java @@ -589,7 +589,7 @@ public class StackAbility extends StackObjImpl implements Ability { newAbility.newId(); StackAbility newStackAbility = new StackAbility(newAbility, newControllerId); game.getStack().push(newStackAbility); - if (chooseNewTargets && newAbility.getTargets().size() > 0) { + if (chooseNewTargets && !newAbility.getTargets().isEmpty()) { Player controller = game.getPlayer(newControllerId); Outcome outcome = newAbility.getEffects().isEmpty() ? Outcome.Detriment : newAbility.getEffects().get(0).getOutcome(); if (controller.chooseUse(outcome, "Choose new targets?", source, game)) { diff --git a/Mage/src/main/java/mage/game/tournament/TournamentImpl.java b/Mage/src/main/java/mage/game/tournament/TournamentImpl.java index a227b82421..3c48e1611b 100644 --- a/Mage/src/main/java/mage/game/tournament/TournamentImpl.java +++ b/Mage/src/main/java/mage/game/tournament/TournamentImpl.java @@ -202,7 +202,7 @@ public abstract class TournamentImpl implements Tournament { round.addPairing(new TournamentPairing(player1, player2)); } - if (roundPlayers.size() > 0) { + if (!roundPlayers.isEmpty()) { // player free round - add to bye players of this round TournamentPlayer player1 = roundPlayers.get(0); round.getPlayerByes().add(player1); diff --git a/Mage/src/main/java/mage/game/tournament/pairing/SwissPairingSimple.java b/Mage/src/main/java/mage/game/tournament/pairing/SwissPairingSimple.java index 0af702e22c..249fa0b116 100644 --- a/Mage/src/main/java/mage/game/tournament/pairing/SwissPairingSimple.java +++ b/Mage/src/main/java/mage/game/tournament/pairing/SwissPairingSimple.java @@ -67,7 +67,7 @@ public class SwissPairingSimple { }); // create pairings - while (players.size() > 0) { + while (!players.isEmpty()) { TournamentPlayer player1 = players.get(0); players.remove(0); TournamentPlayer playerForPossibleSecondPairing = null; diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index f9bc0cb6ae..9f972c8c36 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -680,7 +680,7 @@ public abstract class PlayerImpl implements Player, Serializable { } if (this.getHand().size() == 1 || this.getHand().size() == amount) { discardedCards.addAll(this.getHand()); - while (this.getHand().size() > 0) { + while (!this.getHand().isEmpty()) { discard(this.getHand().get(this.getHand().iterator().next(), game), source, game); } return discardedCards; @@ -1495,7 +1495,7 @@ public abstract class PlayerImpl implements Player, Serializable { filter.add(Predicates.not(new PermanentIdPredicate(permanent.getId()))); } // while targets left and there is still allowed to untap - while (canRespond() && leftForUntap.size() > 0 && numberToUntap > 0) { + while (canRespond() && !leftForUntap.isEmpty() && numberToUntap > 0) { // player has to select the permanent he wants to untap for this restriction Ability ability = handledEntry.getKey().getValue().iterator().next(); if (ability != null) { @@ -2817,14 +2817,14 @@ public abstract class PlayerImpl implements Player, Serializable { if (ability.isModal()) { addModeOptions(options, ability, game); - } else if (ability.getTargets().getUnchosen().size() > 0) { + } else if (!ability.getTargets().getUnchosen().isEmpty()) { // TODO: Handle other variable costs than mana costs - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { addVariableXOptions(options, ability, 0, game); } else { addTargetOptions(options, ability, 0, game); } - } else if (ability.getCosts().getTargets().getUnchosen().size() > 0) { + } else if (!ability.getCosts().getTargets().getUnchosen().isEmpty()) { addCostTargetOptions(options, ability, 0, game); } @@ -2838,13 +2838,13 @@ public abstract class PlayerImpl implements Player, Serializable { newOption.getModes().getSelectedModes().clear(); newOption.getModes().getSelectedModes().add(mode.getId()); newOption.getModes().setActiveMode(mode); - if (newOption.getTargets().getUnchosen().size() > 0) { - if (newOption.getManaCosts().getVariableCosts().size() > 0) { + if (!newOption.getTargets().getUnchosen().isEmpty()) { + if (!newOption.getManaCosts().getVariableCosts().isEmpty()) { addVariableXOptions(options, newOption, 0, game); } else { addTargetOptions(options, newOption, 0, game); } - } else if (newOption.getCosts().getTargets().getUnchosen().size() > 0) { + } else if (!newOption.getCosts().getTargets().getUnchosen().isEmpty()) { addCostTargetOptions(options, newOption, 0, game); } else { options.add(newOption); @@ -2871,7 +2871,7 @@ public abstract class PlayerImpl implements Player, Serializable { } if (targetNum < option.getTargets().size() - 2) { addTargetOptions(options, newOption, targetNum + 1, game); - } else if (option.getCosts().getTargets().size() > 0) { + } else if (!option.getCosts().getTargets().isEmpty()) { addCostTargetOptions(options, newOption, 0, game); } else { options.add(newOption); @@ -3115,7 +3115,7 @@ public abstract class PlayerImpl implements Player, Serializable { case GRAVEYARD: fromZone = game.getState().getZone(cards.iterator().next().getId()); successfulMovedCards = moveCardsToGraveyardWithInfo(cards, source, game, fromZone); - return successfulMovedCards.size() > 0; + return !successfulMovedCards.isEmpty(); case BATTLEFIELD: // new logic that does not yet add the permanents to battlefield while replacement effects are handled List infoList = new ArrayList<>(); for (Card card : cards) { @@ -3175,7 +3175,7 @@ public abstract class PlayerImpl implements Player, Serializable { default: throw new UnsupportedOperationException("to Zone" + toZone.toString() + " not supported yet"); } - return successfulMovedCards.size() > 0; + return !successfulMovedCards.isEmpty(); } @Override diff --git a/Mage/src/main/java/mage/target/TargetImpl.java b/Mage/src/main/java/mage/target/TargetImpl.java index 38996f4128..88c29215ac 100644 --- a/Mage/src/main/java/mage/target/TargetImpl.java +++ b/Mage/src/main/java/mage/target/TargetImpl.java @@ -314,7 +314,7 @@ public abstract class TargetImpl implements Target { chosen = targets.size() >= getNumberOfTargets(); if (isRandom()) { Set possibleTargets = possibleTargets(source.getSourceId(), playerId, game); - if (possibleTargets.size() > 0) { + if (!possibleTargets.isEmpty()) { int i = 0; int rnd = RandomUtil.nextInt(possibleTargets.size()); Iterator it = possibleTargets.iterator(); @@ -370,7 +370,7 @@ public abstract class TargetImpl implements Target { } } - return targets.size() > 0; + return !targets.isEmpty(); } /** @@ -483,7 +483,7 @@ public abstract class TargetImpl implements Target { @Override public UUID getFirstTarget() { - if (targets.size() > 0) { + if (!targets.isEmpty()) { return targets.keySet().iterator().next(); } return null; diff --git a/Mage/src/main/java/mage/target/targetpointer/FirstTargetPointer.java b/Mage/src/main/java/mage/target/targetpointer/FirstTargetPointer.java index d9b1db245e..01d2b3c7db 100644 --- a/Mage/src/main/java/mage/target/targetpointer/FirstTargetPointer.java +++ b/Mage/src/main/java/mage/target/targetpointer/FirstTargetPointer.java @@ -30,7 +30,7 @@ public class FirstTargetPointer implements TargetPointer { @Override public void init(Game game, Ability source) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { for (UUID target : source.getTargets().get(0).getTargets()) { Card card = game.getCard(target); if (card != null) { @@ -43,7 +43,7 @@ public class FirstTargetPointer implements TargetPointer { @Override public List getTargets(Game game, Ability source) { ArrayList target = new ArrayList<>(); - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { for (UUID targetId : source.getTargets().get(0).getTargets()) { Card card = game.getCard(targetId); if (card != null && zoneChangeCounter.containsKey(targetId) diff --git a/Mage/src/main/java/mage/util/TournamentUtil.java b/Mage/src/main/java/mage/util/TournamentUtil.java index 2448a3277a..ccf6c18673 100644 --- a/Mage/src/main/java/mage/util/TournamentUtil.java +++ b/Mage/src/main/java/mage/util/TournamentUtil.java @@ -61,7 +61,7 @@ public class TournamentUtil { // if sets have no basic lands and also it has no parent or parent has no lands get last set with lands // select a set with basic lands by random List basicLandSets = ExpansionRepository.instance.getSetsWithBasicLandsByReleaseDate(); - if (basicLandSets.size() > 0) { + if (!basicLandSets.isEmpty()) { landSetCodes.add(basicLandSets.get(RandomUtil.nextInt(basicLandSets.size())).getCode()); } } diff --git a/Mage/src/main/java/mage/util/trace/TraceUtil.java b/Mage/src/main/java/mage/util/trace/TraceUtil.java index b4da8fb985..ca1df9ea87 100644 --- a/Mage/src/main/java/mage/util/trace/TraceUtil.java +++ b/Mage/src/main/java/mage/util/trace/TraceUtil.java @@ -66,7 +66,7 @@ public class TraceUtil { } } if (cantBeBlocked(attacker)) { - if (group.getBlockers().size() > 0) { + if (!group.getBlockers().isEmpty()) { Permanent blocker = game.getPermanent(group.getBlockers().get(0)); if (blocker != null) { log.warn("Found creature that can't be blocked by some other creature"); From afd42f330b5b23db2324763c3932842565871ebf Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 6 Feb 2017 10:00:52 +0100 Subject: [PATCH 05/12] * Declaration in Stone - Fixed that the target permanent was not exiled (fixes #2839). --- Mage.Sets/src/mage/cards/d/DeclarationInStone.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Mage.Sets/src/mage/cards/d/DeclarationInStone.java b/Mage.Sets/src/mage/cards/d/DeclarationInStone.java index f45a0d0b54..68012bb703 100644 --- a/Mage.Sets/src/mage/cards/d/DeclarationInStone.java +++ b/Mage.Sets/src/mage/cards/d/DeclarationInStone.java @@ -98,6 +98,7 @@ class DeclarationInStoneEffect extends OneShotEffect { nonTokenCount++; } } else { + cardsToExile.add(targetPermanent); for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), targetPermanent.getControllerId(), game)) { if (!permanent.getId().equals(targetPermanent.getId()) && permanent.getName().equals(targetPermanent.getName())) { From 0595d8a54966ecee8468d2730841ce15c91ce7b3 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 6 Feb 2017 10:05:00 +0100 Subject: [PATCH 06/12] * Silvergill Douser - Fixed counting of Merfolk and Faeries to wrongly not taking tribal non creature permanets into account. --- Mage.Sets/src/mage/cards/s/SilvergillDouser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/cards/s/SilvergillDouser.java b/Mage.Sets/src/mage/cards/s/SilvergillDouser.java index e6667c0221..de05bc73dd 100644 --- a/Mage.Sets/src/mage/cards/s/SilvergillDouser.java +++ b/Mage.Sets/src/mage/cards/s/SilvergillDouser.java @@ -41,7 +41,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.target.common.TargetCreaturePermanent; @@ -52,7 +52,7 @@ import mage.target.common.TargetCreaturePermanent; */ public class SilvergillDouser extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Merfolk and/or Faeries you control"); + private static final FilterControlledPermanent filter = new FilterControlledPermanent("Merfolk and/or Faeries you control"); static { filter.add(Predicates.or(new SubtypePredicate("Merfolk"), new SubtypePredicate("Faerie"))); @@ -66,7 +66,7 @@ public class SilvergillDouser extends CardImpl { this.toughness = new MageInt(1); // {tap}: Target creature gets -X/-0 until end of turn, where X is the number of Merfolk and/or Faeries you control. - DynamicValue number = new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent(filter), -1); + DynamicValue number = new PermanentsOnBattlefieldCount(new FilterControlledPermanent(filter), -1); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(number, new StaticValue(0), Duration.EndOfTurn, true), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); From d8c4e601387b40a3f11ca1cc6674d9a1222daaae Mon Sep 17 00:00:00 2001 From: vraskulin Date: Thu, 26 Jan 2017 20:20:03 +0300 Subject: [PATCH 07/12] Removed outdated "main" method that prints few sanitized lines --- .../src/main/java/mage/server/util/SystemUtil.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java index 00cd7ea313..439feaca0b 100644 --- a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java +++ b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java @@ -164,15 +164,6 @@ public class SystemUtil { return input.replaceAll("[^a-zA-Z0-9]", ""); } - public static void main(String... args) { - System.out.println(sanitize("123")); - System.out.println(sanitize("AaAaD_123")); - System.out.println(sanitize("--sas-")); - System.out.println(sanitize("anPlsdf123_") + "|"); - System.out.println(sanitize("anPlsdf123 ") + "|"); - System.out.println(sanitize("anPlsdf123\r\n") + "|"); - } - /** * Get a diff between two dates * From 31589778cae7c9a6b0ef53da0f946d6cfab19030 Mon Sep 17 00:00:00 2001 From: vraskulin Date: Thu, 26 Jan 2017 20:58:40 +0300 Subject: [PATCH 08/12] Try/finally refactored to try with resources --- .../card/dl/sources/TokensMtgImageSource.java | 53 ++--------- .../plugins/card/images/DownloadPictures.java | 91 +++++-------------- .../plugins/counter/CounterPluginImpl.java | 30 ++---- .../java/mage/server/util/SystemUtil.java | 13 +-- .../test/serverside/base/MageTestBase.java | 22 ++--- .../serverside/base/MageTestPlayerBase.java | 22 ++--- .../src/main/java/mage/util/ClassScanner.java | 16 +--- 7 files changed, 61 insertions(+), 186 deletions(-) diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java index 74b1fdb0a5..fbc1ad88e1 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java @@ -27,6 +27,9 @@ */ package org.mage.plugins.card.dl.sources; +import org.apache.log4j.Logger; +import org.mage.plugins.card.images.CardDownloadData; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -36,8 +39,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.log4j.Logger; -import org.mage.plugins.card.images.CardDownloadData; /** * @@ -184,30 +185,18 @@ public class TokensMtgImageSource implements CardImageSource { tokensData = new ArrayList<>(); // get tokens data from resource file - InputStream inputStream = null; - try { - inputStream = this.getClass().getResourceAsStream("/tokens-mtg-onl-list.csv"); + try(InputStream inputStream = this.getClass().getResourceAsStream("/tokens-mtg-onl-list.csv")) { List fileTokensData = parseTokensData(inputStream); tokensData.addAll(fileTokensData); } catch (Exception exception) { logger.warn("Failed to get tokens description from resource file tokens-mtg-onl-list.csv", exception); - } finally { - if (inputStream != null) { - try { - inputStream.close(); - } catch (Exception e) { - logger.error("Input stream close failed:", e); - } - } } // description on site may contain new information // try to add it - try { - URL url = new URL("http://tokens.mtg.onl/data/SetsWithTokens.csv"); - inputStream = url.openStream(); + URL url = new URL("http://tokens.mtg.onl/data/SetsWithTokens.csv"); + try(InputStream inputStream = url.openStream()) { List siteTokensData = parseTokensData(inputStream); - List newTokensData = new ArrayList<>(); for (TokenData siteData : siteTokensData) { boolean isNew = true; @@ -227,14 +216,6 @@ public class TokensMtgImageSource implements CardImageSource { tokensData.addAll(newTokensData); } catch (Exception exception) { logger.warn("Failed to get tokens description from tokens.mtg.onl", exception); - } finally { - if (inputStream != null) { - try { - inputStream.close(); - } catch (Exception e) { - logger.error("Input stream close failed:", e); - } - } } } } @@ -245,12 +226,9 @@ public class TokensMtgImageSource implements CardImageSource { private List parseTokensData(InputStream inputStream) throws IOException { List newTokensData = new ArrayList<>(); - InputStreamReader inputReader = null; - BufferedReader reader = null; - try { + try(InputStreamReader inputReader = new InputStreamReader(inputStream, "Cp1252"); + BufferedReader reader = new BufferedReader(inputReader)) { // we have to specify encoding to read special comma - inputReader = new InputStreamReader(inputStream, "Cp1252"); - reader = new BufferedReader(inputReader); reader.readLine(); // skip header String line = reader.readLine(); @@ -282,21 +260,6 @@ public class TokensMtgImageSource implements CardImageSource { line = reader.readLine(); } - } finally { - if (inputReader != null) { - try { - inputReader.close(); - } catch (Exception e) { - logger.error("Input reader close failed:", e); - } - } - if (reader != null) { - try { - reader.close(); - } catch (Exception e) { - logger.error("Buffered reader close failed:", e); - } - } } return newTokensData; diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java index 0405a759c8..439c89479a 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java @@ -1,45 +1,5 @@ package org.mage.plugins.card.images; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.URL; -import java.net.URLConnection; -import java.nio.file.AccessDeniedException; -import java.util.*; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.atomic.AtomicBoolean; -import javax.imageio.IIOImage; -import javax.imageio.ImageIO; -import javax.imageio.ImageWriteParam; -import javax.imageio.ImageWriter; -import javax.imageio.stream.FileImageOutputStream; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.ComboBoxModel; -import javax.swing.DefaultBoundedRangeModel; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JProgressBar; import mage.cards.repository.CardInfo; import mage.client.constants.Constants; import mage.client.dialog.PreferencesDialog; @@ -51,18 +11,27 @@ import net.java.truevfs.access.TFileOutputStream; import net.java.truevfs.access.TVFS; import net.java.truevfs.kernel.spec.FsSyncException; import org.apache.log4j.Logger; -import org.mage.plugins.card.dl.sources.AltMtgOnlTokensImageSource; -import org.mage.plugins.card.dl.sources.CardImageSource; -import org.mage.plugins.card.dl.sources.GrabbagImageSource; -import org.mage.plugins.card.dl.sources.MagicCardsImageSource; -import org.mage.plugins.card.dl.sources.MagidexImageSource; -import org.mage.plugins.card.dl.sources.MtgOnlTokensImageSource; -import org.mage.plugins.card.dl.sources.MythicspoilerComSource; -import org.mage.plugins.card.dl.sources.TokensMtgImageSource; -import org.mage.plugins.card.dl.sources.WizardCardsImageSource; +import org.mage.plugins.card.dl.sources.*; import org.mage.plugins.card.properties.SettingsManager; import org.mage.plugins.card.utils.CardImageUtils; +import javax.imageio.IIOImage; +import javax.imageio.ImageIO; +import javax.imageio.ImageWriteParam; +import javax.imageio.ImageWriter; +import javax.imageio.stream.FileImageOutputStream; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.*; +import java.net.*; +import java.nio.file.AccessDeniedException; +import java.util.*; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.atomic.AtomicBoolean; + public class DownloadPictures extends DefaultBoundedRangeModel implements Runnable { private static final Logger logger = Logger.getLogger(DownloadPictures.class); @@ -376,11 +345,9 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab return list; } - BufferedReader reader = null; - InputStreamReader input = null; - try { - input = new InputStreamReader(in); - reader = new BufferedReader(input); + + try(InputStreamReader input = new InputStreamReader(in); + BufferedReader reader = new BufferedReader(input)) { String line; line = reader.readLine(); @@ -425,22 +392,6 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab } catch (Exception ex) { logger.error(ex); throw new RuntimeException("DownloadPictures : readFile() error"); - } finally { - if (input != null) { - try { - input.close(); - } catch (Exception e) { - logger.error("Input close failed:", e); - } - } - if (reader != null) { - try { - reader.close(); - } catch (Exception e) { - logger.error("Reader close failed:", e); - } - } - } return list; } diff --git a/Mage.Plugins/Mage.Counter.Plugin/src/main/java/org/mage/plugins/counter/CounterPluginImpl.java b/Mage.Plugins/Mage.Counter.Plugin/src/main/java/org/mage/plugins/counter/CounterPluginImpl.java index dc4e93b206..7c7efdf462 100644 --- a/Mage.Plugins/Mage.Counter.Plugin/src/main/java/org/mage/plugins/counter/CounterPluginImpl.java +++ b/Mage.Plugins/Mage.Counter.Plugin/src/main/java/org/mage/plugins/counter/CounterPluginImpl.java @@ -1,22 +1,15 @@ package org.mage.plugins.counter; -import java.io.EOFException; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - import mage.interfaces.PluginException; import mage.interfaces.plugin.CounterPlugin; import net.xeoh.plugins.base.annotations.PluginImplementation; import net.xeoh.plugins.base.annotations.events.Init; import net.xeoh.plugins.base.annotations.events.PluginLoaded; import net.xeoh.plugins.base.annotations.meta.Author; - import org.apache.log4j.Logger; +import java.io.*; + /** * Implementation of {@link CounterPlugin}.
* Stores data in data folder. @@ -72,12 +65,10 @@ public class CounterPluginImpl implements CounterPlugin { public void addGamePlayed() throws PluginException { if (!isLoaded) return; File data = new File(PLUGIN_DATA_FOLDER_PATH + File.separator + DATA_STORAGE_FILE); - ObjectInputStream ois = null; - ObjectOutputStream oos = null; if (data.exists()) { int prev = 0; - try { - ois = new ObjectInputStream(new FileInputStream(data)); + + try(ObjectInputStream ois = new ObjectInputStream(new FileInputStream(data))) { Object o = ois.readObject(); CounterBean c; if (o instanceof CounterBean) { @@ -90,13 +81,10 @@ public class CounterPluginImpl implements CounterPlugin { throw new PluginException(e); } catch (ClassNotFoundException e) { throw new PluginException(e); - } finally { - if (ois != null) try { ois.close(); } catch (Exception e) {} } - try { + try(ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(data))) { synchronized (this) { - oos = new ObjectOutputStream(new FileOutputStream(data)); CounterBean c = new CounterBean(); c.setGamesPlayed(prev+1); oos.writeObject(c); @@ -104,8 +92,6 @@ public class CounterPluginImpl implements CounterPlugin { } } catch (IOException e) { throw new PluginException(e); - } finally { - if (oos != null) try { oos.close(); } catch (Exception e) {} } } else { log.error("Counter plugin: data file doesn't exist, please restart plugin."); @@ -120,10 +106,8 @@ public class CounterPluginImpl implements CounterPlugin { return 0; } if (data.exists()) { - ObjectInputStream ois = null; - try { + try(ObjectInputStream ois = new ObjectInputStream(new FileInputStream(data))) { synchronized (this) { - ois = new ObjectInputStream(new FileInputStream(data)); Object o = ois.readObject(); CounterBean c = null; if (o instanceof CounterBean) { @@ -138,8 +122,6 @@ public class CounterPluginImpl implements CounterPlugin { throw new PluginException(e); } catch (ClassNotFoundException e) { throw new PluginException(e); - } finally { - if (ois != null) try { ois.close(); } catch (Exception e) {} } } else { log.error("Counter plugin: data file doesn't exist, please restart plugin."); diff --git a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java index 439feaca0b..15d276dfd4 100644 --- a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java +++ b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java @@ -56,7 +56,7 @@ public class SystemUtil { try (Scanner scanner = new Scanner(f)) { while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); - if (line.trim().isEmpty() || line.startsWith("#")) { + if (line.isEmpty() || line.startsWith("#")) { continue; } @@ -69,11 +69,12 @@ public class SystemUtil { String zone = m.group(1); String nickname = m.group(2); - Player player = findPlayer(game, nickname); - if (player == null) { + Optional playerOptional = findPlayer(game, nickname); + if (!playerOptional.isPresent()) { logger.warn("Was skipped: " + line); continue; } + Player player = playerOptional.get(); Zone gameZone; if ("hand".equalsIgnoreCase(zone)) { @@ -148,13 +149,13 @@ public class SystemUtil { * @param name * @return */ - private static Player findPlayer(Game game, String name) { + private static Optional findPlayer(Game game, String name) { for (Player player : game.getPlayers().values()) { if (player.getName().equals(name)) { - return player; + return Optional.of(player); } } - return null; + return Optional.empty(); } public static String sanitize(String input) { diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java index 0d74ac0d8c..0db848daf4 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java @@ -1,15 +1,5 @@ package org.mage.test.serverside.base; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FilenameFilter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Scanner; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import mage.cards.Card; import mage.cards.repository.CardInfo; import mage.cards.repository.CardRepository; @@ -35,6 +25,13 @@ import org.junit.BeforeClass; import org.mage.test.player.RandomPlayer; import org.mage.test.player.TestPlayer; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FilenameFilter; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + /** * Base class for all tests. * @@ -181,8 +178,7 @@ public abstract class MageTestBase { protected void parseScenario(String filename) throws FileNotFoundException { parserState = ParserState.INIT; File f = new File(filename); - Scanner scanner = new Scanner(f); - try { + try(Scanner scanner = new Scanner(f)) { while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); if (line == null || line.isEmpty() || line.startsWith("#")) { @@ -198,8 +194,6 @@ public abstract class MageTestBase { } parseLine(line); } - } finally { - scanner.close(); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java index 6568f377b3..9cdd524421 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java @@ -1,15 +1,5 @@ package org.mage.test.serverside.base; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FilenameFilter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Scanner; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import mage.cards.Card; import mage.cards.repository.CardInfo; import mage.cards.repository.CardRepository; @@ -33,6 +23,13 @@ import org.apache.log4j.Logger; import org.junit.BeforeClass; import org.mage.test.player.TestPlayer; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FilenameFilter; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + /** * Base class for all tests. * @@ -167,8 +164,7 @@ public abstract class MageTestPlayerBase { protected void parseScenario(String filename) throws FileNotFoundException { parserState = ParserState.INIT; File f = new File(filename); - Scanner scanner = new Scanner(f); - try { + try(Scanner scanner = new Scanner(f)) { while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); if (line == null || line.isEmpty() || line.startsWith("#")) { @@ -184,8 +180,6 @@ public abstract class MageTestPlayerBase { } parseLine(line); } - } finally { - scanner.close(); } } diff --git a/Mage/src/main/java/mage/util/ClassScanner.java b/Mage/src/main/java/mage/util/ClassScanner.java index 71253e3e65..ad672ca1a7 100644 --- a/Mage/src/main/java/mage/util/ClassScanner.java +++ b/Mage/src/main/java/mage/util/ClassScanner.java @@ -32,11 +32,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.net.URL; import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.TreeSet; +import java.util.*; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; @@ -111,9 +107,8 @@ public class ClassScanner { List cards = new ArrayList<>(); if (!file.exists()) return cards; - JarInputStream jarFile = null; - try { - jarFile = new JarInputStream(new FileInputStream(file)); + + try(JarInputStream jarFile = new JarInputStream(new FileInputStream(file))) { while (true) { JarEntry jarEntry = jarFile.getNextJarEntry(); if (jarEntry == null) { @@ -127,11 +122,6 @@ public class ClassScanner { } } } catch (IOException ex) { - } finally { - try { - if(jarFile != null) jarFile.close(); - } catch (IOException ex) { - } } return cards; } From f60ebfbb1f4cfbc3491a38c366c64edb4fa17317 Mon Sep 17 00:00:00 2001 From: vraskulin Date: Fri, 27 Jan 2017 15:57:10 +0300 Subject: [PATCH 09/12] 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. --- .../src/main/java/mage/client/MageFrame.java | 4 +- .../main/java/mage/client/cards/BigCard.java | 2 +- .../src/main/java/mage/client/cards/Card.java | 26 ++--- .../java/mage/client/cards/DragCardGrid.java | 10 +- .../java/mage/client/cards/Permanent.java | 16 +-- .../components/layout/RelativeLayout.java | 2 +- .../generator/RatioAdjustingSliderPanel.java | 4 +- .../java/mage/client/deckeditor/DeckArea.java | 2 +- .../client/deckeditor/DeckEditorPanel.java | 8 +- .../client/deckeditor/table/CardHelper.java | 6 +- .../deckeditor/table/MageCardComparator.java | 4 +- .../client/deckeditor/table/TableModel.java | 2 +- .../client/dialog/CardInfoWindowDialog.java | 2 +- .../mage/client/dialog/ConnectDialog.java | 2 +- .../mage/client/dialog/GameEndDialog.java | 6 +- .../mage/client/dialog/NewTableDialog.java | 2 +- .../client/dialog/NewTournamentDialog.java | 6 +- .../java/mage/client/draft/DraftPanel.java | 8 +- .../main/java/mage/client/game/GamePanel.java | 8 +- .../java/mage/client/game/HelperPanel.java | 4 +- .../java/mage/client/game/PlayerPanelExt.java | 2 +- .../client/preference/MagePreferences.java | 2 +- .../mage/client/table/PlayersChatPanel.java | 4 +- .../java/mage/client/table/TablesPanel.java | 6 +- .../client/tournament/TournamentPanel.java | 8 +- .../java/mage/client/util/CardsViewUtil.java | 2 +- .../main/java/mage/client/util/Format.java | 8 +- .../mage/client/util/audio/MusicPlayer.java | 2 +- .../mage/client/util/gui/GuiDisplayUtil.java | 14 +-- .../java/mage/client/util/gui/TableUtil.java | 4 +- .../util/gui/countryBox/MyComboBoxEditor.java | 2 +- .../client/util/object/SaveObjectUtil.java | 2 +- .../java/org/mage/card/arcane/CardPanel.java | 22 ++-- .../card/arcane/CardPanelComponentImpl.java | 6 +- .../org/mage/card/arcane/CardRenderer.java | 6 +- .../org/mage/card/arcane/ManaSymbols.java | 14 +-- .../mage/card/arcane/ModernCardRenderer.java | 2 +- .../plugins/card/constants/Constants.java | 2 +- .../org/mage/plugins/card/dl/DownloadJob.java | 4 +- .../plugins/card/dl/sources/CardFrames.java | 4 +- .../plugins/card/dl/sources/GathererSets.java | 4 +- .../card/dl/sources/GathererSymbols.java | 104 +++++++++--------- .../dl/sources/MagicCardsImageSource.java | 16 +-- .../card/dl/sources/MagidexImageSource.java | 2 +- .../card/dl/sources/MtgImageSource.java | 6 +- .../dl/sources/MythicspoilerComSource.java | 8 +- .../card/dl/sources/TokensMtgImageSource.java | 8 +- .../dl/sources/WizardCardsImageSource.java | 6 +- .../plugins/card/images/DownloadPictures.java | 14 +-- .../mage/plugins/card/images/ImageCache.java | 4 +- .../plugins/card/utils/CardImageUtils.java | 4 +- .../src/mage/db/EntityManagerTest.java | 2 +- Mage.Common/src/mage/remote/Connection.java | 6 +- Mage.Common/src/mage/remote/SessionImpl.java | 42 +++---- Mage.Common/src/mage/utils/MageVersion.java | 2 +- Mage.Common/src/mage/view/CardView.java | 2 +- Mage.Common/src/mage/view/GameEndView.java | 6 +- Mage.Common/src/mage/view/GameView.java | 4 +- Mage.Common/src/mage/view/MatchView.java | 14 +-- Mage.Common/src/mage/view/TableView.java | 18 +-- .../src/mage/view/TournamentGameView.java | 4 +- .../src/mage/view/TournamentPlayerView.java | 2 +- Mage.Common/src/mage/view/TournamentView.java | 4 +- .../mage/server/console/ConnectDialog.java | 2 +- .../mage/server/console/ConsolePanel.java | 8 +- .../src/mage/deck/Commander.java | 8 +- .../src/mage/deck/TinyLeaders.java | 12 +- .../src/mage/player/ai/ComputerPlayer6.java | 22 ++-- .../src/mage/player/ai/ComputerPlayer7.java | 18 +-- .../mage/player/ai/GameStateEvaluator2.java | 6 +- .../src/mage/player/ai/SimulatedPlayer2.java | 4 +- .../src/mage/player/ai/util/CombatUtil.java | 4 +- .../java/mage/player/ai/ComputerPlayer.java | 12 +- .../mage/player/ai/ComputerPlayerMCTS.java | 8 +- .../src/mage/player/ai/MCTSNode.java | 6 +- .../src/mage/player/ai/MCTSPlayer.java | 2 +- .../mage/player/ai/SimulatedPlayerMCTS.java | 2 +- .../src/mage/player/ai/ComputerPlayer2.java | 4 +- .../src/mage/player/ai/SimulatedPlayer.java | 2 +- .../src/mage/player/human/HumanPlayer.java | 6 +- .../main/java/mage/server/ChatManager.java | 4 +- .../main/java/mage/server/ChatSession.java | 6 +- .../main/java/mage/server/MageServerImpl.java | 14 +-- .../main/java/mage/server/MailgunClient.java | 2 +- .../src/main/java/mage/server/Main.java | 6 +- .../src/main/java/mage/server/Session.java | 2 +- .../java/mage/server/TableController.java | 20 ++-- .../main/java/mage/server/TableManager.java | 4 +- .../src/main/java/mage/server/User.java | 24 ++-- .../main/java/mage/server/UserManager.java | 2 +- .../java/mage/server/game/GameController.java | 12 +- .../tournament/TournamentController.java | 2 +- .../server/tournament/TournamentFactory.java | 6 +- .../java/mage/server/util/ThreadExecutor.java | 2 +- .../src/mage/cards/a/AcademyResearchers.java | 2 +- Mage.Sets/src/mage/cards/a/Addle.java | 2 +- .../src/mage/cards/a/AetherbornMarauder.java | 2 +- .../mage/cards/a/AlhammarretHighArbiter.java | 2 +- Mage.Sets/src/mage/cards/a/AssaultSuit.java | 2 +- Mage.Sets/src/mage/cards/a/AureliasFury.java | 2 +- .../src/mage/cards/a/AuriokSurvivors.java | 2 +- .../src/mage/cards/a/AurraSingBaneOfJedi.java | 2 +- .../src/mage/cards/b/BattletideAlchemist.java | 2 +- Mage.Sets/src/mage/cards/b/BlindZealot.java | 2 +- .../src/mage/cards/b/BorderlandExplorer.java | 2 +- .../src/mage/cards/b/BottledCloister.java | 2 +- Mage.Sets/src/mage/cards/b/BrainGorgers.java | 4 +- .../src/mage/cards/b/BrilliantUltimatum.java | 4 +- Mage.Sets/src/mage/cards/c/Cannibalize.java | 2 +- .../src/mage/cards/c/ChainLightning.java | 2 +- Mage.Sets/src/mage/cards/c/ChainOfVapor.java | 4 +- .../src/mage/cards/c/ChorusOfTheConclave.java | 2 +- Mage.Sets/src/mage/cards/c/ChromeMox.java | 2 +- .../src/mage/cards/c/ChronatogTotem.java | 2 +- .../src/mage/cards/c/CollectiveRestraint.java | 2 +- .../src/mage/cards/c/ConfiscationCoup.java | 2 +- .../src/mage/cards/c/ConfusionInTheRanks.java | 2 +- .../src/mage/cards/c/ConundrumSphinx.java | 2 +- Mage.Sets/src/mage/cards/c/CosmicHorror.java | 2 +- .../src/mage/cards/c/CouncilGuardian.java | 2 +- .../src/mage/cards/c/CranialExtraction.java | 2 +- Mage.Sets/src/mage/cards/d/DashHopes.java | 4 +- Mage.Sets/src/mage/cards/d/DecayingSoil.java | 2 +- .../src/mage/cards/d/DeepfireElemental.java | 2 +- Mage.Sets/src/mage/cards/d/DemonicHordes.java | 2 +- Mage.Sets/src/mage/cards/d/DieYoung.java | 2 +- .../src/mage/cards/d/DiluvianPrimordial.java | 2 +- Mage.Sets/src/mage/cards/d/Duplicant.java | 2 +- Mage.Sets/src/mage/cards/d/DustOfMoments.java | 8 +- Mage.Sets/src/mage/cards/e/EliteArcanist.java | 2 +- .../mage/cards/e/EpiphanyAtTheDrownyard.java | 4 +- Mage.Sets/src/mage/cards/e/Expropriate.java | 2 +- .../src/mage/cards/e/ExtraplanarLens.java | 2 +- Mage.Sets/src/mage/cards/f/FactOrFiction.java | 4 +- .../src/mage/cards/f/FaerieArtisans.java | 2 +- Mage.Sets/src/mage/cards/f/Fatespinner.java | 2 +- Mage.Sets/src/mage/cards/f/FellShepherd.java | 2 +- Mage.Sets/src/mage/cards/f/Flash.java | 2 +- .../src/mage/cards/f/FlowstoneSculpture.java | 18 +-- .../src/mage/cards/f/ForgottenAncient.java | 2 +- .../src/mage/cards/g/GoblinDarkDwellers.java | 2 +- Mage.Sets/src/mage/cards/g/Godsend.java | 4 +- .../src/mage/cards/g/GrandAbolisher.java | 2 +- Mage.Sets/src/mage/cards/h/Heartmender.java | 2 +- .../src/mage/cards/h/HellkiteCharger.java | 2 +- Mage.Sets/src/mage/cards/h/HiddenStrings.java | 4 +- .../src/mage/cards/h/HopeOfGhirapur.java | 2 +- .../mage/cards/i/InfiniteObliteration.java | 2 +- .../src/mage/cards/i/IntetTheDreamer.java | 2 +- .../src/mage/cards/i/IsochronScepter.java | 4 +- .../mage/cards/j/JaceArchitectOfThought.java | 2 +- .../mage/cards/k/KalitasBloodchiefOfGhet.java | 2 +- Mage.Sets/src/mage/cards/k/KnowledgePool.java | 2 +- Mage.Sets/src/mage/cards/l/LunarAvenger.java | 16 ++- Mage.Sets/src/mage/cards/m/Magmasaur.java | 2 +- Mage.Sets/src/mage/cards/m/ManaVortex.java | 4 +- Mage.Sets/src/mage/cards/m/Mindblaze.java | 4 +- .../src/mage/cards/m/MogisGodOfSlaughter.java | 2 +- Mage.Sets/src/mage/cards/m/MysticRemora.java | 2 +- .../mage/cards/n/NahiriTheLithomancer.java | 2 +- .../src/mage/cards/n/NarsetTranscendent.java | 2 +- Mage.Sets/src/mage/cards/n/NayaSoulbeast.java | 2 +- .../src/mage/cards/n/NimDeathmantle.java | 2 +- Mage.Sets/src/mage/cards/p/PardicDragon.java | 2 +- .../src/mage/cards/p/Phantasmagorian.java | 4 +- .../src/mage/cards/p/PhyrexianMarauder.java | 2 +- Mage.Sets/src/mage/cards/p/PowerSink.java | 2 +- .../src/mage/cards/p/PyxisOfPandemonium.java | 2 +- Mage.Sets/src/mage/cards/q/Quicken.java | 4 +- .../src/mage/cards/r/ResearchDevelopment.java | 4 +- .../src/mage/cards/r/ReverseTheSands.java | 2 +- Mage.Sets/src/mage/cards/r/RhysticStudy.java | 2 +- .../src/mage/cards/r/RidersOfGavony.java | 2 +- Mage.Sets/src/mage/cards/r/RunedHalo.java | 2 +- .../mage/cards/s/SarpadianEmpiresVolVii.java | 30 ++--- .../src/mage/cards/s/SavageSummoning.java | 10 +- Mage.Sets/src/mage/cards/s/ScoutsWarning.java | 4 +- .../src/mage/cards/s/SealOfTheGuildpact.java | 2 +- Mage.Sets/src/mage/cards/s/SenTriplets.java | 2 +- Mage.Sets/src/mage/cards/s/Shapeshifter.java | 2 +- Mage.Sets/src/mage/cards/s/SharedFate.java | 4 +- .../src/mage/cards/s/SimicManipulator.java | 2 +- Mage.Sets/src/mage/cards/s/SoulFoundry.java | 2 +- .../src/mage/cards/s/SparkOfCreativity.java | 2 +- Mage.Sets/src/mage/cards/s/Spellbinder.java | 4 +- .../src/mage/cards/s/SphereOfSafety.java | 2 +- .../src/mage/cards/s/SphinxAmbassador.java | 2 +- .../src/mage/cards/s/SphinxOfUthuun.java | 4 +- Mage.Sets/src/mage/cards/s/SqueesRevenge.java | 2 +- Mage.Sets/src/mage/cards/s/SteamAugury.java | 4 +- .../src/mage/cards/s/StonewiseFortifier.java | 2 +- .../src/mage/cards/s/StrongholdGambit.java | 2 +- .../src/mage/cards/t/TemporalExtortion.java | 4 +- .../cards/t/TheTabernacleAtPendrellVale.java | 2 +- Mage.Sets/src/mage/cards/t/ThoughtPrison.java | 2 +- Mage.Sets/src/mage/cards/t/TimeVault.java | 2 +- .../src/mage/cards/t/ToilsOfNightAndDay.java | 4 +- .../src/mage/cards/t/TorrentialGearhulk.java | 2 +- Mage.Sets/src/mage/cards/w/WarCadence.java | 2 +- Mage.Sets/src/mage/cards/w/WarTax.java | 2 +- Mage.Sets/src/mage/cards/w/WarpWorld.java | 2 +- Mage.Sets/src/mage/cards/w/WeirdHarvest.java | 2 +- .../src/mage/cards/w/WellOfLostDreams.java | 2 +- .../src/mage/cards/w/WhimsOfTheFates.java | 4 +- Mage.Sets/src/mage/cards/w/WoodSage.java | 2 +- Mage.Sets/src/mage/cards/z/ZursWeirding.java | 2 +- .../com/xmage/ws/util/json/JSONParser.java | 4 +- .../BattlefieldThaumaturgeTest.java | 2 +- .../org/mage/test/player/RandomPlayer.java | 2 +- .../java/org/mage/test/player/TestPlayer.java | 12 +- .../test/serverside/base/MageTestBase.java | 6 +- .../serverside/base/MageTestPlayerBase.java | 6 +- .../serverside/base/impl/CardTestAPIImpl.java | 8 +- .../base/impl/CardTestPlayerAPIImpl.java | 46 ++++---- .../mage/test/sets/BoosterGenerationTest.java | 2 +- .../java/mage/verify/VerifyCardDataTest.java | 2 +- Mage/src/main/java/mage/MageObjectImpl.java | 2 +- Mage/src/main/java/mage/Mana.java | 2 +- Mage/src/main/java/mage/ObjectColor.java | 10 +- .../main/java/mage/abilities/AbilityImpl.java | 14 +-- .../java/mage/abilities/ActivationInfo.java | 4 +- .../abilities/abilityword/KinshipAbility.java | 2 +- .../ActivateIfConditionActivatedAbility.java | 2 +- .../abilities/common/ChancellorAbility.java | 2 +- ...oGraveFromAnywhereAllTriggeredAbility.java | 2 +- ...PutIntoGraveFromAnywhereSourceAbility.java | 2 +- .../delayed/PactDelayedTriggeredAbility.java | 2 +- .../common/CreatureCountCondition.java | 4 +- .../costs/AlternativeCostSourceAbility.java | 6 +- .../java/mage/abilities/costs/OrCost.java | 2 +- .../costs/common/DiscardXTargetCost.java | 2 +- .../costs/common/ExileFromGraveCost.java | 2 +- .../costs/common/ExileXFromYourGraveCost.java | 2 +- .../costs/common/PayLoyaltyCost.java | 2 +- .../costs/common/PayVariableLifeCost.java | 2 +- .../costs/common/PutCountersSourceCost.java | 2 +- .../costs/common/RemoveCounterCost.java | 4 +- .../common/RemoveCountersSourceCost.java | 2 +- .../RemoveVariableCountersTargetCost.java | 4 +- ...rnToHandChosenControlledPermanentCost.java | 2 +- .../common/ReturnToHandFromGraveyardCost.java | 2 +- .../costs/common/SacrificeXTargetCost.java | 2 +- .../abilities/costs/common/TapTargetCost.java | 2 +- .../costs/common/TapVariableTargetCost.java | 2 +- .../costs/common/UntapTargetCost.java | 2 +- .../abilities/costs/mana/ColoredManaCost.java | 2 +- .../abilities/costs/mana/GenericManaCost.java | 2 +- .../abilities/costs/mana/HybridManaCost.java | 2 +- .../costs/mana/MonoHybridManaCost.java | 2 +- .../costs/mana/PhyrexianManaCost.java | 2 +- .../dynamicvalue/common/ParleyCount.java | 2 +- .../common/SignInversionDynamicValue.java | 2 +- .../effects/AsTurnedFaceUpEffect.java | 2 +- .../abilities/effects/ContinuousEffects.java | 4 +- .../java/mage/abilities/effects/Effects.java | 2 +- .../effects/EntersBattlefieldEffect.java | 2 +- .../common/AddManaInAnyCombinationEffect.java | 2 +- .../common/CantBeRegeneratedSourceEffect.java | 4 +- .../common/CantBeRegeneratedTargetEffect.java | 4 +- .../common/CantBeTargetedAllEffect.java | 2 +- .../common/CantBeTargetedAttachedEffect.java | 2 +- .../common/CantBeTargetedSourceEffect.java | 2 +- .../common/CantBeTargetedTargetEffect.java | 2 +- ...getOfTargetSpellAbilityToSourceEffect.java | 4 +- .../abilities/effects/common/ClashEffect.java | 4 +- .../CopySpellForEachItCouldTargetEffect.java | 4 +- .../common/CouncilsDilemmaVoteEffect.java | 2 +- .../effects/common/CreateTokenEffect.java | 2 +- .../common/CreateTokenTargetEffect.java | 2 +- .../common/DestroyMultiTargetEffect.java | 2 +- .../effects/common/DoIfCostPaid.java | 2 +- ...nControllersNextUntapStepSourceEffect.java | 2 +- ...nControllersNextUntapStepTargetEffect.java | 2 +- ...InControllersUntapStepEnchantedEffect.java | 2 +- ...tapInControllersUntapStepTargetEffect.java | 2 +- ...ntapInOpponentsNextUntapStepAllEffect.java | 2 +- .../DrawCardSourceControllerEffect.java | 2 +- .../effects/common/DrawCardTargetEffect.java | 4 +- .../abilities/effects/common/EpicEffect.java | 2 +- ...xileCardYouChooseTargetOpponentEffect.java | 2 +- .../common/ExileFromZoneTargetEffect.java | 2 +- .../common/ExileSourceUnlessPaysEffect.java | 2 +- .../effects/common/GainLifeEffect.java | 4 +- .../effects/common/GainLifeTargetEffect.java | 2 +- .../effects/common/GetEmblemEffect.java | 2 +- .../common/GetEmblemTargetPlayerEffect.java | 2 +- .../LookLibraryAndPickControllerEffect.java | 2 +- .../common/LoseLifeOpponentsEffect.java | 2 +- .../effects/common/LoseLifeTargetEffect.java | 2 +- .../effects/common/NameACardEffect.java | 2 +- .../common/PreventAllDamageToAllEffect.java | 2 +- .../PreventAllNonCombatDamageToAllEffect.java | 2 +- .../PreventDamageToControllerEffect.java | 4 +- .../common/PreventDamageToTargetEffect.java | 2 +- .../common/PutOnLibraryTargetEffect.java | 2 +- ...romGraveyardToBattlefieldTargetEffect.java | 2 +- ...ReturnFromGraveyardToHandTargetEffect.java | 2 +- ...ToHandChosenControlledPermanentEffect.java | 2 +- .../ReturnToHandChosenPermanentEffect.java | 2 +- .../common/ReturnToHandTargetEffect.java | 2 +- .../effects/common/SacrificeAllEffect.java | 2 +- .../effects/common/SacrificeEffect.java | 2 +- .../common/SacrificeOpponentsEffect.java | 4 +- .../SacrificeOpponentsUnlessPayEffect.java | 4 +- .../SacrificeSourceUnlessPaysEffect.java | 2 +- .../common/SkipUntapOptionalSourceEffect.java | 2 +- .../effects/common/TapTargetEffect.java | 4 +- .../effects/common/UntapTargetEffect.java | 2 +- .../abilities/effects/common/WishEffect.java | 4 +- ...kAsThoughItDidntHaveDefenderAllEffect.java | 2 +- .../combat/CantAttackAnyPlayerAllEffect.java | 4 +- .../combat/CantAttackBlockAllEffect.java | 4 +- .../combat/CantBeBlockedTargetEffect.java | 2 +- .../combat/CantBlockAttachedEffect.java | 4 +- .../common/combat/CantBlockTargetEffect.java | 10 +- .../AssignNoCombatDamageSourceEffect.java | 2 +- .../BecomesBasicLandTargetEffect.java | 2 +- .../BecomesColorOrColorsTargetEffect.java | 12 +- .../continuous/BecomesColorSourceEffect.java | 2 +- .../continuous/BecomesColorTargetEffect.java | 2 +- .../BecomesCreatureTargetEffect.java | 2 +- .../BecomesCreatureTypeTargetEffect.java | 2 +- .../continuous/BecomesSubtypeAllEffect.java | 2 +- .../common/continuous/BoostAllEffect.java | 8 +- .../continuous/BoostControlledEffect.java | 8 +- .../continuous/BoostEnchantedEffect.java | 10 +- .../continuous/BoostEquippedEffect.java | 10 +- .../common/continuous/BoostSourceEffect.java | 10 +- .../common/continuous/BoostTargetEffect.java | 10 +- .../continuous/CantGainLifeAllEffect.java | 2 +- .../continuous/CantGainLifeTargetEffect.java | 2 +- .../CastAsThoughItHadFlashAllEffect.java | 3 +- .../continuous/GainAbilityAllEffect.java | 6 +- .../continuous/GainAbilityAttachedEffect.java | 2 +- .../GainAbilityControlledEffect.java | 4 +- .../GainAbilityControllerEffect.java | 2 +- .../continuous/GainAbilitySourceEffect.java | 2 +- .../continuous/GainAbilityTargetEffect.java | 10 +- .../continuous/GainControlTargetEffect.java | 2 +- .../GainProtectionFromTypeTargetEffect.java | 2 +- .../continuous/LoseAbilityAllEffect.java | 2 +- ...seAbilityOrAnotherAbilityTargetEffect.java | 2 +- .../continuous/LoseAbilitySourceEffect.java | 2 +- .../continuous/LoseAbilityTargetEffect.java | 2 +- .../SetCardSubtypeAttachedEffect.java | 2 +- .../SetPowerToughnessAllEffect.java | 4 +- .../SetPowerToughnessSourceEffect.java | 2 +- .../SetPowerToughnessTargetEffect.java | 2 +- .../SwitchPowerToughnessAllEffect.java | 2 +- .../SwitchPowerToughnessTargetEffect.java | 2 +- .../cost/SpellsCostReductionAllEffect.java | 2 +- .../SpellsCostReductionControllerEffect.java | 2 +- .../common/counter/AddCountersAllEffect.java | 4 +- .../counter/AddCountersAttachedEffect.java | 2 +- .../counter/AddCountersControllerEffect.java | 2 +- .../counter/AddCountersSourceEffect.java | 6 +- .../counter/AddCountersTargetEffect.java | 12 +- ...AddRemoveAllTimeSuspentCountersEffect.java | 4 +- .../counter/DistributeCountersEffect.java | 2 +- .../GetEnergyCountersControllerEffect.java | 2 +- .../counter/MoveCountersTargetsEffect.java | 8 +- .../common/counter/ProliferateEffect.java | 4 +- .../counter/RemoveCounterSourceEffect.java | 6 +- .../counter/RemoveCounterTargetEffect.java | 6 +- .../DiscardCardYouChooseTargetEffect.java | 4 +- .../discard/DiscardControllerEffect.java | 6 +- .../discard/DiscardEachPlayerEffect.java | 4 +- .../CastOnlyDuringPhaseStepSourceEffect.java | 2 +- ...SearchLibraryGraveyardPutInHandEffect.java | 4 +- .../search/SearchLibraryPutInHandEffect.java | 2 +- .../search/SearchLibraryPutInPlayEffect.java | 4 +- ...rchLibraryPutInPlayTargetPlayerEffect.java | 4 +- .../keyword/ManifestTargetPlayerEffect.java | 2 +- .../abilities/keyword/AuraSwapAbility.java | 2 +- .../abilities/keyword/BuybackAbility.java | 2 +- .../abilities/keyword/ConspireAbility.java | 2 +- .../keyword/CumulativeUpkeepAbility.java | 4 +- .../abilities/keyword/CyclingAbility.java | 2 +- .../mage/abilities/keyword/DashAbility.java | 2 +- .../mage/abilities/keyword/EchoAbility.java | 4 +- .../abilities/keyword/EntwineAbility.java | 2 +- .../mage/abilities/keyword/EvokeAbility.java | 2 +- .../mage/abilities/keyword/ExtortAbility.java | 2 +- .../abilities/keyword/FlashbackAbility.java | 6 +- .../mage/abilities/keyword/GraftAbility.java | 4 +- .../mage/abilities/keyword/HauntAbility.java | 4 +- .../abilities/keyword/HideawayAbility.java | 2 +- .../mage/abilities/keyword/KickerAbility.java | 2 +- .../abilities/keyword/LevelerCardBuilder.java | 8 +- .../abilities/keyword/ModularAbility.java | 2 +- .../mage/abilities/keyword/MorphAbility.java | 6 +- .../mage/abilities/keyword/MyriadAbility.java | 2 +- .../abilities/keyword/OfferingAbility.java | 2 +- .../mage/abilities/keyword/ProwlAbility.java | 2 +- .../abilities/keyword/RecoverAbility.java | 2 +- .../abilities/keyword/ReplicateAbility.java | 2 +- .../abilities/keyword/SunburstAbility.java | 2 +- .../abilities/keyword/UnleashAbility.java | 2 +- .../mana/ActivateIfConditionManaAbility.java | 2 +- .../ConditionalSpellManaBuilder.java | 4 +- .../java/mage/actions/MageDrawAction.java | 2 +- Mage/src/main/java/mage/cards/CardImpl.java | 2 +- Mage/src/main/java/mage/cards/CardsImpl.java | 2 +- Mage/src/main/java/mage/cards/Sets.java | 2 +- Mage/src/main/java/mage/cards/decks/Deck.java | 2 +- .../cards/decks/InvalidDeckException.java | 4 +- .../cards/decks/importer/DckDeckImporter.java | 2 +- .../cards/decks/importer/DecDeckImporter.java | 4 +- .../cards/decks/importer/DekDeckImporter.java | 6 +- .../cards/decks/importer/MWSDeckImporter.java | 4 +- .../cards/decks/importer/TxtDeckImporter.java | 4 +- .../java/mage/cards/repository/CardInfo.java | 2 +- .../mage/cards/repository/CardRepository.java | 2 +- .../java/mage/designations/Designation.java | 2 +- .../main/java/mage/filter/FilterAbility.java | 2 +- .../mage/filter/predicate/Predicates.java | 6 +- .../predicate/mageobject/CardIdPredicate.java | 2 +- .../permanent/CanBeEnchantedByPredicate.java | 2 +- .../permanent/PermanentIdPredicate.java | 2 +- Mage/src/main/java/mage/game/GameImpl.java | 6 +- .../java/mage/game/GameTinyLeadersImpl.java | 2 +- .../main/java/mage/game/combat/Combat.java | 10 +- .../java/mage/game/command/Commander.java | 2 +- .../main/java/mage/game/command/Emblem.java | 2 +- .../main/java/mage/game/draft/DraftCube.java | 4 +- .../main/java/mage/game/match/MatchImpl.java | 4 +- .../mage/game/permanent/PermanentImpl.java | 2 +- .../java/mage/game/permanent/token/Token.java | 2 +- .../game/permanent/token/ZombieToken2.java | 2 +- Mage/src/main/java/mage/game/stack/Spell.java | 2 +- .../java/mage/game/stack/StackAbility.java | 4 +- .../java/mage/game/stack/StackObjImpl.java | 6 +- .../mage/game/tournament/TournamentImpl.java | 8 +- Mage/src/main/java/mage/game/turn/Turn.java | 14 +-- .../main/java/mage/players/PlayerImpl.java | 18 +-- .../src/main/java/mage/target/TargetImpl.java | 4 +- .../main/java/mage/target/TargetObject.java | 2 +- .../main/java/mage/target/TargetPlayer.java | 2 +- .../target/common/TargetActivatedAbility.java | 4 +- .../TargetCreatureOrPlaneswalkerAmount.java | 2 +- .../target/common/TargetCreatureOrPlayer.java | 4 +- .../common/TargetCreatureOrPlayerAmount.java | 4 +- .../common/TargetCreaturePermanentAmount.java | 2 +- .../mage/target/common/TargetDefender.java | 4 +- .../common/TargetPermanentOrPlayer.java | 4 +- .../TargetPermanentOrSuspendedCard.java | 4 +- .../target/common/TargetSpellOrPermanent.java | 4 +- .../src/main/java/mage/util/ClassScanner.java | 2 +- Mage/src/main/java/mage/util/DateFormat.java | 8 +- Mage/src/main/java/mage/util/ManaUtil.java | 2 +- .../watchers/common/CommanderInfoWatcher.java | 6 +- 451 files changed, 989 insertions(+), 978 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index 01274af98d..67167a7582 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -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); diff --git a/Mage.Client/src/main/java/mage/client/cards/BigCard.java b/Mage.Client/src/main/java/mage/client/cards/BigCard.java index cc3417c1b4..3dd8910da5 100644 --- a/Mage.Client/src/main/java/mage/client/cards/BigCard.java +++ b/Mage.Client/src/main/java/mage/client/cards/BigCard.java @@ -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) { } diff --git a/Mage.Client/src/main/java/mage/client/cards/Card.java b/Mage.Client/src/main/java/mage/client/cards/Card.java index f8d974caf6..96aff7602a 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Card.java +++ b/Mage.Client/src/main/java/mage/client/cards/Card.java @@ -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(' '); } } diff --git a/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java b/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java index e352c154e6..8a4d3a1771 100644 --- a/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java +++ b/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java @@ -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()) { diff --git a/Mage.Client/src/main/java/mage/client/cards/Permanent.java b/Mage.Client/src/main/java/mage/client/cards/Permanent.java index f5b3dd2494..f9f8fa9b96 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Permanent.java +++ b/Mage.Client/src/main/java/mage/client/cards/Permanent.java @@ -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()); diff --git a/Mage.Client/src/main/java/mage/client/components/layout/RelativeLayout.java b/Mage.Client/src/main/java/mage/client/components/layout/RelativeLayout.java index a139a2a144..2abca497ac 100644 --- a/Mage.Client/src/main/java/mage/client/components/layout/RelativeLayout.java +++ b/Mage.Client/src/main/java/mage/client/components/layout/RelativeLayout.java @@ -802,6 +802,6 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable { return getClass().getName() + "[axis=" + axis + ",gap=" + gap - + "]"; + + ']'; } } diff --git a/Mage.Client/src/main/java/mage/client/deck/generator/RatioAdjustingSliderPanel.java b/Mage.Client/src/main/java/mage/client/deck/generator/RatioAdjustingSliderPanel.java index 219bd7ad27..bd6903eaec 100644 --- a/Mage.Client/src/main/java/mage/client/deck/generator/RatioAdjustingSliderPanel.java +++ b/Mage.Client/src/main/java/mage/client/deck/generator/RatioAdjustingSliderPanel.java @@ -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; diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/DeckArea.java b/Mage.Client/src/main/java/mage/client/deckeditor/DeckArea.java index 8437a0b310..241dcc25e4 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/DeckArea.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/DeckArea.java @@ -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; } } diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java b/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java index 53333ae05d..cb11486d6e 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java @@ -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!"); } } diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java index 94bd8e6152..fce95ec0f8 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java @@ -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(); diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java index ab692662d5..71f67900d9 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/MageCardComparator.java @@ -86,10 +86,10 @@ public class MageCardComparator implements Comparator { 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 diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java index 987ccff8c9..2291e16200 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java @@ -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(); diff --git a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java index e4a697854a..71ad41544e 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java @@ -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) { diff --git a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java index b748988ab9..76d379f1c0 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java @@ -398,7 +398,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 { diff --git a/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.java b/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.java index 17a6122fc9..2af0eeaa53 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.java @@ -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()); diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java index 37ef502484..9cb6b7a3ee 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java @@ -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()); diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java index 709d7369e1..a67491bd0f 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java @@ -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()); } diff --git a/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java b/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java index a722263569..ce5a118398 100644 --- a/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java +++ b/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java @@ -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); } diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index c4fbcc0bd0..966e036ae6 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -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()); } diff --git a/Mage.Client/src/main/java/mage/client/game/HelperPanel.java b/Mage.Client/src/main/java/mage/client/game/HelperPanel.java index 79d3ddb8a6..d801a15d3a 100644 --- a/Mage.Client/src/main/java/mage/client/game/HelperPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/HelperPanel.java @@ -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: diff --git a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java index 8c228cf300..fe3ab8d668 100644 --- a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java +++ b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java @@ -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) { diff --git a/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java b/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java index 98e861c60e..646f2e554f 100644 --- a/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java +++ b/Mage.Client/src/main/java/mage/client/preference/MagePreferences.java @@ -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) { diff --git a/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java b/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java index 365f2d6529..c67a88c655 100644 --- a/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java @@ -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(); } diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index a165d13a7c..74ac6dc089 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -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); diff --git a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java index fea2f500e4..884cb53ef4 100644 --- a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java +++ b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java @@ -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": diff --git a/Mage.Client/src/main/java/mage/client/util/CardsViewUtil.java b/Mage.Client/src/main/java/mage/client/util/CardsViewUtil.java index ed5dd61d12..7ab38acb40 100644 --- a/Mage.Client/src/main/java/mage/client/util/CardsViewUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/CardsViewUtil.java @@ -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) { diff --git a/Mage.Client/src/main/java/mage/client/util/Format.java b/Mage.Client/src/main/java/mage/client/util/Format.java index 50b9bdf4ff..492c10f6ee 100644 --- a/Mage.Client/src/main/java/mage/client/util/Format.java +++ b/Mage.Client/src/main/java/mage/client/util/Format.java @@ -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(); diff --git a/Mage.Client/src/main/java/mage/client/util/audio/MusicPlayer.java b/Mage.Client/src/main/java/mage/client/util/audio/MusicPlayer.java index b823ad3ed0..d77d81ef09 100644 --- a/Mage.Client/src/main/java/mage/client/util/audio/MusicPlayer.java +++ b/Mage.Client/src/main/java/mage/client/util/audio/MusicPlayer.java @@ -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); } } diff --git a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java index 081245971d..9dbdb8e3a7 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java @@ -222,7 +222,7 @@ public class GuiDisplayUtil { buffer.append(""); 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(""); - String imageSize = " width=" + GUISizeHelper.cardTooltipFontSize + " height=" + GUISizeHelper.cardTooltipFontSize + ">"; + String imageSize = " width=" + GUISizeHelper.cardTooltipFontSize + " height=" + GUISizeHelper.cardTooltipFontSize + '>'; if (card.getColor().isWhite()) { buffer.append("W"); 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(); } diff --git a/Mage.Client/src/main/java/mage/client/util/gui/TableUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/TableUtil.java index c86933d041..01c77482b0 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/TableUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/TableUtil.java @@ -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; } diff --git a/Mage.Client/src/main/java/mage/client/util/gui/countryBox/MyComboBoxEditor.java b/Mage.Client/src/main/java/mage/client/util/gui/countryBox/MyComboBoxEditor.java index 03f3760a31..00c1f256e3 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/countryBox/MyComboBoxEditor.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/countryBox/MyComboBoxEditor.java @@ -65,7 +65,7 @@ public class MyComboBoxEditor extends BasicComboBoxEditor { @Override public Object getItem() { - return "[" + this.selectedItem.toString() + "]"; + return '[' + this.selectedItem.toString() + ']'; } @Override diff --git a/Mage.Client/src/main/java/mage/client/util/object/SaveObjectUtil.java b/Mage.Client/src/main/java/mage/client/util/object/SaveObjectUtil.java index 081532510b..f8bb49615a 100644 --- a/Mage.Client/src/main/java/mage/client/util/object/SaveObjectUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/object/SaveObjectUtil.java @@ -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(); } diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java index fd329f538d..81dfd06989 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java @@ -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()); } diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java index 827ecc70a5..781df3cb46 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java @@ -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 { diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java index 4b3bcc54b6..fb883c04c9 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java @@ -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(); diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java b/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java index 32e2e6c0e7..fdc1b195c3 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java @@ -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( "$1$2"); + + " 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 "" + rarity + ""; + return "" + rarity + ""; } else { return set; } diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/ModernCardRenderer.java b/Mage.Client/src/main/java/org/mage/card/arcane/ModernCardRenderer.java index 562e1f0c69..b727c29d44 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/ModernCardRenderer.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/ModernCardRenderer.java @@ -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); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/constants/Constants.java b/Mage.Client/src/main/java/org/mage/plugins/card/constants/Constants.java index b7744ae219..c5ed731747 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/constants/Constants.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/constants/Constants.java @@ -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"; } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/DownloadJob.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/DownloadJob.java index 049a9f8403..e82220c845 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/DownloadJob.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/DownloadJob.java @@ -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; } }; } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardFrames.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardFrames.java index 368f128c9b..1f3228bd07 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardFrames.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardFrames.java @@ -78,8 +78,8 @@ public class CardFrames implements Iterable { 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() { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java index 5d63f8ee15..03420448c9 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSets.java @@ -163,12 +163,12 @@ public class GathererSets implements Iterable { } 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) { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSymbols.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSymbols.java index 485582d6a4..2beb29d6ac 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSymbols.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSymbols.java @@ -54,62 +54,64 @@ public class GathererSymbols implements Iterable { @Override protected DownloadJob computeNext() { - String sym; - if (symIndex < symbols.length) { - sym = symbols[symIndex++]; - } else if (numeric <= maxNumeric) { - sym = "" + (numeric++); - } else { - sizeIndex++; - if (sizeIndex == sizes.length) { - return endOfData(); + while (true) { + String sym; + if (symIndex < symbols.length) { + sym = symbols[symIndex++]; + } else if (numeric <= maxNumeric) { + sym = "" + (numeric++); + } else { + sizeIndex++; + if (sizeIndex == sizes.length) { + return endOfData(); + } + + symIndex = 0; + numeric = 0; + dir = new File(outDir, sizes[sizeIndex]); + continue; + } + String symbol = sym.replaceAll("/", ""); + File dst = new File(dir, symbol + ".gif"); + + /** + * Handle a bug on Gatherer where a few symbols are missing at the large size. + * Fall back to using the medium symbol for those cases. + */ + int modSizeIndex = sizeIndex; + if (sizeIndex == 2) { + switch (sym) { + case "WP": + case "UP": + case "BP": + case "RP": + case "GP": + case "E": + case "C": + modSizeIndex = 1; + break; + + default: + // Nothing to do, symbol is available in the large size + } } - symIndex = 0; - numeric = 0; - dir = new File(outDir, sizes[sizeIndex]); - return computeNext(); - } - String symbol = sym.replaceAll("/", ""); - File dst = new File(dir, symbol + ".gif"); - - /** - * Handle a bug on Gatherer where a few symbols are missing at the large size. - * Fall back to using the medium symbol for those cases. - */ - int modSizeIndex = sizeIndex; - if (sizeIndex == 2) { - switch (sym) { - case "WP": - case "UP": - case "BP": - case "RP": - case "GP": - case "E": - case "C": - modSizeIndex = 1; + switch (symbol) { + case "T": + symbol = "tap"; + break; + case "Q": + symbol = "untap"; + break; + case "S": + symbol = "snow"; break; - - default: - // Nothing to do, symbol is available in the large size } + + String url = format(urlFmt, sizes[modSizeIndex], symbol); + + return new DownloadJob(sym, fromURL(url), toFile(dst)); } - - switch (symbol) { - case "T": - symbol = "tap"; - break; - case "Q": - symbol = "untap"; - break; - case "S": - symbol = "snow"; - break; - } - - String url = format(urlFmt, sizes[modSizeIndex], symbol); - - return new DownloadJob(sym, fromURL(url), toFile(dst)); } }; } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java index d9d732b73f..25dbe9bf66 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java @@ -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 diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagidexImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagidexImageSource.java index 7a39d6768a..46e79774dc 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagidexImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagidexImageSource.java @@ -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(); } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java index 25673e33af..96a0ccb5d0 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java @@ -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"); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java index 23d3275ab4..646894efb3 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java @@ -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 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") diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java index fbc1ad88e1..38376e1888 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java @@ -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; } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java index e0b2b7c9fe..52869723ef 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java @@ -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')); } } } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java index 439c89479a..7db13b2326 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java @@ -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 { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java index f31d98eea8..5595794bd7 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java @@ -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() : "#"); } // /** diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java index 74db210fe9..ed67783972 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java @@ -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"; } diff --git a/Mage.Common/src/mage/db/EntityManagerTest.java b/Mage.Common/src/mage/db/EntityManagerTest.java index fc38832125..339c20ad56 100644 --- a/Mage.Common/src/mage/db/EntityManagerTest.java +++ b/Mage.Common/src/mage/db/EntityManagerTest.java @@ -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("]"); diff --git a/Mage.Common/src/mage/remote/Connection.java b/Mage.Common/src/mage/remote/Connection.java index 87e1f634be..a5cac72336 100644 --- a/Mage.Common/src/mage/remote/Connection.java +++ b/Mage.Common/src/mage/remote/Connection.java @@ -94,7 +94,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() { @@ -102,13 +102,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() { diff --git a/Mage.Common/src/mage/remote/SessionImpl.java b/Mage.Common/src/mage/remote/SessionImpl.java index f1cfa362fc..c3a98840c1 100644 --- a/Mage.Common/src/mage/remote/SessionImpl.java +++ b/Mage.Common/src/mage/remote/SessionImpl.java @@ -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) { diff --git a/Mage.Common/src/mage/utils/MageVersion.java b/Mage.Common/src/mage/utils/MageVersion.java index bbc4a7340f..734e402141 100644 --- a/Mage.Common/src/mage/utils/MageVersion.java +++ b/Mage.Common/src/mage/utils/MageVersion.java @@ -77,7 +77,7 @@ public class MageVersion implements Serializable, Comparable { @Override public String toString() { - return major + "." + minor + "." + patch + info + minorPatch; + return major + "." + minor + '.' + patch + info + minorPatch; } @Override diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index 3d03b865f2..0548837a35 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -732,7 +732,7 @@ public class CardView extends SimpleCardView { @Override public String toString() { - return getName() + " [" + getId() + "]"; + return getName() + " [" + getId() + ']'; } public boolean isFaceDown() { diff --git a/Mage.Common/src/mage/view/GameEndView.java b/Mage.Common/src/mage/view/GameEndView.java index 8e99e2ee11..830f9fb725 100644 --- a/Mage.Common/src/mage/view/GameEndView.java +++ b/Mage.Common/src/mage/view/GameEndView.java @@ -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); diff --git a/Mage.Common/src/mage/view/GameView.java b/Mage.Common/src/mage/view/GameView.java index 5ee494809d..1c55dac842 100644 --- a/Mage.Common/src/mage/view/GameView.java +++ b/Mage.Common/src/mage/view/GameView.java @@ -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 diff --git a/Mage.Common/src/mage/view/MatchView.java b/Mage.Common/src/mage/view/MatchView.java index 6b808ebd23..47fc3d6625 100644 --- a/Mage.Common/src/mage/view/MatchView.java +++ b/Mage.Common/src/mage/view/MatchView.java @@ -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"); diff --git a/Mage.Common/src/mage/view/TableView.java b/Mage.Common/src/mage/view/TableView.java index 52051be04c..1d8b74e041 100644 --- a/Mage.Common/src/mage/view/TableView.java +++ b/Mage.Common/src/mage/view/TableView.java @@ -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(); diff --git a/Mage.Common/src/mage/view/TournamentGameView.java b/Mage.Common/src/mage/view/TournamentGameView.java index 6aa2263798..8813ec4d94 100644 --- a/Mage.Common/src/mage/view/TournamentGameView.java +++ b/Mage.Common/src/mage/view/TournamentGameView.java @@ -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 = ""; diff --git a/Mage.Common/src/mage/view/TournamentPlayerView.java b/Mage.Common/src/mage/view/TournamentPlayerView.java index c2a8078a25..198d007435 100644 --- a/Mage.Common/src/mage/view/TournamentPlayerView.java +++ b/Mage.Common/src/mage/view/TournamentPlayerView.java @@ -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(); diff --git a/Mage.Common/src/mage/view/TournamentView.java b/Mage.Common/src/mage/view/TournamentView.java index ae6ca94a64..8197a72774 100644 --- a/Mage.Common/src/mage/view/TournamentView.java +++ b/Mage.Common/src/mage/view/TournamentView.java @@ -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 = ""; } diff --git a/Mage.Server.Console/src/main/java/mage/server/console/ConnectDialog.java b/Mage.Server.Console/src/main/java/mage/server/console/ConnectDialog.java index 6a4b6e8620..6851c2c1c3 100644 --- a/Mage.Server.Console/src/main/java/mage/server/console/ConnectDialog.java +++ b/Mage.Server.Console/src/main/java/mage/server/console/ConnectDialog.java @@ -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(); diff --git a/Mage.Server.Console/src/main/java/mage/server/console/ConsolePanel.java b/Mage.Server.Console/src/main/java/mage/server/console/ConsolePanel.java index d272053f9b..5e2b590c2b 100644 --- a/Mage.Server.Console/src/main/java/mage/server/console/ConsolePanel.java +++ b/Mage.Server.Console/src/main/java/mage/server/console/ConsolePanel.java @@ -575,14 +575,14 @@ class UpdateUsersTask extends SwingWorker> { 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; diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java index 1d35210ae5..804e336bb7 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java @@ -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; } } diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/TinyLeaders.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/TinyLeaders.java index cf8896ccac..ab3b3ec42f 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/TinyLeaders.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/TinyLeaders.java @@ -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; diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java index 908ae33f08..17b7cf9a50 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java @@ -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 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 "); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java index c1ff29cb74..9dc9c24766 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java @@ -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); } diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/GameStateEvaluator2.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/GameStateEvaluator2.java index 68661f92b8..7c762ebe3d 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/GameStateEvaluator2.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/GameStateEvaluator2.java @@ -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; } diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java index 6ae7612a78..8699ba43a4 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java @@ -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') { diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/util/CombatUtil.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/util/CombatUtil.java index a511893676..3ea315a049 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/util/CombatUtil.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/util/CombatUtil.java @@ -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(); } diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index 75e70c3c8d..2ec47e1f00 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -199,7 +199,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { @Override public boolean choose(Outcome outcome, Target target, UUID sourceId, Game game, Map 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 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()); } diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java index e36bde422e..bfacd03fdb 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java @@ -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()); } diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSNode.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSNode.java index f28f868392..7eef75f10e 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSNode.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSNode.java @@ -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()); } } diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java index 9c2769eb1d..d7589f2636 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java @@ -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 engagement = new ArrayList(); for (int j = 0; j < attackersList.size(); j++) { diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java index 2c015d350c..344964fb75 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java @@ -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') { diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java index 3141c5227e..3cba31ffd9 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java @@ -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) { diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java index 743c6a6544..fdefaa68d2 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java @@ -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') { diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index ea2af12d1a..c199fda2c5 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -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()); } } diff --git a/Mage.Server/src/main/java/mage/server/ChatManager.java b/Mage.Server/src/main/java/mage/server/ChatManager.java index eb0938a0e2..4619ad07c1 100644 --- a/Mage.Server/src/main/java/mage/server/ChatManager.java +++ b/Mage.Server/src/main/java/mage/server/ChatManager.java @@ -154,7 +154,7 @@ public class ChatManager { colour = "green"; } messageToCheck = messageToCheck.replaceFirst("\\[" + cardName + "\\]", "card"); - String displayCardName = "" + cardName + ""; + String displayCardName = ""; message = message.replaceFirst("\\[" + cardName + "\\]", displayCardName); } } @@ -209,7 +209,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(); diff --git a/Mage.Server/src/main/java/mage/server/ChatSession.java b/Mage.Server/src/main/java/mage/server/ChatSession.java index fdb5f58f90..0f97c01ca6 100644 --- a/Mage.Server/src/main/java/mage/server/ChatSession.java +++ b/Mage.Server/src/main/java/mage/server/ChatSession.java @@ -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); diff --git a/Mage.Server/src/main/java/mage/server/MageServerImpl.java b/Mage.Server/src/main/java/mage/server/MageServerImpl.java index f642694fd5..1392b92ee5 100644 --- a/Mage.Server/src/main/java/mage/server/MageServerImpl.java +++ b/Mage.Server/src/main/java/mage/server/MageServerImpl.java @@ -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 = UserManager.getInstance().getUser(userId); if (user.isPresent()) { - logger.trace("join tourn. tableId: " + tableId + " " + name); + logger.trace("join tourn. tableId: " + tableId + ' ' + name); } } if (userId == null) { @@ -963,7 +963,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); } @@ -976,7 +976,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()); diff --git a/Mage.Server/src/main/java/mage/server/MailgunClient.java b/Mage.Server/src/main/java/mage/server/MailgunClient.java index 45b3557aa6..cc012886db 100644 --- a/Mage.Server/src/main/java/mage/server/MailgunClient.java +++ b/Mage.Server/src/main/java/mage/server/MailgunClient.java @@ -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 "); + formData.add("from", "XMage '); formData.add("to", email); formData.add("subject", subject); formData.add("text", text); diff --git a/Mage.Server/src/main/java/mage/server/Main.java b/Mage.Server/src/main/java/mage/server/Main.java index 1131b0fd15..1839fa3e44 100644 --- a/Mage.Server/src/main/java/mage/server/Main.java +++ b/Mage.Server/src/main/java/mage/server/Main.java @@ -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 = 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] "); } diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java index e4c4e7d3c1..55e9b5e6e9 100644 --- a/Mage.Server/src/main/java/mage/server/Session.java +++ b/Mage.Server/src/main/java/mage/server/Session.java @@ -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; diff --git a/Mage.Server/src/main/java/mage/server/TableController.java b/Mage.Server/src/main/java/mage/server/TableController.java index 21d6f8aec6..b831426c2e 100644 --- a/Mage.Server/src/main/java/mage/server/TableController.java +++ b/Mage.Server/src/main/java/mage/server/TableController.java @@ -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 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 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; } } diff --git a/Mage.Server/src/main/java/mage/server/TableManager.java b/Mage.Server/src/main/java/mage/server/TableManager.java index 2d8ec48fd7..e7ff34a203 100644 --- a/Mage.Server/src/main/java/mage/server/TableManager.java +++ b/Mage.Server/src/main/java/mage/server/TableManager.java @@ -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 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())); diff --git a/Mage.Server/src/main/java/mage/server/User.java b/Mage.Server/src/main/java/mage/server/User.java index 94ee9b84c3..b7393680c4 100644 --- a/Mage.Server/src/main/java/mage/server/User.java +++ b/Mage.Server/src/main/java/mage/server/User.java @@ -234,7 +234,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() { @@ -509,7 +509,7 @@ public class User { } if (!isConnected()) { - tournamentPlayer.setDisconnectInfo(" (discon. " + getDisconnectDuration() + ")"); + tournamentPlayer.setDisconnectInfo(" (discon. " + getDisconnectDuration() + ')'); } else { tournamentPlayer.setDisconnectInfo(""); } @@ -547,25 +547,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(); } @@ -586,7 +586,7 @@ public class User { if (isConnected()) { return pingInfo; } else { - return " (discon. " + getDisconnectDuration() + ")"; + return " (discon. " + getDisconnectDuration() + ')'; } } @@ -668,7 +668,7 @@ public class User { if (quit.size() > 0) { builder.append(" ("); joinStrings(builder, quit, " "); - builder.append(")"); + builder.append(')'); } return builder.toString(); } @@ -700,7 +700,7 @@ public class User { if (quit.size() > 0) { builder.append(" ("); joinStrings(builder, quit, " "); - builder.append(")"); + builder.append(')'); } return builder.toString(); } diff --git a/Mage.Server/src/main/java/mage/server/UserManager.java b/Mage.Server/src/main/java/mage/server/UserManager.java index 61a673d788..acd963a62d 100644 --- a/Mage.Server/src/main/java/mage/server/UserManager.java +++ b/Mage.Server/src/main/java/mage/server/UserManager.java @@ -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) { diff --git a/Mage.Server/src/main/java/mage/server/game/GameController.java b/Mage.Server/src/main/java/mage/server/game/GameController.java index 4e900e6d28..4725821686 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameController.java +++ b/Mage.Server/src/main/java/mage/server/game/GameController.java @@ -331,7 +331,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 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(); } } diff --git a/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java b/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java index b5ae735a81..bca997678d 100644 --- a/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java +++ b/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java @@ -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()) { diff --git a/Mage.Server/src/main/java/mage/server/tournament/TournamentFactory.java b/Mage.Server/src/main/java/mage/server/tournament/TournamentFactory.java index 4a09cc84fe..3a479da566 100644 --- a/Mage.Server/src/main/java/mage/server/tournament/TournamentFactory.java +++ b/Mage.Server/src/main/java/mage/server/tournament/TournamentFactory.java @@ -92,13 +92,13 @@ public class TournamentFactory { StringBuilder rv = new StringBuilder( "Random Draft using sets: "); for (Map.Entry entry: setInfo.entrySet()){ rv.append(entry.getKey()); - rv.append(";"); + rv.append(';'); } tournament.setBoosterInfo(rv.toString()); } else { StringBuilder sb = new StringBuilder(); for (Map.Entry 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; } diff --git a/Mage.Server/src/main/java/mage/server/util/ThreadExecutor.java b/Mage.Server/src/main/java/mage/server/util/ThreadExecutor.java index 0a171959fe..60f3e56c95 100644 --- a/Mage.Server/src/main/java/mage/server/util/ThreadExecutor.java +++ b/Mage.Server/src/main/java/mage/server/util/ThreadExecutor.java @@ -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; } diff --git a/Mage.Sets/src/mage/cards/a/AcademyResearchers.java b/Mage.Sets/src/mage/cards/a/AcademyResearchers.java index 274378afc3..9ba8e5afe0 100644 --- a/Mage.Sets/src/mage/cards/a/AcademyResearchers.java +++ b/Mage.Sets/src/mage/cards/a/AcademyResearchers.java @@ -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; } } diff --git a/Mage.Sets/src/mage/cards/a/Addle.java b/Mage.Sets/src/mage/cards/a/Addle.java index 9f17a79c67..afd3f43a09 100644 --- a/Mage.Sets/src/mage/cards/a/Addle.java +++ b/Mage.Sets/src/mage/cards/a/Addle.java @@ -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); diff --git a/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java b/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java index 1f32696376..0237247f08 100644 --- a/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java +++ b/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java @@ -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); diff --git a/Mage.Sets/src/mage/cards/a/AlhammarretHighArbiter.java b/Mage.Sets/src/mage/cards/a/AlhammarretHighArbiter.java index 1c58bb68d6..9390e33105 100644 --- a/Mage.Sets/src/mage/cards/a/AlhammarretHighArbiter.java +++ b/Mage.Sets/src/mage/cards/a/AlhammarretHighArbiter.java @@ -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); diff --git a/Mage.Sets/src/mage/cards/a/AssaultSuit.java b/Mage.Sets/src/mage/cards/a/AssaultSuit.java index 729729ffe8..d2c1c1c631 100644 --- a/Mage.Sets/src/mage/cards/a/AssaultSuit.java +++ b/Mage.Sets/src/mage/cards/a/AssaultSuit.java @@ -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())); diff --git a/Mage.Sets/src/mage/cards/a/AureliasFury.java b/Mage.Sets/src/mage/cards/a/AureliasFury.java index 1f2ecff390..29ee0ae014 100644 --- a/Mage.Sets/src/mage/cards/a/AureliasFury.java +++ b/Mage.Sets/src/mage/cards/a/AureliasFury.java @@ -169,7 +169,7 @@ class AureliasFuryCantCastEffect extends ContinuousRuleModifyingEffectImpl { public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - return "You can't cast noncreature spells this turn (you were dealt damage by " + mageObject.getLogName() + ")"; + return "You can't cast noncreature spells this turn (you were dealt damage by " + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage.Sets/src/mage/cards/a/AuriokSurvivors.java b/Mage.Sets/src/mage/cards/a/AuriokSurvivors.java index 34e25bf401..3a006b8c24 100644 --- a/Mage.Sets/src/mage/cards/a/AuriokSurvivors.java +++ b/Mage.Sets/src/mage/cards/a/AuriokSurvivors.java @@ -97,7 +97,7 @@ class AuriokSurvivorsEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (p != null && player != null && sourcePermanent != null) { - if (player.chooseUse(Outcome.Benefit, "Attach " + p.getName() + " to " + sourcePermanent.getName() + "?", source, game)) { + if (player.chooseUse(Outcome.Benefit, "Attach " + p.getName() + " to " + sourcePermanent.getName() + '?', source, game)) { sourcePermanent.addAttachment(p.getId(), game); } return true; diff --git a/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java b/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java index 54ef0caba2..4ad8d32e28 100644 --- a/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java +++ b/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java @@ -118,7 +118,7 @@ class AurraSingBaneOfJediEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - if (controller.chooseUse(outcome, "Deal 2 damage to " + game.getPermanent(getTargetPointer().getFirst(game, source)).getName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Deal 2 damage to " + game.getPermanent(getTargetPointer().getFirst(game, source)).getName() + '?', source, game)) { new DamageTargetEffect(2).apply(game, source); } else { new DamageControllerEffect(1).apply(game, source); diff --git a/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java b/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java index 4a34978a4f..2f72855579 100644 --- a/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java +++ b/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java @@ -96,7 +96,7 @@ class BattletideAlchemistEffect extends PreventionEffectImpl { if (controller != null) { int numberOfClericsControlled = new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent("Cleric", "Clerics")).calculate(game, source, this); int toPrevent = Math.min(numberOfClericsControlled, event.getAmount()); - if (toPrevent > 0 && controller.chooseUse(Outcome.PreventDamage, "Prevent " + toPrevent + " damage to " + targetPlayer.getName() + "?", source, game)) { + if (toPrevent > 0 && controller.chooseUse(Outcome.PreventDamage, "Prevent " + toPrevent + " damage to " + targetPlayer.getName() + '?', source, game)) { GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, targetPlayer.getId(), source.getSourceId(), source.getControllerId(), toPrevent, false); if (!game.replaceEvent(preventEvent)) { if (event.getAmount() >= toPrevent) { diff --git a/Mage.Sets/src/mage/cards/b/BlindZealot.java b/Mage.Sets/src/mage/cards/b/BlindZealot.java index 7e47066d93..74d7892455 100644 --- a/Mage.Sets/src/mage/cards/b/BlindZealot.java +++ b/Mage.Sets/src/mage/cards/b/BlindZealot.java @@ -109,7 +109,7 @@ class BlindZealotTriggeredAbility extends TriggeredAbilityImpl { StringBuilder sb = new StringBuilder(); sb.append("Do you wish to sacrifice ").append(sourcePermanent.getIdName()); sb.append(" to destroy target creature controlled by "); - sb.append(game.getPlayer(event.getTargetId()).getLogName()).append("?"); + sb.append(game.getPlayer(event.getTargetId()).getLogName()).append('?'); if (player.chooseUse(Outcome.DestroyPermanent, sb.toString(), this, game)) { FilterCreaturePermanent filter = new FilterCreaturePermanent(); filter.add(new ControllerIdPredicate(event.getTargetId())); diff --git a/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java b/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java index 7351904528..ae0a9ac04a 100644 --- a/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java +++ b/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java @@ -154,7 +154,7 @@ class BorderlandExplorerEffect extends OneShotEffect { for (UUID cardId : cardsPlayer) { Cards cards = new CardsImpl(game.getCard(cardId)); Card card = game.getCard(cardId); - player.revealCards(card.getIdName() + " (" + player.getName() + ")", cards, game); + player.revealCards(card.getIdName() + " (" + player.getName() + ')', cards, game); player.moveCardToHandWithInfo(card, source.getSourceId(), game); player.shuffleLibrary(source, game); } diff --git a/Mage.Sets/src/mage/cards/b/BottledCloister.java b/Mage.Sets/src/mage/cards/b/BottledCloister.java index dc06c89dce..7b13322429 100644 --- a/Mage.Sets/src/mage/cards/b/BottledCloister.java +++ b/Mage.Sets/src/mage/cards/b/BottledCloister.java @@ -103,7 +103,7 @@ class BottledCloisterExileEffect extends OneShotEffect { card.moveToExile(exileId, sourcePermanent.getName(), source.getSourceId(), game); card.setFaceDown(true, game); } - game.informPlayers(sourcePermanent.getName() + ": " + controller.getLogName() + " exiles his or her hand face down (" + numberOfCards + "card" + (numberOfCards > 1 ?"s":"") +")"); + game.informPlayers(sourcePermanent.getName() + ": " + controller.getLogName() + " exiles his or her hand face down (" + numberOfCards + "card" + (numberOfCards > 1 ?"s":"") + ')'); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BrainGorgers.java b/Mage.Sets/src/mage/cards/b/BrainGorgers.java index 2707fdeac0..3edc103928 100644 --- a/Mage.Sets/src/mage/cards/b/BrainGorgers.java +++ b/Mage.Sets/src/mage/cards/b/BrainGorgers.java @@ -99,9 +99,9 @@ class BrainGorgersCounterSourceEffect extends OneShotEffect { cost.clearPaid(); Player player = game.getPlayer(playerId); if (cost.canPay(source, source.getSourceId(), player.getId(), game) - && player.chooseUse(outcome, "Sacrifice a creature to counter " + sourceObject.getIdName() + "?", source, game)) { + && player.chooseUse(outcome, "Sacrifice a creature to counter " + sourceObject.getIdName() + '?', source, game)) { if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { - game.informPlayers(player.getLogName() + " sacrifices a creature to counter " + sourceObject.getIdName() + "."); + game.informPlayers(player.getLogName() + " sacrifices a creature to counter " + sourceObject.getIdName() + '.'); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { game.getStack().counter(spell.getId(), source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/b/BrilliantUltimatum.java b/Mage.Sets/src/mage/cards/b/BrilliantUltimatum.java index bd1b7b99c9..6f892ed356 100644 --- a/Mage.Sets/src/mage/cards/b/BrilliantUltimatum.java +++ b/Mage.Sets/src/mage/cards/b/BrilliantUltimatum.java @@ -135,8 +135,8 @@ class BrilliantUltimatumEffect extends OneShotEffect { selectedPileCards = pileTwo; selectedPile = pile2; } - game.informPlayers(controller.getLogName() + " chose " + selectedPileName + "."); - while (!selectedPileCards.isEmpty() && controller.chooseUse(Outcome.PlayForFree, "Do you want to play a card for free from " + selectedPileName + "?", source, game)) { + game.informPlayers(controller.getLogName() + " chose " + selectedPileName + '.'); + while (!selectedPileCards.isEmpty() && controller.chooseUse(Outcome.PlayForFree, "Do you want to play a card for free from " + selectedPileName + '?', source, game)) { TargetCard targetExiledCard = new TargetCard(Zone.EXILED, new FilterCard()); if (controller.chooseTarget(Outcome.PlayForFree, selectedPile, targetExiledCard, source, game)) { Card card = selectedPile.get(targetExiledCard.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/c/Cannibalize.java b/Mage.Sets/src/mage/cards/c/Cannibalize.java index 8ec6596b60..d466822acb 100644 --- a/Mage.Sets/src/mage/cards/c/Cannibalize.java +++ b/Mage.Sets/src/mage/cards/c/Cannibalize.java @@ -95,7 +95,7 @@ class CannibalizeEffect extends OneShotEffect { for(UUID targetId: getTargetPointer().getTargets(game, source)) { Permanent creature = game.getPermanent(targetId); if (creature != null) { - if ((count == 0 && controller.chooseUse(Outcome.Exile, "Exile " + creature.getLogName() +"?", source, game)) + if ((count == 0 && controller.chooseUse(Outcome.Exile, "Exile " + creature.getLogName() + '?', source, game)) || (count == 1 && !exileDone)) { controller.moveCardToExileWithInfo(creature, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); exileDone = true; diff --git a/Mage.Sets/src/mage/cards/c/ChainLightning.java b/Mage.Sets/src/mage/cards/c/ChainLightning.java index dc2dcd0cab..bb06d3431b 100644 --- a/Mage.Sets/src/mage/cards/c/ChainLightning.java +++ b/Mage.Sets/src/mage/cards/c/ChainLightning.java @@ -106,7 +106,7 @@ class ChainLightningEffect extends OneShotEffect { Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { spell.createCopyOnStack(game, source, affectedPlayer.getId(), true); - game.informPlayers(affectedPlayer.getLogName() + " copies " + spell.getName() + "."); + game.informPlayers(affectedPlayer.getLogName() + " copies " + spell.getName() + '.'); } } } diff --git a/Mage.Sets/src/mage/cards/c/ChainOfVapor.java b/Mage.Sets/src/mage/cards/c/ChainOfVapor.java index fbfb18babb..5efbb59dd3 100644 --- a/Mage.Sets/src/mage/cards/c/ChainOfVapor.java +++ b/Mage.Sets/src/mage/cards/c/ChainOfVapor.java @@ -96,7 +96,7 @@ class ChainOfVaporEffect extends OneShotEffect { if (permanent != null) { controller.moveCards(permanent, Zone.HAND, source, game); Player player = game.getPlayer(permanent.getControllerId()); - TargetControlledPermanent target = new TargetControlledPermanent(0, 1, new FilterControlledLandPermanent("a land to sacrifice (to be able to copy " + sourceObject.getName() + ")"), true); + TargetControlledPermanent target = new TargetControlledPermanent(0, 1, new FilterControlledLandPermanent("a land to sacrifice (to be able to copy " + sourceObject.getName() + ')'), true); if (player.chooseTarget(Outcome.Sacrifice, target, source, game)) { Permanent land = game.getPermanent(target.getFirstTarget()); if (land != null && land.sacrifice(source.getSourceId(), game)) { @@ -109,7 +109,7 @@ class ChainOfVaporEffect extends OneShotEffect { if (activateMessage.startsWith(" casts ")) { activateMessage = activateMessage.substring(6); } - game.informPlayers(player.getLogName() + " " + activateMessage); + game.informPlayers(player.getLogName() + ' ' + activateMessage); } } } diff --git a/Mage.Sets/src/mage/cards/c/ChorusOfTheConclave.java b/Mage.Sets/src/mage/cards/c/ChorusOfTheConclave.java index c08a79536b..3901ba4f8f 100644 --- a/Mage.Sets/src/mage/cards/c/ChorusOfTheConclave.java +++ b/Mage.Sets/src/mage/cards/c/ChorusOfTheConclave.java @@ -151,7 +151,7 @@ class ChorusOfTheConclaveReplacementEffect extends ReplacementEffectImpl { payed = true; } } - game.informPlayers(player.getLogName() + " pays {" + xValue + "}"); + game.informPlayers(player.getLogName() + " pays {" + xValue + '}'); return xValue; } diff --git a/Mage.Sets/src/mage/cards/c/ChromeMox.java b/Mage.Sets/src/mage/cards/c/ChromeMox.java index d0ccd0356b..a7c8406e39 100644 --- a/Mage.Sets/src/mage/cards/c/ChromeMox.java +++ b/Mage.Sets/src/mage/cards/c/ChromeMox.java @@ -114,7 +114,7 @@ class ChromeMoxEffect extends OneShotEffect { if (cardToImprint != null) { controller.moveCardsToExile(cardToImprint, source, game, true, source.getSourceId(), sourceObject.getIdName() + " (Imprint)"); sourcePermanent.imprint(cardToImprint.getId(), game); - sourcePermanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + GameLog.getColoredObjectIdNameForTooltip(cardToImprint) + "]"), game); + sourcePermanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + GameLog.getColoredObjectIdNameForTooltip(cardToImprint) + ']'), game); } else { sourcePermanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - None]"), game); } diff --git a/Mage.Sets/src/mage/cards/c/ChronatogTotem.java b/Mage.Sets/src/mage/cards/c/ChronatogTotem.java index 6930843c56..7a2bfb2fb3 100644 --- a/Mage.Sets/src/mage/cards/c/ChronatogTotem.java +++ b/Mage.Sets/src/mage/cards/c/ChronatogTotem.java @@ -127,7 +127,7 @@ class ChronatogTotemAbility extends LimitedTimesPerTurnActivatedAbility { public String getRule() { StringBuilder sb = new StringBuilder(super.getRule()); sb.deleteCharAt(sb.length() - 1); // remove last '.' - sb.append(" and only if ").append(condition.toString()).append("."); + sb.append(" and only if ").append(condition.toString()).append('.'); return sb.toString(); } } diff --git a/Mage.Sets/src/mage/cards/c/CollectiveRestraint.java b/Mage.Sets/src/mage/cards/c/CollectiveRestraint.java index d0cf351fc6..a956c84595 100644 --- a/Mage.Sets/src/mage/cards/c/CollectiveRestraint.java +++ b/Mage.Sets/src/mage/cards/c/CollectiveRestraint.java @@ -80,7 +80,7 @@ class CollectiveRestraintPayManaToAttackAllEffect extends CantAttackYouUnlessPay public ManaCosts getManaCostToPay(GameEvent event, Ability source, Game game) { int domainValue = new DomainValue().calculate(game, source, this); if (domainValue > 0) { - return new ManaCostsImpl<>("{" + domainValue + "}"); + return new ManaCostsImpl<>("{" + domainValue + '}'); } return null; } diff --git a/Mage.Sets/src/mage/cards/c/ConfiscationCoup.java b/Mage.Sets/src/mage/cards/c/ConfiscationCoup.java index 4636fbfd09..35d8f7aa7a 100644 --- a/Mage.Sets/src/mage/cards/c/ConfiscationCoup.java +++ b/Mage.Sets/src/mage/cards/c/ConfiscationCoup.java @@ -108,7 +108,7 @@ class ConfiscationCoupEffect extends OneShotEffect { for (int i = 0; i < targetPermanent.getManaCost().convertedManaCost(); i++) { energy += "{E}"; } - if (controller.chooseUse(outcome, "Pay " + energy + " to get control of " + targetPermanent.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Pay " + energy + " to get control of " + targetPermanent.getLogName() + '?', source, game)) { if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { ContinuousEffect controllEffect = new GainControlTargetEffect(Duration.Custom); controllEffect.setTargetPointer(new FixedTarget(targetPermanent, game)); diff --git a/Mage.Sets/src/mage/cards/c/ConfusionInTheRanks.java b/Mage.Sets/src/mage/cards/c/ConfusionInTheRanks.java index d2f3b5856c..9ce9bb67b4 100644 --- a/Mage.Sets/src/mage/cards/c/ConfusionInTheRanks.java +++ b/Mage.Sets/src/mage/cards/c/ConfusionInTheRanks.java @@ -106,7 +106,7 @@ public class ConfusionInTheRanks extends CardImpl { if (!message.isEmpty()) { message += "or "; } - message += cardTypeEntering.toString().toLowerCase() + " "; + message += cardTypeEntering.toString().toLowerCase() + ' '; } filterTarget.add(Predicates.or(cardTypesPredicates)); message += "you do not control"; diff --git a/Mage.Sets/src/mage/cards/c/ConundrumSphinx.java b/Mage.Sets/src/mage/cards/c/ConundrumSphinx.java index 85bada78c2..7defd8d789 100644 --- a/Mage.Sets/src/mage/cards/c/ConundrumSphinx.java +++ b/Mage.Sets/src/mage/cards/c/ConundrumSphinx.java @@ -100,7 +100,7 @@ class ConundrumSphinxEffect extends OneShotEffect { } } String cardName = cardChoice.getChoice(); - game.informPlayers("Conundrum Sphinx, player: " + player.getLogName() + ", named card: [" + cardName + "]"); + game.informPlayers("Conundrum Sphinx, player: " + player.getLogName() + ", named card: [" + cardName + ']'); Card card = player.getLibrary().removeFromTop(game); Cards cards = new CardsImpl(); cards.add(card); diff --git a/Mage.Sets/src/mage/cards/c/CosmicHorror.java b/Mage.Sets/src/mage/cards/c/CosmicHorror.java index 201165802f..464a0cabb4 100644 --- a/Mage.Sets/src/mage/cards/c/CosmicHorror.java +++ b/Mage.Sets/src/mage/cards/c/CosmicHorror.java @@ -93,7 +93,7 @@ class CosmicHorrorEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent cosmicHorror = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && cosmicHorror != null) { - StringBuilder sb = new StringBuilder(cost.getText()).append("?"); + StringBuilder sb = new StringBuilder(cost.getText()).append('?'); if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) { sb.insert(0, "Pay "); } diff --git a/Mage.Sets/src/mage/cards/c/CouncilGuardian.java b/Mage.Sets/src/mage/cards/c/CouncilGuardian.java index a2bf0f3aa1..cee931c9f5 100644 --- a/Mage.Sets/src/mage/cards/c/CouncilGuardian.java +++ b/Mage.Sets/src/mage/cards/c/CouncilGuardian.java @@ -118,7 +118,7 @@ class CouncilsGuardianEffect extends OneShotEffect { } chosenColors.put(color, 1); } - game.informPlayers(player.getLogName() + " has chosen " + color.getDescription() + "."); + game.informPlayers(player.getLogName() + " has chosen " + color.getDescription() + '.'); } } } diff --git a/Mage.Sets/src/mage/cards/c/CranialExtraction.java b/Mage.Sets/src/mage/cards/c/CranialExtraction.java index 5a03316013..8d871d7e39 100644 --- a/Mage.Sets/src/mage/cards/c/CranialExtraction.java +++ b/Mage.Sets/src/mage/cards/c/CranialExtraction.java @@ -98,7 +98,7 @@ class CranialExtractionEffect extends SearchTargetGraveyardHandLibraryForCardNam String cardName = cardChoice.getChoice(); MageObject sourceObject = game.getObject(source.getSourceId()); if (sourceObject != null) { - game.informPlayers(sourceObject.getName() + " named card: [" + cardName + "]"); + game.informPlayers(sourceObject.getName() + " named card: [" + cardName + ']'); } super.applySearchAndExile(game, source, cardName, player.getId()); } diff --git a/Mage.Sets/src/mage/cards/d/DashHopes.java b/Mage.Sets/src/mage/cards/d/DashHopes.java index a55550a166..aa197c6381 100644 --- a/Mage.Sets/src/mage/cards/d/DashHopes.java +++ b/Mage.Sets/src/mage/cards/d/DashHopes.java @@ -95,9 +95,9 @@ class DashHopesCounterSourceEffect extends OneShotEffect { Player player = game.getPlayer(playerId); cost.clearPaid(); if (cost.canPay(source, source.getSourceId(), player.getId(), game) - && player.chooseUse(outcome, "Pay 5 life to counter " + sourceObject.getIdName() + "?", source, game)) { + && player.chooseUse(outcome, "Pay 5 life to counter " + sourceObject.getIdName() + '?', source, game)) { if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { - game.informPlayers(player.getLogName() + " pays 5 life to counter " + sourceObject.getIdName() + "."); + game.informPlayers(player.getLogName() + " pays 5 life to counter " + sourceObject.getIdName() + '.'); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { game.getStack().counter(spell.getId(), source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/d/DecayingSoil.java b/Mage.Sets/src/mage/cards/d/DecayingSoil.java index e06cb61391..530a6910c0 100644 --- a/Mage.Sets/src/mage/cards/d/DecayingSoil.java +++ b/Mage.Sets/src/mage/cards/d/DecayingSoil.java @@ -172,7 +172,7 @@ class DecayingSoilEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - if (player.chooseUse(Outcome.Benefit, " - Pay " + cost.getText() + "?", source, game)) { + if (player.chooseUse(Outcome.Benefit, " - Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { UUID target = this.getTargetPointer().getFirst(game, source); diff --git a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java index 4c76862c89..fa3b71d630 100644 --- a/Mage.Sets/src/mage/cards/d/DeepfireElemental.java +++ b/Mage.Sets/src/mage/cards/d/DeepfireElemental.java @@ -79,7 +79,7 @@ public class DeepfireElemental extends CardImpl { if (ability.getOriginalId().equals(originalId)) { ability.getTargets().clear(); FilterPermanent newFilter = filter.copy(); - newFilter.setMessage(new StringBuilder("artifact or creature with converted mana cost {").append(ability.getManaCostsToPay().getX()).append("}").toString()); + newFilter.setMessage(new StringBuilder("artifact or creature with converted mana cost {").append(ability.getManaCostsToPay().getX()).append('}').toString()); newFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, ability.getManaCostsToPay().getX())); Target target = new TargetPermanent(newFilter); ability.addTarget(target); diff --git a/Mage.Sets/src/mage/cards/d/DemonicHordes.java b/Mage.Sets/src/mage/cards/d/DemonicHordes.java index d5212f9e02..1019b6d746 100644 --- a/Mage.Sets/src/mage/cards/d/DemonicHordes.java +++ b/Mage.Sets/src/mage/cards/d/DemonicHordes.java @@ -104,7 +104,7 @@ class DemonicHordesEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent demonicHordes = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && demonicHordes != null) { - StringBuilder sb = new StringBuilder(cost.getText()).append("?"); + StringBuilder sb = new StringBuilder(cost.getText()).append('?'); if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) { sb.insert(0, "Pay "); } diff --git a/Mage.Sets/src/mage/cards/d/DieYoung.java b/Mage.Sets/src/mage/cards/d/DieYoung.java index e9cb79068f..8b5c4037ab 100644 --- a/Mage.Sets/src/mage/cards/d/DieYoung.java +++ b/Mage.Sets/src/mage/cards/d/DieYoung.java @@ -93,7 +93,7 @@ class DieYoungEffect extends OneShotEffect { if (controller != null) { new GetEnergyCountersControllerEffect(2).apply(game, source); int max = controller.getCounters().getCount(CounterType.ENERGY); - int numberToPayed = controller.getAmount(0, max, "How many energy counters do you like to pay? (maximum = " + max + ")", game); + int numberToPayed = controller.getAmount(0, max, "How many energy counters do you like to pay? (maximum = " + max + ')', game); if (numberToPayed > 0) { Cost cost = new PayEnergyCost(numberToPayed); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { diff --git a/Mage.Sets/src/mage/cards/d/DiluvianPrimordial.java b/Mage.Sets/src/mage/cards/d/DiluvianPrimordial.java index 5844aeb3ee..cb84ea95cd 100644 --- a/Mage.Sets/src/mage/cards/d/DiluvianPrimordial.java +++ b/Mage.Sets/src/mage/cards/d/DiluvianPrimordial.java @@ -126,7 +126,7 @@ class DiluvianPrimordialEffect extends OneShotEffect { if (target instanceof TargetCardInOpponentsGraveyard) { Card targetCard = game.getCard(target.getFirstTarget()); if (targetCard != null) { - if (controller.chooseUse(outcome, "Cast " + targetCard.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Cast " + targetCard.getLogName() + '?', source, game)) { if (controller.cast(targetCard.getSpellAbility(), game, true)) { ContinuousEffect effect = new DiluvianPrimordialReplacementEffect(); effect.setTargetPointer(new FixedTarget(targetCard.getId(), game.getState().getZoneChangeCounter(targetCard.getId()))); diff --git a/Mage.Sets/src/mage/cards/d/Duplicant.java b/Mage.Sets/src/mage/cards/d/Duplicant.java index f0dd4a0346..2132a893d4 100644 --- a/Mage.Sets/src/mage/cards/d/Duplicant.java +++ b/Mage.Sets/src/mage/cards/d/Duplicant.java @@ -108,7 +108,7 @@ class ExileTargetEffect extends OneShotEffect { if (permanent != null) { if(sourcePermananent != null){ sourcePermananent.imprint(permanent.getId(), game); - sourcePermananent.addInfo("imprint", new StringBuilder("[Imprinted card - ").append(permanent.getName()).append("]").toString(), game); + sourcePermananent.addInfo("imprint", new StringBuilder("[Imprinted card - ").append(permanent.getName()).append(']').toString(), game); } return permanent.moveToExile(null, null, source.getSourceId(), game); } diff --git a/Mage.Sets/src/mage/cards/d/DustOfMoments.java b/Mage.Sets/src/mage/cards/d/DustOfMoments.java index 658d0dc24b..529125a9d1 100644 --- a/Mage.Sets/src/mage/cards/d/DustOfMoments.java +++ b/Mage.Sets/src/mage/cards/d/DustOfMoments.java @@ -144,8 +144,8 @@ public class DustOfMoments extends CardImpl { } if (!game.isSimulation()) { game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") - .append(controller.getLogName()).append(getActionStr()).append("s") - .append(counter.getCount()).append(" ").append(counterName.toLowerCase()) + .append(controller.getLogName()).append(getActionStr()).append('s') + .append(counter.getCount()).append(' ').append(counterName.toLowerCase()) .append(" counter on ").append(card.getName()).toString()); } } @@ -170,7 +170,7 @@ public class DustOfMoments extends CardImpl { if (!game.isSimulation()) { game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") .append(controller.getLogName()).append(getActionStr()).append("s ") - .append(counter.getCount()).append(" ").append(counterName.toLowerCase()) + .append(counter.getCount()).append(' ').append(counterName.toLowerCase()) .append(" counter on ").append(card.getName()).toString()); } } @@ -185,7 +185,7 @@ public class DustOfMoments extends CardImpl { StringBuilder sb = new StringBuilder(); sb.append(getActionStr()); if (counter.getCount() > 1) { - sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName().toLowerCase()).append(" counters on each "); + sb.append(Integer.toString(counter.getCount())).append(' ').append(counter.getName().toLowerCase()).append(" counters on each "); } else { sb.append("a ").append(counter.getName().toLowerCase()).append(" counter on each "); } diff --git a/Mage.Sets/src/mage/cards/e/EliteArcanist.java b/Mage.Sets/src/mage/cards/e/EliteArcanist.java index 7098eb85dc..f4fa74b99b 100644 --- a/Mage.Sets/src/mage/cards/e/EliteArcanist.java +++ b/Mage.Sets/src/mage/cards/e/EliteArcanist.java @@ -128,7 +128,7 @@ class EliteArcanistImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", new StringBuilder("[Exiled card - ").append(card.getName()).append("]").toString(), game); + permanent.addInfo("imprint", new StringBuilder("[Exiled card - ").append(card.getName()).append(']').toString(), game); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java b/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java index 8548373f18..0bf68ea784 100644 --- a/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java +++ b/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java @@ -160,13 +160,13 @@ class EpiphanyAtTheDrownyardEffect extends OneShotEffect { } game.informPlayers(sb.toString()); - sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(":"); + sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(':'); i = 0; for (UUID cardUuid : pile2CardsIds) { Card card = game.getCard(cardUuid); if (card != null) { i++; - sb.append(" ").append(GameLog.getColoredObjectName(card)); + sb.append(' ').append(GameLog.getColoredObjectName(card)); if (i < pile2CardsIds.size()) { sb.append(", "); } diff --git a/Mage.Sets/src/mage/cards/e/Expropriate.java b/Mage.Sets/src/mage/cards/e/Expropriate.java index 7c17bd8d09..db60697b19 100644 --- a/Mage.Sets/src/mage/cards/e/Expropriate.java +++ b/Mage.Sets/src/mage/cards/e/Expropriate.java @@ -156,7 +156,7 @@ class ExpropriateDilemmaEffect extends CouncilsDilemmaVoteEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - if (player.chooseUse(Outcome.Vote, "Choose " + choiceOne + "?", source, game)) { + if (player.chooseUse(Outcome.Vote, "Choose " + choiceOne + '?', source, game)) { voteOneCount++; game.informPlayers(player.getName() + " has voted for " + choiceOne); } else { diff --git a/Mage.Sets/src/mage/cards/e/ExtraplanarLens.java b/Mage.Sets/src/mage/cards/e/ExtraplanarLens.java index 8ee5606259..962a277092 100644 --- a/Mage.Sets/src/mage/cards/e/ExtraplanarLens.java +++ b/Mage.Sets/src/mage/cards/e/ExtraplanarLens.java @@ -103,7 +103,7 @@ class ExtraplanarLensImprintEffect extends OneShotEffect { if (targetLand != null) { targetLand.moveToExile(null, extraplanarLens.getName() + " (Imprint)", source.getSourceId(), game); extraplanarLens.imprint(targetLand.getId(), game); - extraplanarLens.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + targetLand.getLogName() + "]"), game); + extraplanarLens.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + targetLand.getLogName() + ']'), game); } } return true; diff --git a/Mage.Sets/src/mage/cards/f/FactOrFiction.java b/Mage.Sets/src/mage/cards/f/FactOrFiction.java index 6a93b12673..1bc2dc39e8 100644 --- a/Mage.Sets/src/mage/cards/f/FactOrFiction.java +++ b/Mage.Sets/src/mage/cards/f/FactOrFiction.java @@ -137,11 +137,11 @@ class FactOrFictionEffect extends OneShotEffect { } game.informPlayers(sb.toString()); - sb = new StringBuilder("Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (":"); + sb = new StringBuilder("Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (':'); i = 0; for (Card card: pile2) { i++; - sb.append(" ").append(card.getName()); + sb.append(' ').append(card.getName()); if (i < pile2.size()) { sb.append(", "); } diff --git a/Mage.Sets/src/mage/cards/f/FaerieArtisans.java b/Mage.Sets/src/mage/cards/f/FaerieArtisans.java index fb99035e3e..80a433d0fb 100644 --- a/Mage.Sets/src/mage/cards/f/FaerieArtisans.java +++ b/Mage.Sets/src/mage/cards/f/FaerieArtisans.java @@ -121,7 +121,7 @@ class FaerieArtisansEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); for (Permanent permanent : effect.getAddedPermanent()) { if (sb.length() > 0) { - sb.append(";"); + sb.append(';'); } sb.append(permanent.getId()); } diff --git a/Mage.Sets/src/mage/cards/f/Fatespinner.java b/Mage.Sets/src/mage/cards/f/Fatespinner.java index 7ed714bf29..6078d1eb96 100644 --- a/Mage.Sets/src/mage/cards/f/Fatespinner.java +++ b/Mage.Sets/src/mage/cards/f/Fatespinner.java @@ -113,7 +113,7 @@ class FatespinnerChooseEffect extends OneShotEffect { } } String chosenPhase = choice.getChoice(); - game.informPlayers(player.getLogName() + " has chosen to skip " + chosenPhase.toLowerCase() + "."); + game.informPlayers(player.getLogName() + " has chosen to skip " + chosenPhase.toLowerCase() + '.'); game.addEffect(new FatespinnerSkipEffect(chosenPhase), source); return true; } diff --git a/Mage.Sets/src/mage/cards/f/FellShepherd.java b/Mage.Sets/src/mage/cards/f/FellShepherd.java index bb01cc12f7..c4db208110 100644 --- a/Mage.Sets/src/mage/cards/f/FellShepherd.java +++ b/Mage.Sets/src/mage/cards/f/FellShepherd.java @@ -162,7 +162,7 @@ class FellShepherdEffect extends OneShotEffect { Card card = game.getCard(creatureId); if (card != null) { card.moveToZone(Zone.HAND, source.getSourceId(), game, false); - sb.append(" ").append(card.getName()); + sb.append(' ').append(card.getName()); } } } diff --git a/Mage.Sets/src/mage/cards/f/Flash.java b/Mage.Sets/src/mage/cards/f/Flash.java index c52032bb75..0cf62455aa 100644 --- a/Mage.Sets/src/mage/cards/f/Flash.java +++ b/Mage.Sets/src/mage/cards/f/Flash.java @@ -101,7 +101,7 @@ class FlashEffect extends OneShotEffect { card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId()); ManaCosts reducedCost = CardUtil.removeVariableManaCost(CardUtil.reduceCost(card.getManaCost(), 2)); - StringBuilder sb = new StringBuilder("Pay ").append(reducedCost.getText()).append("?"); + StringBuilder sb = new StringBuilder("Pay ").append(reducedCost.getText()).append('?'); if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { reducedCost.clearPaid(); if (reducedCost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { diff --git a/Mage.Sets/src/mage/cards/f/FlowstoneSculpture.java b/Mage.Sets/src/mage/cards/f/FlowstoneSculpture.java index c830de50e3..69507915ee 100644 --- a/Mage.Sets/src/mage/cards/f/FlowstoneSculpture.java +++ b/Mage.Sets/src/mage/cards/f/FlowstoneSculpture.java @@ -124,14 +124,16 @@ class FlowstoneSculptureEffect extends OneShotEffect { } else { Ability gainedAbility; - if(chosen.equals("Flying")) { - gainedAbility = FlyingAbility.getInstance(); - } - else if(chosen.equals("First strike")) { - gainedAbility = FirstStrikeAbility.getInstance(); - } - else { - gainedAbility = TrampleAbility.getInstance(); + switch (chosen) { + case "Flying": + gainedAbility = FlyingAbility.getInstance(); + break; + case "First strike": + gainedAbility = FirstStrikeAbility.getInstance(); + break; + default: + gainedAbility = TrampleAbility.getInstance(); + break; } game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.WhileOnBattlefield), source); return true; diff --git a/Mage.Sets/src/mage/cards/f/ForgottenAncient.java b/Mage.Sets/src/mage/cards/f/ForgottenAncient.java index d13001fa77..7513d62d57 100644 --- a/Mage.Sets/src/mage/cards/f/ForgottenAncient.java +++ b/Mage.Sets/src/mage/cards/f/ForgottenAncient.java @@ -124,7 +124,7 @@ public class ForgottenAncient extends CardImpl { continue; } - int amountToMove = controller.getAmount(0, numCounters, "How many counters do you want to move? " + "(" + numCounters + ")" + " counters remaining.", game); + int amountToMove = controller.getAmount(0, numCounters, "How many counters do you want to move? " + '(' + numCounters + ')' + " counters remaining.", game); if(amountToMove > 0) { boolean previouslyChosen = false; diff --git a/Mage.Sets/src/mage/cards/g/GoblinDarkDwellers.java b/Mage.Sets/src/mage/cards/g/GoblinDarkDwellers.java index 7a5e27bc3a..bd4243485f 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinDarkDwellers.java +++ b/Mage.Sets/src/mage/cards/g/GoblinDarkDwellers.java @@ -113,7 +113,7 @@ class GoblinDarkDwellersEffect extends OneShotEffect { if (controller != null) { Card card = game.getCard(this.getTargetPointer().getFirst(game, source)); if (card != null) { - if (controller.chooseUse(outcome, "Cast " + card.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Cast " + card.getLogName() + '?', source, game)) { if (controller.cast(card.getSpellAbility(), game, true)) { ContinuousEffect effect = new GoblinDarkDwellersReplacementEffect(card.getId()); effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId()))); diff --git a/Mage.Sets/src/mage/cards/g/Godsend.java b/Mage.Sets/src/mage/cards/g/Godsend.java index 42acb71b40..f0743615e1 100644 --- a/Mage.Sets/src/mage/cards/g/Godsend.java +++ b/Mage.Sets/src/mage/cards/g/Godsend.java @@ -191,7 +191,7 @@ class GodsendExileEffect extends OneShotEffect { if (creature != null && controller != null && sourcePermanent != null) { UUID exileId = CardUtil.getCardExileZoneId(game, source); controller.moveCardToExileWithInfo(creature, exileId, - sourcePermanent.getIdName() + " (" + sourcePermanent.getZoneChangeCounter(game) + ")", source.getSourceId(), game, Zone.BATTLEFIELD, true); + sourcePermanent.getIdName() + " (" + sourcePermanent.getZoneChangeCounter(game) + ')', source.getSourceId(), game, Zone.BATTLEFIELD, true); } return false; @@ -218,7 +218,7 @@ class GodsendRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl { public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - return "You can't cast this spell because a card with the same name is exiled by " + mageObject.getLogName() + "."; + return "You can't cast this spell because a card with the same name is exiled by " + mageObject.getLogName() + '.'; } return null; } diff --git a/Mage.Sets/src/mage/cards/g/GrandAbolisher.java b/Mage.Sets/src/mage/cards/g/GrandAbolisher.java index 1201a553fb..3eb9c5964b 100644 --- a/Mage.Sets/src/mage/cards/g/GrandAbolisher.java +++ b/Mage.Sets/src/mage/cards/g/GrandAbolisher.java @@ -98,7 +98,7 @@ class GrandAbolisherEffect extends ContinuousRuleModifyingEffectImpl { MageObject mageObject = game.getObject(source.getSourceId()); if (activePlayer != null && mageObject != null) { return "You can't cast spells or activate abilities of artifacts, creatures, or enchantments during the turns of " + activePlayer.getLogName() + - " (" + mageObject.getLogName() + ")"; + " (" + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage.Sets/src/mage/cards/h/Heartmender.java b/Mage.Sets/src/mage/cards/h/Heartmender.java index 5211a7a058..05b9db5c38 100644 --- a/Mage.Sets/src/mage/cards/h/Heartmender.java +++ b/Mage.Sets/src/mage/cards/h/Heartmender.java @@ -100,7 +100,7 @@ class HeartmenderEffect extends OneShotEffect { if (creature != null && creature.getCounters(game).getCount(counter.getName()) >= counter.getCount()) { creature.removeCounters(counter.getName(), counter.getCount(), game); - game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName()) + game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(' ').append(counter.getName()) .append(" counter from ").append(creature.getName()).toString()); applied = true; } diff --git a/Mage.Sets/src/mage/cards/h/HellkiteCharger.java b/Mage.Sets/src/mage/cards/h/HellkiteCharger.java index 5151be6ed3..40e0435a31 100644 --- a/Mage.Sets/src/mage/cards/h/HellkiteCharger.java +++ b/Mage.Sets/src/mage/cards/h/HellkiteCharger.java @@ -96,7 +96,7 @@ class HellkiteChargerEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { ManaCosts cost = new ManaCostsImpl("{5}{R}{R}"); - if (player.chooseUse(Outcome.Damage, "Pay " + cost.getText() + "?", source, game)) { + if (player.chooseUse(Outcome.Damage, "Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { new UntapAllControllerEffect(new FilterAttackingCreature(),"").apply(game, source); diff --git a/Mage.Sets/src/mage/cards/h/HiddenStrings.java b/Mage.Sets/src/mage/cards/h/HiddenStrings.java index a29f12c38e..52b47eb6b7 100644 --- a/Mage.Sets/src/mage/cards/h/HiddenStrings.java +++ b/Mage.Sets/src/mage/cards/h/HiddenStrings.java @@ -98,11 +98,11 @@ class HiddenStringsEffect extends OneShotEffect { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { if (permanent.isTapped()) { - if (player.chooseUse(Outcome.Untap, new StringBuilder("Untap ").append(permanent.getName()).append("?").toString(), source, game)) { + if (player.chooseUse(Outcome.Untap, new StringBuilder("Untap ").append(permanent.getName()).append('?').toString(), source, game)) { permanent.untap(game); } } else { - if (player.chooseUse(Outcome.Tap, new StringBuilder("Tap ").append(permanent.getName()).append("?").toString(), source, game)) { + if (player.chooseUse(Outcome.Tap, new StringBuilder("Tap ").append(permanent.getName()).append('?').toString(), source, game)) { permanent.tap(game); } } diff --git a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java index 411652317c..a34d13da76 100644 --- a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java +++ b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java @@ -132,7 +132,7 @@ class HopeOfGhirapurCantCastEffect extends ContinuousRuleModifyingEffectImpl { public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - return "You can't cast noncreature spells this turn (you were dealt damage by " + mageObject.getLogName() + ")"; + return "You can't cast noncreature spells this turn (you were dealt damage by " + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage.Sets/src/mage/cards/i/InfiniteObliteration.java b/Mage.Sets/src/mage/cards/i/InfiniteObliteration.java index 2d91175784..ecd3f9cce6 100644 --- a/Mage.Sets/src/mage/cards/i/InfiniteObliteration.java +++ b/Mage.Sets/src/mage/cards/i/InfiniteObliteration.java @@ -97,7 +97,7 @@ class InfiniteObliterationEffect extends SearchTargetGraveyardHandLibraryForCard cardName = cardChoice.getChoice(); MageObject sourceObject = game.getObject(source.getSourceId()); if (sourceObject != null) { - game.informPlayers(sourceObject.getName() + " named card: [" + cardName + "]"); + game.informPlayers(sourceObject.getName() + " named card: [" + cardName + ']'); } super.applySearchAndExile(game, source, cardName, player.getId()); diff --git a/Mage.Sets/src/mage/cards/i/IntetTheDreamer.java b/Mage.Sets/src/mage/cards/i/IntetTheDreamer.java index b6185063b0..f58b9d92ca 100644 --- a/Mage.Sets/src/mage/cards/i/IntetTheDreamer.java +++ b/Mage.Sets/src/mage/cards/i/IntetTheDreamer.java @@ -162,7 +162,7 @@ class IntetTheDreamerCastEffect extends AsThoughEffectImpl { if (zone != null && zone.contains(card.getId())/* && CardUtil.cardCanBePlayedNow(card, controller.getId(), game)*/) { if (card.getCardType().contains(CardType.LAND)) { if (game.canPlaySorcery(controller.getId()) && game.getPlayer(controller.getId()).canPlayLand()) { - return controller.chooseUse(outcome, "Play " + card.getIdName() + "?", source, game); + return controller.chooseUse(outcome, "Play " + card.getIdName() + '?', source, game); } } else { controller.setCastSourceIdWithAlternateMana(objectId, null, null); diff --git a/Mage.Sets/src/mage/cards/i/IsochronScepter.java b/Mage.Sets/src/mage/cards/i/IsochronScepter.java index b23de5bf68..96407d8af2 100644 --- a/Mage.Sets/src/mage/cards/i/IsochronScepter.java +++ b/Mage.Sets/src/mage/cards/i/IsochronScepter.java @@ -113,7 +113,7 @@ class IsochronScepterImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + "]"), game); + permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + ']'), game); } } } @@ -155,7 +155,7 @@ class IsochronScepterCopyEffect extends OneShotEffect { if (scepter != null && scepter.getImprinted() != null && !scepter.getImprinted().isEmpty()) { Card imprintedInstant = game.getCard(scepter.getImprinted().get(0)); if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) { - if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append("?").toString(), source, game)) { + if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append('?').toString(), source, game)) { Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId()); if (copiedCard != null) { game.getExile().add(source.getSourceId(), "", copiedCard); diff --git a/Mage.Sets/src/mage/cards/j/JaceArchitectOfThought.java b/Mage.Sets/src/mage/cards/j/JaceArchitectOfThought.java index f6c11df488..c589670c0b 100644 --- a/Mage.Sets/src/mage/cards/j/JaceArchitectOfThought.java +++ b/Mage.Sets/src/mage/cards/j/JaceArchitectOfThought.java @@ -264,7 +264,7 @@ class JaceArchitectOfThoughtEffect2 extends OneShotEffect { private void postPileToLog(String pileName, Set cards, Game game) { StringBuilder message = new StringBuilder(pileName).append(": "); for (Card card : cards) { - message.append(card.getName()).append(" "); + message.append(card.getName()).append(' '); } if (cards.isEmpty()) { message.append(" (empty)"); diff --git a/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java b/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java index 30fd18f176..9ff74ced51 100644 --- a/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java +++ b/Mage.Sets/src/mage/cards/k/KalitasBloodchiefOfGhet.java @@ -103,7 +103,7 @@ class KalitasDestroyEffect extends OneShotEffect { class VampireToken extends Token { public VampireToken(int tokenPower, int tokenToughness) { - super("Vampire", new StringBuilder(tokenPower).append("/").append(tokenToughness).append(" black Vampire creature token").toString()); + super("Vampire", new StringBuilder(tokenPower).append('/').append(tokenToughness).append(" black Vampire creature token").toString()); cardType.add(CardType.CREATURE); color.setBlack(true); subtype.add("Vampire"); diff --git a/Mage.Sets/src/mage/cards/k/KnowledgePool.java b/Mage.Sets/src/mage/cards/k/KnowledgePool.java index 0fb3745420..1a83a89bb8 100644 --- a/Mage.Sets/src/mage/cards/k/KnowledgePool.java +++ b/Mage.Sets/src/mage/cards/k/KnowledgePool.java @@ -101,7 +101,7 @@ class KnowledgePoolEffect1 extends OneShotEffect { if (player != null) { player.moveCardsToExile(player.getLibrary().getTopCards(game, 3), source, game, true, CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), - sourceObject.getIdName() + " (" + sourceObject.getZoneChangeCounter(game) + ")"); + sourceObject.getIdName() + " (" + sourceObject.getZoneChangeCounter(game) + ')'); } } return true; diff --git a/Mage.Sets/src/mage/cards/l/LunarAvenger.java b/Mage.Sets/src/mage/cards/l/LunarAvenger.java index de4a09a51f..232b503747 100644 --- a/Mage.Sets/src/mage/cards/l/LunarAvenger.java +++ b/Mage.Sets/src/mage/cards/l/LunarAvenger.java @@ -119,12 +119,16 @@ class LunarAvengerEffect extends OneShotEffect { Ability gainedAbility; String chosen = choice.getChoice(); - if (chosen.equals("Flying")) { - gainedAbility = FlyingAbility.getInstance(); - } else if (chosen.equals("First strike")) { - gainedAbility = FirstStrikeAbility.getInstance(); - } else { - gainedAbility = HasteAbility.getInstance(); + switch (chosen) { + case "Flying": + gainedAbility = FlyingAbility.getInstance(); + break; + case "First strike": + gainedAbility = FirstStrikeAbility.getInstance(); + break; + default: + gainedAbility = HasteAbility.getInstance(); + break; } game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.EndOfTurn), source); diff --git a/Mage.Sets/src/mage/cards/m/Magmasaur.java b/Mage.Sets/src/mage/cards/m/Magmasaur.java index a6e8c573f6..82fe68b611 100644 --- a/Mage.Sets/src/mage/cards/m/Magmasaur.java +++ b/Mage.Sets/src/mage/cards/m/Magmasaur.java @@ -108,7 +108,7 @@ class MagmasaurEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourceObject = (Permanent) source.getSourceObjectIfItStillExists(game); if (sourceObject != null && controller != null) { - if (controller.chooseUse(outcome, "Remove a +1/+1 counter from " + sourceObject.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Remove a +1/+1 counter from " + sourceObject.getLogName() + '?', source, game)) { sourceObject.removeCounters(CounterType.P1P1.getName(), 1, game); } else { int counters = sourceObject.getCounters(game).getCount(CounterType.P1P1); diff --git a/Mage.Sets/src/mage/cards/m/ManaVortex.java b/Mage.Sets/src/mage/cards/m/ManaVortex.java index f46e2b3237..9ca657b5ad 100644 --- a/Mage.Sets/src/mage/cards/m/ManaVortex.java +++ b/Mage.Sets/src/mage/cards/m/ManaVortex.java @@ -110,10 +110,10 @@ class CounterSourceEffect extends OneShotEffect { } if(spell != null){ Player controller = game.getPlayer(source.getControllerId()); - if(controller.chooseUse(Outcome.Detriment, "Sacrifice a land to not counter " + spell.getName() + "?", source, game)){ + if(controller.chooseUse(Outcome.Detriment, "Sacrifice a land to not counter " + spell.getName() + '?', source, game)){ SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledLandPermanent())); if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)){ - game.informPlayers(controller.getLogName() + " sacrifices a land to not counter " + spell.getName() + "."); + game.informPlayers(controller.getLogName() + " sacrifices a land to not counter " + spell.getName() + '.'); return true; } else { diff --git a/Mage.Sets/src/mage/cards/m/Mindblaze.java b/Mage.Sets/src/mage/cards/m/Mindblaze.java index 4917ffdac8..6bb549849b 100644 --- a/Mage.Sets/src/mage/cards/m/Mindblaze.java +++ b/Mage.Sets/src/mage/cards/m/Mindblaze.java @@ -113,8 +113,8 @@ class MindblazeEffect extends OneShotEffect { } } - game.informPlayers("Mindblaze, named card: [" + cardChoice.getChoice() + "]"); - game.informPlayers("Mindblaze, chosen number: [" + numberChoice.getChoice() + "]"); + game.informPlayers("Mindblaze, named card: [" + cardChoice.getChoice() + ']'); + game.informPlayers("Mindblaze, chosen number: [" + numberChoice.getChoice() + ']'); Cards cards = new CardsImpl(); cards.addAll(player.getLibrary().getCards(game)); diff --git a/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java b/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java index 67cf0f96a7..175418106f 100644 --- a/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java +++ b/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java @@ -124,7 +124,7 @@ class DoUnlessTargetPaysCost extends OneShotEffect { if (player != null && mageObject != null) { String message = userMessage; if (message == null) { - message = getCostText() + " to prevent " + executingEffect.getText(source.getModes().getMode()) + "?"; + message = getCostText() + " to prevent " + executingEffect.getText(source.getModes().getMode()) + '?'; } message = CardUtil.replaceSourceName(message, mageObject.getLogName()); cost.clearPaid(); diff --git a/Mage.Sets/src/mage/cards/m/MysticRemora.java b/Mage.Sets/src/mage/cards/m/MysticRemora.java index b69bda270e..62c0dd8dc4 100644 --- a/Mage.Sets/src/mage/cards/m/MysticRemora.java +++ b/Mage.Sets/src/mage/cards/m/MysticRemora.java @@ -145,7 +145,7 @@ class MysticRemoraTriggeredAbility extends TriggeredAbilityImpl { Cost cost = new GenericManaCost(4); String message = "Would you like to pay {4} to prevent the opponent to draw a card?"; if (!(opponent.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null))) { - if(controller.chooseUse(Outcome.DrawCard, "Draw a card (" + sourceObject.getLogName() +")", source, game)) { + if(controller.chooseUse(Outcome.DrawCard, "Draw a card (" + sourceObject.getLogName() + ')', source, game)) { controller.drawCards(1, game); } } diff --git a/Mage.Sets/src/mage/cards/n/NahiriTheLithomancer.java b/Mage.Sets/src/mage/cards/n/NahiriTheLithomancer.java index 5ab434ecab..289300c2c2 100644 --- a/Mage.Sets/src/mage/cards/n/NahiriTheLithomancer.java +++ b/Mage.Sets/src/mage/cards/n/NahiriTheLithomancer.java @@ -134,7 +134,7 @@ class NahiriTheLithomancerFirstAbilityEffect extends OneShotEffect { //TODO: Make sure the Equipment can legally enchant the token, preferably on targetting. Target target = new TargetControlledPermanent(0, 1, filter, true); if (target.canChoose(source.getSourceId(), controller.getId(), game) - && controller.chooseUse(outcome, "Attach an Equipment you control to the created " + tokenPermanent.getIdName() + "?", source, game)) { + && controller.chooseUse(outcome, "Attach an Equipment you control to the created " + tokenPermanent.getIdName() + '?', source, game)) { if (target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) { Permanent equipmentPermanent = game.getPermanent(target.getFirstTarget()); if (equipmentPermanent != null) { diff --git a/Mage.Sets/src/mage/cards/n/NarsetTranscendent.java b/Mage.Sets/src/mage/cards/n/NarsetTranscendent.java index 2565deb3f8..a4480cfdbb 100644 --- a/Mage.Sets/src/mage/cards/n/NarsetTranscendent.java +++ b/Mage.Sets/src/mage/cards/n/NarsetTranscendent.java @@ -257,7 +257,7 @@ class NarsetTranscendentCantCastEffect extends ContinuousRuleModifyingEffectImpl public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - return "You can't cast can't cast noncreature spells (it is prevented by emblem of " + mageObject.getLogName() + ")"; + return "You can't cast can't cast noncreature spells (it is prevented by emblem of " + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java b/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java index e00bef79a6..e7e24c4f24 100644 --- a/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java +++ b/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java @@ -110,7 +110,7 @@ class NayaSoulbeastCastEffect extends OneShotEffect { if (player.getLibrary().size() > 0) { Card card = player.getLibrary().getFromTop(game); cmc += card.getConvertedManaCost(); - player.revealCards(sourceObject.getName() + " (" + player.getName() + ")", new CardsImpl(card), game); + player.revealCards(sourceObject.getName() + " (" + player.getName() + ')', new CardsImpl(card), game); } } } diff --git a/Mage.Sets/src/mage/cards/n/NimDeathmantle.java b/Mage.Sets/src/mage/cards/n/NimDeathmantle.java index 1049bba9b9..8b53dab95e 100644 --- a/Mage.Sets/src/mage/cards/n/NimDeathmantle.java +++ b/Mage.Sets/src/mage/cards/n/NimDeathmantle.java @@ -151,7 +151,7 @@ class NimDeathmantleEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent equipment = game.getPermanent(source.getSourceId()); if (controller != null && equipment != null) { - if (controller.chooseUse(Outcome.Benefit, equipment.getName() + " - Pay " + cost.getText() + "?", source, game)) { + if (controller.chooseUse(Outcome.Benefit, equipment.getName() + " - Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { UUID target = targetPointer.getFirst(game, source); diff --git a/Mage.Sets/src/mage/cards/p/PardicDragon.java b/Mage.Sets/src/mage/cards/p/PardicDragon.java index d80d164648..066c516b47 100644 --- a/Mage.Sets/src/mage/cards/p/PardicDragon.java +++ b/Mage.Sets/src/mage/cards/p/PardicDragon.java @@ -113,7 +113,7 @@ class PardicDragonEffect extends OneShotEffect { Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); Card sourceCard = game.getCard(source.getSourceId()); if (opponent != null && sourceCard != null) { - if (opponent.chooseUse(outcome, new StringBuilder("Put a time counter on ").append(sourceCard.getName()).append("?").toString(), source, game)) { + if (opponent.chooseUse(outcome, new StringBuilder("Put a time counter on ").append(sourceCard.getName()).append('?').toString(), source, game)) { sourceCard.addCounters(CounterType.TIME.createInstance(), source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/p/Phantasmagorian.java b/Mage.Sets/src/mage/cards/p/Phantasmagorian.java index 0640ffcbd9..e58c48dfc6 100644 --- a/Mage.Sets/src/mage/cards/p/Phantasmagorian.java +++ b/Mage.Sets/src/mage/cards/p/Phantasmagorian.java @@ -101,9 +101,9 @@ class CounterSourceEffect extends OneShotEffect { Player player = game.getPlayer(playerId); cost.clearPaid(); if (cost.canPay(source, source.getSourceId(), player.getId(), game) - && player.chooseUse(outcome, "Discard three cards to counter " + sourceObject.getIdName() + "?", source, game)) { + && player.chooseUse(outcome, "Discard three cards to counter " + sourceObject.getIdName() + '?', source, game)) { if (cost.pay(source, game, source.getSourceId(), playerId, false, null)) { - game.informPlayers(player.getLogName() + " discards 3 cards to counter " + sourceObject.getIdName() + "."); + game.informPlayers(player.getLogName() + " discards 3 cards to counter " + sourceObject.getIdName() + '.'); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { game.getStack().counter(spell.getId(), source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianMarauder.java b/Mage.Sets/src/mage/cards/p/PhyrexianMarauder.java index eda4cad154..68bf40ed5b 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianMarauder.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianMarauder.java @@ -100,7 +100,7 @@ class PhyrexianMarauderCantAttackUnlessYouPayEffect extends CantAttackBlockUnles if (sourceObject != null) { int counter = sourceObject.getCounters(game).getCount(CounterType.P1P1); if (counter > 0) { - return new ManaCostsImpl<>("{" + counter + "}"); + return new ManaCostsImpl<>("{" + counter + '}'); } } return null; diff --git a/Mage.Sets/src/mage/cards/p/PowerSink.java b/Mage.Sets/src/mage/cards/p/PowerSink.java index 2273f48fce..6876100c93 100644 --- a/Mage.Sets/src/mage/cards/p/PowerSink.java +++ b/Mage.Sets/src/mage/cards/p/PowerSink.java @@ -98,7 +98,7 @@ class PowerSinkCounterUnlessPaysEffect extends OneShotEffect { int amount = source.getManaCostsToPay().getX(); if (amount > 0) { GenericManaCost cost = new GenericManaCost(amount); - StringBuilder sb = new StringBuilder("Pay ").append(cost.getText()).append("?"); + StringBuilder sb = new StringBuilder("Pay ").append(cost.getText()).append('?'); if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { game.informPlayers(new StringBuilder(sourceObject.getName()).append(": additional cost was paid").toString()); diff --git a/Mage.Sets/src/mage/cards/p/PyxisOfPandemonium.java b/Mage.Sets/src/mage/cards/p/PyxisOfPandemonium.java index 6db2e4c42a..73c19fe322 100644 --- a/Mage.Sets/src/mage/cards/p/PyxisOfPandemonium.java +++ b/Mage.Sets/src/mage/cards/p/PyxisOfPandemonium.java @@ -122,7 +122,7 @@ class PyxisOfPandemoniumExileEffect extends OneShotEffect { exileId = UUID.randomUUID(); exileIds.put(exileKey, exileId); } - player.moveCardsToExile(card, source, game, false, exileId, sourceObject.getIdName() + " (" + player.getName() + ")"); + player.moveCardsToExile(card, source, game, false, exileId, sourceObject.getIdName() + " (" + player.getName() + ')'); card.setFaceDown(true, game); } } diff --git a/Mage.Sets/src/mage/cards/q/Quicken.java b/Mage.Sets/src/mage/cards/q/Quicken.java index 41162038ec..04b2d4a018 100644 --- a/Mage.Sets/src/mage/cards/q/Quicken.java +++ b/Mage.Sets/src/mage/cards/q/Quicken.java @@ -153,12 +153,12 @@ class QuickenWatcher extends Watcher { } public void addQuickenSpell(UUID playerId, UUID sourceId, int zoneChangeCounter) { - String spellKey = playerId.toString() + sourceId.toString() + "_" + zoneChangeCounter; + String spellKey = playerId.toString() + sourceId.toString() + '_' + zoneChangeCounter; activeQuickenSpells.add(spellKey); } public boolean isQuickenSpellActive(UUID playerId, UUID sourceId, int zoneChangeCounter) { - String spellKey = playerId.toString() + sourceId.toString() + "_" + zoneChangeCounter; + String spellKey = playerId.toString() + sourceId.toString() + '_' + zoneChangeCounter; return activeQuickenSpells.contains(spellKey); } diff --git a/Mage.Sets/src/mage/cards/r/ResearchDevelopment.java b/Mage.Sets/src/mage/cards/r/ResearchDevelopment.java index 9601fb20d3..1646982006 100644 --- a/Mage.Sets/src/mage/cards/r/ResearchDevelopment.java +++ b/Mage.Sets/src/mage/cards/r/ResearchDevelopment.java @@ -127,7 +127,7 @@ class ResearchEffect extends OneShotEffect { textToAsk = new StringBuilder(choiceText); textToAsk.append(" ("); textToAsk.append(count); - textToAsk.append(")"); + textToAsk.append(')'); } } @@ -170,7 +170,7 @@ class DevelopmentEffect extends OneShotEffect { for (UUID opponentUuid : opponents) { Player opponent = game.getPlayer(opponentUuid); if (opponent != null && opponent.chooseUse(Outcome.Detriment, - "Allow " + player.getLogName() + " to draw a card instead? (" + Integer.toString(i+1) + ")", source, game)) { + "Allow " + player.getLogName() + " to draw a card instead? (" + Integer.toString(i+1) + ')', source, game)) { game.informPlayers(opponent.getLogName() + " had chosen to let " + player.getLogName() + " draw a card."); player.drawCards(1, game); putToken = false; diff --git a/Mage.Sets/src/mage/cards/r/ReverseTheSands.java b/Mage.Sets/src/mage/cards/r/ReverseTheSands.java index 6053a99996..970864b126 100644 --- a/Mage.Sets/src/mage/cards/r/ReverseTheSands.java +++ b/Mage.Sets/src/mage/cards/r/ReverseTheSands.java @@ -105,7 +105,7 @@ class ReverseTheSandsEffect extends OneShotEffect { } else { selectedChoice = choices.iterator().next(); } - int index = selectedChoice.indexOf(" "); + int index = selectedChoice.indexOf(' '); if (index > 0) { String lifeString = selectedChoice.substring(0, index); int life = Integer.parseInt(lifeString); diff --git a/Mage.Sets/src/mage/cards/r/RhysticStudy.java b/Mage.Sets/src/mage/cards/r/RhysticStudy.java index d00a339e8d..41e2e18fda 100644 --- a/Mage.Sets/src/mage/cards/r/RhysticStudy.java +++ b/Mage.Sets/src/mage/cards/r/RhysticStudy.java @@ -92,7 +92,7 @@ class RhysticStudyDrawEffect extends OneShotEffect { Cost cost = new GenericManaCost(1); String message = "Would you like to pay {1} to prevent the opponent to draw a card?"; if (!(opponent.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null))) { - if(controller.chooseUse(Outcome.DrawCard, "Draw a card (" + sourceObject.getLogName() +")", source, game)) { + if(controller.chooseUse(Outcome.DrawCard, "Draw a card (" + sourceObject.getLogName() + ')', source, game)) { controller.drawCards(1, game); } } diff --git a/Mage.Sets/src/mage/cards/r/RidersOfGavony.java b/Mage.Sets/src/mage/cards/r/RidersOfGavony.java index 074ada3a05..4c1fae2158 100644 --- a/Mage.Sets/src/mage/cards/r/RidersOfGavony.java +++ b/Mage.Sets/src/mage/cards/r/RidersOfGavony.java @@ -114,7 +114,7 @@ class RidersOfGavonyGainAbilityControlledEffect extends ContinuousEffectImpl { if (permanent != null) { String subtype = (String) game.getState().getValue(permanent.getId() + "_type"); if (subtype != null) { - protectionFilter = new FilterPermanent(subtype + "s"); + protectionFilter = new FilterPermanent(subtype + 's'); protectionFilter.add(new SubtypePredicate(subtype)); } } diff --git a/Mage.Sets/src/mage/cards/r/RunedHalo.java b/Mage.Sets/src/mage/cards/r/RunedHalo.java index 7e5a7d8e0d..f6d89e6dfb 100644 --- a/Mage.Sets/src/mage/cards/r/RunedHalo.java +++ b/Mage.Sets/src/mage/cards/r/RunedHalo.java @@ -96,7 +96,7 @@ class RunedHaloSetProtectionEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY); if (controller != null && cardName != null && !cardName.isEmpty()) { - FilterObject filter = new FilterObject("the name [" + cardName + "]"); + FilterObject filter = new FilterObject("the name [" + cardName + ']'); filter.add(new NamePredicate(cardName)); ContinuousEffect effect = new GainAbilityControllerEffect(new ProtectionAbility(filter), Duration.Custom); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/s/SarpadianEmpiresVolVii.java b/Mage.Sets/src/mage/cards/s/SarpadianEmpiresVolVii.java index f205359c8a..d2effe914a 100644 --- a/Mage.Sets/src/mage/cards/s/SarpadianEmpiresVolVii.java +++ b/Mage.Sets/src/mage/cards/s/SarpadianEmpiresVolVii.java @@ -135,20 +135,22 @@ class CreateSelectedTokenEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { String tokenType = game.getState().getValue(source.getSourceId().toString() + "_SarpadianEmpiresVolVii").toString(); Token token; - if(tokenType.equals("White Citizen")) { - token = new CitizenToken(); - } - else if(tokenType.equals("Blue Camarid")) { - token = new CamaridToken(); - } - else if(tokenType.equals("Black Thrull")) { - token = new ThrullToken(); - } - else if(tokenType.equals("Red Goblin")) { - token = new GoblinToken(); - } - else { - token = new SaprolingToken(); + switch (tokenType) { + case "White Citizen": + token = new CitizenToken(); + break; + case "Blue Camarid": + token = new CamaridToken(); + break; + case "Black Thrull": + token = new ThrullToken(); + break; + case "Red Goblin": + token = new GoblinToken(); + break; + default: + token = new SaprolingToken(); + break; } token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); return true; diff --git a/Mage.Sets/src/mage/cards/s/SavageSummoning.java b/Mage.Sets/src/mage/cards/s/SavageSummoning.java index 645a1bf1bd..1633ecd3f6 100644 --- a/Mage.Sets/src/mage/cards/s/SavageSummoning.java +++ b/Mage.Sets/src/mage/cards/s/SavageSummoning.java @@ -182,7 +182,7 @@ class SavageSummoningWatcher extends Watcher { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && spell.getCardType().contains(CardType.CREATURE)) { spellsCastWithSavageSummoning.put(spell.getId(), new HashSet<>(savageSummoningSpells)); - String cardKey = new StringBuilder(spell.getCard().getId().toString()).append("_").append(spell.getCard().getZoneChangeCounter(game)).toString(); + String cardKey = new StringBuilder(spell.getCard().getId().toString()).append('_').append(spell.getCard().getZoneChangeCounter(game)).toString(); cardsCastWithSavageSummoning.put(cardKey, new HashSet<>(savageSummoningSpells)); savageSummoningSpells.clear(); } @@ -191,7 +191,7 @@ class SavageSummoningWatcher extends Watcher { } public void setSavageSummoningSpellActive(Card card, Game game) { - String cardKey = new StringBuilder(card.getId().toString()).append("_").append(card.getZoneChangeCounter(game)).toString(); + String cardKey = new StringBuilder(card.getId().toString()).append('_').append(card.getZoneChangeCounter(game)).toString(); savageSummoningSpells.add(cardKey); } @@ -200,15 +200,15 @@ class SavageSummoningWatcher extends Watcher { } public boolean isSpellCastWithThisSavageSummoning(UUID spellId, UUID cardId, int zoneChangeCounter) { - String cardKey = new StringBuilder(cardId.toString()).append("_").append(zoneChangeCounter).toString(); + String cardKey = new StringBuilder(cardId.toString()).append('_').append(zoneChangeCounter).toString(); HashSet savageSpells = (HashSet) spellsCastWithSavageSummoning.get(spellId); return savageSpells != null && savageSpells.contains(cardKey); } public boolean isCardCastWithThisSavageSummoning(Card card, UUID cardId, int zoneChangeCounter, Game game) { - String creatureCardKey = card.getId().toString() + "_" + (card.getZoneChangeCounter(game)); + String creatureCardKey = card.getId().toString() + '_' + (card.getZoneChangeCounter(game)); // add one because card is now gone to battlefield as creature - String cardKey = cardId.toString() + "_" + zoneChangeCounter; + String cardKey = cardId.toString() + '_' + zoneChangeCounter; HashSet savageSpells = (HashSet) cardsCastWithSavageSummoning.get(creatureCardKey); return savageSpells != null && savageSpells.contains(cardKey); } diff --git a/Mage.Sets/src/mage/cards/s/ScoutsWarning.java b/Mage.Sets/src/mage/cards/s/ScoutsWarning.java index 5eab7fabbf..bf81872687 100644 --- a/Mage.Sets/src/mage/cards/s/ScoutsWarning.java +++ b/Mage.Sets/src/mage/cards/s/ScoutsWarning.java @@ -152,12 +152,12 @@ class ScoutsWarningWatcher extends Watcher { } public void addScoutsWarningSpell(UUID sourceId, int zoneChangeCounter) { - String spellKey = new StringBuilder(sourceId.toString()).append("_").append(zoneChangeCounter).toString(); + String spellKey = new StringBuilder(sourceId.toString()).append('_').append(zoneChangeCounter).toString(); activeScoutsWarningSpells.add(spellKey); } public boolean isScoutsWarningSpellActive(UUID sourceId, int zoneChangeCounter) { - String spellKey = new StringBuilder(sourceId.toString()).append("_").append(zoneChangeCounter).toString(); + String spellKey = new StringBuilder(sourceId.toString()).append('_').append(zoneChangeCounter).toString(); return activeScoutsWarningSpells.contains(spellKey); } diff --git a/Mage.Sets/src/mage/cards/s/SealOfTheGuildpact.java b/Mage.Sets/src/mage/cards/s/SealOfTheGuildpact.java index 3c06e7928e..e9e815b992 100644 --- a/Mage.Sets/src/mage/cards/s/SealOfTheGuildpact.java +++ b/Mage.Sets/src/mage/cards/s/SealOfTheGuildpact.java @@ -132,7 +132,7 @@ class SealOfTheGuildpactChooseColorEffect extends OneShotEffect { } String color2 = choice2.getChoice(); if (!game.isSimulation()) { - game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + color1 + " and " + color2 + "."); + game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + color1 + " and " + color2 + '.'); } game.getState().setValue(mageObject.getId() + "_color1", choice1.getColor()); game.getState().setValue(mageObject.getId() + "_color2", choice2.getColor()); diff --git a/Mage.Sets/src/mage/cards/s/SenTriplets.java b/Mage.Sets/src/mage/cards/s/SenTriplets.java index 4a260e2a05..715c6d9873 100644 --- a/Mage.Sets/src/mage/cards/s/SenTriplets.java +++ b/Mage.Sets/src/mage/cards/s/SenTriplets.java @@ -112,7 +112,7 @@ class SenTripletsRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl { MageObject mageObject = game.getObject(source.getSourceId()); if (targetPlayer != null && mageObject != null) { return "This turn you can't cast spells or activate abilities" + - " (" + mageObject.getLogName() + ")"; + " (" + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage.Sets/src/mage/cards/s/Shapeshifter.java b/Mage.Sets/src/mage/cards/s/Shapeshifter.java index b17dce99c4..4194f86be8 100644 --- a/Mage.Sets/src/mage/cards/s/Shapeshifter.java +++ b/Mage.Sets/src/mage/cards/s/Shapeshifter.java @@ -119,7 +119,7 @@ class ShapeshifterEffect extends OneShotEffect { return false; } } - game.informPlayers("Shapeshifter, chosen number: [" + numberChoice.getChoice() + "]"); + game.informPlayers("Shapeshifter, chosen number: [" + numberChoice.getChoice() + ']'); game.getState().setValue(source.getSourceId().toString() + "_Shapeshifter", numberChoice.getChoice()); if (mageObject instanceof Permanent) { ((Permanent) mageObject).addInfo("lastChosenNumber", CardUtil.addToolTipMarkTags("Last chosen number: " + numberChoice.getChoice()), game); diff --git a/Mage.Sets/src/mage/cards/s/SharedFate.java b/Mage.Sets/src/mage/cards/s/SharedFate.java index f3bb10985c..1d12d4d225 100644 --- a/Mage.Sets/src/mage/cards/s/SharedFate.java +++ b/Mage.Sets/src/mage/cards/s/SharedFate.java @@ -109,7 +109,7 @@ class SharedFateReplacementEffect extends ReplacementEffectImpl { game, false, CardUtil.getExileZoneId(source.getSourceId().toString() + sourcePermanent.getZoneChangeCounter(game) + playerToDraw.getId().toString(), game), - "Shared Fate (" + playerToDraw.getName() + ")"); + "Shared Fate (" + playerToDraw.getName() + ')'); card.setFaceDown(true, game); } } @@ -159,7 +159,7 @@ class SharedFatePlayEffect extends AsThoughEffectImpl { if (exileId != null) { ExileZone exileZone = game.getExile().getExileZone(exileId); if (exileZone != null && exileZone.contains(objectId)) { - if (player.chooseUse(outcome, "Play " + game.getCard(objectId).getIdName() + "?", source, game)) { + if (player.chooseUse(outcome, "Play " + game.getCard(objectId).getIdName() + '?', source, game)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SimicManipulator.java b/Mage.Sets/src/mage/cards/s/SimicManipulator.java index 79db02c1e2..28682aea6f 100644 --- a/Mage.Sets/src/mage/cards/s/SimicManipulator.java +++ b/Mage.Sets/src/mage/cards/s/SimicManipulator.java @@ -143,6 +143,6 @@ class SimicManipulatorGainControlTargetEffect extends ContinuousEffectImpl { @Override public String getText(Mode mode) { - return "Gain control of target " + mode.getTargets().get(0).getTargetName() + " " + duration.toString(); + return "Gain control of target " + mode.getTargets().get(0).getTargetName() + ' ' + duration.toString(); } } diff --git a/Mage.Sets/src/mage/cards/s/SoulFoundry.java b/Mage.Sets/src/mage/cards/s/SoulFoundry.java index 4d8651a89a..1b2c712dba 100644 --- a/Mage.Sets/src/mage/cards/s/SoulFoundry.java +++ b/Mage.Sets/src/mage/cards/s/SoulFoundry.java @@ -137,7 +137,7 @@ class SoulFoundryImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + "]"), game); + permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + ']'), game); } } } diff --git a/Mage.Sets/src/mage/cards/s/SparkOfCreativity.java b/Mage.Sets/src/mage/cards/s/SparkOfCreativity.java index 9c4acfb0be..1db8aab6db 100644 --- a/Mage.Sets/src/mage/cards/s/SparkOfCreativity.java +++ b/Mage.Sets/src/mage/cards/s/SparkOfCreativity.java @@ -98,7 +98,7 @@ class SparkOfCreativityEffect extends OneShotEffect { Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { int cmc = card.getManaCost().convertedManaCost(); - if (controller.chooseUse(outcome, "Let " + sourceObject.getLogName() + " deal " + cmc + " damage to " + targetCreature.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Let " + sourceObject.getLogName() + " deal " + cmc + " damage to " + targetCreature.getLogName() + '?', source, game)) { targetCreature.damage(cmc, source.getSourceId(), game, false, true); return true; } diff --git a/Mage.Sets/src/mage/cards/s/Spellbinder.java b/Mage.Sets/src/mage/cards/s/Spellbinder.java index 1012fc39c7..482c7e4d19 100644 --- a/Mage.Sets/src/mage/cards/s/Spellbinder.java +++ b/Mage.Sets/src/mage/cards/s/Spellbinder.java @@ -147,7 +147,7 @@ class SpellbinderImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + "]"), game); + permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + ']'), game); } } } @@ -189,7 +189,7 @@ class SpellbinderCopyEffect extends OneShotEffect { if (spellbinder != null && spellbinder.getImprinted() != null && !spellbinder.getImprinted().isEmpty()) { Card imprintedInstant = game.getCard(spellbinder.getImprinted().get(0)); if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) { - if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append("?").toString(), source, game)) { + if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append('?').toString(), source, game)) { Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId()); if (copiedCard != null) { game.getExile().add(source.getSourceId(), "", copiedCard); diff --git a/Mage.Sets/src/mage/cards/s/SphereOfSafety.java b/Mage.Sets/src/mage/cards/s/SphereOfSafety.java index af97aa7eae..af2255a56f 100644 --- a/Mage.Sets/src/mage/cards/s/SphereOfSafety.java +++ b/Mage.Sets/src/mage/cards/s/SphereOfSafety.java @@ -81,7 +81,7 @@ class SphereOfSafetyPayManaToAttackAllEffect extends CantAttackYouUnlessPayManaA public ManaCosts getManaCostToPay(GameEvent event, Ability source, Game game) { int enchantments = game.getBattlefield().countAll(new FilterEnchantmentPermanent(), source.getControllerId(), game); if (enchantments > 0) { - return new ManaCostsImpl<>("{" + enchantments + "}"); + return new ManaCostsImpl<>("{" + enchantments + '}'); } return null; } diff --git a/Mage.Sets/src/mage/cards/s/SphinxAmbassador.java b/Mage.Sets/src/mage/cards/s/SphinxAmbassador.java index 1c2a4b062f..d2bd6f6fdd 100644 --- a/Mage.Sets/src/mage/cards/s/SphinxAmbassador.java +++ b/Mage.Sets/src/mage/cards/s/SphinxAmbassador.java @@ -121,7 +121,7 @@ class SphinxAmbassadorEffect extends OneShotEffect { } String cardName = cardChoice.getChoice(); - game.informPlayers(new StringBuilder(sourcePermanent.getName()).append(", named card: [").append(cardName).append("]").toString()); + game.informPlayers(new StringBuilder(sourcePermanent.getName()).append(", named card: [").append(cardName).append(']').toString()); if (!card.getName().equals(cardName) && card.getCardType().contains(CardType.CREATURE)) { if (controller.chooseUse(outcome, new StringBuilder("Put ").append(card.getName()).append(" onto the battlefield?").toString(), source, game)) { controller.moveCards(card, Zone.BATTLEFIELD, source, game); diff --git a/Mage.Sets/src/mage/cards/s/SphinxOfUthuun.java b/Mage.Sets/src/mage/cards/s/SphinxOfUthuun.java index 3731a6102f..15dbf48a6a 100644 --- a/Mage.Sets/src/mage/cards/s/SphinxOfUthuun.java +++ b/Mage.Sets/src/mage/cards/s/SphinxOfUthuun.java @@ -162,13 +162,13 @@ class SphinxOfUthuunEffect extends OneShotEffect { } game.informPlayers(sb.toString()); - sb = new StringBuilder(sourceObject.getLogName()).append(": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (":"); + sb = new StringBuilder(sourceObject.getLogName()).append(": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (':'); i = 0; for (UUID cardUuid : pile2CardsIds) { Card card = game.getCard(cardUuid); if (card != null) { i++; - sb.append(" ").append(card.getName()); + sb.append(' ').append(card.getName()); if (i < pile2CardsIds.size()) { sb.append(", "); } diff --git a/Mage.Sets/src/mage/cards/s/SqueesRevenge.java b/Mage.Sets/src/mage/cards/s/SqueesRevenge.java index e7d050422c..b360c55ac5 100644 --- a/Mage.Sets/src/mage/cards/s/SqueesRevenge.java +++ b/Mage.Sets/src/mage/cards/s/SqueesRevenge.java @@ -80,7 +80,7 @@ class SqueesRevengeEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if(player != null) { int number = player.announceXMana(0, Integer.MAX_VALUE, "Choose how many times to flip a coin", game, source); - game.informPlayers(player.getLogName() + " chooses " + number + "."); + game.informPlayers(player.getLogName() + " chooses " + number + '.'); for(int i = 0; i < number; i++) { if(!player.flipCoin(game)) { return true; diff --git a/Mage.Sets/src/mage/cards/s/SteamAugury.java b/Mage.Sets/src/mage/cards/s/SteamAugury.java index e6287d3ac4..7644421780 100644 --- a/Mage.Sets/src/mage/cards/s/SteamAugury.java +++ b/Mage.Sets/src/mage/cards/s/SteamAugury.java @@ -161,13 +161,13 @@ class SteamAuguryEffect extends OneShotEffect { } game.informPlayers(sb.toString()); - sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(":"); + sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(':'); i = 0; for (UUID cardUuid : pile2CardsIds) { Card card = game.getCard(cardUuid); if (card != null) { i++; - sb.append(" ").append(GameLog.getColoredObjectName(card)); + sb.append(' ').append(GameLog.getColoredObjectName(card)); if (i < pile2CardsIds.size()) { sb.append(", "); } diff --git a/Mage.Sets/src/mage/cards/s/StonewiseFortifier.java b/Mage.Sets/src/mage/cards/s/StonewiseFortifier.java index 2f8726a477..772587ec89 100644 --- a/Mage.Sets/src/mage/cards/s/StonewiseFortifier.java +++ b/Mage.Sets/src/mage/cards/s/StonewiseFortifier.java @@ -104,7 +104,7 @@ class StonewiseFortifierPreventAllDamageToEffect extends PreventionEffectImpl { if (damageSource != null && preventionSource != null) { StringBuilder message = new StringBuilder(preventedDamage).append(" damage from "); message.append(damageSource.getName()).append(" prevented "); - message.append("(").append(preventionSource).append(")"); + message.append('(').append(preventionSource).append(')'); game.informPlayers(message.toString()); } event.setAmount(0); diff --git a/Mage.Sets/src/mage/cards/s/StrongholdGambit.java b/Mage.Sets/src/mage/cards/s/StrongholdGambit.java index 0d4c93bd21..f1b9620544 100644 --- a/Mage.Sets/src/mage/cards/s/StrongholdGambit.java +++ b/Mage.Sets/src/mage/cards/s/StrongholdGambit.java @@ -106,7 +106,7 @@ class StrongholdGambitEffect extends OneShotEffect { Card card = game.getCard(choosenCard.get(playerId)); if (card != null) { Cards cardsToReveal = new CardsImpl(card); - player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", cardsToReveal, game); + player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', cardsToReveal, game); if (card.getCardType().contains(CardType.CREATURE) && lowestCMC > card.getConvertedManaCost()) { lowestCMC = card.getConvertedManaCost(); diff --git a/Mage.Sets/src/mage/cards/t/TemporalExtortion.java b/Mage.Sets/src/mage/cards/t/TemporalExtortion.java index ee47429139..832f9a188d 100644 --- a/Mage.Sets/src/mage/cards/t/TemporalExtortion.java +++ b/Mage.Sets/src/mage/cards/t/TemporalExtortion.java @@ -89,10 +89,10 @@ class TemporalExtortionCounterSourceEffect extends OneShotEffect { if (sourceObject != null) { for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) { Player player = game.getPlayer(playerId); - if (player.chooseUse(outcome, "Pay half your life, rounded up to counter " + sourceObject.getIdName() + "?", source, game)) { + if (player.chooseUse(outcome, "Pay half your life, rounded up to counter " + sourceObject.getIdName() + '?', source, game)) { Integer amount = (int) Math.ceil(player.getLife() / 2f); player.loseLife(amount, game, false); - game.informPlayers(player.getLogName() + " pays half his or her life, rounded up to counter " + sourceObject.getIdName() + "."); + game.informPlayers(player.getLogName() + " pays half his or her life, rounded up to counter " + sourceObject.getIdName() + '.'); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { game.getStack().counter(spell.getId(), source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/t/TheTabernacleAtPendrellVale.java b/Mage.Sets/src/mage/cards/t/TheTabernacleAtPendrellVale.java index 2efb2539a5..07dd69ea82 100644 --- a/Mage.Sets/src/mage/cards/t/TheTabernacleAtPendrellVale.java +++ b/Mage.Sets/src/mage/cards/t/TheTabernacleAtPendrellVale.java @@ -89,7 +89,7 @@ class DestroySourceUnlessPaysEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { - if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "?", source, game)) { + if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; diff --git a/Mage.Sets/src/mage/cards/t/ThoughtPrison.java b/Mage.Sets/src/mage/cards/t/ThoughtPrison.java index 085d39a818..606a57c384 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtPrison.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtPrison.java @@ -120,7 +120,7 @@ class ThoughtPrisonImprintEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.imprint(card.getId(), game); - permanent.addInfo("imprint", new StringBuilder("[Exiled card - ").append(card.getName()).append("]").toString(), game); + permanent.addInfo("imprint", new StringBuilder("[Exiled card - ").append(card.getName()).append(']').toString(), game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TimeVault.java b/Mage.Sets/src/mage/cards/t/TimeVault.java index d118f7be6a..29b20b4893 100644 --- a/Mage.Sets/src/mage/cards/t/TimeVault.java +++ b/Mage.Sets/src/mage/cards/t/TimeVault.java @@ -118,7 +118,7 @@ class TimeVaultReplacementEffect extends ReplacementEffectImpl { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { - if (player.chooseUse(Outcome.Untap, "Skip your turn to untap " + permanent.getName() + "?", source, game)) { + if (player.chooseUse(Outcome.Untap, "Skip your turn to untap " + permanent.getName() + '?', source, game)) { permanent.untap(game); game.informPlayers(player.getLogName() + " skips his or her turn to untap " + permanent.getLogName()); return true; diff --git a/Mage.Sets/src/mage/cards/t/ToilsOfNightAndDay.java b/Mage.Sets/src/mage/cards/t/ToilsOfNightAndDay.java index bf645b6178..5ce5b0c0a0 100644 --- a/Mage.Sets/src/mage/cards/t/ToilsOfNightAndDay.java +++ b/Mage.Sets/src/mage/cards/t/ToilsOfNightAndDay.java @@ -89,9 +89,9 @@ public class ToilsOfNightAndDay extends CardImpl { for (UUID targetId : source.getTargets().get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - if (player.chooseUse(Outcome.Tap, new StringBuilder("Tap ").append(permanent.getName()).append("?").toString(), source, game)) { + if (player.chooseUse(Outcome.Tap, new StringBuilder("Tap ").append(permanent.getName()).append('?').toString(), source, game)) { permanent.tap(game); - } else if (player.chooseUse(Outcome.Untap, new StringBuilder("Untap ").append(permanent.getName()).append("?").toString(), source, game)) { + } else if (player.chooseUse(Outcome.Untap, new StringBuilder("Untap ").append(permanent.getName()).append('?').toString(), source, game)) { permanent.untap(game); } } diff --git a/Mage.Sets/src/mage/cards/t/TorrentialGearhulk.java b/Mage.Sets/src/mage/cards/t/TorrentialGearhulk.java index 39ebe3e996..0f5bcee906 100644 --- a/Mage.Sets/src/mage/cards/t/TorrentialGearhulk.java +++ b/Mage.Sets/src/mage/cards/t/TorrentialGearhulk.java @@ -112,7 +112,7 @@ class TorrentialGearhulkEffect extends OneShotEffect { if (controller != null) { Card card = game.getCard(this.getTargetPointer().getFirst(game, source)); if (card != null) { - if (controller.chooseUse(outcome, "Cast " + card.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Cast " + card.getLogName() + '?', source, game)) { if (controller.cast(card.getSpellAbility(), game, true)) { ContinuousEffect effect = new TorrentialGearhulkReplacementEffect(card.getId()); effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId()))); diff --git a/Mage.Sets/src/mage/cards/w/WarCadence.java b/Mage.Sets/src/mage/cards/w/WarCadence.java index 76dd94dfbb..2a5f38d0f3 100644 --- a/Mage.Sets/src/mage/cards/w/WarCadence.java +++ b/Mage.Sets/src/mage/cards/w/WarCadence.java @@ -87,7 +87,7 @@ class WarCadenceReplacementEffect extends ReplacementEffectImpl { if (player != null) { int amount = xCosts.calculate(game, source, this); if (amount > 0) { - String mana = "{" + amount + "}"; + String mana = "{" + amount + '}'; ManaCostsImpl cost = new ManaCostsImpl(mana); if (cost.canPay(source, source.getSourceId(), event.getPlayerId(), game) && player.chooseUse(Outcome.Benefit, "Pay " + mana + " to declare blocker?", source, game)) { diff --git a/Mage.Sets/src/mage/cards/w/WarTax.java b/Mage.Sets/src/mage/cards/w/WarTax.java index 2beac05396..5cae163e64 100644 --- a/Mage.Sets/src/mage/cards/w/WarTax.java +++ b/Mage.Sets/src/mage/cards/w/WarTax.java @@ -87,7 +87,7 @@ class WarTaxReplacementEffect extends ReplacementEffectImpl { if (player != null) { int amount = xCosts.calculate(game, source, this); if (amount > 0) { - String mana = "{" + amount + "}"; + String mana = "{" + amount + '}'; ManaCostsImpl cost = new ManaCostsImpl(mana); if (cost.canPay(source, source.getSourceId(), event.getPlayerId(), game) && player.chooseUse(Outcome.Benefit, "Pay " + mana + " to declare attacker?", source, game)) { diff --git a/Mage.Sets/src/mage/cards/w/WarpWorld.java b/Mage.Sets/src/mage/cards/w/WarpWorld.java index 2608475d80..b74b899fa9 100644 --- a/Mage.Sets/src/mage/cards/w/WarpWorld.java +++ b/Mage.Sets/src/mage/cards/w/WarpWorld.java @@ -132,7 +132,7 @@ class WarpWorldEffect extends OneShotEffect { if (player != null) { CardsImpl cards = new CardsImpl(); cards.addAll(player.getLibrary().getTopCards(game, permanentsCount.get(player.getId()))); - player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", cards, game); + player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', cards, game); cardsRevealed.put(player.getId(), cards); } } diff --git a/Mage.Sets/src/mage/cards/w/WeirdHarvest.java b/Mage.Sets/src/mage/cards/w/WeirdHarvest.java index c6ffb034ee..96091a99d6 100644 --- a/Mage.Sets/src/mage/cards/w/WeirdHarvest.java +++ b/Mage.Sets/src/mage/cards/w/WeirdHarvest.java @@ -118,7 +118,7 @@ class WeirdHarvestEffect extends OneShotEffect { if (target.getTargets().size() > 0) { Cards cards = new CardsImpl(target.getTargets()); player.moveCards(cards, Zone.HAND, source, game); - player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", cards, game); + player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', cards, game); } } } diff --git a/Mage.Sets/src/mage/cards/w/WellOfLostDreams.java b/Mage.Sets/src/mage/cards/w/WellOfLostDreams.java index 81a4686a1e..9eb26ebc9c 100644 --- a/Mage.Sets/src/mage/cards/w/WellOfLostDreams.java +++ b/Mage.Sets/src/mage/cards/w/WellOfLostDreams.java @@ -87,7 +87,7 @@ class WellOfLostDreamsEffect extends OneShotEffect { int xValue = controller.announceXMana(0, amount, "Announce X Value", game, source); if (xValue > 0) { if (new GenericManaCost(xValue).pay(source, game, source.getSourceId(), controller.getId(), false)) { - game.informPlayers(new StringBuilder(controller.getLogName()).append(" payed {").append(xValue).append("}").toString()); + game.informPlayers(new StringBuilder(controller.getLogName()).append(" payed {").append(xValue).append('}').toString()); controller.drawCards(xValue, game); } else { return false; diff --git a/Mage.Sets/src/mage/cards/w/WhimsOfTheFates.java b/Mage.Sets/src/mage/cards/w/WhimsOfTheFates.java index 30f70be1ad..327b53cef5 100644 --- a/Mage.Sets/src/mage/cards/w/WhimsOfTheFates.java +++ b/Mage.Sets/src/mage/cards/w/WhimsOfTheFates.java @@ -143,7 +143,7 @@ class WhimsOfTheFateEffect extends OneShotEffect { for (UUID permanentId : target.getTargets()) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { - message.append(permanent.getName()).append(" "); + message.append(permanent.getName()).append(' '); } } } @@ -156,7 +156,7 @@ class WhimsOfTheFateEffect extends OneShotEffect { for (Permanent permanent : game.getState().getBattlefield().getAllActivePermanents(currentPlayer.getId())) { if (!playerPiles.get(1).contains(permanent.getId()) && !playerPiles.get(2).contains(permanent.getId())) { playerPiles.get(3).add(permanent.getId()); - message.append(permanent.getName()).append(" "); + message.append(permanent.getName()).append(' '); } } if (playerPiles.get(3).isEmpty()) { diff --git a/Mage.Sets/src/mage/cards/w/WoodSage.java b/Mage.Sets/src/mage/cards/w/WoodSage.java index 1838a6a47d..c562393390 100644 --- a/Mage.Sets/src/mage/cards/w/WoodSage.java +++ b/Mage.Sets/src/mage/cards/w/WoodSage.java @@ -107,7 +107,7 @@ class WoodSageEffect extends OneShotEffect { } String cardName = cardChoice.getChoice(); if (!game.isSimulation()) { - game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + "]"); + game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + ']'); } FilterCreatureCard filter = new FilterCreatureCard("all of them with that name"); diff --git a/Mage.Sets/src/mage/cards/z/ZursWeirding.java b/Mage.Sets/src/mage/cards/z/ZursWeirding.java index b50b3f5b6e..4026213b23 100644 --- a/Mage.Sets/src/mage/cards/z/ZursWeirding.java +++ b/Mage.Sets/src/mage/cards/z/ZursWeirding.java @@ -101,7 +101,7 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl { Card card = player.getLibrary().getFromTop(game); if (card != null) { // reveals it instead - player.revealCards(sourceObject.getIdName() + " next draw of " + player.getName() + " (" + game.getTurnNum() + "|" + game.getPhase().getType() + ")", new CardsImpl(card), game); + player.revealCards(sourceObject.getIdName() + " next draw of " + player.getName() + " (" + game.getTurnNum() + '|' + game.getPhase().getType() + ')', new CardsImpl(card), game); // Then any other player may pay 2 life. If a player does, put that card into its owner's graveyard String message = "Pay 2 life to put " + card.getLogName() + " into graveyard?"; diff --git a/Mage.Stats/src/main/java/com/xmage/ws/util/json/JSONParser.java b/Mage.Stats/src/main/java/com/xmage/ws/util/json/JSONParser.java index 62e000d45c..3654f32585 100644 --- a/Mage.Stats/src/main/java/com/xmage/ws/util/json/JSONParser.java +++ b/Mage.Stats/src/main/java/com/xmage/ws/util/json/JSONParser.java @@ -97,9 +97,9 @@ public class JSONParser { json = (JSONObject) jsonArray.get(index); jsonArray = null; } else if (param.contains("[")) { - int find = param.indexOf("["); + int find = param.indexOf('['); String newParam = param.substring(0, find); - String s = param.substring(find+1, param.indexOf("]")); + String s = param.substring(find+1, param.indexOf(']')); if (s.isEmpty()) { jsonArray = (JSONArray) json.get(newParam); json = null; diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/cost/modification/BattlefieldThaumaturgeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/cost/modification/BattlefieldThaumaturgeTest.java index a779b7e5ee..9b446aee8c 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/cost/modification/BattlefieldThaumaturgeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/cost/modification/BattlefieldThaumaturgeTest.java @@ -201,7 +201,7 @@ public class BattlefieldThaumaturgeTest extends CardTestPlayerBase { * For each creature destroyed this way, its controller puts a 4/4 red Dragon creature token with flying onto the battlefield. * Battlefield Thaumaturge should reduce the cost of the spell when cast, before he is destroyed and replaced with a dragon. */ - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Descent of the Dragons", createTargetingString(playerACreatures) + "^" + createTargetingString(playerBCreatures)); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Descent of the Dragons", createTargetingString(playerACreatures) + '^' + createTargetingString(playerBCreatures)); setStopAt(1, PhaseStep.END_TURN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java index b611c66f88..821954e2d9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java @@ -200,7 +200,7 @@ public class RandomPlayer extends ComputerPlayer { 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') { diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index e86fc59995..5d98013248 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -491,7 +491,7 @@ public class TestPlayer implements Player { if (numberOfActions == actions.size()) { foundNoAction++; if (foundNoAction > maxCallsWithoutAction) { - throw new AssertionError("More priority calls to " + getName() + " and doing no action than allowed (" + maxCallsWithoutAction + ")"); + throw new AssertionError("More priority calls to " + getName() + " and doing no action than allowed (" + maxCallsWithoutAction + ')'); } } else { foundNoAction = 0; @@ -671,7 +671,7 @@ public class TestPlayer implements Player { break; } } - } else if ((permanent.getName() + "-" + permanent.getExpansionSetCode()).equals(targetName)) { + } else if ((permanent.getName() + '-' + permanent.getExpansionSetCode()).equals(targetName)) { if (target.isNotTarget() || ((TargetPermanent) target).canTarget(computerPlayer.getId(), permanent.getId(), source, game)) { if ((permanent.isCopy() && !originOnly) || (!permanent.isCopy() && !copyOnly)) { target.add(permanent.getId(), game); @@ -816,7 +816,7 @@ public class TestPlayer implements Player { filter = ((FilterCreatureOrPlayer) filter).getCreatureFilter(); } for (Permanent permanent : game.getBattlefield().getAllActivePermanents((FilterPermanent) filter, game)) { - if (permanent.getName().equals(targetName) || (permanent.getName() + "-" + permanent.getExpansionSetCode()).equals(targetName)) { + if (permanent.getName().equals(targetName) || (permanent.getName() + '-' + permanent.getExpansionSetCode()).equals(targetName)) { if (target.canTarget(abilityControllerId, permanent.getId(), source, game) && !target.getTargets().contains(permanent.getId())) { if ((permanent.isCopy() && !originOnly) || (!permanent.isCopy() && !copyOnly)) { target.add(permanent.getId(), game); @@ -841,7 +841,7 @@ public class TestPlayer implements Player { boolean targetFound = false; for (String targetName : targetList) { for (Card card : computerPlayer.getHand().getCards(((TargetCardInHand) target).getFilter(), game)) { - if (card.getName().equals(targetName) || (card.getName() + "-" + card.getExpansionSetCode()).equals(targetName)) { + if (card.getName().equals(targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { if (((TargetCardInHand) target).canTarget(abilityControllerId, card.getId(), source, game) && !target.getTargets().contains(card.getId())) { target.add(card.getId(), game); targetFound = true; @@ -863,7 +863,7 @@ public class TestPlayer implements Player { boolean targetFound = false; for (String targetName : targetList) { for (Card card : computerPlayer.getGraveyard().getCards(((TargetCardInYourGraveyard) target).getFilter(), game)) { - if (card.getName().equals(targetName) || (card.getName() + "-" + card.getExpansionSetCode()).equals(targetName)) { + if (card.getName().equals(targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { if (((TargetCardInYourGraveyard) target).canTarget(abilityControllerId, card.getId(), source, game) && !target.getTargets().contains(card.getId())) { target.add(card.getId(), game); targetFound = true; @@ -890,7 +890,7 @@ public class TestPlayer implements Player { if (computerPlayer.hasOpponent(opponentId, game)) { Player opponent = game.getPlayer(opponentId); for (Card card : opponent.getGraveyard().getCards(((TargetCardInOpponentsGraveyard) target).getFilter(), game)) { - if (card.getName().equals(targetName) || (card.getName() + "-" + card.getExpansionSetCode()).equals(targetName)) { + if (card.getName().equals(targetName) || (card.getName() + '-' + card.getExpansionSetCode()).equals(targetName)) { if (((TargetCardInOpponentsGraveyard) target).canTarget(abilityControllerId, card.getId(), source, game) && !target.getTargets().contains(card.getId())) { target.add(card.getId(), game); targetFound = true; diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java index 0db848daf4..84fb5ef357 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java @@ -120,7 +120,7 @@ public abstract class MageTestBase { private static Class loadPlugin(Plugin plugin) { try { - classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); + classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL()); logger.info("Loading plugin: " + plugin.getClassName()); return Class.forName(plugin.getClassName(), true, classLoader); } catch (ClassNotFoundException ex) { @@ -133,7 +133,7 @@ public abstract class MageTestBase { private static MatchType loadGameType(GamePlugin plugin) { try { - classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); + classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL()); logger.info("Loading game type: " + plugin.getClassName()); return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance(); } catch (ClassNotFoundException ex) { @@ -146,7 +146,7 @@ public abstract class MageTestBase { private static TournamentType loadTournamentType(GamePlugin plugin) { try { - classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); + classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL()); logger.info("Loading tournament type: " + plugin.getClassName()); return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance(); } catch (ClassNotFoundException ex) { diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java index 9cdd524421..265495fbe9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java @@ -106,7 +106,7 @@ public abstract class MageTestPlayerBase { private static Class loadPlugin(Plugin plugin) { try { - classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); + classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL()); logger.info("Loading plugin: " + plugin.getClassName()); return Class.forName(plugin.getClassName(), true, classLoader); } catch (ClassNotFoundException ex) { @@ -119,7 +119,7 @@ public abstract class MageTestPlayerBase { private static MatchType loadGameType(GamePlugin plugin) { try { - classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); + classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL()); logger.info("Loading game type: " + plugin.getClassName()); return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance(); } catch (ClassNotFoundException ex) { @@ -132,7 +132,7 @@ public abstract class MageTestPlayerBase { private static TournamentType loadTournamentType(GamePlugin plugin) { try { - classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); + classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL()); logger.info("Loading tournament type: " + plugin.getClassName()); return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance(); } catch (ClassNotFoundException ex) { diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java index ed59291a0b..8825bc72b7 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java @@ -290,9 +290,9 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP if (permanent.getName().equals(cardName)) { count++; if (scope.equals(Filter.ComparisonScope.All)) { - Assert.assertEquals("Power is not the same (" + power + " vs. " + permanent.getPower().getValue() + ")", + Assert.assertEquals("Power is not the same (" + power + " vs. " + permanent.getPower().getValue() + ')', power, permanent.getPower().getValue()); - Assert.assertEquals("Toughness is not the same (" + toughness + " vs. " + permanent.getToughness().getValue() + ")", + Assert.assertEquals("Toughness is not the same (" + toughness + " vs. " + permanent.getToughness().getValue() + ')', toughness, permanent.getToughness().getValue()); } else if (scope.equals(Filter.ComparisonScope.Any)) { if (power == permanent.getPower().getValue() && toughness == permanent.getToughness().getValue()) { @@ -372,7 +372,7 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP } } } - Assert.assertEquals("(Battlefield) Card counts are not equal (" + cardName + ")", count, actualCount); + Assert.assertEquals("(Battlefield) Card counts are not equal (" + cardName + ')', count, actualCount); } public Permanent getPermanent(String cardName, UUID controller) { @@ -387,7 +387,7 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP } } Assert.assertNotNull("Couldn't find a card with specified name: " + cardName, permanent0); - Assert.assertEquals("More than one permanent was found: " + cardName + "(" + count + ")", 1, count); + Assert.assertEquals("More than one permanent was found: " + cardName + '(' + count + ')', 1, count); return permanent0; } diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index c2b6e993c4..9aa176560d 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -446,9 +446,9 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement if (permanent.getName().equals(cardName) && permanent.getControllerId().equals(player.getId())) { count++; if (scope.equals(Filter.ComparisonScope.All)) { - Assert.assertEquals("Power is not the same (" + power + " vs. " + permanent.getPower().getValue() + ")", + Assert.assertEquals("Power is not the same (" + power + " vs. " + permanent.getPower().getValue() + ')', power, permanent.getPower().getValue()); - Assert.assertEquals("Toughness is not the same (" + toughness + " vs. " + permanent.getToughness().getValue() + ")", + Assert.assertEquals("Toughness is not the same (" + toughness + " vs. " + permanent.getToughness().getValue() + ')', toughness, permanent.getToughness().getValue()); } else if (scope.equals(Filter.ComparisonScope.Any)) { if (power == permanent.getPower().getValue() && toughness == permanent.getToughness().getValue()) { @@ -466,8 +466,8 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement + ", cardName=" + cardName, count > 0); if (scope.equals(Filter.ComparisonScope.Any)) { - Assert.assertTrue("There is no such creature under player's control with specified p/t of " + power + "/" + toughness + ", player=" + player.getName() - + ", cardName=" + cardName + " (found similar: " + found + ", one of them: power=" + foundPower + " toughness=" + foundToughness + ")", fit > 0); + Assert.assertTrue("There is no such creature under player's control with specified p/t of " + power + '/' + toughness + ", player=" + player.getName() + + ", cardName=" + cardName + " (found similar: " + found + ", one of them: power=" + foundPower + " toughness=" + foundToughness + ')', fit > 0); } } @@ -584,7 +584,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } } - Assert.assertEquals("(Battlefield) Permanents counts for " + player.getName() + " are not equal (" + cardName + ")", count, actualCount); + Assert.assertEquals("(Battlefield) Permanents counts for " + player.getName() + " are not equal (" + cardName + ')', count, actualCount); } @Override @@ -595,7 +595,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement actualCount++; } } - Assert.assertEquals("(Command Zone) Card counts are not equal (" + commandZoneObjectName + ")", count, actualCount); + Assert.assertEquals("(Command Zone) Card counts are not equal (" + commandZoneObjectName + ')', count, actualCount); } /** @@ -636,7 +636,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } Assert.assertNotNull("There is no such permanent " + (player == null ? "" : "for player " + player.getName()) + " on the battlefield, cardName=" + cardName, found); - Assert.assertEquals("(Battlefield) Counter counts are not equal (" + cardName + ":" + type + ")", count, found.getCounters(currentGame).getCount(type)); + Assert.assertEquals("(Battlefield) Counter counts are not equal (" + cardName + ':' + type + ')', count, found.getCounters(currentGame).getCount(type)); } /** @@ -659,7 +659,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } Assert.assertNotNull("There is no such card in the exile, cardName=" + cardName, found); - Assert.assertEquals("(Exile) Counter counts are not equal (" + cardName + ":" + type + ")", count, found.getCounters(currentGame).getCount(type)); + Assert.assertEquals("(Exile) Counter counts are not equal (" + cardName + ':' + type + ')', count, found.getCounters(currentGame).getCount(type)); } /** @@ -670,7 +670,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement * @param count Expected count. */ public void assertCounterCount(Player player, CounterType type, int count) throws AssertionError { - Assert.assertEquals("(Battlefield) Counter counts are not equal (" + player.getName() + ":" + type + ")", count, player.getCounters().getCount(type)); + Assert.assertEquals("(Battlefield) Counter counts are not equal (" + player.getName() + ':' + type + ')', count, player.getCounters().getCount(type)); } /** @@ -691,7 +691,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found); - Assert.assertTrue("(Battlefield) card type not found (" + cardName + ":" + type + ")", (found.getCardType().contains(type) == flag)); + Assert.assertTrue("(Battlefield) card type not found (" + cardName + ':' + type + ')', (found.getCardType().contains(type) == flag)); } @@ -713,9 +713,9 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found); - Assert.assertTrue("(Battlefield) card type not found (" + cardName + ":" + type + ")", found.getCardType().contains(type)); + Assert.assertTrue("(Battlefield) card type not found (" + cardName + ':' + type + ')', found.getCardType().contains(type)); if (subType != null) { - Assert.assertTrue("(Battlefield) card sub-type not equal (" + cardName + ":" + subType + ")", found.getSubtype(currentGame).contains(subType)); + Assert.assertTrue("(Battlefield) card sub-type not equal (" + cardName + ':' + subType + ')', found.getSubtype(currentGame).contains(subType)); } } @@ -740,7 +740,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found); - Assert.assertEquals("(Battlefield) Tapped state is not equal (" + cardName + ")", tapped, found.isTapped()); + Assert.assertEquals("(Battlefield) Tapped state is not equal (" + cardName + ')', tapped, found.isTapped()); } /** @@ -781,7 +781,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found); - Assert.assertEquals("(Battlefield) Attacking state is not equal (" + cardName + ")", attacking, found.isAttacking()); + Assert.assertEquals("(Battlefield) Attacking state is not equal (" + cardName + ')', attacking, found.isAttacking()); } /** @@ -836,7 +836,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } - Assert.assertEquals("(Exile) Card counts are not equal (" + cardName + ")", count, actualCount); + Assert.assertEquals("(Exile) Card counts are not equal (" + cardName + ')', count, actualCount); } /** @@ -873,7 +873,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } - Assert.assertEquals("(Graveyard " + player.getName() + ") Card counts are not equal (" + cardName + ")", count, actualCount); + Assert.assertEquals("(Graveyard " + player.getName() + ") Card counts are not equal (" + cardName + ')', count, actualCount); } /** @@ -904,7 +904,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } - Assert.assertEquals("(Library " + player.getName() + ") Card counts are not equal (" + cardName + ")", count, actualCount); + Assert.assertEquals("(Library " + player.getName() + ") Card counts are not equal (" + cardName + ')', count, actualCount); } /** @@ -938,7 +938,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } Assert.assertNotNull("Couldn't find a card with specified name: " + cardName, permanent0); - Assert.assertEquals("More than one permanent was found: " + cardName + "(" + count + ")", 1, count); + Assert.assertEquals("More than one permanent was found: " + cardName + '(' + count + ')', 1, count); return permanent0; } @@ -1021,11 +1021,11 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName, String spellOnStack, StackClause clause) { if (StackClause.WHILE_ON_STACK.equals(clause)) { player.addAction(turnNum, step, "activate:Cast " + cardName - + "$" + (targetName != null && targetName.startsWith("target") ? targetName : "target=" + targetName) + + '$' + (targetName != null && targetName.startsWith("target") ? targetName : "target=" + targetName) + "$spellOnStack=" + spellOnStack); } else { player.addAction(turnNum, step, "activate:Cast " + cardName - + "$" + (targetName != null && targetName.startsWith("target") ? targetName : "target=" + targetName) + + '$' + (targetName != null && targetName.startsWith("target") ? targetName : "target=" + targetName) + "$!spellOnStack=" + spellOnStack); } } @@ -1077,13 +1077,13 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement sb.append("$target=").append(targetName); } if (spellOnStack != null && !spellOnStack.isEmpty()) { - sb.append("$").append(StackClause.WHILE_ON_STACK.equals(clause) ? "" : "!").append("spellOnStack=").append(spellOnStack); + sb.append('$').append(StackClause.WHILE_ON_STACK.equals(clause) ? "" : "!").append("spellOnStack=").append(spellOnStack); } player.addAction(turnNum, step, sb.toString()); } public void addCounters(int turnNum, PhaseStep step, TestPlayer player, String cardName, CounterType type, int count) { - player.addAction(turnNum, step, "addCounters:" + cardName + "$" + type.getName() + "$" + count); + player.addAction(turnNum, step, "addCounters:" + cardName + '$' + type.getName() + '$' + count); } public void attack(int turnNum, TestPlayer player, String attacker) { @@ -1099,7 +1099,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } public void block(int turnNum, TestPlayer player, String blocker, String attacker) { - player.addAction(turnNum, PhaseStep.DECLARE_BLOCKERS, "block:" + blocker + "$" + attacker); + player.addAction(turnNum, PhaseStep.DECLARE_BLOCKERS, "block:" + blocker + '$' + attacker); } /** diff --git a/Mage.Tests/src/test/java/org/mage/test/sets/BoosterGenerationTest.java b/Mage.Tests/src/test/java/org/mage/test/sets/BoosterGenerationTest.java index 5b3ce77e29..8dd6fa7187 100644 --- a/Mage.Tests/src/test/java/org/mage/test/sets/BoosterGenerationTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/sets/BoosterGenerationTest.java @@ -77,7 +77,7 @@ public class BoosterGenerationTest extends MageTestBase { sb.append(", "); } } - sb.append("] (").append(cards.size()).append(")"); + sb.append("] (").append(cards.size()).append(')'); return sb.toString(); } diff --git a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java index d2fd8a0d57..f4140b0703 100644 --- a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java +++ b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java @@ -194,7 +194,7 @@ public class VerifyCardDataTest { private void checkPT(Card card, JsonCard ref) { if (!eqPT(card.getPower().toString(), ref.power) || !eqPT(card.getToughness().toString(), ref.toughness)) { String pt = card.getPower() + "/" + card.getToughness(); - String expected = ref.power + "/" + ref.toughness; + String expected = ref.power + '/' + ref.toughness; fail(card, "pt", pt + " != " + expected); } } diff --git a/Mage/src/main/java/mage/MageObjectImpl.java b/Mage/src/main/java/mage/MageObjectImpl.java index 0e7df0a0e6..19f2ac9dcc 100644 --- a/Mage/src/main/java/mage/MageObjectImpl.java +++ b/Mage/src/main/java/mage/MageObjectImpl.java @@ -108,7 +108,7 @@ public abstract class MageObjectImpl implements MageObject { @Override public String getIdName() { - return getName() + " [" + getId().toString().substring(0, 3) + "]"; + return getName() + " [" + getId().toString().substring(0, 3) + ']'; } @Override diff --git a/Mage/src/main/java/mage/Mana.java b/Mage/src/main/java/mage/Mana.java index 329aba528c..7a7ff39d6b 100644 --- a/Mage/src/main/java/mage/Mana.java +++ b/Mage/src/main/java/mage/Mana.java @@ -443,7 +443,7 @@ public class Mana implements Comparable, Serializable, Copyable { public String toString() { StringBuilder sbMana = new StringBuilder(); if (generic > 0) { - sbMana.append("{").append(Integer.toString(generic)).append("}"); + sbMana.append('{').append(Integer.toString(generic)).append('}'); } for (int i = 0; i < colorless; i++) { sbMana.append("{C}"); diff --git a/Mage/src/main/java/mage/ObjectColor.java b/Mage/src/main/java/mage/ObjectColor.java index c151245260..fe73f3d829 100644 --- a/Mage/src/main/java/mage/ObjectColor.java +++ b/Mage/src/main/java/mage/ObjectColor.java @@ -231,19 +231,19 @@ public class ObjectColor implements Serializable, Copyable, Compara public String toString() { StringBuilder sb = new StringBuilder(5); if (white) { - sb.append("W"); + sb.append('W'); } if (blue) { - sb.append("U"); + sb.append('U'); } if (black) { - sb.append("B"); + sb.append('B'); } if (red) { - sb.append("R"); + sb.append('R'); } if (green) { - sb.append("G"); + sb.append('G'); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index 41df197b99..2ccc13de25 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -348,7 +348,7 @@ public abstract class AbilityImpl implements Ability { for (Cost cost : optionalCosts) { if (cost instanceof ManaCost) { cost.clearPaid(); - if (controller.chooseUse(Outcome.Benefit, "Pay optional cost " + cost.getText() + "?", this, game)) { + if (controller.chooseUse(Outcome.Benefit, "Pay optional cost " + cost.getText() + '?', this, game)) { manaCostsToPay.add((ManaCost) cost); } } @@ -507,11 +507,11 @@ public abstract class AbilityImpl implements Ability { // set the xcosts to paid variableCost.setAmount(xValue); ((Cost) variableCost).setPaid(); - String message = controller.getLogName() + " announces a value of " + xValue + " (" + variableCost.getActionText() + ")"; + String message = controller.getLogName() + " announces a value of " + xValue + " (" + variableCost.getActionText() + ')'; if (announceString == null) { announceString = message; } else { - announceString = announceString + " " + message; + announceString = announceString + ' ' + message; } } } @@ -546,7 +546,7 @@ public abstract class AbilityImpl implements Ability { int amountMana = xValue * variableManaCost.getMultiplier(); StringBuilder manaString = threadLocalBuilder.get(); if (variableManaCost.getFilter() == null || variableManaCost.getFilter().isGeneric()) { - manaString.append("{").append(amountMana).append("}"); + manaString.append('{').append(amountMana).append('}'); } else { String manaSymbol = null; if (variableManaCost.getFilter().isBlack()) { @@ -564,7 +564,7 @@ public abstract class AbilityImpl implements Ability { throw new UnsupportedOperationException("ManaFilter is not supported: " + this.toString()); } for (int i = 0; i < amountMana; i++) { - manaString.append("{").append(manaSymbol).append("}"); + manaString.append('{').append(manaSymbol).append('}'); } } manaCostsToPay.add(new ManaCostsImpl(manaString.toString())); @@ -745,7 +745,7 @@ public abstract class AbilityImpl implements Ability { } if (costs.size() > 0) { if (sbRule.length() > 0) { - sbRule.append(","); + sbRule.append(','); } sbRule.append(costs.getText()); } @@ -1069,7 +1069,7 @@ public abstract class AbilityImpl implements Ability { for (Mode mode : spellModes.values()) { item++; if (mode.getId().equals(selectedMode.getId())) { - sb.append(" (mode ").append(item).append(")"); + sb.append(" (mode ").append(item).append(')'); sb.append(getTargetDescriptionForLog(selectedMode.getTargets(), game)); break; } diff --git a/Mage/src/main/java/mage/abilities/ActivationInfo.java b/Mage/src/main/java/mage/abilities/ActivationInfo.java index bf322f03af..016b76fe35 100644 --- a/Mage/src/main/java/mage/abilities/ActivationInfo.java +++ b/Mage/src/main/java/mage/abilities/ActivationInfo.java @@ -53,7 +53,7 @@ public class ActivationInfo { Integer activations = (Integer) game.getState().getValue(key); ActivationInfo activationInfo; if (activations != null) { - Integer turnNum = (Integer) game.getState().getValue(key + "T"); + Integer turnNum = (Integer) game.getState().getValue(key + 'T'); activationInfo = new ActivationInfo(game, turnNum, activations); } else { activationInfo = new ActivationInfo(game, game.getTurnNum(), 0); @@ -79,7 +79,7 @@ public class ActivationInfo { activationCounter++; } game.getState().setValue(key, activationCounter); - game.getState().setValue(key + "T", turnNum); + game.getState().setValue(key + 'T', turnNum); } public int getActivationCounter() { diff --git a/Mage/src/main/java/mage/abilities/abilityword/KinshipAbility.java b/Mage/src/main/java/mage/abilities/abilityword/KinshipAbility.java index 201b23fca8..cc5c531c57 100644 --- a/Mage/src/main/java/mage/abilities/abilityword/KinshipAbility.java +++ b/Mage/src/main/java/mage/abilities/abilityword/KinshipAbility.java @@ -127,7 +127,7 @@ class KinshipBaseEffect extends OneShotEffect { Cards cards = new CardsImpl(card); controller.lookAtCards(sourcePermanent.getName(), cards, game); if (CardUtil.shareSubtypes(sourcePermanent, card, game)) { - if (controller.chooseUse(outcome,new StringBuilder("Kinship - Reveal ").append(card.getLogName()).append("?").toString(), source, game)) { + if (controller.chooseUse(outcome,new StringBuilder("Kinship - Reveal ").append(card.getLogName()).append('?').toString(), source, game)) { controller.revealCards(sourcePermanent.getName(), cards, game); for (Effect effect: kinshipEffects) { effect.setTargetPointer(new FixedTarget(card.getId())); diff --git a/Mage/src/main/java/mage/abilities/common/ActivateIfConditionActivatedAbility.java b/Mage/src/main/java/mage/abilities/common/ActivateIfConditionActivatedAbility.java index 80b1ec132b..430d82f3e8 100644 --- a/Mage/src/main/java/mage/abilities/common/ActivateIfConditionActivatedAbility.java +++ b/Mage/src/main/java/mage/abilities/common/ActivateIfConditionActivatedAbility.java @@ -92,7 +92,7 @@ public class ActivateIfConditionActivatedAbility extends ActivatedAbilityImpl { !condition.toString().startsWith("before")) { sb.append("if "); } - sb.append(condition.toString()).append("."); + sb.append(condition.toString()).append('.'); } else { sb.append(" [Condition toSting() == null] "); } diff --git a/Mage/src/main/java/mage/abilities/common/ChancellorAbility.java b/Mage/src/main/java/mage/abilities/common/ChancellorAbility.java index 80e6c235b1..bfa5a4cd67 100644 --- a/Mage/src/main/java/mage/abilities/common/ChancellorAbility.java +++ b/Mage/src/main/java/mage/abilities/common/ChancellorAbility.java @@ -70,7 +70,7 @@ public class ChancellorAbility extends StaticAbility implements OpeningHandActio @Override public boolean askUseOpeningHandAction(Card card, Player player, Game game) { - return player.chooseUse(Outcome.PutCardInPlay, "Do you wish to reveal " + card.getIdName() + "?", this, game); + return player.chooseUse(Outcome.PutCardInPlay, "Do you wish to reveal " + card.getIdName() + '?', this, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/common/PutCardIntoGraveFromAnywhereAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/PutCardIntoGraveFromAnywhereAllTriggeredAbility.java index 0635847f29..048400d92d 100644 --- a/Mage/src/main/java/mage/abilities/common/PutCardIntoGraveFromAnywhereAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/PutCardIntoGraveFromAnywhereAllTriggeredAbility.java @@ -78,7 +78,7 @@ public class PutCardIntoGraveFromAnywhereAllTriggeredAbility extends TriggeredAb sb.append("your"); break; default: - sb.append("a"); + sb.append('a'); } sb.append(" graveyard, "); ruleText = sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/common/PutIntoGraveFromAnywhereSourceAbility.java b/Mage/src/main/java/mage/abilities/common/PutIntoGraveFromAnywhereSourceAbility.java index 4272b15086..4658bed21e 100644 --- a/Mage/src/main/java/mage/abilities/common/PutIntoGraveFromAnywhereSourceAbility.java +++ b/Mage/src/main/java/mage/abilities/common/PutIntoGraveFromAnywhereSourceAbility.java @@ -148,7 +148,7 @@ class PutIntoGraveFromAnywhereEffect extends ReplacementEffectImpl { if (controller == null || object == null) { return false; } - if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append("?").toString(), source, game)) { + if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append('?').toString(), source, game)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/common/delayed/PactDelayedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/delayed/PactDelayedTriggeredAbility.java index 5451a2fda6..363962126b 100644 --- a/Mage/src/main/java/mage/abilities/common/delayed/PactDelayedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/delayed/PactDelayedTriggeredAbility.java @@ -98,7 +98,7 @@ class PactEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "?", source, game)) { + if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)){ return true; diff --git a/Mage/src/main/java/mage/abilities/condition/common/CreatureCountCondition.java b/Mage/src/main/java/mage/abilities/condition/common/CreatureCountCondition.java index c4cfce4e97..89705f8e40 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/CreatureCountCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/CreatureCountCondition.java @@ -67,14 +67,14 @@ public class CreatureCountCondition implements Condition { case ANY: sb.append("if "); sb.append(creatureCount); - sb.append(" "); + sb.append(' '); sb.append(filter.getMessage()); sb.append(" are on the battlefield"); return sb.toString(); } sb.append(" control exactly "); sb.append(creatureCount); - sb.append(" "); + sb.append(' '); sb.append(filter.getMessage()); return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/costs/AlternativeCostSourceAbility.java b/Mage/src/main/java/mage/abilities/costs/AlternativeCostSourceAbility.java index 65e1d4fabe..b6937c67a3 100644 --- a/Mage/src/main/java/mage/abilities/costs/AlternativeCostSourceAbility.java +++ b/Mage/src/main/java/mage/abilities/costs/AlternativeCostSourceAbility.java @@ -160,7 +160,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter if (dynamicCost != null) { costChoiceText = dynamicCost.getText(ability, game); } else { - costChoiceText = alternativeCostsToCheck.isEmpty() ? "Cast without paying its mana cost?" : "Pay alternative costs? (" + alternativeCostsToCheck.getText() + ")"; + costChoiceText = alternativeCostsToCheck.isEmpty() ? "Cast without paying its mana cost?" : "Pay alternative costs? (" + alternativeCostsToCheck.getText() + ')'; } if (alternativeCostsToCheck.canPay(ability, ability.getSourceId(), ability.getControllerId(), game) @@ -263,9 +263,9 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter } else if (alternateCosts.isEmpty()) { sb.append("cast {this} without paying its mana cost"); } - sb.append("."); + sb.append('.'); if (numberCosts == 1 && remarkText != null) { - sb.append(" ").append(remarkText); + sb.append(' ').append(remarkText); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/costs/OrCost.java b/Mage/src/main/java/mage/abilities/costs/OrCost.java index a2bd70c0bb..0b921701c2 100644 --- a/Mage/src/main/java/mage/abilities/costs/OrCost.java +++ b/Mage/src/main/java/mage/abilities/costs/OrCost.java @@ -99,7 +99,7 @@ public class OrCost implements Cost { if (firstCost instanceof ManaCost) { sb.append("Pay "); } - sb.append(firstCost.getText()).append("?"); + sb.append(firstCost.getText()).append('?'); if (controller.chooseUse(Outcome.Detriment, sb.toString(), ability, game)) { selectedCost = firstCost; } else { diff --git a/Mage/src/main/java/mage/abilities/costs/common/DiscardXTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/DiscardXTargetCost.java index bd2fc1dd1b..51c084654b 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/DiscardXTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/DiscardXTargetCost.java @@ -52,7 +52,7 @@ public class DiscardXTargetCost extends VariableCostImpl { public DiscardXTargetCost(FilterCard filter, boolean additionalCostText) { super(new StringBuilder(filter.getMessage()).append(" to discard").toString()); this.text = new StringBuilder(additionalCostText ? "As an additional cost to cast {source}, discard ":"Discard ") - .append(xText).append(" ").append(filter.getMessage()).toString(); + .append(xText).append(' ').append(filter.getMessage()).toString(); this.filter = filter; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java index 22ca4906ef..dcf398ffac 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java @@ -59,7 +59,7 @@ public class ExileFromGraveCost extends CostImpl { + (target.getNumberOfTargets() == 1 && target.getMaxNumberOfTargets() == Integer.MAX_VALUE ? "one or more" : ((target.getNumberOfTargets() < target.getMaxNumberOfTargets() ? "up to " : "")) + CardUtil.numberToText(target.getMaxNumberOfTargets())) - + " " + target.getTargetName(); + + ' ' + target.getTargetName(); } else { this.text = "Exile " + target.getTargetName(); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileXFromYourGraveCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileXFromYourGraveCost.java index e3c070c1b7..317b5e45ac 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileXFromYourGraveCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileXFromYourGraveCost.java @@ -50,7 +50,7 @@ public class ExileXFromYourGraveCost extends VariableCostImpl { public ExileXFromYourGraveCost(FilterCard filter, boolean additionalCostText) { super(filter.getMessage() + " to exile"); this.filter = filter; - this.text = (additionalCostText ? "As an additional cost to cast {source}, exile " : "Exile ") + xText + " " + filter.getMessage(); + this.text = (additionalCostText ? "As an additional cost to cast {source}, exile " : "Exile ") + xText + ' ' + filter.getMessage(); } public ExileXFromYourGraveCost(final ExileXFromYourGraveCost cost) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java index 9944d89abc..64945cb846 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java @@ -47,7 +47,7 @@ public class PayLoyaltyCost extends CostImpl { this.amount = amount; this.text = Integer.toString(amount); if (amount >= 0) { - this.text = "+" + this.text; + this.text = '+' + this.text; } } diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayVariableLifeCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayVariableLifeCost.java index 5fb4cea23c..5577627230 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayVariableLifeCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayVariableLifeCost.java @@ -48,7 +48,7 @@ public class PayVariableLifeCost extends VariableCostImpl { public PayVariableLifeCost(boolean additionalCostText) { super("life to pay"); this.text = new StringBuilder(additionalCostText ? "As an additional cost to cast {source}, pay ":"Pay ") - .append(xText).append(" ").append("life").toString(); + .append(xText).append(' ').append("life").toString(); } public PayVariableLifeCost(final PayVariableLifeCost cost) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java index b5d98d44f1..336dddaabb 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java @@ -51,7 +51,7 @@ public class PutCountersSourceCost extends CostImpl { this.amount = counter.getCount(); this.name = counter.getName(); this.text = new StringBuilder("Put ").append((amount == 1 ? "a" : CardUtil.numberToText(amount))) - .append(" ").append(name).append(" counter").append((amount != 1 ? "s" : "")) + .append(' ').append(name).append(" counter").append((amount != 1 ? "s" : "")) .append(" on {this}").toString(); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java index 100beada6c..f24a5dbf47 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java @@ -133,7 +133,7 @@ public class RemoveCounterCost extends CostImpl { countersRemoved += numberOfCountersSelected; if (!game.isSimulation()) { game.informPlayers(new StringBuilder(controller.getLogName()) - .append(" removes ").append(numberOfCountersSelected == 1 ? "a" : numberOfCountersSelected).append(" ") + .append(" removes ").append(numberOfCountersSelected == 1 ? "a" : numberOfCountersSelected).append(' ') .append(counterName).append(numberOfCountersSelected == 1 ? " counter from " : " counters from ") .append(permanent.getName()).toString()); } @@ -158,7 +158,7 @@ public class RemoveCounterCost extends CostImpl { private String setText() { StringBuilder sb = new StringBuilder("Remove "); - sb.append(CardUtil.numberToText(countersToRemove, "a")).append(" "); + sb.append(CardUtil.numberToText(countersToRemove, "a")).append(' '); if (counterTypeToRemove != null) { sb.append(counterTypeToRemove.getName()); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java index 66b8f49efa..44677e4c90 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java @@ -50,7 +50,7 @@ public class RemoveCountersSourceCost extends CostImpl { this.amount = counter.getCount(); this.name = counter.getName(); this.text = new StringBuilder("Remove ").append((amount == 1 ? "a" : CardUtil.numberToText(amount))) - .append(" ").append(name).append(" counter").append((amount != 1 ? "s" : "")) + .append(' ').append(name).append(" counter").append((amount != 1 ? "s" : "")) .append(" from {this}").toString(); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java index bb5160b012..5bdc1966e9 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java @@ -58,7 +58,7 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl { } public RemoveVariableCountersTargetCost(FilterPermanent filter, CounterType counterTypeToRemove, String xText, int minValue) { - super(xText, new StringBuilder(counterTypeToRemove != null ? counterTypeToRemove.getName() + " ":"").append("counters to remove").toString()); + super(xText, new StringBuilder(counterTypeToRemove != null ? counterTypeToRemove.getName() + ' ' :"").append("counters to remove").toString()); this.filter = filter; this.counterTypeToRemove = counterTypeToRemove; this.text = setText(); @@ -79,7 +79,7 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl { private String setText() { StringBuilder sb = new StringBuilder("Remove ").append(xText); if (counterTypeToRemove != null) { - sb.append(" ").append(counterTypeToRemove.getName()); + sb.append(' ').append(counterTypeToRemove.getName()); } sb.append(" counters from among ").append(filter.getMessage()); return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java index a0144cb7ec..df84b8d1f4 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java @@ -52,7 +52,7 @@ public class ReturnToHandChosenControlledPermanentCost extends CostImpl { target.setNotTarget(true); this.addTarget(target); if (target.getMaxNumberOfTargets() > 1 && target.getMaxNumberOfTargets() == target.getNumberOfTargets()) { - this.text = "return " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + " " + target.getTargetName() + " you control to their owner's hand"; + this.text = "return " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + ' ' + target.getTargetName() + " you control to their owner's hand"; } else { this.text = "return " + target.getTargetName() + " you control to its owner's hand"; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java index 767d60cb32..e792c2d66f 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java @@ -49,7 +49,7 @@ public class ReturnToHandFromGraveyardCost extends CostImpl { public ReturnToHandFromGraveyardCost(TargetCardInYourGraveyard target) { this.addTarget(target); if (target.getMaxNumberOfTargets() > 1 && target.getMaxNumberOfTargets() == target.getNumberOfTargets()) { - this.text = new StringBuilder("return ").append(target.getMaxNumberOfTargets()).append(" ").append(target.getTargetName()).append(" from graveyard to it's owner's hand").toString(); + this.text = new StringBuilder("return ").append(target.getMaxNumberOfTargets()).append(' ').append(target.getTargetName()).append(" from graveyard to it's owner's hand").toString(); } else { this.text = new StringBuilder("return ").append(target.getTargetName()).append(" from graveyard to it's owner's hand").toString(); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/SacrificeXTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/SacrificeXTargetCost.java index 7a5a26312d..e83014b796 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/SacrificeXTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/SacrificeXTargetCost.java @@ -48,7 +48,7 @@ public class SacrificeXTargetCost extends VariableCostImpl { public SacrificeXTargetCost(FilterControlledPermanent filter, boolean additionalCostText) { super(filter.getMessage() + " to sacrifice"); - this.text = (additionalCostText ? "As an additional cost to cast {source}, sacrifice " : "Sacrifice ") + xText + " " + filter.getMessage(); + this.text = (additionalCostText ? "As an additional cost to cast {source}, sacrifice " : "Sacrifice ") + xText + ' ' + filter.getMessage(); this.filter = filter; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java index 7f6eedbd10..ef095d353c 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java @@ -51,7 +51,7 @@ public class TapTargetCost extends CostImpl { this.text = new StringBuilder("Tap ") .append((target.getTargetName().startsWith("a ") || target.getTargetName().startsWith("an ") || target.getTargetName().startsWith("another")) - ? "" : CardUtil.numberToText(target.getMaxNumberOfTargets()) + " ") + ? "" : CardUtil.numberToText(target.getMaxNumberOfTargets()) + ' ') .append(target.getTargetName()).toString(); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/TapVariableTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/TapVariableTargetCost.java index 7da86d69f6..5f2bc10650 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/TapVariableTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/TapVariableTargetCost.java @@ -51,7 +51,7 @@ public class TapVariableTargetCost extends VariableCostImpl { super(xText, new StringBuilder(filter.getMessage()).append(" to tap").toString()); this.filter = filter; this.text = new StringBuilder(additionalCostText ? "As an additional cost to cast {source}, tap ":"Tap ") - .append(this.xText).append(" ").append(filter.getMessage()).toString(); + .append(this.xText).append(' ').append(filter.getMessage()).toString(); } public TapVariableTargetCost(final TapVariableTargetCost cost) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java index e0609fa9d9..6f58c745bd 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java @@ -49,7 +49,7 @@ public class UntapTargetCost extends CostImpl { public UntapTargetCost(TargetControlledPermanent target) { this.target = target; - this.text = "Untap " + target.getMaxNumberOfTargets() + " " + target.getTargetName(); + this.text = "Untap " + target.getMaxNumberOfTargets() + ' ' + target.getTargetName(); } public UntapTargetCost(final UntapTargetCost cost) { diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java index e100bcc223..14ef126220 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java @@ -69,7 +69,7 @@ public class ColoredManaCost extends ManaCostImpl { @Override public String getText() { - return "{" + mana.toString() + "}"; + return '{' + mana.toString() + '}'; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/mana/GenericManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/GenericManaCost.java index 32708f1a8e..102da50b9e 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/GenericManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/GenericManaCost.java @@ -73,7 +73,7 @@ public class GenericManaCost extends ManaCostImpl { @Override public String getText() { - return "{" + Integer.toString(mana) + "}"; + return '{' + Integer.toString(mana) + '}'; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java index ae57cd25c1..183150ecdd 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java @@ -76,7 +76,7 @@ public class HybridManaCost extends ManaCostImpl { @Override public String getText() { - return "{" + mana1.toString() + "/" + mana2.toString() + "}"; + return '{' + mana1.toString() + '/' + mana2.toString() + '}'; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java index d02227d18b..e6571177bc 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java @@ -77,7 +77,7 @@ public class MonoHybridManaCost extends ManaCostImpl { @Override public String getText() { - return "{2/" + mana.toString() + "}"; + return "{2/" + mana.toString() + '}'; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/mana/PhyrexianManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/PhyrexianManaCost.java index 885d9cf88b..703f61ddff 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/PhyrexianManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/PhyrexianManaCost.java @@ -57,7 +57,7 @@ public class PhyrexianManaCost extends ColoredManaCost { @Override public String getText() { - return "{" + mana.toString() + "P}"; + return '{' + mana.toString() + "P}"; } @Override diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java index 70133b75d0..4903c8e82f 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ParleyCount.java @@ -71,7 +71,7 @@ public class ParleyCount implements DynamicValue, MageSingleton { if (!card.getCardType().contains(CardType.LAND)) { parleyValue++; } - player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", new CardsImpl(card), game); + player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', new CardsImpl(card), game); } } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java index 030870ebca..6f630c4861 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java @@ -29,7 +29,7 @@ public class SignInversionDynamicValue implements DynamicValue { @Override public String toString() { - return "-" + value.toString(); + return '-' + value.toString(); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/AsTurnedFaceUpEffect.java b/Mage/src/main/java/mage/abilities/effects/AsTurnedFaceUpEffect.java index 8386f2cef7..71d1e22817 100644 --- a/Mage/src/main/java/mage/abilities/effects/AsTurnedFaceUpEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/AsTurnedFaceUpEffect.java @@ -85,7 +85,7 @@ public class AsTurnedFaceUpEffect extends ReplacementEffectImpl { if (controller == null || object == null) { return false; } - if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append("?").toString(), source, game)) { + if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getLogName()).append('?').toString(), source, game)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java index d78dea4be7..3450de2385 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java @@ -1234,9 +1234,9 @@ public class ContinuousEffects implements Serializable { for (Ability ability : entry.getValue()) { MageObject object = game.getObject(ability.getSourceId()); if (object != null) { - texts.put(ability.getId().toString() + "_" + entry.getKey().getId().toString(), object.getName() + ": " + ability.getRule(object.getName())); + texts.put(ability.getId().toString() + '_' + entry.getKey().getId().toString(), object.getName() + ": " + ability.getRule(object.getName())); } else { - texts.put(ability.getId().toString() + "_" + entry.getKey().getId().toString(), entry.getKey().getText(null)); + texts.put(ability.getId().toString() + '_' + entry.getKey().getId().toString(), entry.getKey().getText(null)); } } } else { diff --git a/Mage/src/main/java/mage/abilities/effects/Effects.java b/Mage/src/main/java/mage/abilities/effects/Effects.java index 9f207eeeca..f479863bfb 100644 --- a/Mage/src/main/java/mage/abilities/effects/Effects.java +++ b/Mage/src/main/java/mage/abilities/effects/Effects.java @@ -90,7 +90,7 @@ public class Effects extends ArrayList { !lastRule.startsWith("Level ") && !lastRule.endsWith(".)") && !lastRule.endsWith("
") ) { - sbText.append("."); + sbText.append('.'); } return sbText.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/EntersBattlefieldEffect.java b/Mage/src/main/java/mage/abilities/effects/EntersBattlefieldEffect.java index 37589a698c..320ddaa08b 100644 --- a/Mage/src/main/java/mage/abilities/effects/EntersBattlefieldEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/EntersBattlefieldEffect.java @@ -129,7 +129,7 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl { if (controller == null || object == null) { return false; } - if (!controller.chooseUse(outcome, "Use effect of " + object.getLogName() + "?", source, game)) { + if (!controller.chooseUse(outcome, "Use effect of " + object.getLogName() + '?', source, game)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/AddManaInAnyCombinationEffect.java b/Mage/src/main/java/mage/abilities/effects/common/AddManaInAnyCombinationEffect.java index 722fc0468d..72fae649de 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/AddManaInAnyCombinationEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/AddManaInAnyCombinationEffect.java @@ -134,7 +134,7 @@ public class AddManaInAnyCombinationEffect extends ManaEffect { if (i > 1) { sb.append(" and/or "); } - sb.append("{").append(coloredManaSymbol.toString()).append("}"); + sb.append('{').append(coloredManaSymbol.toString()).append('}'); } } sb.append(" to your mana pool"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java index 79f43448c9..34d107f71b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java @@ -78,11 +78,11 @@ public class CantBeRegeneratedSourceEffect extends ContinuousRuleModifyingEffect StringBuilder sb = new StringBuilder(); sb.append(" {this} can't be regenerated"); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append(" this turn"); } else { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java index d3720acb40..a5cb7335c2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java @@ -81,11 +81,11 @@ public class CantBeRegeneratedTargetEffect extends ContinuousRuleModifyingEffect } sb.append(" can't be regenerated"); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append(" this turn"); } else { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java index 40635ee0c3..29b32ee2d0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java @@ -118,7 +118,7 @@ public class CantBeTargetedAllEffect extends ContinuousRuleModifyingEffectImpl { sb.append("spells"); } if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java index c1bc1edec5..e4d0498e14 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java @@ -117,7 +117,7 @@ public class CantBeTargetedAttachedEffect extends ContinuousRuleModifyingEffectI sb.append(" can't be the target of "); sb.append(filterSource.getMessage()); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append("this turn"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java index 2a09645f96..8c5744862a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java @@ -94,7 +94,7 @@ public class CantBeTargetedSourceEffect extends ContinuousRuleModifyingEffectImp StringBuilder sb = new StringBuilder(); sb.append("{this} can't be the target of "); sb.append(filterSource.getMessage()); - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java index 9e10bde4cb..977c48a5d4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java @@ -114,7 +114,7 @@ public class CantBeTargetedTargetEffect extends ContinuousRuleModifyingEffectImp sb.append(" can't be the target of "); sb.append(filterSource.getMessage()); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append("this turn"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/ChangeATargetOfTargetSpellAbilityToSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ChangeATargetOfTargetSpellAbilityToSourceEffect.java index 8884c6c141..4354f0904d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ChangeATargetOfTargetSpellAbilityToSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ChangeATargetOfTargetSpellAbilityToSourceEffect.java @@ -83,7 +83,7 @@ public class ChangeATargetOfTargetSpellAbilityToSourceEffect extends OneShotEffe if (target.canTarget(stackObject.getControllerId(), source.getSourceId(), sourceAbility, game)) { validTargets = true; if (name != null - && controller.chooseUse(Outcome.Neutral, "Change target from " + name + " to " + sourceObject.getLogName() + "?", source, game)) { + && controller.chooseUse(Outcome.Neutral, "Change target from " + name + " to " + sourceObject.getLogName() + '?', source, game)) { oldTargetName = getTargetName(targetId, game); target.remove(targetId); // The source is still the spell on the stack @@ -97,7 +97,7 @@ public class ChangeATargetOfTargetSpellAbilityToSourceEffect extends OneShotEffe } } if (oldTargetName == null) { - game.informPlayer(controller, "You have to select at least one target to change to " + sourceObject.getIdName() + "!"); + game.informPlayer(controller, "You have to select at least one target to change to " + sourceObject.getIdName() + '!'); } } while (validTargets && oldTargetName == null); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java index 0d42a86272..44db56cada 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java @@ -134,7 +134,7 @@ public class ClashEffect extends OneShotEffect implements MageSingleton { cards.add(cardController); controller.revealCards(sourceObject.getIdName() + ": Clash card of " + controller.getName(), cards, game); cmcController = cardController.getConvertedManaCost(); - message.append(" (").append(cmcController).append(")"); + message.append(" (").append(cmcController).append(')'); } else { message.append(" no card"); } @@ -145,7 +145,7 @@ public class ClashEffect extends OneShotEffect implements MageSingleton { cards.add(cardOpponent); opponent.revealCards(sourceObject.getIdName() + ": Clash card of " + opponent.getName(), cards, game); cmcOpponent = cardOpponent.getConvertedManaCost(); - message.append(" (").append(cmcOpponent).append(")"); + message.append(" (").append(cmcOpponent).append(')'); } else { message.append(" no card"); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java index 9fa78743ac..955ed8c3c4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java @@ -466,11 +466,11 @@ class TargetWithAdditionalFilter extends TargetImpl { for (UUID targetId : getTargets()) { MageObject object = game.getObject(targetId); if (object != null) { - sb.append(object.getLogName()).append(" "); + sb.append(object.getLogName()).append(' '); } else { Player player = game.getPlayer(targetId); if (player != null) { - sb.append(player.getLogName()).append(" "); + sb.append(player.getLogName()).append(' '); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CouncilsDilemmaVoteEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CouncilsDilemmaVoteEffect.java index 3402df0a00..f80cff7c1a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CouncilsDilemmaVoteEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CouncilsDilemmaVoteEffect.java @@ -55,7 +55,7 @@ public abstract class CouncilsDilemmaVoteEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - if (player.chooseUse(Outcome.Vote, "Choose " + choiceOne + "?", source, game)) { + if (player.chooseUse(Outcome.Vote, "Choose " + choiceOne + '?', source, game)) { voteOneCount++; game.informPlayers(player.getName() + " has voted for " + choiceOne); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java index 422b4ec0fa..28a8e93b1c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java @@ -118,7 +118,7 @@ public class CreateTokenEffect extends OneShotEffect { } sb.append(token.getDescription()); } else { - sb.append(CardUtil.numberToText(amount.toString())).append(" "); + sb.append(CardUtil.numberToText(amount.toString())).append(' '); if (tapped && !attacking) { sb.append("tapped "); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java index 0132ebf36b..5243e83300 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java @@ -69,7 +69,7 @@ public class CreateTokenTargetEffect extends OneShotEffect { } StringBuilder sb = new StringBuilder("put "); sb.append(CardUtil.numberToText(amount.toString(), "a")); - sb.append(" ").append(token.getDescription()).append(" onto the battlefield"); + sb.append(' ').append(token.getDescription()).append(" onto the battlefield"); if (tapped) { sb.append(" tapped"); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DestroyMultiTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DestroyMultiTargetEffect.java index 6be73a2eb9..b275b2f96a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DestroyMultiTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DestroyMultiTargetEffect.java @@ -87,7 +87,7 @@ public class DestroyMultiTargetEffect extends OneShotEffect { while (iterator.hasNext()) { Target target = iterator.next(); if (target.getNumberOfTargets() > 1) { - sb.append(target.getNumberOfTargets()).append(" "); + sb.append(target.getNumberOfTargets()).append(' '); } sb.append("target ").append(target.getTargetName()); if (iterator.hasNext()) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java index 6edef3c794..cc27e9ca5c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java @@ -59,7 +59,7 @@ public class DoIfCostPaid extends OneShotEffect { if (effectText.length() > 0 && effectText.charAt(effectText.length() - 1) == '.') { effectText = effectText.substring(0, effectText.length() - 1); } - message = getCostText() + " and " + effectText + "?"; + message = getCostText() + " and " + effectText + '?'; message = Character.toUpperCase(message.charAt(0)) + message.substring(1); } else { message = chooseUseText; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepSourceEffect.java index 98973401bd..666aa0a08b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepSourceEffect.java @@ -37,7 +37,7 @@ public class DontUntapInControllersNextUntapStepSourceEffect extends ContinuousR public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - return "{this} doesn't untap (" + mageObject.getLogName() + ")"; + return "{this} doesn't untap (" + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java index f59773e1e4..d77a8abdb9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java @@ -100,7 +100,7 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR MageObject mageObject = game.getObject(source.getSourceId()); Permanent permanentToUntap = game.getPermanent((event.getTargetId())); if (permanentToUntap != null && mageObject != null) { - return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ")"; + return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java index 1919824f29..f259f9568d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java @@ -43,7 +43,7 @@ public class DontUntapInControllersUntapStepEnchantedEffect extends ContinuousRu if (enchantment != null && enchantment.getAttachedTo() != null) { Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); if (enchanted != null) { - return enchanted.getLogName() + " doesn't untap during its controller's untap step (" + enchantment.getLogName() + ")"; + return enchanted.getLogName() + " doesn't untap during its controller's untap step (" + enchantment.getLogName() + ')'; } } return null; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java index 3eac0bd7e0..69118f2ac1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java @@ -69,7 +69,7 @@ public class DontUntapInControllersUntapStepTargetEffect extends ContinuousRuleM MageObject mageObject = game.getObject(source.getSourceId()); Permanent permanentToUntap = game.getPermanent((event.getTargetId())); if (permanentToUntap != null && mageObject != null) { - return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ")"; + return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInOpponentsNextUntapStepAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInOpponentsNextUntapStepAllEffect.java index 2a20c30e91..53a627a1d9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInOpponentsNextUntapStepAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInOpponentsNextUntapStepAllEffect.java @@ -85,7 +85,7 @@ public class DontUntapInOpponentsNextUntapStepAllEffect extends ContinuousRuleMo MageObject mageObject = game.getObject(source.getSourceId()); Permanent permanentToUntap = game.getPermanent((event.getTargetId())); if (permanentToUntap != null && mageObject != null) { - return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ")"; + return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ')'; } return null; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java index 2a152eebc1..62da3f0a0d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java @@ -80,7 +80,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect { || amount instanceof PermanentsOnBattlefieldCount || amount.toString().equals("1"); sb.append("draw ").append(oneCard ? "a" : CardUtil.numberToText(amount.toString())).append(" card"); if (!oneCard) { - sb.append("s"); + sb.append('s'); } String message = amount.getMessage(); if (message.length() > 0) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java index 76558defd9..ae0c85ec39 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java @@ -130,10 +130,10 @@ public class DrawCardTargetEffect extends OneShotEffect { sb.append(CardUtil.numberToText(amount.toString(), "a")).append(" card"); try { if (Integer.parseInt(amount.toString()) > 1) { - sb.append("s"); + sb.append('s'); } } catch (Exception e) { - sb.append("s"); + sb.append('s'); } String message = amount.getMessage(); if (message.length() > 0) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/EpicEffect.java b/Mage/src/main/java/mage/abilities/effects/common/EpicEffect.java index a695f7a936..87ddd2f748 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/EpicEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/EpicEffect.java @@ -100,7 +100,7 @@ class EpicReplacementEffect extends ContinuousRuleModifyingEffectImpl { public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - return "For the rest of the game, you can't cast spells (Epic - " + mageObject.getName() + ")"; + return "For the rest of the game, you can't cast spells (Epic - " + mageObject.getName() + ')'; } return null; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileCardYouChooseTargetOpponentEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileCardYouChooseTargetOpponentEffect.java index 5517e52b38..dc0d697844 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileCardYouChooseTargetOpponentEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileCardYouChooseTargetOpponentEffect.java @@ -68,7 +68,7 @@ public class ExileCardYouChooseTargetOpponentEffect extends OneShotEffect { Card sourceCard = game.getCard(source.getSourceId()); if (controller != null && opponent != null) { if (!opponent.getHand().isEmpty()) { - opponent.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ")" : "Exile", opponent.getHand(), game); + opponent.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ')' : "Exile", opponent.getHand(), game); TargetCard target = new TargetCard(Zone.HAND, filter); if (controller.choose(Outcome.Exile, opponent.getHand(), target, game)) { Card card = opponent.getHand().get(target.getFirstTarget(), game); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileFromZoneTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileFromZoneTargetEffect.java index 97ecc487a0..4ff7097f65 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileFromZoneTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileFromZoneTargetEffect.java @@ -106,6 +106,6 @@ public class ExileFromZoneTargetEffect extends OneShotEffect { } private void setText() { - staticText = "target player exiles " + CardUtil.numberToText(amount, "a") + " " + filter.getMessage() + " from his or her " + zone.toString().toLowerCase(); + staticText = "target player exiles " + CardUtil.numberToText(amount, "a") + ' ' + filter.getMessage() + " from his or her " + zone.toString().toLowerCase(); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java index f6043e913f..1b10a2c554 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java @@ -60,7 +60,7 @@ public class ExileSourceUnlessPaysEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && sourcePermanent != null) { - StringBuilder sb = new StringBuilder(cost.getText()).append("?"); + StringBuilder sb = new StringBuilder(cost.getText()).append('?'); if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) { sb.insert(0, "Pay "); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java index c01b6923cf..af86ff288c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java @@ -87,9 +87,9 @@ public class GainLifeEffect extends OneShotEffect { String message = life.getMessage(); sb.append("you gain "); if (message.startsWith("that")) { - sb.append(message).append(" "); + sb.append(message).append(' '); } else if (message.isEmpty() || !message.equals("1")) { - sb.append(life).append(" "); + sb.append(life).append(' '); } sb.append("life"); if (message.length() > 0 && !message.startsWith("that")) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java index e51c820b5e..3e965d01ee 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java @@ -92,7 +92,7 @@ public class GainLifeTargetEffect extends OneShotEffect { } sb.append(" gains "); if (message.isEmpty() || !message.equals("1")) { - sb.append(life.toString()).append(" "); + sb.append(life.toString()).append(' '); } sb.append("life"); if (message.length() > 0) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/GetEmblemEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GetEmblemEffect.java index cd7c4dd6b3..796fb67700 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GetEmblemEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GetEmblemEffect.java @@ -45,7 +45,7 @@ public class GetEmblemEffect extends OneShotEffect { public GetEmblemEffect(Emblem emblem) { super(Outcome.Benefit); this.emblem = emblem; - this.staticText = "You get an emblem with \"" + emblem.getAbilities().getRules(null) + "\""; + this.staticText = "You get an emblem with \"" + emblem.getAbilities().getRules(null) + '"'; } public GetEmblemEffect(final GetEmblemEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/GetEmblemTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GetEmblemTargetPlayerEffect.java index 7f5daf3849..7c274efee2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GetEmblemTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GetEmblemTargetPlayerEffect.java @@ -79,6 +79,6 @@ public class GetEmblemTargetPlayerEffect extends OneShotEffect { if (staticText != null && !staticText.isEmpty()) { return staticText; } - return "Target " + mode.getTargets().get(0).getTargetName() + " gets an emblem with \"" + emblem.getAbilities().getRules(null) + "\""; + return "Target " + mode.getTargets().get(0).getTargetName() + " gets an emblem with \"" + emblem.getAbilities().getRules(null) + '"'; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java index b8b7167858..0d1c9dda85 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java @@ -222,7 +222,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff sb.append("put ").append(filter.getMessage()).append(" into your graveyard"); break; } - return sb.append("?").toString(); + return sb.append('?').toString(); } private String getPickText() { diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java index f63c0f5011..7537b12f15 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java @@ -84,7 +84,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect { sb.append("each opponent loses "); if (message.isEmpty() || !message.equals("1")) { - sb.append(amount).append(" "); + sb.append(amount).append(' '); } sb.append("life"); if (message.length() > 0) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java index 38164b67db..2909da13cb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java @@ -88,7 +88,7 @@ public class LoseLifeTargetEffect extends OneShotEffect { } sb.append(" loses "); if (message.isEmpty() || !message.equals("1")) { - sb.append(amount).append(" "); + sb.append(amount).append(' '); } sb.append("life"); if (message.length() > 0) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/NameACardEffect.java b/Mage/src/main/java/mage/abilities/effects/common/NameACardEffect.java index dccac2abdc..3559542e8b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/NameACardEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/NameACardEffect.java @@ -108,7 +108,7 @@ public class NameACardEffect extends OneShotEffect { } String cardName = cardChoice.getChoice(); if (!game.isSimulation()) { - game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + "]"); + game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + ']'); } game.getState().setValue(source.getSourceId().toString() + INFO_KEY, cardName); if (sourceObject instanceof Permanent) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToAllEffect.java index 6fe9320041..b57ae00a4b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToAllEffect.java @@ -64,7 +64,7 @@ public class PreventAllDamageToAllEffect extends PreventionEffectImpl { + (onlyCombat ? "combat ":"") + "damage that would be dealt to " + filter.getMessage() - + (duration.toString().isEmpty() ?"": " "+ duration.toString()); + + (duration.toString().isEmpty() ?"": ' ' + duration.toString()); } public PreventAllDamageToAllEffect(final PreventAllDamageToAllEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventAllNonCombatDamageToAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventAllNonCombatDamageToAllEffect.java index e17d8dafaf..7a3ef9802b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventAllNonCombatDamageToAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventAllNonCombatDamageToAllEffect.java @@ -49,7 +49,7 @@ public class PreventAllNonCombatDamageToAllEffect extends PreventionEffectImpl { public PreventAllNonCombatDamageToAllEffect(Duration duration, FilterInPlay filter) { super(duration, Integer.MAX_VALUE, false); this.filter = filter; - staticText = "Prevent all non combat damage that would be dealt to " + filter.getMessage() + " " + duration.toString(); + staticText = "Prevent all non combat damage that would be dealt to " + filter.getMessage() + ' ' + duration.toString(); } public PreventAllNonCombatDamageToAllEffect(final PreventAllNonCombatDamageToAllEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToControllerEffect.java index 92ae7dcf75..a3a87151d1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToControllerEffect.java @@ -80,9 +80,9 @@ public class PreventDamageToControllerEffect extends PreventionEffectImpl { if (amountToPrevent == Integer.MAX_VALUE) { sb.append("all "); } else if (amountToPreventDynamic != null) { - sb.append("the next ").append(amountToPreventDynamic.toString()).append(" "); + sb.append("the next ").append(amountToPreventDynamic.toString()).append(' '); } else { - sb.append("the next ").append(amountToPrevent).append(" "); + sb.append("the next ").append(amountToPrevent).append(' '); } if (onlyCombat) { sb.append("combat "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetEffect.java index c6aacddc43..6b651aa8e0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetEffect.java @@ -89,7 +89,7 @@ public class PreventDamageToTargetEffect extends PreventionEffectImpl { } sb.append(mode.getTargets().get(0).getTargetName()); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append("this turn"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java index d5638262ca..0b71592368 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java @@ -155,7 +155,7 @@ public class PutOnLibraryTargetEffect extends OneShotEffect { if (target.getMaxNumberOfTargets() > target.getNumberOfTargets()) { sb.append("up to "); } - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' '); } sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" on "); sb.append(onTop ? "top" : "the bottom").append(" of its owner's library"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToBattlefieldTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToBattlefieldTargetEffect.java index cc449d0cec..90516fa4ff 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToBattlefieldTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToBattlefieldTargetEffect.java @@ -97,7 +97,7 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) { sb.append("up to "); } - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' '); } sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" to the battlefield"); if (tapped) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToHandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToHandTargetEffect.java index fdd5ad5cf3..a78bd5c6b5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToHandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnFromGraveyardToHandTargetEffect.java @@ -78,7 +78,7 @@ public class ReturnFromGraveyardToHandTargetEffect extends OneShotEffect { if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) { sb.append("up to "); } - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' '); } if (!mode.getTargets().get(0).getTargetName().startsWith("another")) { sb.append("target "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenControlledPermanentEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenControlledPermanentEffect.java index 3d7d07cd2e..6a6949d37e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenControlledPermanentEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenControlledPermanentEffect.java @@ -68,7 +68,7 @@ public class ReturnToHandChosenControlledPermanentEffect extends ReturnToHandCho if (!filter.getMessage().startsWith("another")) { sb.append(CardUtil.numberToText(number, "a")); } - sb.append(" ").append(filter.getMessage()); + sb.append(' ').append(filter.getMessage()); if (number > 1) { sb.append(" to their owner's hand"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java index ccb9e97478..86538efe0b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java @@ -90,7 +90,7 @@ public class ReturnToHandChosenPermanentEffect extends OneShotEffect { if (!filter.getMessage().startsWith("another")) { sb.append(CardUtil.numberToText(number, "a")); } - sb.append(" ").append(filter.getMessage()); + sb.append(' ').append(filter.getMessage()); sb.append(" he or she controls"); if (number > 1) { sb.append(" to their owner's hand"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandTargetEffect.java index 5e85cdfac7..2ab4c45591 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandTargetEffect.java @@ -110,7 +110,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect { return sb.toString(); } else { if (target.getNumberOfTargets() > 1) { - sb.append(CardUtil.numberToText(target.getNumberOfTargets())).append(" "); + sb.append(CardUtil.numberToText(target.getNumberOfTargets())).append(' '); } if (!target.getTargetName().startsWith("another")) { sb.append("target "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeAllEffect.java index b58d273475..84377c93b3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeAllEffect.java @@ -115,7 +115,7 @@ public class SacrificeAllEffect extends OneShotEffect { } else { sb.append(CardUtil.numberToText(amount.toString(), "a")); } - sb.append(" "); + sb.append(' '); sb.append(filter.getMessage()); staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeEffect.java index a821c35458..6950c5d43e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeEffect.java @@ -130,7 +130,7 @@ public class SacrificeEffect extends OneShotEffect{ sb.append(" sacrifice "); } } - sb.append(CardUtil.numberToText(count.toString(), "a")).append(" "); + sb.append(CardUtil.numberToText(count.toString(), "a")).append(' '); sb.append(filter.getMessage()); staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsEffect.java index 5cdc5da396..147df3a392 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsEffect.java @@ -114,13 +114,13 @@ public class SacrificeOpponentsEffect extends OneShotEffect { } else { if (amount.toString().equals("1")) { if (!filter.getMessage().startsWith("a ") && !filter.getMessage().startsWith("an ")) { - sb.append("a"); + sb.append('a'); } } else { sb.append(CardUtil.numberToText(amount.toString())); } } - sb.append(" "); + sb.append(' '); sb.append(filter.getMessage()); staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsUnlessPayEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsUnlessPayEffect.java index 1b6ccbcdaf..5c891be7df 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsUnlessPayEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeOpponentsUnlessPayEffect.java @@ -189,14 +189,14 @@ public class SacrificeOpponentsUnlessPayEffect extends OneShotEffect{ } else { if (amount.toString().equals("1")) { if (!filter.getMessage().startsWith("a ") && !filter.getMessage().startsWith("an ")) { - sb.append("a"); + sb.append('a'); } } else { sb.append(CardUtil.numberToText(amount.toString())); } } - sb.append(" "); + sb.append(' '); sb.append(filter.getMessage()); sb.append(" unless he or she pays "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java index 3b8afb7944..e9990d91b1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java @@ -33,7 +33,7 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && sourcePermanent != null) { - StringBuilder sb = new StringBuilder(cost.getText()).append("?"); + StringBuilder sb = new StringBuilder(cost.getText()).append('?'); if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) { sb.insert(0, "Pay "); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SkipUntapOptionalSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SkipUntapOptionalSourceEffect.java index dc98024dd9..f12a191f58 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SkipUntapOptionalSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SkipUntapOptionalSourceEffect.java @@ -60,7 +60,7 @@ public class SkipUntapOptionalSourceEffect extends RestrictionEffect { @Override public boolean canBeUntapped(Permanent permanent, Ability source, Game game) { Player player = game.getPlayer(permanent.getControllerId()); - return player != null && player.chooseUse(Outcome.Benefit, "Untap " + permanent.getLogName() + "?", source, game); + return player != null && player.chooseUse(Outcome.Benefit, "Untap " + permanent.getLogName() + '?', source, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java index efc2b9321d..d92c01d4c7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java @@ -83,9 +83,9 @@ public class TapTargetEffect extends OneShotEffect { Target target = mode.getTargets().get(0); if (target.getMaxNumberOfTargets() > 1) { if (target.getMaxNumberOfTargets() == target.getNumberOfTargets()) { - return "tap " + CardUtil.numberToText(target.getNumberOfTargets()) + " target " + target.getTargetName() + "s"; + return "tap " + CardUtil.numberToText(target.getNumberOfTargets()) + " target " + target.getTargetName() + 's'; } else { - return "tap up to " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + " target " + target.getTargetName() + "s"; + return "tap up to " + CardUtil.numberToText(target.getMaxNumberOfTargets()) + " target " + target.getTargetName() + 's'; } } else if (target.getMaxNumberOfTargets() == 0){ return "tap X target " + mode.getTargets().get(0).getTargetName(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/UntapTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/UntapTargetEffect.java index 1347aeaeb1..57d5a9bbc0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/UntapTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/UntapTargetEffect.java @@ -81,7 +81,7 @@ public class UntapTargetEffect extends OneShotEffect { } if (target.getMaxNumberOfTargets() > 1 || target.getNumberOfTargets() == 0) { - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append("s"); + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append('s'); } else { if (!target.getTargetName().startsWith("another")) { sb.append("target "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/WishEffect.java b/Mage/src/main/java/mage/abilities/effects/common/WishEffect.java index 05208eb958..e18709fa15 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/WishEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/WishEffect.java @@ -101,7 +101,7 @@ public class WishEffect extends OneShotEffect { List exile = game.getExile().getAllCards(game); boolean noTargets = cards.isEmpty() && (alsoFromExile ? exile.isEmpty() : true); if (noTargets) { - game.informPlayer(controller, "You have no cards outside the game" + (alsoFromExile ? " or in exile" : "") + "."); + game.informPlayer(controller, "You have no cards outside the game" + (alsoFromExile ? " or in exile" : "") + '.'); return true; } @@ -118,7 +118,7 @@ public class WishEffect extends OneShotEffect { } } if (filteredCards.isEmpty()) { - game.informPlayer(controller, "You don't have " + filter.getMessage() + " outside the game" + (alsoFromExile ? " or in exile" : "") + "."); + game.informPlayer(controller, "You don't have " + filter.getMessage() + " outside the game" + (alsoFromExile ? " or in exile" : "") + '.'); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CanAttackAsThoughItDidntHaveDefenderAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CanAttackAsThoughItDidntHaveDefenderAllEffect.java index 85a4e2eff6..1acbd8bba1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CanAttackAsThoughItDidntHaveDefenderAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CanAttackAsThoughItDidntHaveDefenderAllEffect.java @@ -86,7 +86,7 @@ public class CanAttackAsThoughItDidntHaveDefenderAllEffect extends AsThoughEffec } else { sb.append(duration.toString()); } - sb.append(" "); + sb.append(' '); } sb.append("as though they didn't have defender"); return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAnyPlayerAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAnyPlayerAllEffect.java index d5fa0b7dd9..436ed02beb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAnyPlayerAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAnyPlayerAllEffect.java @@ -49,11 +49,11 @@ public class CantAttackAnyPlayerAllEffect extends RestrictionEffect { this.filter = filter; StringBuilder sb = new StringBuilder(filter.getMessage()).append(" can't attack"); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append(" this turn"); } else { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } } staticText = sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockAllEffect.java index 7fee1dd847..96a726b457 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackBlockAllEffect.java @@ -47,11 +47,11 @@ public class CantAttackBlockAllEffect extends RestrictionEffect { this.filter = filter; StringBuilder sb = new StringBuilder(filter.getMessage()).append(" can't attack or block"); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append(" this turn"); } else { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } } staticText = sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java index 121b5aa6ba..67abeff84d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java @@ -88,7 +88,7 @@ public class CantBeBlockedTargetEffect extends RestrictionEffect { } } if (target.getMaxNumberOfTargets() > 1) { - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' '); } sb.append("target ").append(mode.getTargets().get(0).getTargetName()); if (target.getMaxNumberOfTargets() > 1) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockAttachedEffect.java index 2c5f215b82..50927b66ab 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockAttachedEffect.java @@ -62,10 +62,10 @@ public class CantBlockAttachedEffect extends RestrictionEffect { sb.append("Equipped creature can't block"); } if (!filter.getMessage().equals("creature")) { - sb.append(" ").append(filter.getMessage()); + sb.append(' ').append(filter.getMessage()); } if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockTargetEffect.java index 940ab26b09..5e61b12edd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockTargetEffect.java @@ -75,17 +75,17 @@ public class CantBlockTargetEffect extends RestrictionEffect { } StringBuilder sb = new StringBuilder(); Target target = mode.getTargets().get(0); - if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) { - sb.append("any number of "); - } else if (target.getMaxNumberOfTargets() > 1) { + if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) { + sb.append("any number of "); + } else if (target.getMaxNumberOfTargets() > 1) { if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) { sb.append("up to "); } - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' '); } sb.append("target ").append(mode.getTargets().get(0).getTargetName()); if (target.getMaxNumberOfTargets() > 1) { - sb.append("s"); + sb.append('s'); } sb.append(" can't block"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java index 380b3a1fff..9961a6f614 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java @@ -107,7 +107,7 @@ public class AssignNoCombatDamageSourceEffect extends ReplacementEffectImpl { break; default: if (duration.toString().length() > 0) { - text += " " + duration.toString(); + text += ' ' + duration.toString(); } } return text; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java index 22ccfa003e..ef525ea505 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java @@ -216,7 +216,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { } } if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java index 0f5244ef2b..a9312c85d3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java @@ -85,15 +85,15 @@ public class BecomesColorOrColorsTargetEffect extends OneShotEffect { game.informPlayers(target.getName() + ": " + controller.getLogName() + " has chosen " + choiceColor.getChoice()); } if (choiceColor.getColor().isBlack()) { - sb.append("B"); + sb.append('B'); } else if (choiceColor.getColor().isBlue()) { - sb.append("U"); + sb.append('U'); } else if (choiceColor.getColor().isRed()) { - sb.append("R"); + sb.append('R'); } else if (choiceColor.getColor().isGreen()) { - sb.append("G"); + sb.append('G'); } else if (choiceColor.getColor().isWhite()) { - sb.append("W"); + sb.append('W'); } } String colors = new String(sb); @@ -123,7 +123,7 @@ public class BecomesColorOrColorsTargetEffect extends OneShotEffect { sb.append(mode.getTargets().get(0).getFilter().getMessage()); sb.append(" becomes the color or colors of your choice"); if (duration.toString().length() > 0) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorSourceEffect.java index c945fbcd2a..2ab725e74a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorSourceEffect.java @@ -120,6 +120,6 @@ public class BecomesColorSourceEffect extends ContinuousEffectImpl { return staticText; } return "{this} becomes " + (setColor == null ? "the color of your choice" : setColor.getDescription()) - + " " + duration.toString(); + + ' ' + duration.toString(); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorTargetEffect.java index f1d1369cdb..12675f6798 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorTargetEffect.java @@ -143,7 +143,7 @@ public class BecomesColorTargetEffect extends ContinuousEffectImpl { } else { sb.append(setColor.getDescription()); } - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); return sb.toString(); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java index 00475d4f93..e16b52adcc 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java @@ -184,7 +184,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { sb.append(" becomes a "); } sb.append(token.getDescription()); - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); if (addStillALandText) { if (target.getMaxNumberOfTargets() > 1) { sb.append(". They're still lands"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java index 4837e258e1..f7bb98281d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java @@ -101,7 +101,7 @@ public class BecomesCreatureTypeTargetEffect extends ContinuousEffectImpl { StringBuilder sb = new StringBuilder(); sb.append("Target creature becomes that type"); if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java index 982a6831d9..f59a794e8e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java @@ -103,7 +103,7 @@ public class BecomesSubtypeAllEffect extends ContinuousEffectImpl { sb.append("Target creature becomes that type"); if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllEffect.java index 74f5f39b5b..e16c81de1f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllEffect.java @@ -178,15 +178,15 @@ public class BoostAllEffect extends ContinuousEffectImpl { sb.append(filter.getMessage()).append(" get "); String p = power.toString(); if (!p.startsWith("-")) { - sb.append("+"); + sb.append('+'); } - sb.append(p).append("/"); + sb.append(p).append('/'); String t = toughness.toString(); if (!t.startsWith("-")) { if (p.startsWith("-")) { - sb.append("-"); + sb.append('-'); } else { - sb.append("+"); + sb.append('+'); } } sb.append(t); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostControlledEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostControlledEffect.java index 1ac09946b4..7a743e6f5e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostControlledEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostControlledEffect.java @@ -161,15 +161,15 @@ public class BoostControlledEffect extends ContinuousEffectImpl { String p = power.toString(); if (!p.startsWith("-")) { - sb.append("+"); + sb.append('+'); } - sb.append(p).append("/"); + sb.append(p).append('/'); String t = toughness.toString(); if (!t.startsWith("-")) { if (p.startsWith("-")) { - sb.append("-"); + sb.append('-'); } else { - sb.append("+"); + sb.append('+'); } } sb.append(t); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEnchantedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEnchantedEffect.java index 4470727115..41d5d5dda2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEnchantedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEnchantedEffect.java @@ -118,20 +118,20 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl { sb.append("Enchanted creature gets "); String p = power.toString(); if (!p.startsWith("-")) { - sb.append("+"); + sb.append('+'); } - sb.append(p).append("/"); + sb.append(p).append('/'); String t = toughness.toString(); if (!t.startsWith("-")) { if (p.startsWith("-")) { - sb.append("-"); + sb.append('-'); } else { - sb.append("+"); + sb.append('+'); } } sb.append(t); if (duration != Duration.WhileOnBattlefield) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } String message = null; String fixedPart = null; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java index dd3150b62e..33eff81c6a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java @@ -119,18 +119,18 @@ public class BoostEquippedEffect extends ContinuousEffectImpl { sb.append("Equipped creature gets "); String p = power.toString(); if (!p.startsWith("-")) - sb.append("+"); - sb.append(p).append("/"); + sb.append('+'); + sb.append(p).append('/'); String t = toughness.toString(); if (!t.startsWith("-")) { if (p.startsWith("-")) - sb.append("-"); + sb.append('-'); else - sb.append("+"); + sb.append('+'); } sb.append(t); if (duration != Duration.WhileOnBattlefield) - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); String message = power.getMessage(); if (message.length() > 0) { sb.append(" for each "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostSourceEffect.java index 93ab0363ad..2442da61cf 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostSourceEffect.java @@ -121,21 +121,21 @@ public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEff sb.append("{this} gets "); String p = power.toString(); if(!p.startsWith("-")) { - sb.append("+"); + sb.append('+'); } - sb.append(p).append("/"); + sb.append(p).append('/'); String t = toughness.toString(); if(!t.startsWith("-")){ if(t.startsWith("-")) { - sb.append("-"); + sb.append('-'); } else { - sb.append("+"); + sb.append('+'); } } sb.append(t); if (duration != Duration.WhileOnBattlefield) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } String message = null; String fixedPart = null; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostTargetEffect.java index 31655da573..6b8eaed477 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostTargetEffect.java @@ -133,20 +133,20 @@ public class BoostTargetEffect extends ContinuousEffectImpl { } String p = power.toString(); if (!p.startsWith("-")) { - sb.append("+"); + sb.append('+'); } - sb.append(p).append("/"); + sb.append(p).append('/'); String t = toughness.toString(); if (!t.startsWith("-")) { if (t.equals("0") && p.startsWith("-")) { - sb.append("-"); + sb.append('-'); } else { - sb.append("+"); + sb.append('+'); } } sb.append(t); if (duration != Duration.WhileOnBattlefield) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } String message = null; String fixedPart = null; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeAllEffect.java index e14041fc65..1e32816cce 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeAllEffect.java @@ -129,7 +129,7 @@ public class CantGainLifeAllEffect extends ContinuousEffectImpl { } sb.append(" can't gain life"); if (!this.duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); if (duration.equals(Duration.EndOfTurn)) { sb.append("this turn"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeTargetEffect.java index a1dd5e5819..7ac097963a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/CantGainLifeTargetEffect.java @@ -51,7 +51,7 @@ public class CantGainLifeTargetEffect extends ContinuousEffectImpl { if (duration.equals(Duration.EndOfTurn)) { sb.append("this turn, "); } else { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } } sb.append("that player gains no life instead"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/CastAsThoughItHadFlashAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/CastAsThoughItHadFlashAllEffect.java index 5589f5e8ca..ab7967dc1d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/CastAsThoughItHadFlashAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/CastAsThoughItHadFlashAllEffect.java @@ -97,7 +97,8 @@ public class CastAsThoughItHadFlashAllEffect extends AsThoughEffectImpl { if (duration.equals(Duration.EndOfTurn)) { sb.append(" this turn"); } else { - sb.append(" "); + sb.append(' '); + sb.append(' '); sb.append(duration.toString()); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java index b7a948f298..66320f7a27 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java @@ -191,14 +191,14 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl { sb.append(" gain "); } if (quotes) { - sb.append("\""); + sb.append('"'); } sb.append(ability.getRule()); if (quotes) { - sb.append("\""); + sb.append('"'); } if (duration.toString().length() > 0) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAttachedEffect.java index d26eaf8ab7..90734de9f2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAttachedEffect.java @@ -137,7 +137,7 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl { } sb.append(ability.getRule()); if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledEffect.java index c20ada07bd..d9811387ea 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControlledEffect.java @@ -166,7 +166,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl { if (duration.equals(Duration.WhileOnBattlefield) || duration.equals(Duration.EndOfGame)) { sb.append("have "); if (gainedAbility.startsWith("Whenever ") || gainedAbility.startsWith("{T}")) { - gainedAbility = "\"" + gainedAbility + "\""; + gainedAbility = '"' + gainedAbility + '"'; } } else { @@ -174,7 +174,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl { } sb.append(gainedAbility); if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControllerEffect.java index a4842f68bb..2bd6476997 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControllerEffect.java @@ -63,7 +63,7 @@ public class GainAbilityControllerEffect extends ContinuousEffectImpl { this.ability = ability; staticText = "You have " + ability.getRule(); if (!duration.toString().isEmpty()) { - staticText += " " + duration.toString(); + staticText += ' ' + duration.toString(); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java index 609ad65d29..1d6666a93a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java @@ -64,7 +64,7 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl implements Sou public GainAbilitySourceEffect(Ability ability, Duration duration, boolean onCard) { super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); this.ability = ability; - staticText = "{this} gains " + ability.getRule() + " " + duration.toString(); + staticText = "{this} gains " + ability.getRule() + ' ' + duration.toString(); this.onCard = onCard; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java index ac019f328d..b689d1224d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java @@ -162,11 +162,11 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl { } StringBuilder sb = new StringBuilder(); Target target = mode.getTargets().get(0); - if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) { - sb.append("any number of target ").append(target.getTargetName()).append(" gain "); - } else if (target.getMaxNumberOfTargets() > 1) { + if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) { + sb.append("any number of target ").append(target.getTargetName()).append(" gain "); + } else if (target.getMaxNumberOfTargets() > 1) { if (target.getNumberOfTargets() < target.getMaxNumberOfTargets()) { - sb.append("up to "); + sb.append("up to "); } sb.append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()).append(" gain "); } else { @@ -180,7 +180,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl { if (durationPhaseStep != null) { sb.append(" until your next ").append(durationPhaseStep.toString().toLowerCase(Locale.ENGLISH)); } else if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainControlTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainControlTargetEffect.java index 3927e34b34..9a3d9fedd4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainControlTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainControlTargetEffect.java @@ -150,7 +150,7 @@ public class GainControlTargetEffect extends ContinuousEffectImpl { } sb.append(mode.getTargets().get(0).getTargetName()); if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromTypeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromTypeTargetEffect.java index 8cd87d07f1..2d51b991f3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromTypeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromTypeTargetEffect.java @@ -47,7 +47,7 @@ public class GainProtectionFromTypeTargetEffect extends GainAbilityTargetEffect super(new ProtectionAbility(new FilterCard()), duration); ((ProtectionAbility)ability).setFilter(protectionFrom); typeName = protectionFrom.getMessage(); - staticText = "Target creature gains protection from " + typeName + " " + duration.toString(); + staticText = "Target creature gains protection from " + typeName + ' ' + duration.toString(); } public GainProtectionFromTypeTargetEffect(final GainProtectionFromTypeTargetEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAllEffect.java index 3962f8f9a1..4e8e86e908 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityAllEffect.java @@ -28,7 +28,7 @@ public class LoseAbilityAllEffect extends ContinuousEffectImpl { super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); this.filter = filter; this.ability = ability; - staticText = filter.getMessage() + " lose " + ability.toString() + (duration.toString().isEmpty() ? "" : " " + duration.toString()); + staticText = filter.getMessage() + " lose " + ability.toString() + (duration.toString().isEmpty() ? "" : ' ' + duration.toString()); } public LoseAbilityAllEffect(final LoseAbilityAllEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityOrAnotherAbilityTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityOrAnotherAbilityTargetEffect.java index beec0ac0a2..aa7201f1f8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityOrAnotherAbilityTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityOrAnotherAbilityTargetEffect.java @@ -123,7 +123,7 @@ public class LoseAbilityOrAnotherAbilityTargetEffect extends LoseAbilityTargetEf sb.append(" or "); sb.append(ability2.getRule()); if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilitySourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilitySourceEffect.java index 785420e329..bbb09b1281 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilitySourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilitySourceEffect.java @@ -27,7 +27,7 @@ public class LoseAbilitySourceEffect extends ContinuousEffectImpl{ public LoseAbilitySourceEffect(Ability ability, Duration duration){ super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.LoseAbility); this.ability = ability; - staticText = "{this} loses " + ability.getRule() + " " + duration.toString(); + staticText = "{this} loses " + ability.getRule() + ' ' + duration.toString(); } public LoseAbilitySourceEffect(final LoseAbilitySourceEffect effect){ diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityTargetEffect.java index 6ceab45adb..3ac29f8314 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAbilityTargetEffect.java @@ -93,7 +93,7 @@ public class LoseAbilityTargetEffect extends ContinuousEffectImpl { } sb.append(ability.getRule()); if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java index f6636df1e2..cb528774c9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetCardSubtypeAttachedEffect.java @@ -96,7 +96,7 @@ public class SetCardSubtypeAttachedEffect extends ContinuousEffectImpl { sb.append(" creature is a"); for (String subtype : this.setSubtypes) { - sb.append(" ").append(subtype); + sb.append(' ').append(subtype); } staticText = sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessAllEffect.java index 8b1c6fa277..0e47cf0ea0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessAllEffect.java @@ -131,9 +131,9 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl { } else { sb.append(" have base power and toughness "); } - sb.append(power).append("/").append(toughness); + sb.append(power).append('/').append(toughness); if (!duration.toString().isEmpty()) { - sb.append(" ").append(duration.toString()); + sb.append(' ').append(duration.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java index 36e4ec09c1..5947dbdb31 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java @@ -66,7 +66,7 @@ public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl { super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature); this.power = power; this.toughness = toughness; - staticText = "{this}'s power and toughness is " + power + "/" + toughness + " " + duration.toString(); + staticText = "{this}'s power and toughness is " + power + '/' + toughness + ' ' + duration.toString(); } public SetPowerToughnessSourceEffect(final SetPowerToughnessSourceEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessTargetEffect.java index 0824e1b523..f9cd504ccb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessTargetEffect.java @@ -96,7 +96,7 @@ public class SetPowerToughnessTargetEffect extends ContinuousEffectImpl { } StringBuilder sb = new StringBuilder(); sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" has base power and toughness "); - sb.append(power).append("/").append(toughness).append(" ").append(duration.toString()); + sb.append(power).append('/').append(toughness).append(' ').append(duration.toString()); return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessAllEffect.java index 576aeaf0e6..d61932de00 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessAllEffect.java @@ -109,7 +109,7 @@ public class SwitchPowerToughnessAllEffect extends ContinuousEffectImpl { StringBuilder sb = new StringBuilder(); sb.append("Switch each creature's power and toughness"); if (!duration.toString().isEmpty()) { - sb.append(" "); + sb.append(' '); sb.append(duration.toString()); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessTargetEffect.java index bd1bbdb961..759ae59865 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SwitchPowerToughnessTargetEffect.java @@ -73,7 +73,7 @@ public class SwitchPowerToughnessTargetEffect extends ContinuousEffectImpl { public String getText(Mode mode) { StringBuilder sb = new StringBuilder(); sb.append("Switch target ").append(mode.getTargets().get(0).getTargetName()).append("'s power and toughness") - .append(" ").append(duration.toString()); + .append(' ').append(duration.toString()); return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java index 50b4e1506a..e63c115b7e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java @@ -67,7 +67,7 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl { this.amount = amount; this.upTo = upTo; - this.staticText = filter.getMessage() + " cost " + (upTo ? "up to " : "") + "{" + amount + "} less to cast"; + this.staticText = filter.getMessage() + " cost " + (upTo ? "up to " : "") + '{' + amount + "} less to cast"; } protected SpellsCostReductionAllEffect(SpellsCostReductionAllEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java index 9aa7fc3710..20d8ab95b7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java @@ -83,7 +83,7 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI this.filter = filter; this.amount = amount; this.upTo = upTo; - this.staticText = filter.getMessage() + " you cast cost " + (upTo ? "up to " : "") + "{" + amount + "} less to cast"; + this.staticText = filter.getMessage() + " you cast cost " + (upTo ? "up to " : "") + '{' + amount + "} less to cast"; } protected SpellsCostReductionControllerEffect(final SpellsCostReductionControllerEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAllEffect.java index 0dc24e8709..3bc9ba0e98 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAllEffect.java @@ -68,7 +68,7 @@ public class AddCountersAllEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.addCounters(counter.copy(), source, game); if (!game.isSimulation()) { - game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + counter.getCount() + " " + counter.getName().toLowerCase() + game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + counter.getCount() + ' ' + counter.getName().toLowerCase() + " counter on " + permanent.getLogName()); } } @@ -82,7 +82,7 @@ public class AddCountersAllEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("put "); if (counter.getCount() > 1) { - sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName().toLowerCase()).append(" counters on each "); + sb.append(Integer.toString(counter.getCount())).append(' ').append(counter.getName().toLowerCase()).append(" counters on each "); } else { sb.append("a ").append(counter.getName().toLowerCase()).append(" counter on each "); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java index a96dfea05f..20554668e2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java @@ -95,7 +95,7 @@ public class AddCountersAttachedEffect extends OneShotEffect { // put a +1/+1 counter on it sb.append("put "); if (counter.getCount() > 1) { - sb.append(CardUtil.numberToText(counter.getCount())).append(" "); + sb.append(CardUtil.numberToText(counter.getCount())).append(' '); } else { sb.append("a "); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersControllerEffect.java index 36234a508c..6e937a1c47 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersControllerEffect.java @@ -94,7 +94,7 @@ public class AddCountersControllerEffect extends OneShotEffect { private void setText() { if (counter.getCount() > 1) { StringBuilder sb = new StringBuilder(); - sb.append("its controller gets ").append(Integer.toString(counter.getCount())).append(" ").append(counter.getName()).append(" counters"); + sb.append("its controller gets ").append(Integer.toString(counter.getCount())).append(' ').append(counter.getName()).append(" counters"); staticText = sb.toString(); } else { staticText = "its controller gets a " + counter.getName() + " counter"; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java index 99f46c8f7a..f1b1bb981c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java @@ -107,7 +107,7 @@ public class AddCountersSourceEffect extends OneShotEffect { if (informPlayers && !game.isSimulation()) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - game.informPlayers(player.getLogName() + " puts " + newCounter.getCount() + " " + newCounter.getName().toLowerCase() + " counter on " + card.getLogName()); + game.informPlayers(player.getLogName() + " puts " + newCounter.getCount() + ' ' + newCounter.getName().toLowerCase() + " counter on " + card.getLogName()); } } } @@ -133,7 +133,7 @@ public class AddCountersSourceEffect extends OneShotEffect { int amountAdded = permanent.getCounters(game).getCount(newCounter.getName()) - before; Player player = game.getPlayer(source.getControllerId()); if (player != null) { - game.informPlayers(player.getLogName() + " puts " + amountAdded + " " + newCounter.getName().toLowerCase() + " counter on " + permanent.getLogName()); + game.informPlayers(player.getLogName() + " puts " + amountAdded + ' ' + newCounter.getName().toLowerCase() + " counter on " + permanent.getLogName()); } } } @@ -149,7 +149,7 @@ public class AddCountersSourceEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("put "); if (counter.getCount() > 1) { - sb.append(CardUtil.numberToText(counter.getCount())).append(" "); + sb.append(CardUtil.numberToText(counter.getCount())).append(' '); } else { if (amount.toString().equals("X") && amount.getMessage().isEmpty()) { sb.append("X "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index 05587f40fb..f2f40afefd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -102,7 +102,7 @@ public class AddCountersTargetEffect extends OneShotEffect { affectedTargets++; if (!game.isSimulation()) { game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " - + numberAdded + " " + counter.getName().toLowerCase() + " counter on " + permanent.getLogName()); + + numberAdded + ' ' + counter.getName().toLowerCase() + " counter on " + permanent.getLogName()); } } else if (player != null) { Counter newCounter = counter.copy(); @@ -111,14 +111,14 @@ public class AddCountersTargetEffect extends OneShotEffect { affectedTargets++; if (!game.isSimulation()) { game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " - + counter.getCount() + " " + counter.getName().toLowerCase() + " counter on " + player.getLogName()); + + counter.getCount() + ' ' + counter.getName().toLowerCase() + " counter on " + player.getLogName()); } } else if (card != null) { card.addCounters(counter, source, game); if (!game.isSimulation()) { - game.informPlayers(new StringBuilder("Added ").append(counter.getCount()).append(" ").append(counter.getName()) + game.informPlayers(new StringBuilder("Added ").append(counter.getCount()).append(' ').append(counter.getName()) .append(" counter to ").append(card.getName()) - .append(" (").append(card.getCounters(game).getCount(counter.getName())).append(")").toString()); + .append(" (").append(card.getCounters(game).getCount(counter.getName())).append(')').toString()); } return true; } @@ -136,13 +136,13 @@ public class AddCountersTargetEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("put "); if (counter.getCount() > 1) { - sb.append(CardUtil.numberToText(counter.getCount())).append(" "); + sb.append(CardUtil.numberToText(counter.getCount())).append(' '); } else { sb.append("a "); } sb.append(counter.getName().toLowerCase()).append(" counter"); if (counter.getCount() > 1) { - sb.append("s"); + sb.append('s'); } sb.append(" on "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java index 6d84a0614f..0e59f9641e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java @@ -98,7 +98,7 @@ public class AddRemoveAllTimeSuspentCountersEffect extends OneShotEffect { if (!game.isSimulation()) { game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") .append(controller.getLogName()).append(actionStr) - .append(counter.getCount()).append(" ").append(counterName.toLowerCase()) + .append(counter.getCount()).append(' ').append(counterName.toLowerCase()) .append(" counter on ").append(card.getName()).toString()); } } @@ -110,7 +110,7 @@ public class AddRemoveAllTimeSuspentCountersEffect extends OneShotEffect { final String actionsStr2 = removeCounter ? "remove " : " put "; sb.append(actionsStr2); if (counter.getCount() > 1) { - sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName().toLowerCase()).append(" counters on each "); + sb.append(Integer.toString(counter.getCount())).append(' ').append(counter.getName().toLowerCase()).append(" counters on each "); } else { sb.append("a ").append(counter.getName().toLowerCase()).append(" counter on each "); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java index 0f74a9fb4c..6cb3f44bb1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java @@ -102,7 +102,7 @@ public class DistributeCountersEffect extends OneShotEffect { } String name = counterType.getName(); - String text = "distribute " + CardUtil.numberToText(amount) + " " + name + " counters among " + targetDescription + "."; + String text = "distribute " + CardUtil.numberToText(amount) + ' ' + name + " counters among " + targetDescription + '.'; if (removeAtEndOfTurn) { text += " For each " + name + " counter you put on a creature this way, remove a " + name + " counter from that creature at the beginning of the next cleanup step."; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java index b255546221..983797d08c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java @@ -88,7 +88,7 @@ public class GetEnergyCountersControllerEffect extends OneShotEffect { sb.append(val > 1 ? "s" : ""); sb.append(")
"); if ((value instanceof StaticValue)) { - sb.append("."); + sb.append('.'); } else { sb.append(" for each "); sb.append(value.getMessage()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java index 4979d2ca0f..c4fce2f0f1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java @@ -70,7 +70,7 @@ public class MoveCountersTargetsEffect extends OneShotEffect { removeTargetCreature.removeCounters(counterType.createInstance(amount), game); addTargetCreature.addCounters(counterType.createInstance(amount), source, game); if (!game.isSimulation()) { - game.informPlayers("Moved " + amount + " " + counterType.getName() + " counter" + (amount > 1 ? "s" : "") + " from " + removeTargetCreature.getLogName() + " to " + addTargetCreature.getLogName()); + game.informPlayers("Moved " + amount + ' ' + counterType.getName() + " counter" + (amount > 1 ? "s" : "") + " from " + removeTargetCreature.getLogName() + " to " + addTargetCreature.getLogName()); } return true; } @@ -87,15 +87,15 @@ public class MoveCountersTargetsEffect extends OneShotEffect { if (amount > 1) { sb.append(amount); } else { - sb.append("a"); + sb.append('a'); } - sb.append(" "); + sb.append(' '); sb.append(counterType.getName()); sb.append(" counter"); if (amount > 1) { sb.append("s "); } else { - sb.append(" "); + sb.append(' '); } sb.append("from one target creature to another target creature"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java index 89f4ff24cd..b67caad706 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java @@ -88,7 +88,7 @@ public class ProliferateEffect extends OneShotEffect { choices.add(counter.getName()); } choice.setChoices(choices); - choice.setMessage("Choose a counter to proliferate (" + permanent.getIdName() + ")"); + choice.setMessage("Choose a counter to proliferate (" + permanent.getIdName() + ')'); controller.choose(Outcome.Benefit, choice, game); for (Counter counter : permanent.getCounters(game).values()) { if (counter.getName().equals(choice.getChoice())) { @@ -115,7 +115,7 @@ public class ProliferateEffect extends OneShotEffect { choices.add(counter.getName()); } choice.setChoices(choices); - choice.setMessage("Choose a counter to proliferate (" + player.getLogName() + ")"); + choice.setMessage("Choose a counter to proliferate (" + player.getLogName() + ')'); controller.choose(Outcome.Benefit, choice, game); for (Counter counter : player.getCounters().values()) { if (counter.getName().equals(choice.getChoice())) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java index 6322b59d12..2e4feb8c52 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java @@ -62,7 +62,7 @@ public class RemoveCounterSourceEffect extends OneShotEffect { if (toRemove > 0) { permanent.removeCounters(counter.getName(), toRemove, game); if (!game.isSimulation()) { - game.informPlayers("Removed " + toRemove + " " + counter.getName() + " counter from " + permanent.getLogName()); + game.informPlayers("Removed " + toRemove + ' ' + counter.getName() + " counter from " + permanent.getLogName()); } } return true; @@ -73,7 +73,7 @@ public class RemoveCounterSourceEffect extends OneShotEffect { if (toRemove > 0) { card.removeCounters(counter.getName(), toRemove, game); if (!game.isSimulation()) { - game.informPlayers("Removed " + toRemove + " " + counter.getName() + game.informPlayers("Removed " + toRemove + ' ' + counter.getName() + " counter from " + card.getLogName() + " (" + card.getCounters(game).getCount(counter.getName()) + " left)"); } @@ -91,7 +91,7 @@ public class RemoveCounterSourceEffect extends OneShotEffect { private void setText() { if (counter.getCount() > 1) { StringBuilder sb = new StringBuilder(); - sb.append("remove ").append(Integer.toString(counter.getCount())).append(" ").append(counter.getName()).append(" counters from {this}"); + sb.append("remove ").append(Integer.toString(counter.getCount())).append(' ').append(counter.getName()).append(" counters from {this}"); staticText = sb.toString(); } else { staticText = "remove a " + counter.getName() + " counter from {this}"; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java index ff8a03f950..3647644a9d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java @@ -74,7 +74,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { if(toRemove != null && p.getCounters(game).getCount(toRemove.getName()) >= toRemove.getCount()) { p.removeCounters(toRemove.getName(), toRemove.getCount(), game); if(!game.isSimulation()) - game.informPlayers("Removed " + toRemove.getCount() + " " + toRemove.getName() + game.informPlayers("Removed " + toRemove.getCount() + ' ' + toRemove.getName() + " counter from " + p.getName()); return true; } @@ -83,7 +83,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { if (c != null && counter != null && c.getCounters(game).getCount(counter.getName()) >= counter.getCount()) { c.removeCounters(counter.getName(), counter.getCount(), game); if (!game.isSimulation()) - game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName()) + game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(' ').append(counter.getName()) .append(" counter from ").append(c.getName()) .append(" (").append(c.getCounters(game).getCount(counter.getName())).append(" left)").toString()); return true; @@ -135,7 +135,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { text += "a counter"; } else { - text += CardUtil.numberToText(counter.getCount(), "a") + " " + counter.getName(); + text += CardUtil.numberToText(counter.getCount(), "a") + ' ' + counter.getName(); text += counter.getCount() > 1 ? " counters" : " counter"; } text += " from target " + mode.getTargets().get(0).getTargetName(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java index f0daee0174..b527f9073f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java @@ -151,7 +151,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect { revealedCards.addAll(player.getHand()); } - player.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ")" : "Discard", revealedCards, game); + player.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ')' : "Discard", revealedCards, game); boolean result = true; int filteredCardsCount = revealedCards.count(filter, source.getSourceId(), source.getControllerId(), game); @@ -208,7 +208,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect { sb.append(". You choose "); boolean discardMultipleCards = !numberCardsToDiscard.toString().equals("1"); if (discardMultipleCards) { - sb.append(numberCardsToDiscard).append(" "); + sb.append(numberCardsToDiscard).append(' '); } else { if (!filter.getMessage().startsWith("a ") && !filter.getMessage().startsWith("an ")) { sb.append("a "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java index fa9d314a21..e21c7574d8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java @@ -100,17 +100,17 @@ public class DiscardControllerEffect extends OneShotEffect { private void setText() { StringBuilder sb = new StringBuilder("discard "); if (amount.toString().equals("1")) { - sb.append("a"); + sb.append('a'); } else { sb.append(CardUtil.numberToText(amount.toString())); } sb.append(" card"); try { if (Integer.parseInt(amount.toString()) > 1) { - sb.append("s"); + sb.append('s'); } } catch (Exception e) { - sb.append("s"); + sb.append('s'); } if (randomDiscard) { sb.append(" at random"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java index c4817e5e59..7272b439ce 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java @@ -140,10 +140,10 @@ public class DiscardEachPlayerEffect extends OneShotEffect { sb.append(CardUtil.numberToText(amount.toString(), "a")).append(" card"); try { if (Integer.parseInt(amount.toString()) > 1) { - sb.append("s"); + sb.append('s'); } } catch (Exception e) { - sb.append("s"); + sb.append('s'); } if (randomDiscard) { sb.append(" at random"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyDuringPhaseStepSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyDuringPhaseStepSourceEffect.java index f506db3798..c20202dfc9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyDuringPhaseStepSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyDuringPhaseStepSourceEffect.java @@ -72,7 +72,7 @@ public class CastOnlyDuringPhaseStepSourceEffect extends ContinuousRuleModifying sb.append("the ").append(phaseStep.getStepText()); } if (condition != null) { - sb.append(" ").append(condition.toString()); + sb.append(' ').append(condition.toString()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java index 0b007176b8..656a47b3e7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java @@ -78,7 +78,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect { MageObject sourceObject = source.getSourceObject(game); Card cardFound = null; if (controller != null && sourceObject != null) { - if (forceToSearchBoth || controller.chooseUse(outcome, "Search your library for a card named " + filter.getMessage() + "?", source, game)) { + if (forceToSearchBoth || controller.chooseUse(outcome, "Search your library for a card named " + filter.getMessage() + '?', source, game)) { TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter); target.clearChosen(); if (controller.searchLibrary(target, game)) { @@ -89,7 +89,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect { controller.shuffleLibrary(source, game); } - if (cardFound == null && controller.chooseUse(outcome, "Search your graveyard for a card named " + filter.getMessage() + "?", source, game)) { + if (cardFound == null && controller.chooseUse(outcome, "Search your graveyard for a card named " + filter.getMessage() + '?', source, game)) { TargetCard target = new TargetCard(0, 1, Zone.GRAVEYARD, filter); target.clearChosen(); if (controller.choose(outcome, controller.getGraveyard(), target, game)) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java index a992a18e79..8ce316cfc5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java @@ -121,7 +121,7 @@ public class SearchLibraryPutInHandEffect extends SearchEffect { StringBuilder sb = new StringBuilder(); sb.append(rulePrefix); if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) { - sb.append("up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + sb.append("up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(' '); sb.append(target.getTargetName()).append(revealCards ? ", reveal them," : "").append(" and put them into your hand"); } else { sb.append("a ").append(target.getTargetName()).append(revealCards ? ", reveal it," : "").append(" and put that card into your hand"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java index c0b387f67d..39d26abaf5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java @@ -106,9 +106,9 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect { sb.append("search your library for "); if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) { if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) { - sb.append("any number of ").append(" "); + sb.append("any number of ").append(' '); } else { - sb.append("up to ").append(target.getMaxNumberOfTargets()).append(" "); + sb.append("up to ").append(target.getMaxNumberOfTargets()).append(' '); } sb.append(target.getTargetName()).append(" and put them onto the battlefield"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java index 6b145d3a39..0b851ee858 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java @@ -92,9 +92,9 @@ public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect { sb.append("target player searches his or her library for "); if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) { if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) { - sb.append("any number of ").append(" "); + sb.append("any number of ").append(' '); } else { - sb.append("up to ").append(target.getMaxNumberOfTargets()).append(" "); + sb.append("up to ").append(target.getMaxNumberOfTargets()).append(' '); } sb.append(target.getTargetName()).append(" and put them onto the battlefield"); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java index 1f7ed73df7..184850b354 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java @@ -105,7 +105,7 @@ public class ManifestTargetPlayerEffect extends OneShotEffect { private String setText() { StringBuilder sb = new StringBuilder(); if (prefix != null && !prefix.isEmpty()) { - sb.append(prefix).append(" "); + sb.append(prefix).append(' '); } sb.append("manifest the top "); if (amount > 1) { diff --git a/Mage/src/main/java/mage/abilities/keyword/AuraSwapAbility.java b/Mage/src/main/java/mage/abilities/keyword/AuraSwapAbility.java index c1ede4ef17..c2ae418441 100644 --- a/Mage/src/main/java/mage/abilities/keyword/AuraSwapAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/AuraSwapAbility.java @@ -104,7 +104,7 @@ class AuraSwapEffect extends OneShotEffect { game.getState().setValue("attachTo:" + auraInHand.getId(), enchantedPermanent); auraInHand.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), controller.getId()); enchantedPermanent.addAttachment(auraInHand.getId(), game); - game.informPlayers(controller.getLogName() + " put " + auraInHand.getLogName() + " on the battlefield attached to " + enchantedPermanent.getLogName() + "."); + game.informPlayers(controller.getLogName() + " put " + auraInHand.getLogName() + " on the battlefield attached to " + enchantedPermanent.getLogName() + '.'); enchantedPermanent.removeAttachment(auraSourcePermanent.getId(), game); return controller.moveCards(game.getCard(source.getSourceId()), Zone.HAND, source, game); } diff --git a/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java b/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java index 98eb6e7752..8bd67d0348 100644 --- a/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/BuybackAbility.java @@ -138,7 +138,7 @@ public class BuybackAbility extends StaticAbility implements OptionalAdditionalS StringBuilder sb = new StringBuilder(); if (buybackCost != null) { sb.append(buybackCost.getText(false)); - sb.append(" ").append(buybackCost.getReminderText()); + sb.append(' ').append(buybackCost.getReminderText()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/keyword/ConspireAbility.java b/Mage/src/main/java/mage/abilities/keyword/ConspireAbility.java index 26b23a062c..fe9421ac61 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ConspireAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ConspireAbility.java @@ -195,7 +195,7 @@ public class ConspireAbility extends StaticAbility implements OptionalAdditional StringBuilder sb = new StringBuilder(); if (conspireCost != null) { sb.append(conspireCost.getText(false)); - sb.append(" ").append(conspireCost.getReminderText()); + sb.append(' ').append(conspireCost.getReminderText()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java index eb8e0e7bac..f24a1a8817 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java @@ -104,7 +104,7 @@ class CumulativeUpkeepEffect extends OneShotEffect { for (int i = 0; i < ageCounter; i++) { totalCost.add((ManaCost) cumulativeCost.copy()); } - if (player.chooseUse(Outcome.Benefit, "Pay " + totalCost.getText() + "?", source, game)) { + if (player.chooseUse(Outcome.Benefit, "Pay " + totalCost.getText() + '?', source, game)) { totalCost.clearPaid(); if (totalCost.payOrRollback(source, game, source.getSourceId(), source.getControllerId())) { game.fireEvent(new GameEvent(EventType.PAID_CUMULATIVE_UPKEEP, permanent.getId(), permanent.getId(), player.getId(), ageCounter, false)); @@ -119,7 +119,7 @@ class CumulativeUpkeepEffect extends OneShotEffect { for (int i = 0; i < ageCounter; i++) { totalCost.add(cumulativeCost.copy()); } - if (player.chooseUse(Outcome.Benefit, totalCost.getText() + "?", source, game)) { + if (player.chooseUse(Outcome.Benefit, totalCost.getText() + '?', source, game)) { totalCost.clearPaid(); int bookmark = game.bookmarkState(); if (totalCost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { diff --git a/Mage/src/main/java/mage/abilities/keyword/CyclingAbility.java b/Mage/src/main/java/mage/abilities/keyword/CyclingAbility.java index e52a77724c..3f9cc3700e 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CyclingAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CyclingAbility.java @@ -77,7 +77,7 @@ public class CyclingAbility extends ActivatedAbilityImpl { public String getRule() { StringBuilder rule = new StringBuilder(this.text); if(cost instanceof ManaCost){ - rule.append(" "); + rule.append(' '); } else{ rule.append("—"); diff --git a/Mage/src/main/java/mage/abilities/keyword/DashAbility.java b/Mage/src/main/java/mage/abilities/keyword/DashAbility.java index 6b862cff30..20a087dd96 100644 --- a/Mage/src/main/java/mage/abilities/keyword/DashAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/DashAbility.java @@ -179,7 +179,7 @@ public class DashAbility extends StaticAbility implements AlternativeSourceCosts ++numberCosts; } if (numberCosts == 1) { - sb.append(" ").append(remarkText); + sb.append(' ').append(remarkText); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java b/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java index e3c0531073..8b28bb0e00 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java @@ -118,7 +118,7 @@ public class EchoAbility extends TriggeredAbilityImpl { public String getRule() { StringBuilder sb = new StringBuilder("Echo"); if (manaEcho) { - sb.append(" "); + sb.append(' '); } else { sb.append("—"); } @@ -145,7 +145,7 @@ class EchoEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && source.getSourceObjectIfItStillExists(game) != null) { - if (controller.chooseUse(Outcome.Benefit, "Pay " + cost.getText() /* + " or sacrifice " + permanent.getName() */ + "?", source, game)) { + if (controller.chooseUse(Outcome.Benefit, "Pay " + cost.getText() /* + " or sacrifice " + permanent.getName() */ + '?', source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; diff --git a/Mage/src/main/java/mage/abilities/keyword/EntwineAbility.java b/Mage/src/main/java/mage/abilities/keyword/EntwineAbility.java index 27d7c37b41..16141ebd91 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EntwineAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EntwineAbility.java @@ -143,7 +143,7 @@ public class EntwineAbility extends StaticAbility implements OptionalAdditionalM StringBuilder sb = new StringBuilder(); if (additionalCost != null) { sb.append(additionalCost.getText(false)); - sb.append(" ").append(additionalCost.getReminderText()); + sb.append(' ').append(additionalCost.getReminderText()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java b/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java index d4aca82458..8253232c6e 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java @@ -171,7 +171,7 @@ public class EvokeAbility extends StaticAbility implements AlternativeSourceCost ++numberCosts; } if (numberCosts == 1) { - sb.append(" ").append(remarkText); + sb.append(' ').append(remarkText); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java b/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java index 63e7fda4e6..4ab4ff99c5 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java @@ -101,7 +101,7 @@ class ExtortEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { - if (player.chooseUse(Outcome.Damage, new StringBuilder("Extort opponents? (").append(permanent.getName()).append(")").toString(), source, game)) { + if (player.chooseUse(Outcome.Damage, new StringBuilder("Extort opponents? (").append(permanent.getName()).append(')').toString(), source, game)) { Cost cost = new ManaCostsImpl("{W/B}"); if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { int loseLife = 0; diff --git a/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java b/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java index 214d84e9c5..350cc8e517 100644 --- a/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java @@ -126,7 +126,7 @@ public class FlashbackAbility extends SpellAbility { if (costs.size() > 0) { sbRule.append(" - "); } else { - sbRule.append(" "); + sbRule.append(' '); } if (manaCosts.size() > 0) { sbRule.append(manaCosts.getText()); @@ -136,10 +136,10 @@ public class FlashbackAbility extends SpellAbility { sbRule.append(", "); } sbRule.append(costs.getText()); - sbRule.append("."); + sbRule.append('.'); } if (abilityName != null) { - sbRule.append(" "); + sbRule.append(' '); sbRule.append(abilityName); } sbRule.append(" (You may cast this card from your graveyard for its flashback cost. Then exile it.)"); diff --git a/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java b/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java index 937501a4ea..6d6e781d6c 100644 --- a/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java @@ -71,7 +71,7 @@ public class GraftAbility extends TriggeredAbilityImpl { this.amount = amount; StringBuilder sb = new StringBuilder(); for (CardType theCardtype : card.getCardType()) { - sb.append(theCardtype.toString().toLowerCase(Locale.ENGLISH)).append(" "); + sb.append(theCardtype.toString().toLowerCase(Locale.ENGLISH)).append(' '); } this.cardtype = sb.toString().trim(); addSubAbility(new GraftStaticAbility(amount)); @@ -113,7 +113,7 @@ public class GraftAbility extends TriggeredAbilityImpl { @Override public String getRule() { StringBuilder sb = new StringBuilder("Graft"); - sb.append(" ").append(amount).append(" (This ").append(cardtype).append(" enters the battlefield with ") + sb.append(' ').append(amount).append(" (This ").append(cardtype).append(" enters the battlefield with ") .append(amount == 1 ? "a" : CardUtil.numberToText(amount)) .append(" +1/+1 counter on it. Whenever a creature enters the battlefield, you may move a +1/+1 counter from this ") .append(cardtype).append(" onto it.)"); diff --git a/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java b/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java index e104a5e26c..5a033f3a2d 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java @@ -108,7 +108,7 @@ public class HauntAbility extends TriggeredAbilityImpl { if (zEvent.isDiesEvent()) { Card card = game.getCard(getSourceId()); if (card != null) { - String key = new StringBuilder("Haunting_").append(getSourceId().toString()).append("_").append(card.getZoneChangeCounter(game)).toString(); + String key = new StringBuilder("Haunting_").append(getSourceId().toString()).append('_').append(card.getZoneChangeCounter(game)).toString(); Object object = game.getState().getValue(key); if (object != null && object instanceof FixedTarget) { FixedTarget target = (FixedTarget) object; @@ -209,7 +209,7 @@ class HauntEffect extends OneShotEffect { if (hauntedCreature != null) { if (card.moveToExile(source.getSourceId(), "Haunting", source.getSourceId(), game)) { // remember the haunted creature - String key = new StringBuilder("Haunting_").append(source.getSourceId().toString()).append("_").append(card.getZoneChangeCounter(game)).toString(); + String key = new StringBuilder("Haunting_").append(source.getSourceId().toString()).append('_').append(card.getZoneChangeCounter(game)).toString(); game.getState().setValue(key, new FixedTarget(targetPointer.getFirst(game, source))); card.addInfo("hauntinfo", new StringBuilder("Haunting ").append(hauntedCreature.getLogName()).toString(), game); hauntedCreature.addInfo("hauntinfo", new StringBuilder("Haunted by ").append(card.getLogName()).toString(), game); diff --git a/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java b/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java index 6052344429..bd839096a4 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java @@ -125,7 +125,7 @@ class HideawayExileEffect extends OneShotEffect { if (card != null) { cards.remove(card); controller.moveCardToExileWithInfo(card, CardUtil.getCardExileZoneId(game, source), - "Hideaway (" + hideawaySource.getIdName() + ")", source.getSourceId(), game, Zone.LIBRARY, false); + "Hideaway (" + hideawaySource.getIdName() + ')', source.getSourceId(), game, Zone.LIBRARY, false); card.setFaceDown(true, game); } } diff --git a/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java b/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java index 138189fc08..e897faae38 100644 --- a/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java @@ -291,7 +291,7 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo ++numberKicker; } if (numberKicker == 1) { - sb.append(" ").append(remarkText); + sb.append(' ').append(remarkText); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/keyword/LevelerCardBuilder.java b/Mage/src/main/java/mage/abilities/keyword/LevelerCardBuilder.java index 950d40d008..0749bbe6c5 100644 --- a/Mage/src/main/java/mage/abilities/keyword/LevelerCardBuilder.java +++ b/Mage/src/main/java/mage/abilities/keyword/LevelerCardBuilder.java @@ -210,13 +210,13 @@ public class LevelerCardBuilder { StringBuilder sb = new StringBuilder(); sb.append("Level ").append(level1); if (level2 == -1) { - sb.append("+"); + sb.append('+'); } else { - sb.append("-").append(level2); + sb.append('-').append(level2); } - sb.append(": ").append(power).append("/").append(toughness).append(" "); + sb.append(": ").append(power).append('/').append(toughness).append(' '); for (String rule : abilities.getRules("{this}")) { - sb.append(rule).append(" "); + sb.append(rule).append(' '); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java b/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java index bcac6e5cd6..bb155c232b 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java @@ -93,7 +93,7 @@ public class ModularAbility extends DiesTriggeredAbility { if (sunburst) { sb.append("-Sunburst (This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it. When it dies, you may put its +1/+1 counters on target artifact creature.)"); } else { - sb.append(" ").append(amount).append(" (This enters the battlefield with ") + sb.append(' ').append(amount).append(" (This enters the battlefield with ") .append(CardUtil.numberToText(amount, "a")) .append(" +1/+1 counter").append(amount != 1 ? "s" : "") .append(" on it. When it dies, you may put its +1/+1 counters on target artifact creature.)"); diff --git a/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java b/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java index 7ea7f48f7e..fa8f8b6e08 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java @@ -127,9 +127,9 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost this.setWorksFaceDown(true); StringBuilder sb = new StringBuilder(); if (megamorph) { - sb.append(ABILITY_KEYWORD_MEGA).append(" "); + sb.append(ABILITY_KEYWORD_MEGA).append(' '); } else { - sb.append(ABILITY_KEYWORD).append(" "); + sb.append(ABILITY_KEYWORD).append(' '); } name = ABILITY_KEYWORD; for (Cost cost : morphCosts) { @@ -138,7 +138,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost break; } } - sb.append(morphCosts.getText()).append(" "); + sb.append(morphCosts.getText()).append(' '); if (megamorph) { sb.append(REMINDER_TEXT_MEGA); } else { diff --git a/Mage/src/main/java/mage/abilities/keyword/MyriadAbility.java b/Mage/src/main/java/mage/abilities/keyword/MyriadAbility.java index 8fc0d734e3..d09b69ee59 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MyriadAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MyriadAbility.java @@ -101,7 +101,7 @@ class MyriadEffect extends OneShotEffect { if (!playerId.equals(defendingPlayerId) && controller.hasOpponent(playerId, game)) { Player opponent = game.getPlayer(playerId); if (opponent != null && controller.chooseUse(Outcome.PutCreatureInPlay, - "Put a copy of " + sourceObject.getIdName() + " onto battlefield attacking " + opponent.getName() + "?", source, game)) { + "Put a copy of " + sourceObject.getIdName() + " onto battlefield attacking " + opponent.getName() + '?', source, game)) { PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(controller.getId(), null, false, 1, true, true, playerId); effect.setTargetPointer(new FixedTarget(sourceObject, game)); effect.apply(game, source); diff --git a/Mage/src/main/java/mage/abilities/keyword/OfferingAbility.java b/Mage/src/main/java/mage/abilities/keyword/OfferingAbility.java index 5f0532ee44..15d4747d69 100644 --- a/Mage/src/main/java/mage/abilities/keyword/OfferingAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/OfferingAbility.java @@ -159,7 +159,7 @@ class OfferingAsThoughEffect extends AsThoughEffectImpl { Card spellToCast = game.getCard(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (player != null && !CardUtil.isCheckPlayableMode(affectedAbility) && - player.chooseUse(Outcome.Benefit, "Offer a " + filter.getMessage() + " to cast " + spellToCast.getName() + "?", source, game)) { + player.chooseUse(Outcome.Benefit, "Offer a " + filter.getMessage() + " to cast " + spellToCast.getName() + '?', source, game)) { Target target = new TargetControlledCreaturePermanent(1,1,filter,true); player.chooseTarget(Outcome.Sacrifice, target, source, game); if (!target.isChosen()) { diff --git a/Mage/src/main/java/mage/abilities/keyword/ProwlAbility.java b/Mage/src/main/java/mage/abilities/keyword/ProwlAbility.java index b61921457f..9d59fdf140 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ProwlAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ProwlAbility.java @@ -167,7 +167,7 @@ public class ProwlAbility extends StaticAbility implements AlternativeSourceCost ++numberCosts; } if (numberCosts == 1) { - sb.append(" ").append(remarkText); + sb.append(' ').append(remarkText); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java b/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java index 55fbe2116d..dc9637865f 100644 --- a/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java @@ -132,7 +132,7 @@ class RecoverEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("Recover"); if (cost instanceof ManaCost) { - sb.append(" ").append(cost.getText()).append(" "); + sb.append(' ').append(cost.getText()).append(' '); } else { sb.append("—").append(cost.getText()).append(". "); } diff --git a/Mage/src/main/java/mage/abilities/keyword/ReplicateAbility.java b/Mage/src/main/java/mage/abilities/keyword/ReplicateAbility.java index 0499ba0d9e..13c064507b 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ReplicateAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ReplicateAbility.java @@ -143,7 +143,7 @@ public class ReplicateAbility extends StaticAbility implements OptionalAdditiona StringBuilder sb = new StringBuilder(); if (additionalCost != null) { sb.append(additionalCost.getText(false)); - sb.append(" ").append(additionalCost.getReminderText()); + sb.append(' ').append(additionalCost.getReminderText()); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java b/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java index 725d15424b..80b10df022 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java @@ -102,7 +102,7 @@ class SunburstEffect extends OneShotEffect { if (!game.isSimulation()) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - game.informPlayers(player.getLogName() + " puts " + counter.getCount() + " " + counter.getName() + " counter on " + permanent.getName()); + game.informPlayers(player.getLogName() + " puts " + counter.getCount() + ' ' + counter.getName() + " counter on " + permanent.getName()); } } } diff --git a/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java b/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java index 3f9cfbfcaf..6cdc697f12 100644 --- a/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java @@ -101,7 +101,7 @@ class UnleashReplacementEffect extends ReplacementEffectImpl { Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); Player controller = game.getPlayer(source.getControllerId()); if (creature != null && controller != null) { - if (controller.chooseUse(outcome, "Unleash " + creature.getLogName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Unleash " + creature.getLogName() + '?', source, game)) { if (!game.isSimulation()) { game.informPlayers(controller.getLogName() + " unleashes " + creature.getName()); } diff --git a/Mage/src/main/java/mage/abilities/mana/ActivateIfConditionManaAbility.java b/Mage/src/main/java/mage/abilities/mana/ActivateIfConditionManaAbility.java index b7f846f957..f12d8e5565 100644 --- a/Mage/src/main/java/mage/abilities/mana/ActivateIfConditionManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/ActivateIfConditionManaAbility.java @@ -74,7 +74,7 @@ public class ActivateIfConditionManaAbility extends ActivatedManaAbilityImpl { @Override public String getRule() { - return new StringBuilder(super.getRule()).append(" Activate this ability only if ").append(condition.toString()).append(".").toString(); + return new StringBuilder(super.getRule()).append(" Activate this ability only if ").append(condition.toString()).append('.').toString(); } @Override diff --git a/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java b/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java index 6b7a7c40b1..c1d071e93f 100644 --- a/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java +++ b/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java @@ -38,7 +38,7 @@ public class ConditionalSpellManaBuilder extends ConditionalManaBuilder { @Override public String getRule() { - return "Spend this mana only to cast " + filter.getMessage() + "."; + return "Spend this mana only to cast " + filter.getMessage() + '.'; } } @@ -46,7 +46,7 @@ class SpellCastConditionalMana extends ConditionalMana { SpellCastConditionalMana(Mana mana, FilterSpell filter) { super(mana); - staticText = "Spend this mana only to cast " + filter.getMessage() + "."; + staticText = "Spend this mana only to cast " + filter.getMessage() + '.'; addCondition(new SpellCastManaCondition(filter)); } } diff --git a/Mage/src/main/java/mage/actions/MageDrawAction.java b/Mage/src/main/java/mage/actions/MageDrawAction.java index f2513cc5e1..ba7922b590 100644 --- a/Mage/src/main/java/mage/actions/MageDrawAction.java +++ b/Mage/src/main/java/mage/actions/MageDrawAction.java @@ -83,7 +83,7 @@ public class MageDrawAction extends MageAction { drawnCards.add(card); card.moveToZone(Zone.HAND, null, game, false); if (player.isTopCardRevealed()) { - game.fireInformEvent(player.getLogName() + " draws a revealed card (" + card.getLogName() + ")"); + game.fireInformEvent(player.getLogName() + " draws a revealed card (" + card.getLogName() + ')'); } game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DREW_CARD, card.getId(), player.getId())); diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index f8a1ff9147..e56e5f64bb 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -483,7 +483,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { default: MageObject sourceObject = game.getObject(sourceId); logger.fatal("Invalid from zone [" + fromZone + "] for card [" + this.getIdName() - + "] source [" + (sourceObject != null ? sourceObject.getName() : "null") + "]"); + + "] source [" + (sourceObject != null ? sourceObject.getName() : "null") + ']'); break; } if (removed) { diff --git a/Mage/src/main/java/mage/cards/CardsImpl.java b/Mage/src/main/java/mage/cards/CardsImpl.java index c7228776be..49e0622ccd 100644 --- a/Mage/src/main/java/mage/cards/CardsImpl.java +++ b/Mage/src/main/java/mage/cards/CardsImpl.java @@ -206,7 +206,7 @@ public class CardsImpl extends LinkedHashSet implements Cards, Serializabl } Collections.sort(cards); for (String name : cards) { - sb.append(name).append(":"); + sb.append(name).append(':'); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/cards/Sets.java b/Mage/src/main/java/mage/cards/Sets.java index 4ea294f199..7fc0e1374e 100644 --- a/Mage/src/main/java/mage/cards/Sets.java +++ b/Mage/src/main/java/mage/cards/Sets.java @@ -193,7 +193,7 @@ public class Sets extends HashMap { List>> cardGrid = layout.getCards(); int height = cardGrid.size(); int width = (height > 0) ? cardGrid.get(0).size() : 0; - out.print("(" + height + "," + width + ")"); + out.print("(" + height + ',' + width + ')'); out.print(layout.getSettings()); out.print("|"); for (List> row : cardGrid) { diff --git a/Mage/src/main/java/mage/cards/decks/Deck.java b/Mage/src/main/java/mage/cards/decks/Deck.java index 7af38ed879..923d90b30e 100644 --- a/Mage/src/main/java/mage/cards/decks/Deck.java +++ b/Mage/src/main/java/mage/cards/decks/Deck.java @@ -122,7 +122,7 @@ public class Deck implements Serializable { cardInfo = CardRepository.instance.findCard("Silvercoat Lion"); Logger.getLogger(Deck.class).error("Tried to restart the DB: " + (cardInfo == null ? "not successful" : "successful")); } - return new GameException("Card not found - " + deckCardInfo.getCardName() + " - " + deckCardInfo.getSetCode() + " for deck - " + deckName + "\n" + return new GameException("Card not found - " + deckCardInfo.getCardName() + " - " + deckCardInfo.getSetCode() + " for deck - " + deckName + '\n' + "Possible reason is, that you use cards in your deck, that are only supported in newer versions of the server.\n" + "So it can help to use the same card from another set, that's already supported from this server."); diff --git a/Mage/src/main/java/mage/cards/decks/InvalidDeckException.java b/Mage/src/main/java/mage/cards/decks/InvalidDeckException.java index c67c7491d0..c4e70bcb68 100644 --- a/Mage/src/main/java/mage/cards/decks/InvalidDeckException.java +++ b/Mage/src/main/java/mage/cards/decks/InvalidDeckException.java @@ -52,9 +52,9 @@ public class InvalidDeckException extends GameException { @Override public String getMessage() { StringBuilder sb = new StringBuilder(); - sb.append(super.getMessage()).append("\n"); + sb.append(super.getMessage()).append('\n'); for (Entry entry: invalid.entrySet()) { - sb.append(entry.getKey()).append(" ").append(entry.getValue()).append("\n"); + sb.append(entry.getKey()).append(' ').append(entry.getValue()).append('\n'); } return sb.toString(); } diff --git a/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java index 9b042dc48c..6593401fc1 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java @@ -93,7 +93,7 @@ public class DckDeckImporter extends DeckImporter { } } } else { - sbMessage.append("Could not find card '").append("' at line ").append(lineCount).append(": ").append(line).append("\n"); + sbMessage.append("Could not find card '").append("' at line ").append(lineCount).append(": ").append(line).append('\n'); } } else if (line.startsWith("NAME:")) { deckList.setName(line.substring(5, line.length())); diff --git a/Mage/src/main/java/mage/cards/decks/importer/DecDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/DecDeckImporter.java index 0dee3e9980..89a4b4d085 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/DecDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/DecDeckImporter.java @@ -57,7 +57,7 @@ public class DecDeckImporter extends DeckImporter { int num = Integer.parseInt(lineNum); CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(lineName, true); if (cardInfo == null) { - sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append("\n"); + sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append('\n'); } else { for (int i = 0; i < num; i++) { if (!sideboard) { @@ -68,7 +68,7 @@ public class DecDeckImporter extends DeckImporter { } } } catch (NumberFormatException nfe) { - sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append("\n"); + sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append('\n'); } } diff --git a/Mage/src/main/java/mage/cards/decks/importer/DekDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/DekDeckImporter.java index f66158ff34..36e3a3c5f3 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/DekDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/DekDeckImporter.java @@ -23,7 +23,7 @@ public class DekDeckImporter extends DeckImporter { Boolean isSideboard = "true".equals(extractAttribute(line, "Sideboard")); CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(cardName, true); if (cardInfo == null) { - sbMessage.append("Could not find card: '").append(cardName).append("' at line ").append(lineCount).append("\n"); + sbMessage.append("Could not find card: '").append(cardName).append("' at line ").append(lineCount).append('\n'); } else { for (int i = 0; i < cardCount; i++) { DeckCardInfo deckCardInfo = new DeckCardInfo(cardInfo.getName(), cardInfo.getCardNumber(), cardInfo.getSetCode()); @@ -35,7 +35,7 @@ public class DekDeckImporter extends DeckImporter { } } }catch (NumberFormatException nfe) { - sbMessage.append("Invalid number: ").append(extractAttribute(line, "Quantity")).append(" at line ").append(lineCount).append("\n"); + sbMessage.append("Invalid number: ").append(extractAttribute(line, "Quantity")).append(" at line ").append(lineCount).append('\n'); } } @@ -43,7 +43,7 @@ public class DekDeckImporter extends DeckImporter { private String extractAttribute(String line, String name) { String searchString = name+"=\""; int startDelim = line.indexOf(searchString)+searchString.length(); - int endDelim = line.substring(startDelim).indexOf("\""); + int endDelim = line.substring(startDelim).indexOf('\"'); return line.substring(startDelim, startDelim+endDelim); } diff --git a/Mage/src/main/java/mage/cards/decks/importer/MWSDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/MWSDeckImporter.java index fed0aa179f..797ff47ea5 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/MWSDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/MWSDeckImporter.java @@ -79,7 +79,7 @@ public class MWSDeckImporter extends DeckImporter { } if (cardInfo == null) { - sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append("\n"); + sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append('\n'); } else { for (int i = 0; i < num; i++) { if (!sideboard) { @@ -90,7 +90,7 @@ public class MWSDeckImporter extends DeckImporter { } } } catch (NumberFormatException nfe) { - sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append("\n"); + sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append('\n'); } } } diff --git a/Mage/src/main/java/mage/cards/decks/importer/TxtDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/TxtDeckImporter.java index 420553f0a9..089fbb1a6d 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/TxtDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/TxtDeckImporter.java @@ -89,7 +89,7 @@ public class TxtDeckImporter extends DeckImporter { int num = Integer.parseInt(lineNum.replaceAll("\\D+", "")); CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(lineName, true); if (cardInfo == null) { - sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append("\n"); + sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append('\n'); } else { for (int i = 0; i < num; i++) { if (!sideboard) { @@ -100,7 +100,7 @@ public class TxtDeckImporter extends DeckImporter { } } } catch (NumberFormatException nfe) { - sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append("\n"); + sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append('\n'); } } diff --git a/Mage/src/main/java/mage/cards/repository/CardInfo.java b/Mage/src/main/java/mage/cards/repository/CardInfo.java index bf9f2977d7..09320b0c7b 100644 --- a/Mage/src/main/java/mage/cards/repository/CardInfo.java +++ b/Mage/src/main/java/mage/cards/repository/CardInfo.java @@ -183,7 +183,7 @@ public class CardInfo { if (spellAbility != null) { SpellAbilityType spellAbilityType = spellAbility.getSpellAbilityType(); if (spellAbilityType == SpellAbilityType.SPLIT_LEFT || spellAbilityType == SpellAbilityType.SPLIT_RIGHT) { - this.className = this.setCode + "." + this.name; + this.className = this.setCode + '.' + this.name; this.splitCardHalf = true; } } diff --git a/Mage/src/main/java/mage/cards/repository/CardRepository.java b/Mage/src/main/java/mage/cards/repository/CardRepository.java index 9bac098b3f..94a8b3a2dd 100644 --- a/Mage/src/main/java/mage/cards/repository/CardRepository.java +++ b/Mage/src/main/java/mage/cards/repository/CardRepository.java @@ -400,7 +400,7 @@ public enum CardRepository { try { String sqlName = name.toLowerCase().replaceAll("\'", "\'\'"); GenericRawResults rawResults = cardDao.queryRaw( - "select * from " + CardRepository.VERSION_ENTITY_NAME + " where lower(name) = '" + sqlName + "'", + "select * from " + CardRepository.VERSION_ENTITY_NAME + " where lower(name) = '" + sqlName + '\'', cardDao.getRawRowMapper()); List result = new ArrayList<>(); for (CardInfo cardinfo : rawResults) { diff --git a/Mage/src/main/java/mage/designations/Designation.java b/Mage/src/main/java/mage/designations/Designation.java index 81e5682194..5636a0a295 100644 --- a/Mage/src/main/java/mage/designations/Designation.java +++ b/Mage/src/main/java/mage/designations/Designation.java @@ -71,7 +71,7 @@ public abstract class Designation implements MageObject { @Override public String getIdName() { - return getName() + " [" + getId().toString().substring(0, 3) + "]"; + return getName() + " [" + getId().toString().substring(0, 3) + ']'; } @Override diff --git a/Mage/src/main/java/mage/filter/FilterAbility.java b/Mage/src/main/java/mage/filter/FilterAbility.java index 6051f26f58..d1d8db8870 100644 --- a/Mage/src/main/java/mage/filter/FilterAbility.java +++ b/Mage/src/main/java/mage/filter/FilterAbility.java @@ -80,7 +80,7 @@ public class FilterAbility extends FilterImpl { @Override public String toString() { - return "Zone(" + zone.toString() + ")"; + return "Zone(" + zone.toString() + ')'; } } diff --git a/Mage/src/main/java/mage/filter/predicate/Predicates.java b/Mage/src/main/java/mage/filter/predicate/Predicates.java index 103217fbf8..30ad5956a4 100644 --- a/Mage/src/main/java/mage/filter/predicate/Predicates.java +++ b/Mage/src/main/java/mage/filter/predicate/Predicates.java @@ -150,7 +150,7 @@ public final class Predicates { @Override public String toString() { - return "Not(" + predicate.toString() + ")"; + return "Not(" + predicate.toString() + ')'; } private static final long serialVersionUID = 0; } @@ -178,7 +178,7 @@ public final class Predicates { @Override public String toString() { - return "And(" + commaJoin(components) + ")"; + return "And(" + commaJoin(components) + ')'; } private static final long serialVersionUID = 0; } @@ -206,7 +206,7 @@ public final class Predicates { @Override public String toString() { - return "Or(" + commaJoin(components) + ")"; + return "Or(" + commaJoin(components) + ')'; } private static final long serialVersionUID = 0; } diff --git a/Mage/src/main/java/mage/filter/predicate/mageobject/CardIdPredicate.java b/Mage/src/main/java/mage/filter/predicate/mageobject/CardIdPredicate.java index 9eecf20a6d..34de046c35 100644 --- a/Mage/src/main/java/mage/filter/predicate/mageobject/CardIdPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/mageobject/CardIdPredicate.java @@ -51,6 +51,6 @@ public class CardIdPredicate implements Predicate { @Override public String toString() { - return "CardId(" + cardId.toString() + ")"; + return "CardId(" + cardId.toString() + ')'; } } diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/CanBeEnchantedByPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/CanBeEnchantedByPredicate.java index f9441f84d0..1852eca541 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/CanBeEnchantedByPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/CanBeEnchantedByPredicate.java @@ -50,6 +50,6 @@ public class CanBeEnchantedByPredicate implements Predicate { @Override public String toString() { - return "CanBeEnchanted(" + auraEnchantment.toString() + ")"; + return "CanBeEnchanted(" + auraEnchantment.toString() + ')'; } } diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/PermanentIdPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/PermanentIdPredicate.java index 268bcc305a..ec3b1231e4 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/PermanentIdPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/PermanentIdPredicate.java @@ -51,6 +51,6 @@ public class PermanentIdPredicate implements Predicate { @Override public String toString() { - return "PermanentId(" + permanentId + ")"; + return "PermanentId(" + permanentId + ')'; } } diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 5736ae4746..d63b9eacc2 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -781,19 +781,19 @@ public abstract class GameImpl implements Game, Serializable { } if (gameOver(null) && !isSimulation()) { winnerId = findWinnersAndLosers(); - StringBuilder sb = new StringBuilder("GAME END gameId: ").append(this.getId()).append(" "); + StringBuilder sb = new StringBuilder("GAME END gameId: ").append(this.getId()).append(' '); int count = 0; for (Player player : this.getState().getPlayers().values()) { if (count > 0) { sb.append(" - "); } - sb.append("[").append(player.getName()).append(" => "); + sb.append('[').append(player.getName()).append(" => "); sb.append(player.hasWon() ? "W" : ""); sb.append(player.hasLost() ? "L" : ""); sb.append(player.hasQuit() ? "Q" : ""); sb.append(player.hasIdleTimeout() ? "I" : ""); sb.append(player.hasTimerTimeout() ? "T" : ""); - sb.append("]"); + sb.append(']'); count++; } logger.info(sb.toString()); diff --git a/Mage/src/main/java/mage/game/GameTinyLeadersImpl.java b/Mage/src/main/java/mage/game/GameTinyLeadersImpl.java index 2a9405332f..70038ac643 100644 --- a/Mage/src/main/java/mage/game/GameTinyLeadersImpl.java +++ b/Mage/src/main/java/mage/game/GameTinyLeadersImpl.java @@ -94,7 +94,7 @@ public abstract class GameTinyLeadersImpl extends GameImpl { getState().getWatchers().add(watcher); watcher.addCardInfoToCommander(this); } else { - throw new UnknownError("Commander card could not be created. Name: [" + player.getMatchPlayer().getDeck().getName() + "]"); + throw new UnknownError("Commander card could not be created. Name: [" + player.getMatchPlayer().getDeck().getName() + ']'); } } diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java index 8156532bed..edd139d5ab 100644 --- a/Mage/src/main/java/mage/game/combat/Combat.java +++ b/Mage/src/main/java/mage/game/combat/Combat.java @@ -399,7 +399,7 @@ public class Combat implements Serializable, Copyable { if (!effect.canAttackCheckAfter(numberAttackers, ability, game)) { MageObject sourceObject = ability.getSourceObject(game); if (attackingPlayer.isHuman()) { - game.informPlayer(attackingPlayer, attackingCreature.getIdName() + " can't attack this way (" + (sourceObject == null ? "null" : sourceObject.getIdName()) + ")"); + game.informPlayer(attackingPlayer, attackingCreature.getIdName() + " can't attack this way (" + (sourceObject == null ? "null" : sourceObject.getIdName()) + ')'); return false; } else { // remove attacking creatures for AI that are not allowed to attack @@ -504,7 +504,7 @@ public class Combat implements Serializable, Copyable { if (attackingCreature != null) { sb.append("Attacker: "); sb.append(attackingCreature.getLogName()).append(" ("); - sb.append(attackingCreature.getPower().getValue()).append("/").append(attackingCreature.getToughness().getValue()).append(") "); + sb.append(attackingCreature.getPower().getValue()).append('/').append(attackingCreature.getToughness().getValue()).append(") "); } else { // creature left battlefield attackingCreature = (Permanent) game.getLastKnownInformation(attackingCreatureId, Zone.BATTLEFIELD); @@ -520,7 +520,7 @@ public class Combat implements Serializable, Copyable { Permanent blockingCreature = game.getPermanent(blockingCreatureId); if (blockingCreature != null) { sb.append(blockingCreature.getLogName()).append(" ("); - sb.append(blockingCreature.getPower().getValue()).append("/").append(blockingCreature.getToughness().getValue()).append(") "); + sb.append(blockingCreature.getPower().getValue()).append('/').append(blockingCreature.getToughness().getValue()).append(") "); } } @@ -782,7 +782,7 @@ public class Combat implements Serializable, Copyable { possibleBlockerId, toBeBlockedCreatureId, mustBeBlockedByAtLeastOne, game); if (blockRequiredMessage != null) { // message means not required removeBlocker(possibleBlockerId, game); - game.informPlayer(controller, blockRequiredMessage + " Existing block removed. It's a requirement to block " + toBeBlockedCreature.getIdName() + "."); + game.informPlayer(controller, blockRequiredMessage + " Existing block removed. It's a requirement to block " + toBeBlockedCreature.getIdName() + '.'); return false; } } @@ -894,7 +894,7 @@ public class Combat implements Serializable, Copyable { } if (!blockIsValid) { - sb.append(" ").append(creatureForcedToBlock.getIdName()); + sb.append(' ').append(creatureForcedToBlock.getIdName()); } } if (sb.length() > 0) { diff --git a/Mage/src/main/java/mage/game/command/Commander.java b/Mage/src/main/java/mage/game/command/Commander.java index d31721b97b..2c77772d72 100644 --- a/Mage/src/main/java/mage/game/command/Commander.java +++ b/Mage/src/main/java/mage/game/command/Commander.java @@ -96,7 +96,7 @@ public class Commander implements CommandObject { @Override public String getIdName() { - return sourceObject.getName() + " [" + sourceObject.getId().toString().substring(0, 3) + "]"; + return sourceObject.getName() + " [" + sourceObject.getId().toString().substring(0, 3) + ']'; } @Override diff --git a/Mage/src/main/java/mage/game/command/Emblem.java b/Mage/src/main/java/mage/game/command/Emblem.java index 8501b2ea72..debb77a5bc 100644 --- a/Mage/src/main/java/mage/game/command/Emblem.java +++ b/Mage/src/main/java/mage/game/command/Emblem.java @@ -129,7 +129,7 @@ public class Emblem implements CommandObject { @Override public String getIdName() { - return getName() + " [" + getId().toString().substring(0, 3) + "]"; + return getName() + " [" + getId().toString().substring(0, 3) + ']'; } @Override diff --git a/Mage/src/main/java/mage/game/draft/DraftCube.java b/Mage/src/main/java/mage/game/draft/DraftCube.java index dc72fb3cf0..b120bb0a94 100644 --- a/Mage/src/main/java/mage/game/draft/DraftCube.java +++ b/Mage/src/main/java/mage/game/draft/DraftCube.java @@ -119,11 +119,11 @@ public abstract class DraftCube { booster.add(cardInfo.getCard()); done = true; } else { - logger.warn(new StringBuilder(this.getName()).append(" - Card not found: ").append(cardId.getName()).append(":").append(cardId.extension)); + logger.warn(new StringBuilder(this.getName()).append(" - Card not found: ").append(cardId.getName()).append(':').append(cardId.extension)); notValid++; } } else { - logger.error(new StringBuilder(this.getName()).append(" - Empty card name: ").append(cardId.getName()).append(":").append(cardId.extension)); + logger.error(new StringBuilder(this.getName()).append(" - Empty card name: ").append(cardId.getName()).append(':').append(cardId.extension)); notValid++; } diff --git a/Mage/src/main/java/mage/game/match/MatchImpl.java b/Mage/src/main/java/mage/game/match/MatchImpl.java index 28118e7548..4f52db281e 100644 --- a/Mage/src/main/java/mage/game/match/MatchImpl.java +++ b/Mage/src/main/java/mage/game/match/MatchImpl.java @@ -290,13 +290,13 @@ public abstract class MatchImpl implements Match { String duelingTime = ""; 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) + ')'; } state = "Finished" + duelingTime; 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) + ')'; } state = "Dueling" + duelingTime; result = ""; diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index b8a2194209..3d93c69198 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -189,7 +189,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { @Override public String toString() { StringBuilder sb = threadLocalBuilder.get(); - sb.append(this.name).append("-").append(this.expansionSetCode); + sb.append(this.name).append('-').append(this.expansionSetCode); if (copy) { sb.append(" [Copy]"); } diff --git a/Mage/src/main/java/mage/game/permanent/token/Token.java b/Mage/src/main/java/mage/game/permanent/token/Token.java index 1c7845f5f0..ef5f13c824 100644 --- a/Mage/src/main/java/mage/game/permanent/token/Token.java +++ b/Mage/src/main/java/mage/game/permanent/token/Token.java @@ -130,7 +130,7 @@ public class Token extends MageObjectImpl { String subtype = this.subtype.toString().replaceAll("[^a-zA-Z0-9]", ""); String cardType = this.cardType.toString().replaceAll("[^a-zA-Z0-9]", ""); String originalset = this.getOriginalExpansionSetCode(); - String descriptor = name + "." + color + "." + subtype + "." + cardType + "." + this.power + "." + this.toughness; + String descriptor = name + '.' + color + '.' + subtype + '.' + cardType + '.' + this.power + '.' + this.toughness; descriptor = descriptor.toUpperCase(); return descriptor; } diff --git a/Mage/src/main/java/mage/game/permanent/token/ZombieToken2.java b/Mage/src/main/java/mage/game/permanent/token/ZombieToken2.java index 0b6967692e..fa95c4f401 100644 --- a/Mage/src/main/java/mage/game/permanent/token/ZombieToken2.java +++ b/Mage/src/main/java/mage/game/permanent/token/ZombieToken2.java @@ -41,7 +41,7 @@ public class ZombieToken2 extends Token { } public ZombieToken2(int zPower, int zToughness) { - super("Zombie", String.valueOf(zPower) + "/" + String.valueOf(zToughness) + " black Zombie creature token"); + super("Zombie", String.valueOf(zPower) + '/' + String.valueOf(zToughness) + " black Zombie creature token"); cardType.add(CardType.CREATURE); color.setBlack(true); subtype.add("Zombie"); diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index bd421709e6..38c49d6ded 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -427,7 +427,7 @@ public class Spell extends StackObjImpl implements Card { } else { idName = getId().toString().substring(0, 3); } - return getName() + " [" + idName + "]"; + return getName() + " [" + idName + ']'; } @Override diff --git a/Mage/src/main/java/mage/game/stack/StackAbility.java b/Mage/src/main/java/mage/game/stack/StackAbility.java index 98a45a40ad..2ba1f248d6 100644 --- a/Mage/src/main/java/mage/game/stack/StackAbility.java +++ b/Mage/src/main/java/mage/game/stack/StackAbility.java @@ -87,7 +87,7 @@ public class StackAbility extends StackObjImpl implements Ability { public StackAbility(Ability ability, UUID controllerId) { this.ability = ability; this.controllerId = controllerId; - this.name = "stack ability (" + ability.getRule() + ")"; + this.name = "stack ability (" + ability.getRule() + ')'; } public StackAbility(final StackAbility stackAbility) { @@ -142,7 +142,7 @@ public class StackAbility extends StackObjImpl implements Ability { @Override public String getIdName() { - return getName() + " [" + getId().toString().substring(0, 3) + "]"; + return getName() + " [" + getId().toString().substring(0, 3) + ']'; } @Override diff --git a/Mage/src/main/java/mage/game/stack/StackObjImpl.java b/Mage/src/main/java/mage/game/stack/StackObjImpl.java index d0012217a7..9d175b0599 100644 --- a/Mage/src/main/java/mage/game/stack/StackObjImpl.java +++ b/Mage/src/main/java/mage/game/stack/StackObjImpl.java @@ -165,7 +165,7 @@ public abstract class StackObjImpl implements StackObject { // change the target? Outcome outcome = mode.getEffects().isEmpty() ? Outcome.Detriment : mode.getEffects().get(0).getOutcome(); if (targetNames != null - && (forceChange || targetController.chooseUse(outcome, "Change this target: " + targetNames + "?", ability, game))) { + && (forceChange || targetController.chooseUse(outcome, "Change this target: " + targetNames + '?', ability, game))) { Set possibleTargets = target.possibleTargets(this.getSourceId(), getControllerId(), game); // choose exactly one other target - already targeted objects are not counted if (forceChange && possibleTargets != null && possibleTargets.size() > 1) { // controller of spell must be used (e.g. TargetOpponent) @@ -182,7 +182,7 @@ public abstract class StackObjImpl implements StackObject { if (newTarget.getFirstTarget() != null && filterNewTarget != null) { Permanent newTargetPermanent = game.getPermanent(newTarget.getFirstTarget()); if (newTargetPermanent == null || !filterNewTarget.match(newTargetPermanent, game)) { - game.informPlayer(targetController, "Target does not fullfil the target requirements (" + filterNewTarget.getMessage() + ")"); + game.informPlayer(targetController, "Target does not fullfil the target requirements (" + filterNewTarget.getMessage() + ')'); newTarget.clearChosen(); } } @@ -235,7 +235,7 @@ public abstract class StackObjImpl implements StackObject { } else if (newTarget.getFirstTarget() != null && filterNewTarget != null) { Permanent newTargetPermanent = game.getPermanent(newTarget.getFirstTarget()); if (newTargetPermanent == null || !filterNewTarget.match(newTargetPermanent, game)) { - game.informPlayer(targetController, "This target does not fullfil the target requirements (" + filterNewTarget.getMessage() + ")"); + game.informPlayer(targetController, "This target does not fullfil the target requirements (" + filterNewTarget.getMessage() + ')'); again = true; } } else { diff --git a/Mage/src/main/java/mage/game/tournament/TournamentImpl.java b/Mage/src/main/java/mage/game/tournament/TournamentImpl.java index eecd485654..a227b82421 100644 --- a/Mage/src/main/java/mage/game/tournament/TournamentImpl.java +++ b/Mage/src/main/java/mage/game/tournament/TournamentImpl.java @@ -329,7 +329,7 @@ public abstract class TournamentImpl implements Tournament { } } for (TournamentPlayer tp : round.getPlayerByes()) { - tp.setResults(new StringBuilder(tp.getResults()).append("R").append(round.getRoundNumber()).append(" ").append("Bye ").toString()); + tp.setResults(new StringBuilder(tp.getResults()).append('R').append(round.getRoundNumber()).append(' ').append("Bye ").toString()); tp.setPoints(tp.getPoints() + 3); } } @@ -337,7 +337,7 @@ public abstract class TournamentImpl implements Tournament { private static String addRoundResult(int round, TournamentPairing pair, TournamentPlayer tournamentPlayer, TournamentPlayer opponentPlayer) { StringBuilder playerResult = new StringBuilder(tournamentPlayer.getResults()); - playerResult.append("R").append(round).append(" "); + playerResult.append('R').append(round).append(' '); playerResult.append(getMatchResultString(tournamentPlayer, opponentPlayer, pair.getMatch())); return playerResult.toString(); } @@ -352,9 +352,9 @@ public abstract class TournamentImpl implements Tournament { matchResult.append(mp1.getPlayer().hasIdleTimeout() ? "I" : (mp1.getPlayer().hasTimerTimeout() ? "T" : "Q")); } if (match.getDraws() > 0) { - matchResult.append("-").append(match.getDraws()); + matchResult.append('-').append(match.getDraws()); } - matchResult.append("-").append(mp2.getWins()); + matchResult.append('-').append(mp2.getWins()); if (mp2.hasQuit()) { matchResult.append(mp2.getPlayer().hasIdleTimeout() ? "I" : (mp2.getPlayer().hasTimerTimeout() ? "T" : "Q")); } diff --git a/Mage/src/main/java/mage/game/turn/Turn.java b/Mage/src/main/java/mage/game/turn/Turn.java index bf2dc0a872..c4c635b278 100644 --- a/Mage/src/main/java/mage/game/turn/Turn.java +++ b/Mage/src/main/java/mage/game/turn/Turn.java @@ -328,17 +328,17 @@ public class Turn implements Serializable { public String getValue(int turnNum) { StringBuilder sb = threadLocalBuilder.get(); - sb.append("[").append(turnNum) - .append(":").append(currentPhase.getType()) - .append(":").append(currentPhase.getStep().getType()) - .append("]"); + sb.append('[').append(turnNum) + .append(':').append(currentPhase.getType()) + .append(':').append(currentPhase.getStep().getType()) + .append(']'); return sb.toString(); } private void logStartOfTurn(Game game, Player player) { StringBuilder sb = new StringBuilder(game.getState().isExtraTurn() ? "Extra turn" : "Turn "); - sb.append(game.getState().getTurnNum()).append(" "); + sb.append(game.getState().getTurnNum()).append(' '); sb.append(player.getLogName()); sb.append(" ("); int delimiter = game.getPlayers().size() - 1; @@ -346,14 +346,14 @@ public class Turn implements Serializable { sb.append(gamePlayer.getLife()); int poison = gamePlayer.getCounters().getCount(CounterType.POISON); if (poison > 0) { - sb.append("[P:").append(poison).append("]"); + sb.append("[P:").append(poison).append(']'); } if (delimiter > 0) { sb.append(" - "); delimiter--; } } - sb.append(")"); + sb.append(')'); game.fireStatusEvent(sb.toString(), true); } } diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 0b84f713b1..f9bc0cb6ae 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -944,7 +944,7 @@ public abstract class PlayerImpl implements Player, Serializable { result = cast(card.getSpellAbility(), game, noMana); } if (!result) { - game.informPlayer(this, "You can't play " + card.getIdName() + "."); + game.informPlayer(this, "You can't play " + card.getIdName() + '.'); } return result; } @@ -1504,7 +1504,7 @@ public abstract class PlayerImpl implements Player, Serializable { if (effectSource != null) { sb.append(" from ").append(effectSource.getLogName()); } - sb.append(")"); + sb.append(')'); filter.setMessage(sb.toString()); Target target = new TargetPermanent(1, 1, filter, true); if (!this.chooseTarget(Outcome.Untap, target, ability, game)) { @@ -3217,7 +3217,7 @@ public abstract class PlayerImpl implements Player, Serializable { if (!game.isSimulation()) { game.informPlayers(getLogName() + " puts " + (withName ? card.getLogName() : (card.isFaceDown(game) ? "a face down card" : "a card")) - + " from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + " " + + " from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + ' ' + (card.getOwnerId().equals(this.getId()) ? "into his or her hand" : "into its owner's hand") ); } @@ -3306,8 +3306,8 @@ public abstract class PlayerImpl implements Player, Serializable { card = game.getCard(card.getId()); } StringBuilder sb = new StringBuilder(this.getLogName()) - .append(" puts ").append(card.getLogName()).append(" ").append(card.isCopy() ? "(Copy) " : "") - .append(fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + " " : ""); + .append(" puts ").append(card.getLogName()).append(' ').append(card.isCopy() ? "(Copy) " : "") + .append(fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + ' ' : ""); if (card.getOwnerId().equals(getId())) { sb.append("into his or her graveyard"); } else { @@ -3332,9 +3332,9 @@ public abstract class PlayerImpl implements Player, Serializable { card = game.getCard(card.getId()); } StringBuilder sb = new StringBuilder(this.getLogName()) - .append(" puts ").append(withName ? card.getLogName() : "a card").append(" "); + .append(" puts ").append(withName ? card.getLogName() : "a card").append(' '); if (fromZone != null) { - sb.append("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" "); + sb.append("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(' '); } sb.append("to the ").append(toTop ? "top" : "bottom"); if (card.getOwnerId().equals(getId())) { @@ -3367,8 +3367,8 @@ public abstract class PlayerImpl implements Player, Serializable { card = basicCard; } } - game.informPlayers(this.getLogName() + " moves " + (withName ? card.getLogName() + (card.isCopy() ? " (Copy)" : "") : "a card face down") + " " - + (fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + " " : "") + "to the exile zone"); + game.informPlayers(this.getLogName() + " moves " + (withName ? card.getLogName() + (card.isCopy() ? " (Copy)" : "") : "a card face down") + ' ' + + (fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + ' ' : "") + "to the exile zone"); } result = true; } diff --git a/Mage/src/main/java/mage/target/TargetImpl.java b/Mage/src/main/java/mage/target/TargetImpl.java index 0bd012dd1b..38996f4128 100644 --- a/Mage/src/main/java/mage/target/TargetImpl.java +++ b/Mage/src/main/java/mage/target/TargetImpl.java @@ -132,9 +132,9 @@ public abstract class TargetImpl implements Target { StringBuilder sb = new StringBuilder(); sb.append("Select ").append(targetName); if (getMaxNumberOfTargets() > 0 && getMaxNumberOfTargets() != Integer.MAX_VALUE) { - sb.append(" (").append(targets.size()).append("/").append(getMaxNumberOfTargets()).append(")"); + sb.append(" (").append(targets.size()).append('/').append(getMaxNumberOfTargets()).append(')'); } else { - sb.append(" (").append(targets.size()).append(")"); + sb.append(" (").append(targets.size()).append(')'); } sb.append(suffix); return sb.toString(); diff --git a/Mage/src/main/java/mage/target/TargetObject.java b/Mage/src/main/java/mage/target/TargetObject.java index bc34fea778..1066f80d14 100644 --- a/Mage/src/main/java/mage/target/TargetObject.java +++ b/Mage/src/main/java/mage/target/TargetObject.java @@ -69,7 +69,7 @@ public abstract class TargetObject extends TargetImpl { for (UUID targetId: getTargets()) { MageObject object = game.getObject(targetId); if (object != null) { - sb.append(object.getLogName()).append(" "); + sb.append(object.getLogName()).append(' '); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/target/TargetPlayer.java b/Mage/src/main/java/mage/target/TargetPlayer.java index 64430423e6..d70085d98a 100644 --- a/Mage/src/main/java/mage/target/TargetPlayer.java +++ b/Mage/src/main/java/mage/target/TargetPlayer.java @@ -197,7 +197,7 @@ public class TargetPlayer extends TargetImpl { for (UUID targetId : getTargets()) { Player player = game.getPlayer(targetId); if (player != null) { - sb.append(player.getLogName()).append(" "); + sb.append(player.getLogName()).append(' '); } else { sb.append("[target missing]"); } diff --git a/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java b/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java index 1ed9374721..5056610f74 100644 --- a/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java +++ b/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java @@ -115,10 +115,10 @@ public class TargetActivatedAbility extends TargetObject { for (UUID targetId : getTargets()) { StackAbility object = (StackAbility) game.getObject(targetId); if (object != null) { - sb.append(object.getRule()).append(" "); + sb.append(object.getRule()).append(' '); } } - sb.append(")"); + sb.append(')'); return sb.toString(); } } diff --git a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlaneswalkerAmount.java b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlaneswalkerAmount.java index 1cefb2098f..b373715695 100644 --- a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlaneswalkerAmount.java +++ b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlaneswalkerAmount.java @@ -165,7 +165,7 @@ for (UUID targetId : getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append("(").append(getTargetAmount(targetId)).append(") "); + sb.append(permanent.getLogName()).append('(').append(getTargetAmount(targetId)).append(") "); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayer.java b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayer.java index a7a3b87318..54151a5b88 100644 --- a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayer.java +++ b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayer.java @@ -229,11 +229,11 @@ public class TargetCreatureOrPlayer extends TargetImpl { for (UUID targetId : getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append(" "); + sb.append(permanent.getLogName()).append(' '); } else { Player player = game.getPlayer(targetId); if (player != null) { - sb.append(player.getLogName()).append(" "); + sb.append(player.getLogName()).append(' '); } } } diff --git a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayerAmount.java b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayerAmount.java index 1c7d8b970e..60a8d04ee7 100644 --- a/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayerAmount.java +++ b/Mage/src/main/java/mage/target/common/TargetCreatureOrPlayerAmount.java @@ -201,10 +201,10 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount { for (UUID targetId : getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append("(").append(getTargetAmount(targetId)).append(") "); + sb.append(permanent.getLogName()).append('(').append(getTargetAmount(targetId)).append(") "); } else { Player player = game.getPlayer(targetId); - sb.append(player.getLogName()).append("(").append(getTargetAmount(targetId)).append(") "); + sb.append(player.getLogName()).append('(').append(getTargetAmount(targetId)).append(") "); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/target/common/TargetCreaturePermanentAmount.java b/Mage/src/main/java/mage/target/common/TargetCreaturePermanentAmount.java index 430126b7db..06491ad922 100644 --- a/Mage/src/main/java/mage/target/common/TargetCreaturePermanentAmount.java +++ b/Mage/src/main/java/mage/target/common/TargetCreaturePermanentAmount.java @@ -163,7 +163,7 @@ public class TargetCreaturePermanentAmount extends TargetAmount { for (UUID targetId : getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append("(").append(getTargetAmount(targetId)).append(") "); + sb.append(permanent.getLogName()).append('(').append(getTargetAmount(targetId)).append(") "); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/target/common/TargetDefender.java b/Mage/src/main/java/mage/target/common/TargetDefender.java index 55717c19ac..24f8ace2c2 100644 --- a/Mage/src/main/java/mage/target/common/TargetDefender.java +++ b/Mage/src/main/java/mage/target/common/TargetDefender.java @@ -170,11 +170,11 @@ public class TargetDefender extends TargetImpl { for (UUID targetId: getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getName()).append(" "); + sb.append(permanent.getName()).append(' '); } else { Player player = game.getPlayer(targetId); - sb.append(player.getLogName()).append(" "); + sb.append(player.getLogName()).append(' '); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java index c7317b02c4..0555610187 100644 --- a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java +++ b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java @@ -242,11 +242,11 @@ public class TargetPermanentOrPlayer extends TargetImpl { for (UUID targetId: getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append(" "); + sb.append(permanent.getLogName()).append(' '); } else { Player player = game.getPlayer(targetId); - sb.append(player.getLogName()).append(" "); + sb.append(player.getLogName()).append(' '); } } return sb.toString(); diff --git a/Mage/src/main/java/mage/target/common/TargetPermanentOrSuspendedCard.java b/Mage/src/main/java/mage/target/common/TargetPermanentOrSuspendedCard.java index 40022b8909..470472c495 100644 --- a/Mage/src/main/java/mage/target/common/TargetPermanentOrSuspendedCard.java +++ b/Mage/src/main/java/mage/target/common/TargetPermanentOrSuspendedCard.java @@ -158,11 +158,11 @@ public class TargetPermanentOrSuspendedCard extends TargetImpl { for (UUID targetId : this.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append(" "); + sb.append(permanent.getLogName()).append(' '); } else { Card card = game.getExile().getCard(targetId, game); if (card != null) { - sb.append(card.getLogName()).append(" "); + sb.append(card.getLogName()).append(' '); } } } diff --git a/Mage/src/main/java/mage/target/common/TargetSpellOrPermanent.java b/Mage/src/main/java/mage/target/common/TargetSpellOrPermanent.java index 95e612cd82..50ced1b860 100644 --- a/Mage/src/main/java/mage/target/common/TargetSpellOrPermanent.java +++ b/Mage/src/main/java/mage/target/common/TargetSpellOrPermanent.java @@ -245,13 +245,13 @@ public class TargetSpellOrPermanent extends TargetImpl { for (UUID targetId : getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - sb.append(permanent.getLogName()).append(" "); + sb.append(permanent.getLogName()).append(' '); } else { Spell spell = game.getStack().getSpell(targetId); if (spell.isFaceDown(game)) { sb.append(GameLog.getNeutralColoredText("face down spell")); } else { - sb.append(spell.getLogName()).append(" "); + sb.append(spell.getLogName()).append(' '); } } } diff --git a/Mage/src/main/java/mage/util/ClassScanner.java b/Mage/src/main/java/mage/util/ClassScanner.java index ad672ca1a7..dd1987b542 100644 --- a/Mage/src/main/java/mage/util/ClassScanner.java +++ b/Mage/src/main/java/mage/util/ClassScanner.java @@ -69,7 +69,7 @@ public class ClassScanner { URL resource = resources.nextElement(); String filePath = resource.getFile(); if (filePath.startsWith("file:")) { - filePath = filePath.substring("file:".length(), filePath.lastIndexOf("!")); + filePath = filePath.substring("file:".length(), filePath.lastIndexOf('!')); jars.add(filePath); } else { dirs.put(filePath, packageName); diff --git a/Mage/src/main/java/mage/util/DateFormat.java b/Mage/src/main/java/mage/util/DateFormat.java index 83252544df..2bd324e85c 100644 --- a/Mage/src/main/java/mage/util/DateFormat.java +++ b/Mage/src/main/java/mage/util/DateFormat.java @@ -61,13 +61,13 @@ public class DateFormat { 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(); diff --git a/Mage/src/main/java/mage/util/ManaUtil.java b/Mage/src/main/java/mage/util/ManaUtil.java index b617d82a04..2221ebf406 100644 --- a/Mage/src/main/java/mage/util/ManaUtil.java +++ b/Mage/src/main/java/mage/util/ManaUtil.java @@ -468,7 +468,7 @@ public class ManaUtil { // Combine the cost back as a mana string StringBuilder sb = new StringBuilder(); for (String s : finalCost) { - sb.append("{" + s + "}"); + sb.append('{' + s + '}'); } // Return the condensed string return sb.toString(); diff --git a/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java b/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java index e458b1d756..3f4b4f90fd 100644 --- a/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java @@ -110,15 +110,15 @@ public class CommanderInfoWatcher extends Watcher { sb.append("Commander"); Integer castCount = (Integer) game.getState().getValue(sourceId + "_castCount"); if (castCount != null) { - sb.append(" ").append(castCount).append(castCount == 1 ? " time" : " times").append(" casted from the command zone."); + sb.append(' ').append(castCount).append(castCount == 1 ? " time" : " times").append(" casted from the command zone."); } this.addInfo(object, "Commander", sb.toString(), game); if (checkCommanderDamage) { for (Map.Entry entry : damageToPlayer.entrySet()) { Player damagedPlayer = game.getPlayer(entry.getKey()); - sb.append("Commander did ").append(entry.getValue()).append(" combat damage to player ").append(damagedPlayer.getLogName()).append("."); + sb.append("Commander did ").append(entry.getValue()).append(" combat damage to player ").append(damagedPlayer.getLogName()).append('.'); this.addInfo(object, "Commander" + entry.getKey(), - "Commander did " + entry.getValue() + " combat damage to player " + damagedPlayer.getLogName() + ".", game); + "Commander did " + entry.getValue() + " combat damage to player " + damagedPlayer.getLogName() + '.', game); } } } From 0557b5e89cbed0490adeb673be6a42375513ffcd Mon Sep 17 00:00:00 2001 From: vraskulin Date: Fri, 27 Jan 2017 16:04:56 +0300 Subject: [PATCH 10/12] list.size > 0 changed to !list.isEmpty We care about if it's empty or not, not about it's size --- .../src/main/java/mage/client/cards/Card.java | 12 +++--- .../main/java/mage/client/cards/CardArea.java | 2 +- .../main/java/mage/client/cards/Cards.java | 2 +- .../java/mage/client/cards/CardsList.java | 2 +- .../java/mage/client/cards/DragCardGrid.java | 6 +-- .../java/mage/client/cards/Permanent.java | 4 +- .../mage/client/components/MageTextArea.java | 2 +- .../components/ability/AbilityPicker.java | 2 +- .../client/deckeditor/table/CardHelper.java | 2 +- .../client/dialog/CardInfoWindowDialog.java | 2 +- .../mage/client/dialog/NewTableDialog.java | 2 +- .../client/dialog/NewTournamentDialog.java | 4 +- .../main/java/mage/client/game/GamePanel.java | 8 ++-- .../java/mage/client/table/TablesPanel.java | 2 +- .../java/mage/client/util/ImageHelper.java | 2 +- .../mage/client/util/MageTableRowSorter.java | 2 +- .../mage/client/util/gui/ArrowBuilder.java | 2 +- .../mage/client/util/gui/GuiDisplayUtil.java | 6 +-- .../client/util/stats/UpdateMemUsageTask.java | 2 +- .../java/org/mage/card/arcane/CardPanel.java | 6 +-- .../org/mage/card/arcane/CardRenderer.java | 2 +- .../org/mage/card/arcane/TextboxRule.java | 2 +- .../org/mage/plugins/card/CardPluginImpl.java | 4 +- Mage.Common/src/mage/constants/Constants.java | 2 +- Mage.Common/src/mage/view/CardView.java | 2 +- Mage.Common/src/mage/view/CardsView.java | 2 +- Mage.Common/src/mage/view/ChatMessage.java | 6 +-- Mage.Common/src/mage/view/GameView.java | 2 +- Mage.Common/src/mage/view/MatchView.java | 2 +- Mage.Common/src/mage/view/PermanentView.java | 2 +- Mage.Common/src/mage/view/PlayerView.java | 2 +- .../src/mage/view/StackAbilityView.java | 4 +- .../src/mage/player/ai/ComputerPlayer6.java | 22 +++++----- .../src/mage/player/ai/ComputerPlayer7.java | 14 +++---- .../src/mage/player/ai/SimulatedAction2.java | 2 +- .../src/mage/player/ai/SimulatedPlayer2.java | 6 +-- .../java/mage/player/ai/ComputerPlayer.java | 40 +++++++++---------- .../src/mage/player/ai/MCTSPlayer.java | 6 +-- .../mage/player/ai/SimulatedPlayerMCTS.java | 4 +- .../src/mage/player/ai/ComputerPlayer2.java | 16 ++++---- .../src/mage/player/ai/ComputerPlayer3.java | 10 ++--- .../src/mage/player/ai/SimulatedAction.java | 2 +- .../src/mage/player/ai/SimulatedPlayer.java | 4 +- .../src/mage/player/human/HumanPlayer.java | 10 ++--- .../src/main/java/mage/server/User.java | 6 +-- .../java/mage/server/game/GameController.java | 4 +- .../mage/server/game/GameSessionPlayer.java | 3 +- Mage.Sets/src/mage/cards/a/ActOnImpulse.java | 2 +- .../src/mage/cards/a/AgonizingMemories.java | 2 +- Mage.Sets/src/mage/cards/a/AladdinsLamp.java | 2 +- .../src/mage/cards/a/AltarOfDementia.java | 2 +- .../src/mage/cards/a/AmassTheComponents.java | 2 +- .../src/mage/cards/a/AncestralMemories.java | 2 +- .../src/mage/cards/a/AngelOfSerenity.java | 6 +-- .../src/mage/cards/a/AngelicArbiter.java | 2 +- .../src/mage/cards/a/AnimalBoneyard.java | 2 +- .../src/mage/cards/a/AnimationModule.java | 4 +- .../src/mage/cards/a/AnimistsAwakening.java | 2 +- .../src/mage/cards/a/AnyaMercilessAngel.java | 2 +- .../src/mage/cards/b/BaneAlleyBroker.java | 4 +- Mage.Sets/src/mage/cards/b/BirthingPod.java | 2 +- .../src/mage/cards/b/BitterRevelation.java | 2 +- .../mage/cards/b/BlessedReincarnation.java | 2 +- .../src/mage/cards/b/BorderlandExplorer.java | 2 +- Mage.Sets/src/mage/cards/b/BrionStoutarm.java | 2 +- Mage.Sets/src/mage/cards/b/Browse.java | 2 +- .../src/mage/cards/c/ChandraPyromaster.java | 2 +- Mage.Sets/src/mage/cards/c/ChimneyImp.java | 2 +- .../src/mage/cards/c/ChitteringRats.java | 2 +- Mage.Sets/src/mage/cards/c/ChromeMox.java | 6 +-- .../mage/cards/c/CircleOfProtectionWhite.java | 2 +- Mage.Sets/src/mage/cards/c/CitanulFlute.java | 2 +- Mage.Sets/src/mage/cards/c/Clockspinning.java | 4 +- Mage.Sets/src/mage/cards/c/CloneShell.java | 4 +- Mage.Sets/src/mage/cards/c/CobraTrap.java | 2 +- Mage.Sets/src/mage/cards/c/Conflux.java | 10 ++--- .../src/mage/cards/c/CongregationAtDawn.java | 2 +- .../src/mage/cards/c/CorpseConnoisseur.java | 2 +- .../src/mage/cards/c/CorruptedGrafstone.java | 2 +- Mage.Sets/src/mage/cards/c/Cultivate.java | 2 +- Mage.Sets/src/mage/cards/c/CurseOfChaos.java | 2 +- Mage.Sets/src/mage/cards/c/CurseOfEchoes.java | 2 +- Mage.Sets/src/mage/cards/c/CursedScroll.java | 2 +- .../src/mage/cards/d/DanceOfTheDead.java | 2 +- .../src/mage/cards/d/DarkSupplicant.java | 2 +- Mage.Sets/src/mage/cards/d/DarthTyranus.java | 2 +- .../src/mage/cards/d/DementiaSliver.java | 2 +- .../src/mage/cards/d/DeployTheGatewatch.java | 2 +- .../mage/cards/d/DescendantOfMasumaro.java | 4 +- .../src/mage/cards/d/DevoutInvocation.java | 2 +- Mage.Sets/src/mage/cards/d/DimirCharm.java | 2 +- .../src/mage/cards/d/DimirMachinations.java | 2 +- .../cards/d/DivergentTransformations.java | 2 +- Mage.Sets/src/mage/cards/d/Dracoplasm.java | 2 +- Mage.Sets/src/mage/cards/d/DralnusPet.java | 2 +- Mage.Sets/src/mage/cards/d/Duplicant.java | 2 +- .../src/mage/cards/e/EldritchEvolution.java | 2 +- Mage.Sets/src/mage/cards/e/EliteArcanist.java | 2 +- .../src/mage/cards/e/EndlessHorizons.java | 2 +- .../src/mage/cards/e/EpicExperiment.java | 2 +- Mage.Sets/src/mage/cards/e/Excavator.java | 4 +- .../src/mage/cards/e/ExclusionRitual.java | 2 +- Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java | 2 +- Mage.Sets/src/mage/cards/f/Firestorm.java | 2 +- .../src/mage/cards/f/FlamesOfRemembrance.java | 2 +- Mage.Sets/src/mage/cards/f/Fleshwrither.java | 2 +- Mage.Sets/src/mage/cards/f/Fling.java | 2 +- .../src/mage/cards/f/ForbiddenAlchemy.java | 2 +- Mage.Sets/src/mage/cards/f/ForkInTheRoad.java | 4 +- Mage.Sets/src/mage/cards/f/FriendlyFire.java | 2 +- Mage.Sets/src/mage/cards/f/FromTheAshes.java | 2 +- Mage.Sets/src/mage/cards/g/GaeasCradle.java | 2 - .../src/mage/cards/g/GallowsAtWillowHill.java | 2 +- .../src/mage/cards/g/GarrukTheVeilCursed.java | 2 +- Mage.Sets/src/mage/cards/g/GatherThePack.java | 4 +- Mage.Sets/src/mage/cards/g/GenesisHydra.java | 2 +- Mage.Sets/src/mage/cards/g/GenesisWave.java | 2 +- Mage.Sets/src/mage/cards/g/GhastlyDemise.java | 2 +- Mage.Sets/src/mage/cards/g/GiftsUngiven.java | 2 +- .../src/mage/cards/g/GlimpseTheFuture.java | 2 +- Mage.Sets/src/mage/cards/g/Godsend.java | 2 +- Mage.Sets/src/mage/cards/g/GrinningTotem.java | 2 +- Mage.Sets/src/mage/cards/g/GripOfChaos.java | 2 +- Mage.Sets/src/mage/cards/g/Grozoth.java | 2 +- Mage.Sets/src/mage/cards/g/GurmagDrowner.java | 2 +- .../src/mage/cards/h/HarmonyOfNature.java | 2 +- Mage.Sets/src/mage/cards/h/HeartOfKiran.java | 2 +- .../src/mage/cards/h/HellcarverDemon.java | 2 +- Mage.Sets/src/mage/cards/h/HeroesPodium.java | 2 +- Mage.Sets/src/mage/cards/h/HiredTorturer.java | 2 +- Mage.Sets/src/mage/cards/h/HisokasGuard.java | 2 +- .../src/mage/cards/h/HoardingDragon.java | 2 +- .../src/mage/cards/h/HopeOfGhirapur.java | 2 +- .../src/mage/cards/i/IgniteMemories.java | 2 +- .../src/mage/cards/i/InameDeathAspect.java | 2 +- .../src/mage/cards/i/IncreasingAmbition.java | 2 +- .../mage/cards/i/IndomitableCreativity.java | 2 +- Mage.Sets/src/mage/cards/i/InfernalKirin.java | 2 +- Mage.Sets/src/mage/cards/i/InfernalTutor.java | 2 +- .../src/mage/cards/i/InvaderParasite.java | 2 +- .../src/mage/cards/i/IsochronScepter.java | 2 +- .../src/mage/cards/j/JacesMindseeker.java | 2 +- Mage.Sets/src/mage/cards/j/JaradsOrders.java | 2 +- .../src/mage/cards/j/JestersScepter.java | 2 +- .../src/mage/cards/k/KaaliaOfTheVast.java | 2 +- .../src/mage/cards/k/KahoMinamoHistorian.java | 4 +- .../src/mage/cards/k/KangeeAerieKeeper.java | 4 +- Mage.Sets/src/mage/cards/k/KodamasReach.java | 2 +- .../src/mage/cards/k/KrovikanSorcerer.java | 2 +- Mage.Sets/src/mage/cards/l/Leashling.java | 2 +- Mage.Sets/src/mage/cards/l/LifesLegacy.java | 2 +- Mage.Sets/src/mage/cards/l/LordOfTheVoid.java | 2 +- .../src/mage/cards/m/MadcapExperiment.java | 2 +- .../src/mage/cards/m/MagneticMountain.java | 2 +- Mage.Sets/src/mage/cards/m/MagusOfTheJar.java | 2 +- .../src/mage/cards/m/MagusOfTheScroll.java | 2 +- Mage.Sets/src/mage/cards/m/ManaSeverance.java | 2 +- .../src/mage/cards/m/ManifoldInsights.java | 2 +- .../src/mage/cards/m/MarshalingTheTroops.java | 2 +- .../mage/cards/m/MasterOfPredicaments.java | 2 +- Mage.Sets/src/mage/cards/m/MemoryJar.java | 2 +- Mage.Sets/src/mage/cards/m/MerfolkSpy.java | 2 +- Mage.Sets/src/mage/cards/m/Metamorphosis.java | 2 +- Mage.Sets/src/mage/cards/m/MeteorBlast.java | 2 +- Mage.Sets/src/mage/cards/m/MeteorCrater.java | 2 +- Mage.Sets/src/mage/cards/m/MimicVat.java | 2 +- .../src/mage/cards/m/MindclawShaman.java | 2 +- Mage.Sets/src/mage/cards/m/MindleechMass.java | 4 +- .../src/mage/cards/m/MizzixsMastery.java | 2 +- Mage.Sets/src/mage/cards/m/MomentousFall.java | 2 +- .../src/mage/cards/m/MoonringMirror.java | 2 +- .../src/mage/cards/m/MyrBattlesphere.java | 2 +- .../src/mage/cards/n/NahiriTheHarbinger.java | 2 +- .../src/mage/cards/n/NezumiShortfang.java | 3 +- .../src/mage/cards/n/NissaNaturesArtisan.java | 2 +- .../src/mage/cards/n/NissaWorldwaker.java | 2 +- .../src/mage/cards/o/OrcishLibrarian.java | 6 +-- .../src/mage/cards/p/PainfulMemories.java | 2 +- .../src/mage/cards/p/PanopticMirror.java | 2 +- Mage.Sets/src/mage/cards/p/Peregrination.java | 2 +- .../src/mage/cards/p/PerishTheThought.java | 2 +- .../src/mage/cards/p/PhyrexianDelver.java | 2 +- .../src/mage/cards/p/PhyrexianGrimoire.java | 2 +- .../src/mage/cards/p/PlaneswalkersFavor.java | 2 +- .../src/mage/cards/p/PlaneswalkersFury.java | 2 +- .../src/mage/cards/p/PlaneswalkersMirth.java | 2 +- .../src/mage/cards/p/PlaneswalkersScorn.java | 2 +- .../mage/cards/p/PolukranosWorldEater.java | 2 +- Mage.Sets/src/mage/cards/p/Polymorph.java | 2 +- .../src/mage/cards/p/PreeminentCaptain.java | 2 +- Mage.Sets/src/mage/cards/p/ProteusStaff.java | 2 +- .../src/mage/cards/p/PrototypePortal.java | 6 +-- .../src/mage/cards/p/PryingQuestions.java | 2 +- .../src/mage/cards/q/QasaliAmbusher.java | 4 +- .../src/mage/cards/q/QuietSpeculation.java | 2 +- .../src/mage/cards/r/RealmsUncharted.java | 2 +- .../src/mage/cards/r/ReflectingPool.java | 2 +- .../src/mage/cards/r/RenownedWeaponsmith.java | 2 +- Mage.Sets/src/mage/cards/r/Reweave.java | 2 +- Mage.Sets/src/mage/cards/r/RiseFall.java | 2 +- Mage.Sets/src/mage/cards/r/RoninWarclub.java | 2 +- .../src/mage/cards/r/RootwaterThief.java | 2 +- .../src/mage/cards/s/SadisticAugermage.java | 2 +- .../src/mage/cards/s/SanguinePraetor.java | 2 +- .../mage/cards/s/SasayaOrochiAscendant.java | 2 +- .../src/mage/cards/s/SavageSummoning.java | 1 - Mage.Sets/src/mage/cards/s/SecretSalvage.java | 2 +- Mage.Sets/src/mage/cards/s/SeeBeyond.java | 2 +- .../src/mage/cards/s/SemblanceAnvil.java | 4 +- Mage.Sets/src/mage/cards/s/SerrasSanctum.java | 2 +- .../mage/cards/s/ShimatsuTheBloodcloaked.java | 2 +- .../src/mage/cards/s/SignalTheClans.java | 2 +- .../src/mage/cards/s/SilentBladeOni.java | 2 +- .../src/mage/cards/s/SkyshipWeatherlight.java | 2 +- .../src/mage/cards/s/SlumberingTora.java | 2 +- Mage.Sets/src/mage/cards/s/SoldeviSage.java | 2 +- Mage.Sets/src/mage/cards/s/SoulFoundry.java | 4 +- Mage.Sets/src/mage/cards/s/Spellbinder.java | 2 +- Mage.Sets/src/mage/cards/s/Spellshift.java | 2 +- .../src/mage/cards/s/SpiritOfResistance.java | 2 +- .../src/mage/cards/s/SquanderedResources.java | 4 +- Mage.Sets/src/mage/cards/s/StarCompass.java | 2 +- .../src/mage/cards/s/StarlitSanctum.java | 4 +- .../src/mage/cards/s/SteelcladSerpent.java | 2 +- Mage.Sets/src/mage/cards/s/StompingSlabs.java | 2 +- Mage.Sets/src/mage/cards/s/StrataScythe.java | 4 +- .../src/mage/cards/s/StrategicPlanning.java | 2 +- Mage.Sets/src/mage/cards/s/StripBare.java | 2 +- .../src/mage/cards/s/StrongholdGambit.java | 2 +- .../src/mage/cards/s/SuddenDisappearance.java | 2 +- .../src/mage/cards/s/SultaiSoothsayer.java | 2 +- Mage.Sets/src/mage/cards/s/SummonersEgg.java | 2 +- Mage.Sets/src/mage/cards/s/SummoningTrap.java | 2 +- Mage.Sets/src/mage/cards/s/SuturedGhoul.java | 2 +- Mage.Sets/src/mage/cards/s/SyphonMind.java | 2 +- .../src/mage/cards/t/TalentOfTheTelepath.java | 4 +- .../mage/cards/t/TemptWithReflections.java | 2 +- .../src/mage/cards/t/TestamentOfFaith.java | 6 +-- .../src/mage/cards/t/ThadaAdelAcquisitor.java | 2 +- Mage.Sets/src/mage/cards/t/ThoughtGorger.java | 2 +- .../src/mage/cards/t/ThoughtpickerWitch.java | 2 +- .../src/mage/cards/t/TransmuteArtifact.java | 2 +- Mage.Sets/src/mage/cards/v/VastwoodHydra.java | 2 +- .../src/mage/cards/v/VerdelothTheAncient.java | 4 +- .../src/mage/cards/v/VeteranExplorer.java | 2 +- Mage.Sets/src/mage/cards/w/WaveOfVitriol.java | 2 +- Mage.Sets/src/mage/cards/w/WeirdHarvest.java | 2 +- .../src/mage/cards/w/WerewolfRansacker.java | 2 +- .../src/mage/cards/w/WidespreadPanic.java | 2 +- Mage.Sets/src/mage/cards/w/WildEvocation.java | 2 +- Mage.Sets/src/mage/cards/w/WildPair.java | 2 +- Mage.Sets/src/mage/cards/w/WildResearch.java | 2 +- .../src/mage/cards/w/WoodlandBellower.java | 2 +- .../src/mage/cards/x/XenagosTheReveler.java | 2 +- Mage.Sets/src/mage/cards/y/YavimayaDryad.java | 2 +- .../abilities/equipped/HeavyArbalestTest.java | 2 +- .../org/mage/test/player/RandomPlayer.java | 4 +- .../java/org/mage/test/player/TestPlayer.java | 4 +- .../base/impl/CardTestPlayerAPIImpl.java | 2 +- .../java/mage/abilities/AbilitiesImpl.java | 4 +- .../main/java/mage/abilities/AbilityImpl.java | 12 +++--- .../abilities/DelayedTriggeredAbility.java | 2 - Mage/src/main/java/mage/abilities/Modes.java | 2 +- .../common/EntersBattlefieldAbility.java | 2 +- .../common/CardsInHandCondition.java | 2 +- .../condition/common/FerociousCondition.java | 2 +- .../OpponentControlsPermanentCondition.java | 4 +- .../common/PermanentHasCounterCondition.java | 2 +- .../PermanentsOnTheBattlefieldCondition.java | 3 +- .../common/TenOrLessLifeCondition.java | 2 +- .../common/TopLibraryCardTypeCondition.java | 2 +- .../abilities/costs/AlternativeCost2Impl.java | 2 - .../java/mage/abilities/costs/CostsImpl.java | 2 +- .../costs/OptionalAdditionalCostImpl.java | 8 ---- .../costs/common/PutCountersSourceCost.java | 2 +- .../costs/common/RemoveCounterCost.java | 2 +- .../abilities/costs/mana/ManaCostsImpl.java | 2 +- .../dynamicvalue/common/MultikickerCount.java | 6 +-- .../abilities/effects/ContinuousEffects.java | 4 +- .../AddManaOfAnyTypeProducedEffect.java | 2 +- .../CopySpellForEachItCouldTargetEffect.java | 2 +- .../effects/common/CreateTokenEffect.java | 2 +- .../common/CreateTokenTargetEffect.java | 2 +- .../effects/common/DamageAllEffect.java | 2 +- .../common/DamageControllerEffect.java | 2 +- .../effects/common/DamageMultiEffect.java | 2 +- .../effects/common/DamageTargetEffect.java | 4 +- .../effects/common/DevourEffect.java | 2 +- .../effects/common/DoIfCostPaid.java | 2 +- ...nControllersNextUntapStepTargetEffect.java | 2 +- .../DrawCardSourceControllerEffect.java | 2 +- .../effects/common/DrawCardTargetEffect.java | 4 +- ...ExileAndReturnTransformedSourceEffect.java | 2 +- .../effects/common/GainLifeEffect.java | 2 +- .../effects/common/GainLifeTargetEffect.java | 4 +- .../LoseLifeControllerAttachedEffect.java | 2 +- .../common/LoseLifeOpponentsEffect.java | 2 +- .../LoseLifeSourceControllerEffect.java | 2 +- .../effects/common/LoseLifeTargetEffect.java | 4 +- .../effects/common/PhaseOutTargetEffect.java | 2 +- .../PlayTargetWithoutPayingManaEffect.java | 2 +- .../effects/common/PopulateEffect.java | 2 +- .../PutLibraryIntoGraveTargetEffect.java | 2 +- .../effects/common/RecruiterEffect.java | 2 +- .../RevealCardsFromLibraryUntilEffect.java | 4 +- .../common/SkipNextPlayerUntapStepEffect.java | 4 +- .../effects/common/TapTargetEffect.java | 2 +- .../effects/common/TransformTargetEffect.java | 2 +- .../AddCardSubTypeTargetEffect.java | 2 +- .../AssignNoCombatDamageSourceEffect.java | 2 +- .../BecomesColorOrColorsTargetEffect.java | 4 +- .../continuous/BecomesCreatureAllEffect.java | 8 ++-- .../BecomesCreatureAttachedEffect.java | 10 ++--- .../BecomesCreatureSourceEffect.java | 8 ++-- .../BecomesCreatureTargetEffect.java | 6 +-- .../continuous/BoostEquippedEffect.java | 2 +- .../continuous/GainAbilityAllEffect.java | 2 +- .../continuous/GainAbilityTargetEffect.java | 2 +- .../MaximumHandSizeControllerEffect.java | 2 +- .../counter/AddCountersAttachedEffect.java | 2 +- .../counter/AddCountersTargetEffect.java | 4 +- .../counter/DistributeCountersEffect.java | 4 +- .../common/counter/ProliferateEffect.java | 4 +- .../counter/RemoveCounterTargetEffect.java | 2 +- .../discard/DiscardControllerEffect.java | 2 +- .../discard/DiscardHandTargetEffect.java | 2 +- .../common/discard/DiscardTargetEffect.java | 2 +- ...SearchLibraryGraveyardPutInHandEffect.java | 4 +- .../search/SearchLibraryPutInHandEffect.java | 2 +- .../search/SearchLibraryPutInPlayEffect.java | 2 +- ...rchLibraryPutInPlayTargetPlayerEffect.java | 2 +- ...archLibraryWithLessCMCPutInPlayEffect.java | 2 +- .../effects/keyword/FatesealEffect.java | 2 +- .../abilities/keyword/CascadeAbility.java | 2 +- .../abilities/keyword/ConvokeAbility.java | 2 +- .../mage/abilities/keyword/DelveAbility.java | 6 +-- .../abilities/keyword/FlashbackAbility.java | 8 ++-- .../abilities/keyword/HideawayAbility.java | 2 +- .../abilities/keyword/TransmuteAbility.java | 2 +- .../mana/ActivatedManaAbilityImpl.java | 2 +- .../mana/AnyColorLandsProduceManaAbility.java | 2 +- .../CommanderColorIdentityManaAbility.java | 2 +- .../java/mage/abilities/mana/ManaOptions.java | 2 - .../abilities/mana/TriggeredManaAbility.java | 2 +- Mage/src/main/java/mage/cards/Sets.java | 4 +- .../cards/decks/importer/DckDeckImporter.java | 2 +- .../src/main/java/mage/filter/FilterCard.java | 2 +- .../java/mage/game/GameCommanderImpl.java | 2 +- Mage/src/main/java/mage/game/GameImpl.java | 2 +- Mage/src/main/java/mage/game/GameStates.java | 6 +-- .../src/main/java/mage/game/ZonesHandler.java | 2 +- .../main/java/mage/game/combat/Combat.java | 2 +- .../java/mage/game/combat/CombatGroup.java | 6 +-- .../main/java/mage/game/draft/DraftCube.java | 2 +- .../mage/game/draft/RandomBoosterDraft.java | 2 +- .../java/mage/game/match/MatchPlayer.java | 2 +- .../java/mage/game/permanent/token/Token.java | 2 +- Mage/src/main/java/mage/game/stack/Spell.java | 2 +- .../java/mage/game/stack/StackAbility.java | 2 +- .../mage/game/tournament/TournamentImpl.java | 2 +- .../pairing/SwissPairingSimple.java | 2 +- .../main/java/mage/players/PlayerImpl.java | 22 +++++----- .../src/main/java/mage/target/TargetImpl.java | 6 +-- .../targetpointer/FirstTargetPointer.java | 4 +- .../main/java/mage/util/TournamentUtil.java | 2 +- .../main/java/mage/util/trace/TraceUtil.java | 2 +- 366 files changed, 532 insertions(+), 548 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/cards/Card.java b/Mage.Client/src/main/java/mage/client/cards/Card.java index 96aff7602a..b3ddbadeec 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Card.java +++ b/Mage.Client/src/main/java/mage/client/cards/Card.java @@ -181,7 +181,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis gImage.setColor(Color.BLACK); gImage.drawImage(background, 0, 0, this); - if (card.getManaCost().size() > 0) { + if (!card.getManaCost().isEmpty()) { ImageHelper.drawCosts(card.getManaCost(), gImage, FRAME_MAX_WIDTH - SYMBOL_MAX_XOFFSET, SYMBOL_MAX_YOFFSET, this); } @@ -197,7 +197,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis gImage.drawString(card.getLoyalty(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP); } - if (card.getCardTypes().size() > 0) { + if (!card.getCardTypes().isEmpty()) { gImage.drawString(cardType, CONTENT_MAX_XOFFSET, TYPE_MAX_YOFFSET); } @@ -211,7 +211,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis gSmall.drawString(card.getLoyalty(), Config.dimensions.powBoxTextLeft, Config.dimensions.powBoxTextTop); } - if (card.getCardTypes().size() > 0) { + if (!card.getCardTypes().isEmpty()) { gSmall.drawString(cardType, Config.dimensions.contentXOffset, Config.dimensions.typeYOffset); } drawText(); @@ -232,7 +232,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis } } else { sb.append(card.getName()); - if (card.getManaCost().size() > 0) { + if (!card.getManaCost().isEmpty()) { sb.append('\n').append(card.getManaCost()); } sb.append('\n').append(cardType); @@ -247,7 +247,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis for (String rule : getRules()) { sb.append('\n').append(rule); } - if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) { + if (card.getExpansionSetCode() != null && !card.getExpansionSetCode().isEmpty()) { sb.append('\n').append(card.getCardNumber()).append(" - "); sb.append(Sets.getInstance().get(card.getExpansionSetCode()).getName()).append(" - "); sb.append(card.getRarity().toString()); @@ -308,7 +308,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis sbType.append(cardType.toString()).append(' '); } - if (card.getSubTypes().size() > 0) { + if (!card.getSubTypes().isEmpty()) { sbType.append("- "); for (String subType : card.getSubTypes()) { sbType.append(subType).append(' '); diff --git a/Mage.Client/src/main/java/mage/client/cards/CardArea.java b/Mage.Client/src/main/java/mage/client/cards/CardArea.java index 531cf10eb2..4ead4cf4dd 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardArea.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardArea.java @@ -163,7 +163,7 @@ public class CardArea extends JPanel implements MouseListener { private void loadCardsMany(CardsView showCards, BigCard bigCard, UUID gameId) { int rowsOfCards = 20; int columns = 1; - if (showCards != null && showCards.size() > 0) { + if (showCards != null && !showCards.isEmpty()) { Rectangle rectangle = new Rectangle(cardDimension.width, cardDimension.height); int count = 0; for (CardView card : showCards.values()) { diff --git a/Mage.Client/src/main/java/mage/client/cards/Cards.java b/Mage.Client/src/main/java/mage/client/cards/Cards.java index d6a3363db7..6996657d74 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Cards.java +++ b/Mage.Client/src/main/java/mage/client/cards/Cards.java @@ -225,7 +225,7 @@ public class Cards extends javax.swing.JPanel { } if (!isVisibleIfEmpty) { - cardArea.setVisible(cards.size() > 0); + cardArea.setVisible(!cards.isEmpty()); } sizeCards(getCardDimension()); diff --git a/Mage.Client/src/main/java/mage/client/cards/CardsList.java b/Mage.Client/src/main/java/mage/client/cards/CardsList.java index bec809a416..5c16d1c9bb 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardsList.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardsList.java @@ -322,7 +322,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar cardArea.remove(card); } - if (cards != null && cards.size() > 0) { + if (cards != null && !cards.isEmpty()) { Rectangle rectangle = new Rectangle(cardDimension.width, cardDimension.height); List sortedCards = new ArrayList<>(cards.values()); switch (sortSetting.getSortBy()) { diff --git a/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java b/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java index 8a4d3a1771..83dd8bc9da 100644 --- a/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java +++ b/Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java @@ -1077,7 +1077,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg for (Sort s : sortMenuItems.keySet()) { sortMenuItems.get(s).setSelected(cardSort == s); } - hideSelected.setEnabled(dragCardList().size() > 0); + hideSelected.setEnabled(!dragCardList().isEmpty()); separateButton.setSelected(separateCreatures); menu.show(e.getComponent(), e.getX(), e.getY()); } @@ -1534,7 +1534,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg List cardPool = CardRepository.instance.findCards(cardCriteria); - if (cardPool.size() > 0) { + if (!cardPool.isEmpty()) { Card acard = cardPool.get(RandomUtil.nextInt(cardPool.size())).getMockCard(); if (acard.getName().equals(card.getName())) { @@ -1656,7 +1656,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg if (trackedCards.containsKey(info.getSetCode()) && trackedCards.get(info.getSetCode()).containsKey(info.getCardNum())) { ArrayList candidates = trackedCards.get(info.getSetCode()).get(info.getCardNum()); - if (candidates.size() > 0) { + if (!candidates.isEmpty()) { gridStack.add(candidates.remove(0)); thisMaxStackSize = Math.max(thisMaxStackSize, gridStack.size()); } diff --git a/Mage.Client/src/main/java/mage/client/cards/Permanent.java b/Mage.Client/src/main/java/mage/client/cards/Permanent.java index f9f8fa9b96..f23c01cc88 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Permanent.java +++ b/Mage.Client/src/main/java/mage/client/cards/Permanent.java @@ -106,7 +106,7 @@ public class Permanent extends Card { if (permanent.getOriginal() != null) { sb.append("\n----- Originally -------\n"); sb.append(permanent.getOriginal().getName()); - if (permanent.getOriginal().getManaCost().size() > 0) { + if (!permanent.getOriginal().getManaCost().isEmpty()) { sb.append('\n').append(permanent.getOriginal().getManaCost()); } sb.append('\n').append(getType(permanent.getOriginal())); @@ -122,7 +122,7 @@ public class Permanent extends Card { for (String rule: getRules()) { sb.append('\n').append(rule); } - if (permanent.getOriginal().getExpansionSetCode().length() > 0) { + if (!permanent.getOriginal().getExpansionSetCode().isEmpty()) { 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()); diff --git a/Mage.Client/src/main/java/mage/client/components/MageTextArea.java b/Mage.Client/src/main/java/mage/client/components/MageTextArea.java index 9f2f6975df..6928297878 100644 --- a/Mage.Client/src/main/java/mage/client/components/MageTextArea.java +++ b/Mage.Client/src/main/java/mage/client/components/MageTextArea.java @@ -51,7 +51,7 @@ public class MageTextArea extends JEditorPane { text = text.replace("\r\n", "
"); final String basicText = ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.DIALOG); - if (text.length() > 0) { + if (!text.isEmpty()) { buffer.append(basicText); } diff --git a/Mage.Client/src/main/java/mage/client/components/ability/AbilityPicker.java b/Mage.Client/src/main/java/mage/client/components/ability/AbilityPicker.java index 574b6036c9..fa4e43e60d 100644 --- a/Mage.Client/src/main/java/mage/client/components/ability/AbilityPicker.java +++ b/Mage.Client/src/main/java/mage/client/components/ability/AbilityPicker.java @@ -296,7 +296,7 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener { text = text.replace("\r\n", "
"); //text += "
"; - if (text.length() > 0) { + if (!text.isEmpty()) { buffer.append(ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.DIALOG)); } diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java index fce95ec0f8..67126f9170 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/CardHelper.java @@ -62,7 +62,7 @@ public class CardHelper { type.append(cardType.toString()); type.append(' '); } - if (c.getSubTypes().size() > 0) { + if (!c.getSubTypes().isEmpty()) { type.append("- "); for (String subType : c.getSubTypes()) { type.append(subType); diff --git a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java index 71ad41544e..4141d4832b 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java @@ -137,7 +137,7 @@ public class CardInfoWindowDialog extends MageDialog { String titel = name + " (" + exile.size() + ')'; setTitle(titel); this.setTitelBarToolTip(titel); - if (exile.size() > 0) { + if (!exile.isEmpty()) { show(); if (changed) { try { diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java index 9cb6b7a3ee..be43daee88 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java @@ -507,7 +507,7 @@ public class NewTableDialog extends MageDialog { while (players.size() != numPlayers) { TablePlayerPanel playerPanel = new TablePlayerPanel(); String playerType = "Human"; - if (prefPlayerTypes.size() >= players.size() && players.size() > 0) { + if (prefPlayerTypes.size() >= players.size() && !players.isEmpty()) { playerType = prefPlayerTypes.get(players.size() - 1); } playerPanel.init(players.size() + 2, playerType); diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java index a67491bd0f..bc7584eed9 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java @@ -826,7 +826,7 @@ public class NewTournamentDialog extends MageDialog { txtRandomPacks.setEnabled(false); txtRandomPacks.setLineWrap(true); String randomPrefs = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT, ""); - if (randomPrefs.length() > 0) { + if (!randomPrefs.isEmpty()) { txtRandomPacks.setText(randomPrefs); ArrayList theList = new ArrayList<>(); theList.addAll(Arrays.asList(randomPrefs.split(";"))); @@ -1026,7 +1026,7 @@ public class NewTournamentDialog extends MageDialog { } private void loadBoosterPacks(String packString) { - if (packString.length()>0) { + if (!packString.isEmpty()) { String[] packsArray = packString.substring(1, packString.length() - 1).split(","); int packNumber = 0; for (String pack : packsArray ){ diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index 966e036ae6..85435f2fe3 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -723,7 +723,7 @@ public final class GamePanel extends javax.swing.JPanel { if (!handCards.containsKey(chosenHandKey)) { chosenHandKey = YOUR_HAND; } - } else if (chosenHandKey.isEmpty() && handCards.size() > 0) { + } else if (chosenHandKey.isEmpty() && !handCards.isEmpty()) { chosenHandKey = handCards.keySet().iterator().next(); } if (chosenHandKey != null && handCards.containsKey(chosenHandKey)) { @@ -854,7 +854,7 @@ public final class GamePanel extends javax.swing.JPanel { showRevealed(game); showLookedAt(game); - if (game.getCombat().size() > 0) { + if (!game.getCombat().isEmpty()) { CombatManager.getInstance().showCombat(game.getCombat(), gameId); } else { CombatManager.getInstance().hideCombat(gameId); @@ -1164,7 +1164,7 @@ public final class GamePanel extends javax.swing.JPanel { updateGame(gameView); Map options0 = options == null ? new HashMap<>() : options; ShowCardsDialog dialog = null; - if (cardView != null && cardView.size() > 0) { + if (cardView != null && !cardView.isEmpty()) { dialog = showCards(message, cardView, required, options0, popupMenuType); options0.put("dialog", dialog); } @@ -2130,7 +2130,7 @@ public final class GamePanel extends javax.swing.JPanel { choices, this.chosenHandKey); - if (newChosenHandKey != null && newChosenHandKey.length() > 0) { + if (newChosenHandKey != null && !newChosenHandKey.isEmpty()) { this.chosenHandKey = newChosenHandKey; CardsView cards = handCards.get(chosenHandKey); handContainer.loadCards(cards, bigCard, gameId); diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index 74ac6dc089..3000313736 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -259,7 +259,7 @@ public class TablesPanel extends javax.swing.JPanel { switch (action) { case "Replay": List gameList = matchesModel.getListofGames(modelRow); - if (gameList != null && gameList.size() > 0) { + if (gameList != null && !gameList.isEmpty()) { if (gameList.size() == 1) { SessionHandler.replayGame(gameList.get(0)); } else { diff --git a/Mage.Client/src/main/java/mage/client/util/ImageHelper.java b/Mage.Client/src/main/java/mage/client/util/ImageHelper.java index 64c727257f..dfb6340b33 100644 --- a/Mage.Client/src/main/java/mage/client/util/ImageHelper.java +++ b/Mage.Client/src/main/java/mage/client/util/ImageHelper.java @@ -86,7 +86,7 @@ public class ImageHelper { } public static void drawCosts(List costs, Graphics2D g, int xOffset, int yOffset, ImageObserver o) { - if (costs.size() > 0) { + if (!costs.isEmpty()) { int costLeft = xOffset; for (int i = costs.size() - 1; i >= 0; i--) { String symbol = costs.get(i); diff --git a/Mage.Client/src/main/java/mage/client/util/MageTableRowSorter.java b/Mage.Client/src/main/java/mage/client/util/MageTableRowSorter.java index 43f74c7a80..b8b182940c 100644 --- a/Mage.Client/src/main/java/mage/client/util/MageTableRowSorter.java +++ b/Mage.Client/src/main/java/mage/client/util/MageTableRowSorter.java @@ -49,7 +49,7 @@ public class MageTableRowSorter extends TableRowSorter { @Override public void toggleSortOrder(int column) { List sortKeys = getSortKeys(); - if (sortKeys.size() > 0) { + if (!sortKeys.isEmpty()) { if (sortKeys.get(0).getSortOrder() == SortOrder.DESCENDING) { setSortKeys(null); return; diff --git a/Mage.Client/src/main/java/mage/client/util/gui/ArrowBuilder.java b/Mage.Client/src/main/java/mage/client/util/gui/ArrowBuilder.java index 1f0c3d6764..f8760c5165 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/ArrowBuilder.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/ArrowBuilder.java @@ -135,7 +135,7 @@ public class ArrowBuilder { if (map.containsKey(gameId)) { Map> innerMap = map.get(gameId); java.util.List arrows = innerMap.get(type); - if (arrows != null && arrows.size() > 0) { + if (arrows != null && !arrows.isEmpty()) { JPanel p = getArrowsPanel(gameId); synchronized (map) { for (Arrow arrow : arrows) { diff --git a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java index 9dbdb8e3a7..f70bd5ec0e 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java @@ -330,7 +330,7 @@ public class GuiDisplayUtil { } } } - if (textLines.lines.size() > 0) { + if (!textLines.lines.isEmpty()) { for (String textLine : textLines.lines) { if (textLine != null && !textLine.replace(".", "").trim().isEmpty()) { rule.append("

").append(textLine).append("

"); @@ -339,7 +339,7 @@ public class GuiDisplayUtil { } String legal = rule.toString(); - if (legal.length() > 0) { + if (!legal.isEmpty()) { legal = legal.replaceAll("\\{this\\}", card.getName().isEmpty() ? "this" : card.getName()); legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this" : card.getName()); buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.TOOLTIP)); @@ -366,7 +366,7 @@ public class GuiDisplayUtil { for (CardType cardType : card.getCardTypes()) { types += cardType.toString() + ' '; } - if (card.getSubTypes().size() > 0) { + if (!card.getSubTypes().isEmpty()) { types += "- "; } for (String subType : card.getSubTypes()) { diff --git a/Mage.Client/src/main/java/mage/client/util/stats/UpdateMemUsageTask.java b/Mage.Client/src/main/java/mage/client/util/stats/UpdateMemUsageTask.java index b3c6366b56..cc6907b614 100644 --- a/Mage.Client/src/main/java/mage/client/util/stats/UpdateMemUsageTask.java +++ b/Mage.Client/src/main/java/mage/client/util/stats/UpdateMemUsageTask.java @@ -36,7 +36,7 @@ public class UpdateMemUsageTask extends SwingWorker { @Override protected void process(List chunks) { - if (chunks != null && chunks.size() > 0) { + if (chunks != null && !chunks.isEmpty()) { Float memUsage = chunks.get(chunks.size() - 1); if (memUsage != null) { jLabelToDisplayInfo.setText(Math.round(memUsage) + "% Mem free"); diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java index 81dfd06989..f55acc778c 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java @@ -688,7 +688,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener, sbType.append(cardType.toString()).append(' '); } - if (card.getSubTypes().size() > 0) { + if (!card.getSubTypes().isEmpty()) { sbType.append("- "); for (String subType : card.getSubTypes()) { sbType.append(subType).append(' '); @@ -706,7 +706,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener, } } else { sb.append(card.getName()); - if (card.getManaCost().size() > 0) { + if (!card.getManaCost().isEmpty()) { sb.append('\n').append(card.getManaCost()); } sb.append('\n').append(cardType); @@ -724,7 +724,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener, for (String rule : card.getRules()) { sb.append('\n').append(rule); } - if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) { + if (card.getExpansionSetCode() != null && !card.getExpansionSetCode().isEmpty()) { sb.append('\n').append(card.getCardNumber()).append(" - "); sb.append(card.getExpansionSetCode()).append(" - "); sb.append(card.getRarity().toString()); diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java index fb883c04c9..fa568e13b7 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardRenderer.java @@ -385,7 +385,7 @@ public abstract class CardRenderer { for (CardType cardType : cardView.getCardTypes()) { sbType.append(cardType.toString()).append(' '); } - if (cardView.getSubTypes().size() > 0) { + if (!cardView.getSubTypes().isEmpty()) { sbType.append("- "); for (String subType : cardView.getSubTypes()) { sbType.append(subType).append(' '); diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/TextboxRule.java b/Mage.Client/src/main/java/org/mage/card/arcane/TextboxRule.java index 807e03d654..0e4b836042 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/TextboxRule.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/TextboxRule.java @@ -87,7 +87,7 @@ public class TextboxRule { // Do it in reverse order for proper handling of regions where // there are multiple attributes stacked (EG: bold + italic) AttributedString attributedRule = new AttributedString(text); - if (text.length() != 0) { + if (!text.isEmpty()) { attributedRule.addAttribute(TextAttribute.FONT, normal); for (int i = regions.size() - 1; i >= 0; --i) { regions.get(i).applyToAttributedString(attributedRule, normal, italic); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java b/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java index 29195aa2f0..f41304525f 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java @@ -179,7 +179,7 @@ public class CardPluginImpl implements CardPlugin { break; } List counters = firstPanel.getOriginalPermanent().getCounters(); - if (counters != null && counters.size() > 0) { + if (counters != null && !counters.isEmpty()) { // don't put to first panel if it has counters insertIndex = i; break; @@ -191,7 +191,7 @@ public class CardPluginImpl implements CardPlugin { continue; } counters = permanent.getOriginalPermanent().getCounters(); - if (counters != null && counters.size() > 0) { + if (counters != null && !counters.isEmpty()) { // if a land has counter, put it to the right insertIndex = i + 1; continue; diff --git a/Mage.Common/src/mage/constants/Constants.java b/Mage.Common/src/mage/constants/Constants.java index fd8bf95052..c2617b522b 100644 --- a/Mage.Common/src/mage/constants/Constants.java +++ b/Mage.Common/src/mage/constants/Constants.java @@ -78,7 +78,7 @@ public final class Constants { public enum SessionState { - DISCONNECTED, CONNECTED, CONNECTING, DISCONNECTING, SERVER_STARTING; + DISCONNECTED, CONNECTED, CONNECTING, DISCONNECTING, SERVER_STARTING } public enum Option { diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index 0548837a35..e20c27d4a1 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -397,7 +397,7 @@ public class CardView extends SimpleCardView { for (SpellAbility spellAbility : spell.getSpellAbilities()) { for (UUID modeId : spellAbility.getModes().getSelectedModes()) { Mode mode = spellAbility.getModes().get(modeId); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { setTargets(mode.getTargets()); } } diff --git a/Mage.Common/src/mage/view/CardsView.java b/Mage.Common/src/mage/view/CardsView.java index 4d8518493d..e37b9801a6 100644 --- a/Mage.Common/src/mage/view/CardsView.java +++ b/Mage.Common/src/mage/view/CardsView.java @@ -133,7 +133,7 @@ public class CardsView extends LinkedHashMap { } abilityView = new AbilityView(ability, sourceObject.getName(), sourceCardView); } - if (ability.getTargets().size() > 0) { + if (!ability.getTargets().isEmpty()) { abilityView.setTargets(ability.getTargets()); } else { List abilityTargets = new ArrayList<>(); diff --git a/Mage.Common/src/mage/view/ChatMessage.java b/Mage.Common/src/mage/view/ChatMessage.java index 487e2fbf1c..d13dccddb3 100644 --- a/Mage.Common/src/mage/view/ChatMessage.java +++ b/Mage.Common/src/mage/view/ChatMessage.java @@ -45,15 +45,15 @@ public class ChatMessage implements Serializable { private MessageType messageType; public enum MessageColor { - BLACK, RED, GREEN, BLUE, ORANGE, YELLOW; + BLACK, RED, GREEN, BLUE, ORANGE, YELLOW } public enum MessageType { - USER_INFO, STATUS, GAME, TALK, WHISPER; + USER_INFO, STATUS, GAME, TALK, WHISPER } public enum SoundToPlay { - PlayerLeft, PlayerQuitTournament, PlayerSubmittedDeck, PlayerWhispered; + PlayerLeft, PlayerQuitTournament, PlayerSubmittedDeck, PlayerWhispered } public ChatMessage(String username, String message, String time, MessageColor color) { diff --git a/Mage.Common/src/mage/view/GameView.java b/Mage.Common/src/mage/view/GameView.java index 1c55dac842..a9f7bfa9ee 100644 --- a/Mage.Common/src/mage/view/GameView.java +++ b/Mage.Common/src/mage/view/GameView.java @@ -191,7 +191,7 @@ public class GameView implements Serializable { if (priorityPlayer != null && createdForPlayer != null && createdForPlayerId != null && createdForPlayer.isGameUnderControl() && (createdForPlayerId.equals(priorityPlayer.getId()) // player controls the turn || createdForPlayer.getPlayersUnderYourControl().contains(priorityPlayer.getId()))) { // player controls active players turn - this.special = state.getSpecialActions().getControlledBy(priorityPlayer.getId(), priorityPlayer.isInPayManaMode()).size() > 0; + this.special = !state.getSpecialActions().getControlledBy(priorityPlayer.getId(), priorityPlayer.isInPayManaMode()).isEmpty(); } } else { this.special = false; diff --git a/Mage.Common/src/mage/view/MatchView.java b/Mage.Common/src/mage/view/MatchView.java index 47fc3d6625..23cf644ff5 100644 --- a/Mage.Common/src/mage/view/MatchView.java +++ b/Mage.Common/src/mage/view/MatchView.java @@ -143,7 +143,7 @@ public class MatchView implements Serializable { } this.players = sb1.toString(); StringBuilder sb2 = new StringBuilder(); - if (table.getTournament().getRounds().size() > 0) { + if (!table.getTournament().getRounds().isEmpty()) { for (TournamentPlayer tPlayer : table.getTournament().getPlayers()) { sb2.append(tPlayer.getPlayer().getName()).append(": ").append(tPlayer.getResults()).append(' '); } diff --git a/Mage.Common/src/mage/view/PermanentView.java b/Mage.Common/src/mage/view/PermanentView.java index 9e44be6169..003af1f693 100644 --- a/Mage.Common/src/mage/view/PermanentView.java +++ b/Mage.Common/src/mage/view/PermanentView.java @@ -72,7 +72,7 @@ public class PermanentView extends CardView { this.morphed = permanent.isMorphed(); this.manifested = permanent.isManifested(); this.damage = permanent.getDamage(); - if (permanent.getAttachments().size() > 0) { + if (!permanent.getAttachments().isEmpty()) { attachments = new ArrayList<>(); attachments.addAll(permanent.getAttachments()); } diff --git a/Mage.Common/src/mage/view/PlayerView.java b/Mage.Common/src/mage/view/PlayerView.java index 86f87c0a70..0d08ff3cf3 100644 --- a/Mage.Common/src/mage/view/PlayerView.java +++ b/Mage.Common/src/mage/view/PlayerView.java @@ -258,7 +258,7 @@ public class PlayerView implements Serializable { } public boolean hasAttachments() { - return attachments != null && attachments.size() > 0; + return attachments != null && !attachments.isEmpty(); } public int getStatesSavedSize() { diff --git a/Mage.Common/src/mage/view/StackAbilityView.java b/Mage.Common/src/mage/view/StackAbilityView.java index 1c5c6914d5..a34de5abf5 100644 --- a/Mage.Common/src/mage/view/StackAbilityView.java +++ b/Mage.Common/src/mage/view/StackAbilityView.java @@ -101,7 +101,7 @@ public class StackAbilityView extends CardView { List names = new ArrayList<>(); for (UUID modeId : ability.getModes().getSelectedModes()) { Mode mode = ability.getModes().get(modeId); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { setTargets(mode.getTargets()); } else { List targetList = new ArrayList<>(); @@ -111,7 +111,7 @@ public class StackAbilityView extends CardView { targetList.add(((FixedTarget) targetPointer).getTarget()); } } - if (targetList.size() > 0) { + if (!targetList.isEmpty()) { overrideTargets(targetList); for (UUID uuid : targetList) { diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java index 17b7cf9a50..cb5a449746 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java @@ -272,7 +272,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { while (actions.peek() != null) { Ability ability = actions.poll(); logger.info(new StringBuilder("===> Act [").append(game.getPlayer(playerId).getName()).append("] Action: ").append(ability.toString()).toString()); - if (ability.getTargets().size() > 0) { + if (!ability.getTargets().isEmpty()) { for (Target target : ability.getTargets()) { for (UUID id : target.getTargets()) { target.updateTarget(id, game); @@ -318,7 +318,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { //int bestScore = addActionsTimed(new FilterAbility()); currentScore = GameStateEvaluator2.evaluate(playerId, game); addActionsTimed(); - if (root.children.size() > 0) { + if (!root.children.isEmpty()) { root = root.children.get(0); //GameStateEvaluator2.evaluate(playerId, root.getGame()); int bestScore = root.getScore(); @@ -335,10 +335,10 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { } protected boolean getNextAction(Game game) { - if (root != null && root.children.size() > 0) { + if (root != null && !root.children.isEmpty()) { SimulationNode2 test = root; root = root.children.get(0); - while (root.children.size() > 0 && !root.playerId.equals(playerId)) { + while (!root.children.isEmpty() && !root.playerId.equals(playerId)) { test = root; root = root.children.get(0); } @@ -525,7 +525,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { UUID currentPlayerId = node.getGame().getPlayerList().get(); //logger.info("reached - " + val + ", playerId=" + playerId + ", node.pid="+currentPlayerId); return val; - } else if (node.getChildren().size() > 0) { + } else if (!node.getChildren().isEmpty()) { logger.trace("Add actions -- something added children:" + node.getChildren().size()); val = minimaxAB(node, depth - 1, alpha, beta); return val; @@ -542,7 +542,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { if (game.gameOver(null)) { val = GameStateEvaluator2.evaluate(playerId, game); - } else if (node.getChildren().size() > 0) { + } else if (!node.getChildren().isEmpty()) { //declared attackers or blockers or triggered abilities logger.debug("Add actions -- attack/block/trigger added children:" + node.getChildren().size()); val = minimaxAB(node, depth - 1, alpha, beta); @@ -568,7 +568,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { SimulationNode2 bestNode = null; List allActions = currentPlayer.simulatePriority(game); optimize(game, allActions); - if (logger.isInfoEnabled() && allActions.size() > 0 && depth == maxDepth) { + if (logger.isInfoEnabled() && !allActions.isEmpty() && depth == maxDepth) { logger.info("ADDED ACTIONS (" + allActions.size() + ") " + ' ' + allActions); } int counter = 0; @@ -614,9 +614,9 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { .append(listTargets(game, action.getTargets())).append(')') .append(logger.isTraceEnabled() ? " #" + newNode.hashCode() : ""); SimulationNode2 logNode = newNode; - while (logNode.getChildren() != null && logNode.getChildren().size() > 0) { + while (logNode.getChildren() != null && !logNode.getChildren().isEmpty()) { logNode = logNode.getChildren().get(0); - if (logNode.getAbilities() != null && logNode.getAbilities().size() > 0) { + if (logNode.getAbilities() != null && !logNode.getAbilities().isEmpty()) { sb.append(" -> [").append(logNode.getDepth()).append(']').append(logNode.getAbilities().toString()).append('<').append(logNode.getScore()).append('>'); } } @@ -634,7 +634,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { alpha = val; bestNode = newNode; bestNode.setScore(val); - if (newNode.getChildren().size() > 0) { + if (!newNode.getChildren().isEmpty()) { bestNode.setCombat(newNode.getChildren().get(0).getCombat()); } /* @@ -660,7 +660,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { beta = val; bestNode = newNode; bestNode.setScore(val); - if (newNode.getChildren().size() > 0) { + if (!newNode.getChildren().isEmpty()) { bestNode.setCombat(newNode.getChildren().get(0).getCombat()); } } diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java index 9dc9c24766..99bce93ce8 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java @@ -164,7 +164,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { addActionsTimed(); logger.trace("After add actions timed: root.children.size = " + root.children.size()); - if (root.children.size() > 0) { + if (!root.children.isEmpty()) { root = root.children.get(0); // int bestScore = root.getScore(); // if (bestScore > currentScore || allowBadMoves) { @@ -204,7 +204,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { logger.debug("Sim Calculate post combat actions ----------------------------------------------------------------------------------------"); addActionsTimed(); - if (root != null && root.children.size() > 0) { + if (root != null && !root.children.isEmpty()) { root = root.children.get(0); int bestScore = root.getScore(); if (bestScore > currentScore || allowBadMoves) { @@ -244,7 +244,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { } while ((logNode.getParent() != null)); logger.trace(sb); } - } else if (node.getChildren().size() > 0) { + } else if (!node.getChildren().isEmpty()) { if (logger.isDebugEnabled()) { StringBuilder sb = new StringBuilder("Add Action [").append(depth) .append("] -- something added children ") @@ -299,7 +299,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { val = GameStateEvaluator2.evaluate(playerId, game); */ } - } else if (node.getChildren().size() > 0) { + } else if (!node.getChildren().isEmpty()) { if (logger.isDebugEnabled()) { StringBuilder sb = new StringBuilder("Add Action [").append(depth) .append("] -- trigger ") @@ -411,7 +411,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { beta = val; bestNode = newNode; bestNode.setScore(val); - if (newNode.getChildren().size() > 0) { + if (!newNode.getChildren().isEmpty()) { bestNode.setCombat(newNode.getChildren().get(0).getCombat()); } } @@ -419,7 +419,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { alpha = val; bestNode = newNode; bestNode.setScore(val); - if (newNode.getChildren().size() > 0) { + if (!newNode.getChildren().isEmpty()) { bestNode.setCombat(newNode.getChildren().get(0).getCombat()); } } @@ -460,7 +460,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 { } Game sim = game.copy(); for (CombatGroup group : engagement.getGroups()) { - if (group.getAttackers().size() > 0) { + if (!group.getAttackers().isEmpty()) { UUID attackerId = group.getAttackers().get(0); for (UUID blockerId : group.getBlockers()) { sim.getPlayer(defenderId).declareBlocker(defenderId, blockerId, attackerId, sim); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedAction2.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedAction2.java index 521070a183..d9ffaea922 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedAction2.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedAction2.java @@ -60,7 +60,7 @@ public class SimulatedAction2 { } public boolean usesStack() { - if (abilities != null && abilities.size() > 0) { + if (abilities != null && !abilities.isEmpty()) { return abilities.get(abilities.size() -1).isUsesStack(); } return true; diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java index 8699ba43a4..dc113944d3 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java @@ -103,7 +103,7 @@ public class SimulatedPlayer2 extends ComputerPlayer { if (logger.isTraceEnabled()) { for (Ability a : allActions) { logger.info("ability==" + a); - if (a.getTargets().size() > 0) { + if (!a.getTargets().isEmpty()) { MageObject mageObject = game.getObject(a.getFirstTarget()); if (mageObject != null) { logger.info(" target=" + mageObject.getName()); @@ -177,7 +177,7 @@ public class SimulatedPlayer2 extends ComputerPlayer { } card.adjustTargets(newAbility, game); // add the different possible target option for the specific X value - if (newAbility.getTargets().getUnchosen().size() > 0) { + if (!newAbility.getTargets().getUnchosen().isEmpty()) { addTargetOptions(options, newAbility, targetNum, game); } } @@ -240,7 +240,7 @@ public class SimulatedPlayer2 extends ComputerPlayer { } List filtered = new ArrayList<>(); for (Ability option : options) { - if (option.getTargets().size() > 0 && option.getTargets().get(0).getMaxNumberOfTargets() == 1) { + if (!option.getTargets().isEmpty() && option.getTargets().get(0).getMaxNumberOfTargets() == 1) { Card card = game.getCard(ability.getSourceId()); for (String s : suggested) { String[] groups = s.split(";"); diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index 2ec47e1f00..4d285b8e27 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -212,7 +212,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } if (target.getOriginalTarget() instanceof TargetDiscard) { findPlayables(game); - if (unplayable.size() > 0) { + if (!unplayable.isEmpty()) { for (int i = unplayable.size() - 1; i >= 0; i--) { if (target.canTarget(unplayable.values().toArray(new Card[0])[i].getId(), game)) { target.add(unplayable.values().toArray(new Card[0])[i].getId(), game); @@ -222,7 +222,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } } } - if (hand.size() > 0) { + if (!hand.isEmpty()) { for (int i = 0; i < hand.size(); i++) { if (target.canTarget(hand.toArray(new UUID[0])[i], game)) { target.add(hand.toArray(new UUID[0])[i], game); @@ -467,7 +467,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { Cards cards = new CardsImpl(target.possibleTargets(source.getSourceId(), getId(), game)); ArrayList cardsInHand = new ArrayList<>(cards.getCards(game)); while (!target.isChosen() - && target.possibleTargets(source.getSourceId(), getId(), game).size() > 0 + && !target.possibleTargets(source.getSourceId(), getId(), game).isEmpty() && target.getMaxNumberOfTargets() > target.getTargets().size()) { Card card = pickBestCard(cardsInHand, null, target, source, game); if (card != null) { @@ -482,7 +482,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } } else { findPlayables(game); - if (unplayable.size() > 0) { + if (!unplayable.isEmpty()) { for (int i = unplayable.size() - 1; i >= 0; i--) { if (target.canTarget(getId(), unplayable.values().toArray(new Card[0])[i].getId(), source, game)) { target.addTarget(unplayable.values().toArray(new Card[0])[i].getId(), source, game); @@ -492,7 +492,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } } } - if (hand.size() > 0) { + if (!hand.isEmpty()) { for (int i = 0; i < hand.size(); i++) { if (target.canTarget(getId(), hand.toArray(new UUID[0])[i], source, game)) { target.addTarget(hand.toArray(new UUID[0])[i], source, game); @@ -674,7 +674,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { return target.isChosen(); } if (target.getOriginalTarget() instanceof TargetSpell) { - if (game.getStack().size() > 0) { + if (!game.getStack().isEmpty()) { Iterator it = game.getStack().iterator(); while (it.hasNext()) { StackObject o = it.next(); @@ -708,7 +708,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } } } - if (game.getStack().size() > 0) { + if (!game.getStack().isEmpty()) { Iterator it = game.getStack().iterator(); while (it.hasNext()) { StackObject stackObject = it.next(); @@ -878,7 +878,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { break; case PRECOMBAT_MAIN: findPlayables(game); - if (playableAbilities.size() > 0) { + if (!playableAbilities.isEmpty()) { for (ActivatedAbility ability : playableAbilities) { if (ability.canActivate(playerId, game)) { if (ability.getEffects().hasOutcome(Outcome.PutLandInPlay)) { @@ -909,7 +909,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { case POSTCOMBAT_MAIN: findPlayables(game); if (game.getStack().isEmpty()) { - if (playableNonInstant.size() > 0) { + if (!playableNonInstant.isEmpty()) { for (Card card : playableNonInstant) { if (card.getSpellAbility().canActivate(playerId, game)) { if (this.activateAbility(card.getSpellAbility(), game)) { @@ -918,7 +918,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } } } - if (playableAbilities.size() > 0) { + if (!playableAbilities.isEmpty()) { for (ActivatedAbility ability : playableAbilities) { if (ability.canActivate(playerId, game)) { if (!(ability.getEffects().get(0) instanceof BecomesCreatureSourceEffect)) { @@ -975,7 +975,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } lands.add(landCard); } - while (lands.size() > 0 && this.canPlayLand()) { + while (!lands.isEmpty() && this.canPlayLand()) { if (lands.size() == 1) { this.playLand(lands.iterator().next(), game, false); } else { @@ -1030,7 +1030,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { for (Card card : nonLands) { ManaOptions options = card.getManaCost().getOptions(); - if (card.getManaCost().getVariableCosts().size() > 0) { + if (!card.getManaCost().getVariableCosts().isEmpty()) { //don't use variable mana costs unless there is at least 3 extra mana for X for (Mana option : options) { option.add(Mana.GenericMana(3)); @@ -1062,7 +1062,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { continue; } ManaOptions abilityOptions = ability.getManaCosts().getOptions(); - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { //don't use variable mana costs unless there is at least 3 extra mana for X for (Mana option : abilityOptions) { option.add(Mana.GenericMana(3)); @@ -1386,7 +1386,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { for (Permanent permanent : game.getBattlefield().getActivePermanents(this.getId(), game)) { if (game.getOpponents(this.getId()).contains(permanent.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE) - && permanent.getSubtype(game).size() > 0) { + && !permanent.getSubtype(game).isEmpty()) { if (choice.getChoices().contains(permanent.getSubtype(game).get(0))) { choice.setChoice(permanent.getSubtype(game).get(0)); break; @@ -1398,7 +1398,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { for (UUID opponentId : game.getOpponents(this.getId())) { Player opponent = game.getPlayer(opponentId); for (Card card : opponent.getGraveyard().getCards(game)) { - if (card != null && card.getCardType().contains(CardType.CREATURE) && card.getSubtype(game).size() > 0) { + if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) { if (choice.getChoices().contains(card.getSubtype(game).get(0))) { choice.setChoice(card.getSubtype(game).get(0)); break; @@ -1414,7 +1414,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { // choose a creature type of hand or library for (UUID cardId : this.getHand()) { Card card = game.getCard(cardId); - if (card != null && card.getCardType().contains(CardType.CREATURE) && card.getSubtype(game).size() > 0) { + if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) { if (choice.getChoices().contains(card.getSubtype(game).get(0))) { choice.setChoice(card.getSubtype(game).get(0)); break; @@ -1424,7 +1424,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { if (!choice.isChosen()) { for (UUID cardId : this.getLibrary().getCardList()) { Card card = game.getCard(cardId); - if (card != null && card.getCardType().contains(CardType.CREATURE) && card.getSubtype(game).size() > 0) { + if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) { if (choice.getChoices().contains(card.getSubtype(game).get(0))) { choice.setChoice(card.getSubtype(game).get(0)); break; @@ -1545,7 +1545,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { MageObject object = game.getObject(ability.getSourceId()); if (object != null) { LinkedHashMap useableAbilities = getSpellAbilities(object, game.getState().getZone(object.getId()), game); - if (useableAbilities != null && useableAbilities.size() > 0) { + if (useableAbilities != null && !useableAbilities.isEmpty()) { game.fireGetChoiceEvent(playerId, name, object, new ArrayList<>(useableAbilities.values())); // TODO: Improve this return (SpellAbility) useableAbilities.values().iterator().next(); @@ -1584,7 +1584,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { public TriggeredAbility chooseTriggeredAbility(List abilities, Game game) { log.debug("chooseTriggeredAbility: " + abilities.toString()); //TODO: improve this - if (abilities.size() > 0) { + if (!abilities.isEmpty()) { return abilities.get(0); } return null; @@ -1729,7 +1729,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { @Override public void construct(Tournament tournament, Deck deck) { - if (deck != null && deck.getCards().size() < 40 && deck.getSideboard().size() > 0) { + if (deck != null && deck.getCards().size() < 40 && !deck.getSideboard().isEmpty()) { //pick the top 23 cards if (chosenColors == null) { for (Card card : deck.getSideboard()) { diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java index d7589f2636..ad07de128b 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java @@ -52,7 +52,7 @@ public class MCTSPlayer extends ComputerPlayer { private NextAction nextAction; public enum NextAction { - PRIORITY, SELECT_ATTACKERS, SELECT_BLOCKERS; + PRIORITY, SELECT_ATTACKERS, SELECT_BLOCKERS } public MCTSPlayer(UUID id) { @@ -83,7 +83,7 @@ public class MCTSPlayer extends ComputerPlayer { for (Ability ability: playables) { List options = game.getPlayer(playerId).getPlayableOptions(ability, game); if (options.isEmpty()) { - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { simulateVariableCosts(ability, all, game); } else { @@ -92,7 +92,7 @@ public class MCTSPlayer extends ComputerPlayer { } else { for (Ability option: options) { - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { simulateVariableCosts(option, all, game); } else { diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java index 344964fb75..f2b59669e4 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java @@ -124,7 +124,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer { ability = options.get(RandomUtil.nextInt(options.size())); } } - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { int amount = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost(); if (amount > 0) { ability = ability.copy(); @@ -221,7 +221,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer { int check = RandomUtil.nextInt(numGroups + 1); if (check < numGroups) { CombatGroup group = game.getCombat().getGroups().get(check); - if (group.getAttackers().size() > 0) { + if (!group.getAttackers().isEmpty()) { this.declareBlocker(this.getId(), blocker.getId(), group.getAttackers().get(0), game); } } diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java index 3cba31ffd9..d37112a665 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java @@ -161,7 +161,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { else addActions(root, Integer.MIN_VALUE, Integer.MAX_VALUE); logger.info(name + " simulated " + nodeCount + " nodes in " + thinkTime/1000000000.0 + "s - average " + nodeCount/(thinkTime/1000000000.0) + " nodes/s"); - if (root.children.size() > 0) { + if (!root.children.isEmpty()) { root = root.children.get(0); actions = new LinkedList(root.abilities); combat = root.combat; @@ -174,10 +174,10 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { } protected boolean getNextAction(Game game) { - if (root != null && root.children.size() > 0) { + if (root != null && !root.children.isEmpty()) { SimulationNode test = root; root = root.children.get(0); - while (root.children.size() > 0 && !root.playerId.equals(playerId)) { + while (!root.children.isEmpty() && !root.playerId.equals(playerId)) { test = root; root = root.children.get(0); } @@ -335,7 +335,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { logger.debug(indent(node.depth) + "simulating -- reached end state"); val = GameStateEvaluator.evaluate(playerId, game); } - else if (node.getChildren().size() > 0) { + else if (!node.getChildren().isEmpty()) { logger.debug(indent(node.depth) + "simulating -- somthing added children:" + node.getChildren().size()); val = minimaxAB(node, alpha, beta); } @@ -361,7 +361,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { if (game.gameOver(null)) { val = GameStateEvaluator.evaluate(playerId, game); } - else if (node.getChildren().size() > 0) { + else if (!node.getChildren().isEmpty()) { //declared attackers or blockers or triggered abilities logger.debug(indent(node.depth) + "simulating -- attack/block/trigger added children:" + node.getChildren().size()); val = minimaxAB(node, alpha, beta); @@ -430,9 +430,9 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { alpha = val; bestNode = newNode; node.setCombat(newNode.getCombat()); - if (node.getTargets().size() > 0) + if (!node.getTargets().isEmpty()) targets = node.getTargets(); - if (node.getChoices().size() > 0) + if (!node.getChoices().isEmpty()) choices = node.getChoices(); } if (val == GameStateEvaluator.WIN_SCORE) { @@ -673,7 +673,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player { @Override public void selectBlockers(Game game, UUID defendingPlayerId) { logger.debug("selectBlockers"); - if (combat != null && combat.getGroups().size() > 0) { + if (combat != null && !combat.getGroups().isEmpty()) { List groups = game.getCombat().getGroups(); for (int i = 0; i < groups.size(); i++) { if (i < combat.getGroups().size()) { diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer3.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer3.java index 2ceb791e15..c38a835d74 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer3.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer3.java @@ -139,7 +139,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player { else addActions(root, Integer.MIN_VALUE, Integer.MAX_VALUE); logger.info(name + " simulated " + nodeCount + " nodes in " + thinkTime/1000000000.0 + "s - average " + nodeCount/(thinkTime/1000000000.0) + " nodes/s"); - if (root.children.size() > 0) { + if (!root.children.isEmpty()) { root = root.children.get(0); actions = new LinkedList(root.abilities); combat = root.combat; @@ -163,7 +163,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player { else addActions(root, Integer.MIN_VALUE, Integer.MAX_VALUE); logger.info(name + " simulated " + nodeCount + " nodes in " + thinkTime/1000000000.0 + "s - average " + nodeCount/(thinkTime/1000000000.0) + " nodes/s"); - if (root.children.size() > 0) { + if (!root.children.isEmpty()) { root = root.children.get(0); actions = new LinkedList(root.abilities); combat = root.combat; @@ -189,7 +189,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player { logger.debug(indent(node.depth) + "simulating -- reached end state"); val = GameStateEvaluator.evaluate(playerId, game); } - else if (node.getChildren().size() > 0) { + else if (!node.getChildren().isEmpty()) { logger.debug(indent(node.depth) + "simulating -- somthing added children:" + node.getChildren().size()); val = minimaxAB(node, alpha, beta); } @@ -238,7 +238,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player { val = GameStateEvaluator.evaluate(playerId, game); } } - else if (node.getChildren().size() > 0) { + else if (!node.getChildren().isEmpty()) { logger.debug(indent(node.depth) + "simulating -- trigger added children:" + node.getChildren().size()); val = minimaxAB(node, alpha, beta); } @@ -388,7 +388,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player { } Game sim = game.copy(); for (CombatGroup group: engagement.getGroups()) { - if (group.getAttackers().size() > 0) { + if (!group.getAttackers().isEmpty()) { UUID attackerId = group.getAttackers().get(0); for (UUID blockerId: group.getBlockers()) { sim.getPlayer(defenderId).declareBlocker(defenderId, blockerId, attackerId, sim); diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedAction.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedAction.java index 855fa0c568..11fac9f264 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedAction.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedAction.java @@ -60,7 +60,7 @@ public class SimulatedAction { } public boolean usesStack() { - if (abilities != null && abilities.size() > 0) { + if (abilities != null && !abilities.isEmpty()) { return abilities.get(abilities.size() -1).isUsesStack(); } return true; diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java index fdefaa68d2..fb43fcb694 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java @@ -90,7 +90,7 @@ public class SimulatedPlayer extends ComputerPlayer { for (Ability ability: playables) { List options = game.getPlayer(playerId).getPlayableOptions(ability, game); if (options.isEmpty()) { - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { simulateVariableCosts(ability, game); } else { @@ -101,7 +101,7 @@ public class SimulatedPlayer extends ComputerPlayer { else { // ExecutorService simulationExecutor = Executors.newFixedThreadPool(4); for (Ability option: options) { - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { simulateVariableCosts(option, game); } else { diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index c199fda2c5..d5749dce83 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -726,7 +726,7 @@ public class HumanPlayer extends PlayerImpl { } if (actingPlayer != null) { LinkedHashMap useableAbilities = actingPlayer.getUseableActivatedAbilities(object, zone, game); - if (useableAbilities != null && useableAbilities.size() > 0) { + if (useableAbilities != null && !useableAbilities.isEmpty()) { activateAbility(useableAbilities, object, game); result = true; } @@ -912,7 +912,7 @@ public class HumanPlayer extends PlayerImpl { Zone zone = game.getState().getZone(object.getId()); if (zone != null) { LinkedHashMap useableAbilities = getUseableManaAbilities(object, zone, game); - if (useableAbilities != null && useableAbilities.size() > 0) { + if (useableAbilities != null && !useableAbilities.isEmpty()) { useableAbilities = ManaUtil.tryToAutoPay(unpaid, useableAbilities); // eliminates other abilities if one fits perfectly currentlyUnpaidMana = unpaid; activateAbility(useableAbilities, object, game); @@ -940,7 +940,7 @@ public class HumanPlayer extends PlayerImpl { } } options.put(Constants.Option.POSSIBLE_ATTACKERS, (Serializable) possibleAttackers); - if (possibleAttackers.size() > 0) { + if (!possibleAttackers.isEmpty()) { options.put(Constants.Option.SPECIAL_BUTTON, (Serializable) "All attack"); } @@ -1330,7 +1330,7 @@ public class HumanPlayer extends PlayerImpl { LinkedHashMap useableAbilities = getSpellAbilities(object, game.getState().getZone(object.getId()), game); if (useableAbilities != null && useableAbilities.size() == 1) { return (SpellAbility) useableAbilities.values().iterator().next(); - } else if (useableAbilities != null && useableAbilities.size() > 0) { + } else if (useableAbilities != null && !useableAbilities.isEmpty()) { game.fireGetChoiceEvent(playerId, name, object, new ArrayList<>(useableAbilities.values())); waitForResponse(game); if (response.getUUID() != null) { @@ -1378,7 +1378,7 @@ public class HumanPlayer extends PlayerImpl { modeMap.put(mode.getId(), modeText); } } - if (modeMap.size() > 0) { + if (!modeMap.isEmpty()) { boolean done = false; while (!done) { game.fireGetModeEvent(playerId, "Choose Mode", modeMap); diff --git a/Mage.Server/src/main/java/mage/server/User.java b/Mage.Server/src/main/java/mage/server/User.java index b7393680c4..5fb1619110 100644 --- a/Mage.Server/src/main/java/mage/server/User.java +++ b/Mage.Server/src/main/java/mage/server/User.java @@ -564,7 +564,7 @@ public class User { if (tournament > 0) { sb.append("Tourn: ").append(tournament).append(' '); } - if (watchedGames.size() > 0) { + if (!watchedGames.isEmpty()) { sb.append("Watch: ").append(watchedGames.size()).append(' '); } return sb.toString(); @@ -665,7 +665,7 @@ public class User { if (proto.getMatchesQuit() > 0) { quit.add("Q:" + Integer.toString(proto.getMatchesQuit())); } - if (quit.size() > 0) { + if (!quit.isEmpty()) { builder.append(" ("); joinStrings(builder, quit, " "); builder.append(')'); @@ -697,7 +697,7 @@ public class User { if (proto.getTourneysQuitDuringRound() > 0) { quit.add("R:" + Integer.toString(proto.getTourneysQuitDuringRound())); } - if (quit.size() > 0) { + if (!quit.isEmpty()) { builder.append(" ("); joinStrings(builder, quit, " "); builder.append(')'); diff --git a/Mage.Server/src/main/java/mage/server/game/GameController.java b/Mage.Server/src/main/java/mage/server/game/GameController.java index 4725821686..5436f1c1ee 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameController.java +++ b/Mage.Server/src/main/java/mage/server/game/GameController.java @@ -236,7 +236,7 @@ public class GameController implements GameCallback { break; case CHOOSE_ABILITY: String objectName = null; - if (event.getChoices() != null && event.getChoices().size() > 0) { + if (event.getChoices() != null && !event.getChoices().isEmpty()) { objectName = event.getChoices().iterator().next(); } chooseAbility(event.getPlayerId(), objectName, event.getAbilities()); @@ -816,7 +816,7 @@ public class GameController implements GameCallback { private void informOthers(List players) throws MageException { // first player is always original controller Player controller = null; - if (players != null && players.size() > 0) { + if (players != null && !players.isEmpty()) { controller = game.getPlayer(players.get(0)); } if (controller == null || game.getStep() == null || game.getStep().getType() == null) { diff --git a/Mage.Server/src/main/java/mage/server/game/GameSessionPlayer.java b/Mage.Server/src/main/java/mage/server/game/GameSessionPlayer.java index 89e0ac8597..d2b897c6e8 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameSessionPlayer.java +++ b/Mage.Server/src/main/java/mage/server/game/GameSessionPlayer.java @@ -86,7 +86,6 @@ public class GameSessionPlayer extends GameSessionWatcher { if (!killed) { UserManager.getInstance().getUser(userId).ifPresent(user -> user.fireCallback(new ClientCallback("gameSelect", game.getId(), new GameClientMessage(getGameView(), message, options)))); } - ; } public void chooseAbility(final AbilityPickerView abilities) { @@ -232,7 +231,7 @@ public class GameSessionPlayer extends GameSessionWatcher { } private void processControlledPlayers(Player player, GameView gameView) { - if (player.getPlayersUnderYourControl().size() > 0) { + if (!player.getPlayersUnderYourControl().isEmpty()) { Map handCards = new HashMap<>(); for (UUID controlledPlayerId : player.getPlayersUnderYourControl()) { Player opponent = game.getPlayer(controlledPlayerId); diff --git a/Mage.Sets/src/mage/cards/a/ActOnImpulse.java b/Mage.Sets/src/mage/cards/a/ActOnImpulse.java index 67e5ac1587..8fba52dd91 100644 --- a/Mage.Sets/src/mage/cards/a/ActOnImpulse.java +++ b/Mage.Sets/src/mage/cards/a/ActOnImpulse.java @@ -98,7 +98,7 @@ class ActOnImpulseExileEffect extends OneShotEffect { cards.add(card); } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { List cardsId = new ArrayList<>(); for (Card card : cards) { card.moveToExile(source.getSourceId(), "Act on Impulse", source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/a/AgonizingMemories.java b/Mage.Sets/src/mage/cards/a/AgonizingMemories.java index 16ec49dc2b..afc34c70fd 100644 --- a/Mage.Sets/src/mage/cards/a/AgonizingMemories.java +++ b/Mage.Sets/src/mage/cards/a/AgonizingMemories.java @@ -96,7 +96,7 @@ class AgonizingMemoriesEffect extends OneShotEffect { } private void chooseCardInHandAndPutOnTopOfLibrary(Game game, Ability source, Player you, Player targetPlayer) { - if (targetPlayer.getHand().size() > 0) { + if (!targetPlayer.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, new FilterCard("card to put on the top of library (last chosen will be on top)")); if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) { Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/a/AladdinsLamp.java b/Mage.Sets/src/mage/cards/a/AladdinsLamp.java index 0d24ffb4b4..608529408c 100644 --- a/Mage.Sets/src/mage/cards/a/AladdinsLamp.java +++ b/Mage.Sets/src/mage/cards/a/AladdinsLamp.java @@ -121,7 +121,7 @@ class AladdinsLampEffect extends ReplacementEffectImpl { // Put the rest on the bottom of your library in a random order - while (cards.size() > 0) { + while (!cards.isEmpty()) { Card card = cards.getRandom(game); if (card != null) { cards.remove(card); diff --git a/Mage.Sets/src/mage/cards/a/AltarOfDementia.java b/Mage.Sets/src/mage/cards/a/AltarOfDementia.java index 6355c03189..a4467f071e 100644 --- a/Mage.Sets/src/mage/cards/a/AltarOfDementia.java +++ b/Mage.Sets/src/mage/cards/a/AltarOfDementia.java @@ -95,7 +95,7 @@ class AltarOfDementiaEffect extends OneShotEffect { if (player != null) { int amount = 0; for (Cost cost: source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue(); break; } diff --git a/Mage.Sets/src/mage/cards/a/AmassTheComponents.java b/Mage.Sets/src/mage/cards/a/AmassTheComponents.java index d7deb9ef33..48944049f8 100644 --- a/Mage.Sets/src/mage/cards/a/AmassTheComponents.java +++ b/Mage.Sets/src/mage/cards/a/AmassTheComponents.java @@ -90,7 +90,7 @@ class AmassTheComponentsEffect extends OneShotEffect { } player.drawCards(3, game); - if (player.getHand().size() > 0) { + if (!player.getHand().isEmpty()) { FilterCard filter = new FilterCard("card from your hand to put on the bottom of your library"); TargetCard target = new TargetCard(Zone.HAND, filter); diff --git a/Mage.Sets/src/mage/cards/a/AncestralMemories.java b/Mage.Sets/src/mage/cards/a/AncestralMemories.java index 5929f9e5d2..5041fb9b37 100644 --- a/Mage.Sets/src/mage/cards/a/AncestralMemories.java +++ b/Mage.Sets/src/mage/cards/a/AncestralMemories.java @@ -98,7 +98,7 @@ class AncestralMemoriesEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { player.lookAtCards("Ancestral Memories", cards, game); TargetCard target = new TargetCard(Math.min(2, cards.size()), Zone.LIBRARY, new FilterCard("two cards to put in your hand")); diff --git a/Mage.Sets/src/mage/cards/a/AngelOfSerenity.java b/Mage.Sets/src/mage/cards/a/AngelOfSerenity.java index c2890bec7f..9d17814815 100644 --- a/Mage.Sets/src/mage/cards/a/AngelOfSerenity.java +++ b/Mage.Sets/src/mage/cards/a/AngelOfSerenity.java @@ -106,7 +106,7 @@ class AngelOfSerenityTriggeredAbility extends ZoneChangeTriggeredAbility { filter.add(new AnotherPredicate()); TargetCreaturePermanent target1 = new TargetCreaturePermanent(0, 3, filter, false); game.getPlayer(getControllerId()).chooseTarget(Outcome.Exile, target1, this, game); - if (target1.getTargets().size() > 0) { + if (!target1.getTargets().isEmpty()) { getTargets().add(target1); } @@ -115,7 +115,7 @@ class AngelOfSerenityTriggeredAbility extends ZoneChangeTriggeredAbility { FilterCard filter2 = new FilterCreatureCard("up to " + leftTargets + " target creature card" + (leftTargets > 1 ? "s" : "") + " from graveyards"); TargetCardInGraveyard target2 = new TargetCardInGraveyard(0, leftTargets, filter2); game.getPlayer(getControllerId()).chooseTarget(Outcome.Exile, target2, this, game); - if (target2.getTargets().size() > 0) { + if (!target2.getTargets().isEmpty()) { getTargets().add(target2); } } @@ -152,7 +152,7 @@ class AngelOfSerenityEnterEffect extends OneShotEffect { boolean result = true; Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); - if (controller != null && sourceObject != null && source.getTargets().size() > 0) { + if (controller != null && sourceObject != null && !source.getTargets().isEmpty()) { UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); for (Target target : source.getTargets()) { if (target instanceof TargetCreaturePermanent) { diff --git a/Mage.Sets/src/mage/cards/a/AngelicArbiter.java b/Mage.Sets/src/mage/cards/a/AngelicArbiter.java index 3763f19620..4c61d2ad67 100644 --- a/Mage.Sets/src/mage/cards/a/AngelicArbiter.java +++ b/Mage.Sets/src/mage/cards/a/AngelicArbiter.java @@ -109,7 +109,7 @@ class AngelicArbiterWatcher2 extends Watcher { && game.getActivePlayerId().equals(event.getPlayerId()) && game.getOpponents(controllerId).contains(event.getPlayerId()) && game.getCombat().getAttackerId().equals(event.getPlayerId()) - && game.getCombat().getAttackers().size() > 0) { + && !game.getCombat().getAttackers().isEmpty()) { playersThatAttackedThisTurn.add(event.getPlayerId()); } } diff --git a/Mage.Sets/src/mage/cards/a/AnimalBoneyard.java b/Mage.Sets/src/mage/cards/a/AnimalBoneyard.java index c66f39e4fe..07f19f2005 100644 --- a/Mage.Sets/src/mage/cards/a/AnimalBoneyard.java +++ b/Mage.Sets/src/mage/cards/a/AnimalBoneyard.java @@ -105,7 +105,7 @@ class AnimalBoneyardEffect extends OneShotEffect { int toughness = 0; for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { toughness = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue(); break; } diff --git a/Mage.Sets/src/mage/cards/a/AnimationModule.java b/Mage.Sets/src/mage/cards/a/AnimationModule.java index aec546a8a0..8b041211fb 100644 --- a/Mage.Sets/src/mage/cards/a/AnimationModule.java +++ b/Mage.Sets/src/mage/cards/a/AnimationModule.java @@ -143,7 +143,7 @@ class AnimationModuleEffect extends OneShotEffect { if (controller != null) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { - if (permanent.getCounters(game).size() > 0) { + if (!permanent.getCounters(game).isEmpty()) { if (permanent.getCounters(game).size() == 1) { for (Counter counter : permanent.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName()); @@ -172,7 +172,7 @@ class AnimationModuleEffect extends OneShotEffect { else { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { - if (player.getCounters().size() > 0) { + if (!player.getCounters().isEmpty()) { if (player.getCounters().size() == 1) { for (Counter counter : player.getCounters().values()) { Counter newCounter = new Counter(counter.getName()); diff --git a/Mage.Sets/src/mage/cards/a/AnimistsAwakening.java b/Mage.Sets/src/mage/cards/a/AnimistsAwakening.java index ea757d6945..fdd8295e4f 100644 --- a/Mage.Sets/src/mage/cards/a/AnimistsAwakening.java +++ b/Mage.Sets/src/mage/cards/a/AnimistsAwakening.java @@ -93,7 +93,7 @@ class AnimistsAwakeningEffect extends OneShotEffect { Cards cards = new CardsImpl(); int xValue = source.getManaCostsToPay().getX(); cards.addAll(controller.getLibrary().getTopCards(game, xValue)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.revealCards(sourceObject.getIdName(), cards, game); Set toBattlefield = new LinkedHashSet<>(); for (Card card : cards.getCards(new FilterLandCard(), source.getSourceId(), source.getControllerId(), game)) { diff --git a/Mage.Sets/src/mage/cards/a/AnyaMercilessAngel.java b/Mage.Sets/src/mage/cards/a/AnyaMercilessAngel.java index b233744046..66f9bdd063 100644 --- a/Mage.Sets/src/mage/cards/a/AnyaMercilessAngel.java +++ b/Mage.Sets/src/mage/cards/a/AnyaMercilessAngel.java @@ -127,7 +127,7 @@ class AnyaMercilessAngelCondition implements Condition { public static AnyaMercilessAngelCondition getInstance() { return fInstance; - }; + } private AnyaMercilessAngelCondition() {} diff --git a/Mage.Sets/src/mage/cards/b/BaneAlleyBroker.java b/Mage.Sets/src/mage/cards/b/BaneAlleyBroker.java index bcd2df53f4..3226e3cd65 100644 --- a/Mage.Sets/src/mage/cards/b/BaneAlleyBroker.java +++ b/Mage.Sets/src/mage/cards/b/BaneAlleyBroker.java @@ -176,7 +176,7 @@ class TargetCardInBaneAlleyBrokerExile extends TargetCardInExile { if (sourceCard != null) { UUID exileId = CardUtil.getCardExileZoneId(game, sourceId); ExileZone exile = game.getExile().getExileZone(exileId); - if (exile != null && exile.size() > 0) { + if (exile != null && !exile.isEmpty()) { possibleTargets.addAll(exile); } } @@ -189,7 +189,7 @@ class TargetCardInBaneAlleyBrokerExile extends TargetCardInExile { if (sourceCard != null) { UUID exileId = CardUtil.getCardExileZoneId(game, sourceId); ExileZone exile = game.getExile().getExileZone(exileId); - if (exile != null && exile.size() > 0) { + if (exile != null && !exile.isEmpty()) { return true; } } diff --git a/Mage.Sets/src/mage/cards/b/BirthingPod.java b/Mage.Sets/src/mage/cards/b/BirthingPod.java index 3233b1eb1f..2ede7fdac7 100644 --- a/Mage.Sets/src/mage/cards/b/BirthingPod.java +++ b/Mage.Sets/src/mage/cards/b/BirthingPod.java @@ -95,7 +95,7 @@ class BirthingPodEffect extends OneShotEffect { for (Cost cost : source.getCosts()) { if (cost instanceof SacrificeTargetCost) { SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; - if (sacrificeCost.getPermanents().size() > 0) { + if (!sacrificeCost.getPermanents().isEmpty()) { sacrificedPermanent = sacrificeCost.getPermanents().get(0); } break; diff --git a/Mage.Sets/src/mage/cards/b/BitterRevelation.java b/Mage.Sets/src/mage/cards/b/BitterRevelation.java index b5341a5ec4..d5f7c2ca83 100644 --- a/Mage.Sets/src/mage/cards/b/BitterRevelation.java +++ b/Mage.Sets/src/mage/cards/b/BitterRevelation.java @@ -97,7 +97,7 @@ class BitterRevelationEffect extends OneShotEffect { cards.add(card); } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { Cards cardsToHand = new CardsImpl(); player.lookAtCards("Bitter Revelation", cards, game); TargetCard target = new TargetCard(Math.min(2, cards.size()), Zone.LIBRARY, new FilterCard("two cards to put in your hand")); diff --git a/Mage.Sets/src/mage/cards/b/BlessedReincarnation.java b/Mage.Sets/src/mage/cards/b/BlessedReincarnation.java index 590761adf9..71f68f65af 100644 --- a/Mage.Sets/src/mage/cards/b/BlessedReincarnation.java +++ b/Mage.Sets/src/mage/cards/b/BlessedReincarnation.java @@ -127,7 +127,7 @@ class BlessedReincarnationEffect extends OneShotEffect { card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId()); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { player.revealCards("BlessedReincarnation", cards, game); Set cardsToShuffle = cards.getCards(game); cardsToShuffle.remove(card); diff --git a/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java b/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java index ae0a9ac04a..5d7eee81fe 100644 --- a/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java +++ b/Mage.Sets/src/mage/cards/b/BorderlandExplorer.java @@ -136,7 +136,7 @@ class BorderlandExplorerEffect extends OneShotEffect { if (cardsPlayer != null) { TargetCardInLibrary target = new TargetCardInLibrary(0, 1, new FilterBasicLandCard()); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(target.getTargets()); cards.addAll(target.getTargets()); cardsToReveal.put(playerId, cards); diff --git a/Mage.Sets/src/mage/cards/b/BrionStoutarm.java b/Mage.Sets/src/mage/cards/b/BrionStoutarm.java index f021847a79..83a6d95488 100644 --- a/Mage.Sets/src/mage/cards/b/BrionStoutarm.java +++ b/Mage.Sets/src/mage/cards/b/BrionStoutarm.java @@ -110,7 +110,7 @@ class BrionStoutarmEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = 0; for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue(); break; } diff --git a/Mage.Sets/src/mage/cards/b/Browse.java b/Mage.Sets/src/mage/cards/b/Browse.java index 5dddb79372..a31cedc640 100644 --- a/Mage.Sets/src/mage/cards/b/Browse.java +++ b/Mage.Sets/src/mage/cards/b/Browse.java @@ -99,7 +99,7 @@ class BrowseEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { player.lookAtCards("Browse", cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand")); diff --git a/Mage.Sets/src/mage/cards/c/ChandraPyromaster.java b/Mage.Sets/src/mage/cards/c/ChandraPyromaster.java index 76b5a3ca94..6c39693cf3 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraPyromaster.java +++ b/Mage.Sets/src/mage/cards/c/ChandraPyromaster.java @@ -278,7 +278,7 @@ class ChandraPyromasterEffect3 extends OneShotEffect { cards.addAll(controller.getLibrary().getTopCards(game, 10)); controller.moveCardsToExile(cards.getCards(game), source, game, true, source.getSourceId(), sourceObject.getIdName()); - if (cards.getCards(new FilterInstantOrSorceryCard(), game).size() > 0) { + if (!cards.getCards(new FilterInstantOrSorceryCard(), game).isEmpty()) { TargetCard target = new TargetCard(Zone.EXILED, new FilterInstantOrSorceryCard()); if (controller.chooseTarget(Outcome.PlayForFree, cards, target, source, game)) { Card card = cards.get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/c/ChimneyImp.java b/Mage.Sets/src/mage/cards/c/ChimneyImp.java index 6386f9f2f5..f18e96d11f 100644 --- a/Mage.Sets/src/mage/cards/c/ChimneyImp.java +++ b/Mage.Sets/src/mage/cards/c/ChimneyImp.java @@ -96,7 +96,7 @@ class ChimneyImpEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetOpponent = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetOpponent != null) { - if (targetOpponent.getHand().size() > 0) { + if (!targetOpponent.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); target.setNotTarget(true); target.setTargetName("a card from your hand to put on top of your library"); diff --git a/Mage.Sets/src/mage/cards/c/ChitteringRats.java b/Mage.Sets/src/mage/cards/c/ChitteringRats.java index 5364f9b99f..2cb26c0903 100644 --- a/Mage.Sets/src/mage/cards/c/ChitteringRats.java +++ b/Mage.Sets/src/mage/cards/c/ChitteringRats.java @@ -93,7 +93,7 @@ class ChitteringRatsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetOpponent = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetOpponent != null) { - if (targetOpponent.getHand().size() > 0) { + if (!targetOpponent.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); target.setNotTarget(true); target.setTargetName("a card from your hand to put on top of your library"); diff --git a/Mage.Sets/src/mage/cards/c/ChromeMox.java b/Mage.Sets/src/mage/cards/c/ChromeMox.java index a7c8406e39..292d9cd2a5 100644 --- a/Mage.Sets/src/mage/cards/c/ChromeMox.java +++ b/Mage.Sets/src/mage/cards/c/ChromeMox.java @@ -107,7 +107,7 @@ class ChromeMoxEffect extends OneShotEffect { target.setNotTarget(true); Card cardToImprint = null; Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (controller.getHand().size() > 0 && controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) { + if (!controller.getHand().isEmpty() && controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) { cardToImprint = controller.getHand().get(target.getFirstTarget(), game); } if (sourcePermanent != null) { @@ -154,7 +154,7 @@ class ChromeMoxManaEffect extends ManaEffect { Player player = game.getPlayer(source.getControllerId()); if (permanent != null && player != null) { List imprinted = permanent.getImprinted(); - if (imprinted.size() > 0) { + if (!imprinted.isEmpty()) { Card imprintedCard = game.getCard(imprinted.get(0)); if (imprintedCard != null) { Choice choice = new ChoiceColor(true); @@ -177,7 +177,7 @@ class ChromeMoxManaEffect extends ManaEffect { choice.getChoices().add("White"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Mana mana = new Mana(); if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); diff --git a/Mage.Sets/src/mage/cards/c/CircleOfProtectionWhite.java b/Mage.Sets/src/mage/cards/c/CircleOfProtectionWhite.java index 05cc85c8d5..d1d84a009e 100644 --- a/Mage.Sets/src/mage/cards/c/CircleOfProtectionWhite.java +++ b/Mage.Sets/src/mage/cards/c/CircleOfProtectionWhite.java @@ -60,7 +60,7 @@ public class CircleOfProtectionWhite extends CardImpl { // {1}: The next time a white source of your choice would deal damage to you this turn, prevent that damage. Effect effect = new PreventNextDamageFromChosenSourceToYouEffect(Duration.EndOfTurn, filter); - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("1")));; + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("1"))); } public CircleOfProtectionWhite(final CircleOfProtectionWhite card) { diff --git a/Mage.Sets/src/mage/cards/c/CitanulFlute.java b/Mage.Sets/src/mage/cards/c/CitanulFlute.java index 013e9fbf5f..81504b425a 100644 --- a/Mage.Sets/src/mage/cards/c/CitanulFlute.java +++ b/Mage.Sets/src/mage/cards/c/CitanulFlute.java @@ -106,7 +106,7 @@ class CitanulFluteSearchEffect extends OneShotEffect { TargetCardInLibrary target = new TargetCardInLibrary(filter); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = player.getLibrary().getCard(target.getFirstTarget(), game); Cards cards = new CardsImpl(); if (card != null){ diff --git a/Mage.Sets/src/mage/cards/c/Clockspinning.java b/Mage.Sets/src/mage/cards/c/Clockspinning.java index 198b50ddbc..e8aab7e550 100644 --- a/Mage.Sets/src/mage/cards/c/Clockspinning.java +++ b/Mage.Sets/src/mage/cards/c/Clockspinning.java @@ -94,7 +94,7 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect { private Counter selectCounterType(Game game, Ability source, Permanent permanent) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && permanent.getCounters(game).size() > 0) { + if (controller != null && !permanent.getCounters(game).isEmpty()) { String counterName = null; if (permanent.getCounters(game).size() > 1) { Choice choice = new ChoiceImpl(true); @@ -122,7 +122,7 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect { private Counter selectCounterType(Game game, Ability source, Card card) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && card.getCounters(game).size() > 0) { + if (controller != null && !card.getCounters(game).isEmpty()) { String counterName = null; if (card.getCounters(game).size() > 1) { Choice choice = new ChoiceImpl(true); diff --git a/Mage.Sets/src/mage/cards/c/CloneShell.java b/Mage.Sets/src/mage/cards/c/CloneShell.java index cc61165c32..0293a4e79a 100644 --- a/Mage.Sets/src/mage/cards/c/CloneShell.java +++ b/Mage.Sets/src/mage/cards/c/CloneShell.java @@ -120,7 +120,7 @@ class CloneShellEffect extends OneShotEffect { target1.clearChosen(); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { TargetCard target2 = new TargetCard(Zone.LIBRARY, filter2); while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Benefit, cards, target2, game); @@ -163,7 +163,7 @@ class CloneShellDiesEffect extends OneShotEffect { Permanent permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); if (permanent != null) { List imprinted = permanent.getImprinted(); - if (imprinted.size() > 0) { + if (!imprinted.isEmpty()) { Card imprintedCard = game.getCard(imprinted.get(0)); imprintedCard.setFaceDown(false, game); if (imprintedCard.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/cards/c/CobraTrap.java b/Mage.Sets/src/mage/cards/c/CobraTrap.java index 08ca3436f7..7bc5b0ba42 100644 --- a/Mage.Sets/src/mage/cards/c/CobraTrap.java +++ b/Mage.Sets/src/mage/cards/c/CobraTrap.java @@ -117,7 +117,7 @@ class CobraTrapWatcher extends Watcher { if (event.getType() == EventType.DESTROYED_PERMANENT) { Permanent perm = (Permanent) game.getPermanentOrLKIBattlefield(event.getTargetId()); // can regenerate or be indestructible if (perm != null && !perm.getCardType().contains(CardType.CREATURE)) { - if (game.getStack().size() > 0) { + if (!game.getStack().isEmpty()) { StackObject spell = game.getStack().getStackObject(event.getSourceId()); if (spell != null && game.getOpponents(perm.getControllerId()).contains(spell.getControllerId())) { players.add(perm.getControllerId()); diff --git a/Mage.Sets/src/mage/cards/c/Conflux.java b/Mage.Sets/src/mage/cards/c/Conflux.java index aa5d0003a8..a39557b81c 100644 --- a/Mage.Sets/src/mage/cards/c/Conflux.java +++ b/Mage.Sets/src/mage/cards/c/Conflux.java @@ -109,7 +109,7 @@ class ConfluxEffect extends OneShotEffect { if (you != null && you.getLibrary().size() > 0) { if (you.searchLibrary(targetWhite, game)) { - if (targetWhite.getTargets().size() > 0) { + if (!targetWhite.getTargets().isEmpty()) { for (UUID cardId : (List) targetWhite.getTargets()) { Card card = you.getLibrary().remove(cardId, game); if (card != null) { @@ -121,7 +121,7 @@ class ConfluxEffect extends OneShotEffect { } if (you != null && you.getLibrary().size() > 0) { if (you.searchLibrary(targetBlue, game)) { - if (targetBlue.getTargets().size() > 0) { + if (!targetBlue.getTargets().isEmpty()) { for (UUID cardId : (List) targetBlue.getTargets()) { Card card = you.getLibrary().remove(cardId, game); if (card != null) { @@ -133,7 +133,7 @@ class ConfluxEffect extends OneShotEffect { } if (you != null && you.getLibrary().size() > 0) { if (you.searchLibrary(targetBlack, game)) { - if (targetBlack.getTargets().size() > 0) { + if (!targetBlack.getTargets().isEmpty()) { for (UUID cardId : (List) targetBlack.getTargets()) { Card card = you.getLibrary().remove(cardId, game); if (card != null) { @@ -145,7 +145,7 @@ class ConfluxEffect extends OneShotEffect { } if (you != null && you.getLibrary().size() > 0) { if (you.searchLibrary(targetRed, game)) { - if (targetRed.getTargets().size() > 0) { + if (!targetRed.getTargets().isEmpty()) { for (UUID cardId : (List) targetRed.getTargets()) { Card card = you.getLibrary().remove(cardId, game); if (card != null) { @@ -157,7 +157,7 @@ class ConfluxEffect extends OneShotEffect { } if (you != null && you.getLibrary().size() > 0) { if (you.searchLibrary(targetGreen, game)) { - if (targetGreen.getTargets().size() > 0) { + if (!targetGreen.getTargets().isEmpty()) { for (UUID cardId : (List) targetGreen.getTargets()) { Card card = you.getLibrary().remove(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/c/CongregationAtDawn.java b/Mage.Sets/src/mage/cards/c/CongregationAtDawn.java index 3521efde2b..596c2ff250 100644 --- a/Mage.Sets/src/mage/cards/c/CongregationAtDawn.java +++ b/Mage.Sets/src/mage/cards/c/CongregationAtDawn.java @@ -95,7 +95,7 @@ class CongregationAtDawnEffect extends OneShotEffect { if (controller != null && sourceObject != null) { TargetCardInLibrary target = new TargetCardInLibrary(0, 3, new FilterCreatureCard("creature cards")); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(); for (UUID cardId : (List) target.getTargets()) { Card card = controller.getLibrary().remove(cardId, game); diff --git a/Mage.Sets/src/mage/cards/c/CorpseConnoisseur.java b/Mage.Sets/src/mage/cards/c/CorpseConnoisseur.java index c654819659..9917868bd9 100644 --- a/Mage.Sets/src/mage/cards/c/CorpseConnoisseur.java +++ b/Mage.Sets/src/mage/cards/c/CorpseConnoisseur.java @@ -97,7 +97,7 @@ class SearchLibraryPutInGraveyard extends SearchEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); if (card != null) { controller.moveCards(card, Zone.GRAVEYARD, source, game); diff --git a/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java b/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java index 0f91cdd892..5d2668e8f0 100644 --- a/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java +++ b/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java @@ -136,7 +136,7 @@ class CorruptedGrafstoneManaEffect extends ManaEffect { if (types.getWhite() > 0) { choice.getChoices().add("White"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { diff --git a/Mage.Sets/src/mage/cards/c/Cultivate.java b/Mage.Sets/src/mage/cards/c/Cultivate.java index 7d29dd2a16..b50d86bba9 100644 --- a/Mage.Sets/src/mage/cards/c/Cultivate.java +++ b/Mage.Sets/src/mage/cards/c/Cultivate.java @@ -98,7 +98,7 @@ class CultivateEffect extends OneShotEffect { } TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard()); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); diff --git a/Mage.Sets/src/mage/cards/c/CurseOfChaos.java b/Mage.Sets/src/mage/cards/c/CurseOfChaos.java index 3b6eabf41b..3889b540bc 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfChaos.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfChaos.java @@ -140,7 +140,7 @@ class CurseOfChaosEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player attacker = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (attacker != null) { - if (attacker.getHand().size() > 0 && attacker.chooseUse(outcome, "Discard a card and draw a card?", source, game)){ + if (!attacker.getHand().isEmpty() && attacker.chooseUse(outcome, "Discard a card and draw a card?", source, game)){ attacker.discard(1, false, source, game); attacker.drawCards(1, game); } diff --git a/Mage.Sets/src/mage/cards/c/CurseOfEchoes.java b/Mage.Sets/src/mage/cards/c/CurseOfEchoes.java index 49d85b43b4..f936fb3513 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfEchoes.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfEchoes.java @@ -166,7 +166,7 @@ class CurseOfEchoesEffect extends OneShotEffect { @Override public String getText(Mode mode) { - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { return "Copy target " + mode.getTargets().get(0).getTargetName() + ". You may choose new targets for the copy"; } return "No target"; diff --git a/Mage.Sets/src/mage/cards/c/CursedScroll.java b/Mage.Sets/src/mage/cards/c/CursedScroll.java index 18bbb0f067..8b58b4984d 100644 --- a/Mage.Sets/src/mage/cards/c/CursedScroll.java +++ b/Mage.Sets/src/mage/cards/c/CursedScroll.java @@ -93,7 +93,7 @@ class CursedScrollEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY); if (sourceObject != null && controller != null && cardName != null && !cardName.isEmpty()) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = controller.getHand().getRandom(game); revealed.add(card); diff --git a/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java b/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java index 4c84b49886..990e3ca775 100644 --- a/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java +++ b/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java @@ -261,7 +261,7 @@ class DanceOfTheDeadChangeAbilityEffect extends ContinuousEffectImpl implements @Override public boolean apply(Game game, Ability source) { - Permanent permanent = affectedObjectList.get(0).getPermanent(game);; + Permanent permanent = affectedObjectList.get(0).getPermanent(game); if (permanent != null) { Ability abilityToRemove = null; for (Ability ability : permanent.getAbilities()) { diff --git a/Mage.Sets/src/mage/cards/d/DarkSupplicant.java b/Mage.Sets/src/mage/cards/d/DarkSupplicant.java index 70cc2e33dc..bde1f4d55f 100644 --- a/Mage.Sets/src/mage/cards/d/DarkSupplicant.java +++ b/Mage.Sets/src/mage/cards/d/DarkSupplicant.java @@ -116,7 +116,7 @@ class DarkSupplicantEffect extends OneShotEffect { // Library check if (player.chooseUse(Outcome.Benefit, "Do you want to search your library for Scion of Darkness?", source, game)) { if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId : (List) target.getTargets()) { Card card = player.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/d/DarthTyranus.java b/Mage.Sets/src/mage/cards/d/DarthTyranus.java index f80e8a5184..18766d2ec6 100644 --- a/Mage.Sets/src/mage/cards/d/DarthTyranus.java +++ b/Mage.Sets/src/mage/cards/d/DarthTyranus.java @@ -148,7 +148,7 @@ class TransmuteArtifactEffect extends SearchEffect { } } if (sacrifice && controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/d/DementiaSliver.java b/Mage.Sets/src/mage/cards/d/DementiaSliver.java index 73b15fc748..f1ba7513f5 100644 --- a/Mage.Sets/src/mage/cards/d/DementiaSliver.java +++ b/Mage.Sets/src/mage/cards/d/DementiaSliver.java @@ -107,7 +107,7 @@ class DementiaSliverEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY); if (opponent != null && sourceObject != null && !cardName.isEmpty()) { - if (opponent.getHand().size() > 0) { + if (!opponent.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = opponent.getHand().getRandom(game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/d/DeployTheGatewatch.java b/Mage.Sets/src/mage/cards/d/DeployTheGatewatch.java index 9bdef7feba..d9042c27e7 100644 --- a/Mage.Sets/src/mage/cards/d/DeployTheGatewatch.java +++ b/Mage.Sets/src/mage/cards/d/DeployTheGatewatch.java @@ -123,7 +123,7 @@ class DeployTheGatewatchEffect extends OneShotEffect { } // Put the rest on the bottom of your library in a random order - while (cards.size() > 0) { + while (!cards.isEmpty()) { Card card = cards.getRandom(game); if (card != null) { cards.remove(card); diff --git a/Mage.Sets/src/mage/cards/d/DescendantOfMasumaro.java b/Mage.Sets/src/mage/cards/d/DescendantOfMasumaro.java index 448e94ffb9..5412a84808 100644 --- a/Mage.Sets/src/mage/cards/d/DescendantOfMasumaro.java +++ b/Mage.Sets/src/mage/cards/d/DescendantOfMasumaro.java @@ -95,11 +95,11 @@ class DescendantOfMasumaroEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (controller != null && sourcePermanent != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { new AddCountersSourceEffect(CounterType.P1P1.createInstance(controller.getHand().size()), true).apply(game, source); } Player targetOpponent = game.getPlayer(getTargetPointer().getFirst(game, source)); - if (targetOpponent != null && targetOpponent.getHand().size() > 0) { + if (targetOpponent != null && !targetOpponent.getHand().isEmpty()) { sourcePermanent.removeCounters(CounterType.P1P1.getName(), targetOpponent.getHand().size(), game); game.informPlayers(controller.getLogName() + " removes " + targetOpponent.getHand().size() + " +1/+1 counters from " + sourcePermanent.getLogName()); } diff --git a/Mage.Sets/src/mage/cards/d/DevoutInvocation.java b/Mage.Sets/src/mage/cards/d/DevoutInvocation.java index d145307397..0585406735 100644 --- a/Mage.Sets/src/mage/cards/d/DevoutInvocation.java +++ b/Mage.Sets/src/mage/cards/d/DevoutInvocation.java @@ -98,7 +98,7 @@ class DevoutInvocationEffect extends OneShotEffect { Map options = new HashMap<>(); options.put("UI.right.btn.text", "Tapping complete"); controller.choose(outcome, target, source.getControllerId(), game, options); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID creature = target.getFirstTarget(); if (creature != null) { game.getPermanent(creature).tap(game); diff --git a/Mage.Sets/src/mage/cards/d/DimirCharm.java b/Mage.Sets/src/mage/cards/d/DimirCharm.java index 0d005c0fba..0d4f999b50 100644 --- a/Mage.Sets/src/mage/cards/d/DimirCharm.java +++ b/Mage.Sets/src/mage/cards/d/DimirCharm.java @@ -120,7 +120,7 @@ class DimirCharmEffect extends OneShotEffect { cards.add(card); } } - if(cards.size() > 0){ + if(!cards.isEmpty()){ TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("Card to put back on top of library")); if(controller.chooseTarget(Outcome.Benefit, cards, target, source, game)){ Card card = cards.get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/d/DimirMachinations.java b/Mage.Sets/src/mage/cards/d/DimirMachinations.java index 5f9be567a6..7493efb190 100644 --- a/Mage.Sets/src/mage/cards/d/DimirMachinations.java +++ b/Mage.Sets/src/mage/cards/d/DimirMachinations.java @@ -108,7 +108,7 @@ class DimirMachinationsEffect extends OneShotEffect { cards.remove(card); } } - while (cards.size() > 0) { + while (!cards.isEmpty()) { if (cards.size() == 1) { Card card = cards.get(cards.iterator().next(), game); controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false); diff --git a/Mage.Sets/src/mage/cards/d/DivergentTransformations.java b/Mage.Sets/src/mage/cards/d/DivergentTransformations.java index f82fec795c..05ab36fc93 100644 --- a/Mage.Sets/src/mage/cards/d/DivergentTransformations.java +++ b/Mage.Sets/src/mage/cards/d/DivergentTransformations.java @@ -125,7 +125,7 @@ class DivergentTransformationsEffect extends OneShotEffect { card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId()); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { player.revealCards(sourceObject.getIdName(), cards, game); Set cardsToShuffle = cards.getCards(game); cardsToShuffle.remove(card); diff --git a/Mage.Sets/src/mage/cards/d/Dracoplasm.java b/Mage.Sets/src/mage/cards/d/Dracoplasm.java index 36f6dd28e3..8609d41e87 100644 --- a/Mage.Sets/src/mage/cards/d/Dracoplasm.java +++ b/Mage.Sets/src/mage/cards/d/Dracoplasm.java @@ -130,7 +130,7 @@ class DracoplasmEffect extends ReplacementEffectImpl { return false; } controller.chooseTarget(Outcome.Detriment, target, source, game); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { int power = 0; int toughness = 0; for (UUID targetId : target.getTargets()) { diff --git a/Mage.Sets/src/mage/cards/d/DralnusPet.java b/Mage.Sets/src/mage/cards/d/DralnusPet.java index 2e6f2b9296..943197b875 100644 --- a/Mage.Sets/src/mage/cards/d/DralnusPet.java +++ b/Mage.Sets/src/mage/cards/d/DralnusPet.java @@ -121,7 +121,7 @@ class DralnusPetEffect extends OneShotEffect { && permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) { int cmc = 0; for (Cost cost : spellAbility.getCosts()) { - if (cost instanceof DiscardCardCost && ((DiscardCardCost) cost).getCards().size() > 0) { + if (cost instanceof DiscardCardCost && !((DiscardCardCost) cost).getCards().isEmpty()) { cmc = ((DiscardCardCost) cost).getCards().get(0).getConvertedManaCost(); } if (cmc > 0) { diff --git a/Mage.Sets/src/mage/cards/d/Duplicant.java b/Mage.Sets/src/mage/cards/d/Duplicant.java index 2132a893d4..8f0b960c65 100644 --- a/Mage.Sets/src/mage/cards/d/Duplicant.java +++ b/Mage.Sets/src/mage/cards/d/Duplicant.java @@ -143,7 +143,7 @@ class DuplicantContinuousEffect extends ContinuousEffectImpl { public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - if(permanent.getImprinted().size() > 0){ + if(!permanent.getImprinted().isEmpty()){ Card card = game.getCard(permanent.getImprinted().get(0)); if(card != null && card.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/cards/e/EldritchEvolution.java b/Mage.Sets/src/mage/cards/e/EldritchEvolution.java index 1fe9634ae4..b78f3cda7f 100644 --- a/Mage.Sets/src/mage/cards/e/EldritchEvolution.java +++ b/Mage.Sets/src/mage/cards/e/EldritchEvolution.java @@ -96,7 +96,7 @@ class EldritchEvolutionEffect extends OneShotEffect { for (Cost cost : source.getCosts()) { if (cost instanceof SacrificeTargetCost) { SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; - if (sacrificeCost.getPermanents().size() > 0) { + if (!sacrificeCost.getPermanents().isEmpty()) { sacrificedPermanent = sacrificeCost.getPermanents().get(0); } break; diff --git a/Mage.Sets/src/mage/cards/e/EliteArcanist.java b/Mage.Sets/src/mage/cards/e/EliteArcanist.java index f4fa74b99b..1e3f659ed6 100644 --- a/Mage.Sets/src/mage/cards/e/EliteArcanist.java +++ b/Mage.Sets/src/mage/cards/e/EliteArcanist.java @@ -118,7 +118,7 @@ class EliteArcanistImprintEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - if (player.getHand().size() > 0) { + if (!player.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, filter); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && player.choose(Outcome.Benefit, player.getHand(), target, game)) { diff --git a/Mage.Sets/src/mage/cards/e/EndlessHorizons.java b/Mage.Sets/src/mage/cards/e/EndlessHorizons.java index 79f3d125f8..7e10d7e92e 100644 --- a/Mage.Sets/src/mage/cards/e/EndlessHorizons.java +++ b/Mage.Sets/src/mage/cards/e/EndlessHorizons.java @@ -105,7 +105,7 @@ class EndlessHorizonsEffect extends SearchEffect { if (you != null) { if (you.searchLibrary(target, game)) { UUID exileZone = CardUtil.getCardExileZoneId(game, source); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId : target.getTargets()) { Card card = you.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/e/EpicExperiment.java b/Mage.Sets/src/mage/cards/e/EpicExperiment.java index 3a5ef26ea4..a2e8d0670a 100644 --- a/Mage.Sets/src/mage/cards/e/EpicExperiment.java +++ b/Mage.Sets/src/mage/cards/e/EpicExperiment.java @@ -101,7 +101,7 @@ class EpicExperimentEffect extends OneShotEffect { return true; } cardsToCast.addAll(epicExperimentExileZone.getCards(filter, source.getSourceId(), source.getControllerId(), game)); - while (cardsToCast.size() > 0) { + while (!cardsToCast.isEmpty()) { if (!controller.chooseUse(Outcome.PlayForFree, "Cast (another) a card exiled with " + sourceObject.getLogName() + " without paying its mana cost?", source, game)) { break; } diff --git a/Mage.Sets/src/mage/cards/e/Excavator.java b/Mage.Sets/src/mage/cards/e/Excavator.java index 460035023a..818f42ebc6 100644 --- a/Mage.Sets/src/mage/cards/e/Excavator.java +++ b/Mage.Sets/src/mage/cards/e/Excavator.java @@ -91,8 +91,8 @@ public class Excavator extends CardImpl { class ExcavatorEffect extends ContinuousEffectImpl implements SourceEffect { - private Abilities abilities = new AbilitiesImpl();; - + private Abilities abilities = new AbilitiesImpl(); + public ExcavatorEffect() { super(Duration.EndOfTurn, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); setText("Target creature gains landwalk of each of the land types of the sacrificed land until end of turn"); diff --git a/Mage.Sets/src/mage/cards/e/ExclusionRitual.java b/Mage.Sets/src/mage/cards/e/ExclusionRitual.java index 0579771edf..ba5b6c5834 100644 --- a/Mage.Sets/src/mage/cards/e/ExclusionRitual.java +++ b/Mage.Sets/src/mage/cards/e/ExclusionRitual.java @@ -128,7 +128,7 @@ class ExclusionRitualReplacementEffect extends ContinuousRuleModifyingEffectImpl Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Card card = game.getCard(event.getSourceId()); if (sourcePermanent != null && card != null) { - if (sourcePermanent.getImprinted().size() > 0) { + if (!sourcePermanent.getImprinted().isEmpty()) { Card imprintedCard = game.getCard(sourcePermanent.getImprinted().get(0)); if (imprintedCard != null) { return card.getName().equals(imprintedCard.getName()); diff --git a/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java b/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java index eb6f64355b..5029bfca0d 100644 --- a/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java +++ b/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java @@ -154,7 +154,7 @@ class EyeOfTheStormEffect1 extends OneShotEffect { if (spellController.moveCardsToExile(spell, source, game, true, exileZoneId, eyeOfTheStorm.getIdName())) { eyeOfTheStorm.imprint(card.getId(), game); - if (eyeOfTheStorm.getImprinted() != null && eyeOfTheStorm.getImprinted().size() > 0) { + if (eyeOfTheStorm.getImprinted() != null && !eyeOfTheStorm.getImprinted().isEmpty()) { CardsImpl copiedCards = new CardsImpl(); for (UUID uuid : eyeOfTheStorm.getImprinted()) { card = game.getCard(uuid); diff --git a/Mage.Sets/src/mage/cards/f/Firestorm.java b/Mage.Sets/src/mage/cards/f/Firestorm.java index 1210525ca7..67e1dc7e07 100644 --- a/Mage.Sets/src/mage/cards/f/Firestorm.java +++ b/Mage.Sets/src/mage/cards/f/Firestorm.java @@ -95,7 +95,7 @@ class FirestormEffect extends OneShotEffect { Player you = game.getPlayer(source.getControllerId()); int amount = (new GetXValue()).calculate(game, source, this); if (you != null) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { for (UUID targetId : this.getTargetPointer().getTargets(game, source)) { Permanent creature = game.getPermanent(targetId); if (creature != null) { diff --git a/Mage.Sets/src/mage/cards/f/FlamesOfRemembrance.java b/Mage.Sets/src/mage/cards/f/FlamesOfRemembrance.java index 9846be0847..6b9314a12b 100644 --- a/Mage.Sets/src/mage/cards/f/FlamesOfRemembrance.java +++ b/Mage.Sets/src/mage/cards/f/FlamesOfRemembrance.java @@ -115,7 +115,7 @@ class FlamesOfRemembranceExileEffect extends OneShotEffect { cards.add(card); } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { List cardsId = new ArrayList<>(); for (Card card : cards) { card.moveToExile(source.getSourceId(), "Flames of Remembrance", source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/f/Fleshwrither.java b/Mage.Sets/src/mage/cards/f/Fleshwrither.java index 4f92fb5690..580ef74b32 100644 --- a/Mage.Sets/src/mage/cards/f/Fleshwrither.java +++ b/Mage.Sets/src/mage/cards/f/Fleshwrither.java @@ -100,7 +100,7 @@ class FleshwritherEffect extends OneShotEffect { filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, sourceObject.getConvertedManaCost())); TargetCardInLibrary target = new TargetCardInLibrary(1, filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards chosen = new CardsImpl(target.getTargets()); controller.moveCards(chosen, Zone.BATTLEFIELD, source, game); } diff --git a/Mage.Sets/src/mage/cards/f/Fling.java b/Mage.Sets/src/mage/cards/f/Fling.java index 7d4526fc34..1286b38e26 100644 --- a/Mage.Sets/src/mage/cards/f/Fling.java +++ b/Mage.Sets/src/mage/cards/f/Fling.java @@ -82,7 +82,7 @@ class FlingEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = 0; for (Cost cost: source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue(); break; } diff --git a/Mage.Sets/src/mage/cards/f/ForbiddenAlchemy.java b/Mage.Sets/src/mage/cards/f/ForbiddenAlchemy.java index 5c9e37f0f7..8ef5b97a97 100644 --- a/Mage.Sets/src/mage/cards/f/ForbiddenAlchemy.java +++ b/Mage.Sets/src/mage/cards/f/ForbiddenAlchemy.java @@ -102,7 +102,7 @@ class ForbiddenAlchemyEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { player.lookAtCards("Forbidden Alchemy", cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand")); diff --git a/Mage.Sets/src/mage/cards/f/ForkInTheRoad.java b/Mage.Sets/src/mage/cards/f/ForkInTheRoad.java index 97b1143ea3..066266ec64 100644 --- a/Mage.Sets/src/mage/cards/f/ForkInTheRoad.java +++ b/Mage.Sets/src/mage/cards/f/ForkInTheRoad.java @@ -96,7 +96,7 @@ class ForkInTheRoadEffect extends OneShotEffect { } TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard()); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = game.getCard(cardId); @@ -105,7 +105,7 @@ class ForkInTheRoadEffect extends OneShotEffect { } } controller.revealCards(sourceObject.getIdName(), revealed, game); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { TargetCard target2 = new TargetCard(Zone.LIBRARY, filter); controller.choose(Outcome.Benefit, revealed, target2, game); Card card = revealed.get(target2.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/f/FriendlyFire.java b/Mage.Sets/src/mage/cards/f/FriendlyFire.java index 49ca81bfdd..f72eb127a9 100644 --- a/Mage.Sets/src/mage/cards/f/FriendlyFire.java +++ b/Mage.Sets/src/mage/cards/f/FriendlyFire.java @@ -93,7 +93,7 @@ class FriendlyFireEffect extends OneShotEffect { if (targetCreature != null) { Player controllerOfTargetCreature = game.getPlayer(targetCreature.getControllerId()); if (controllerOfTargetCreature != null) { - if (controllerOfTargetCreature.getHand().size() > 0) { + if (!controllerOfTargetCreature.getHand().isEmpty()) { Cards cards = new CardsImpl(); Card card = controllerOfTargetCreature.getHand().getRandom(game); cards.add(card); diff --git a/Mage.Sets/src/mage/cards/f/FromTheAshes.java b/Mage.Sets/src/mage/cards/f/FromTheAshes.java index 61b5f307e1..397d6c1fa2 100644 --- a/Mage.Sets/src/mage/cards/f/FromTheAshes.java +++ b/Mage.Sets/src/mage/cards/f/FromTheAshes.java @@ -108,7 +108,7 @@ class FromTheAshesEffect extends OneShotEffect { if (player != null) { TargetCardInLibrary target = new TargetCardInLibrary(0, entry.getValue(), new FilterBasicLandCard()); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId: target.getTargets()) { Card card = player.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/g/GaeasCradle.java b/Mage.Sets/src/mage/cards/g/GaeasCradle.java index f5251cee50..f854815edd 100644 --- a/Mage.Sets/src/mage/cards/g/GaeasCradle.java +++ b/Mage.Sets/src/mage/cards/g/GaeasCradle.java @@ -45,8 +45,6 @@ public class GaeasCradle extends CardImpl { private static final FilterControlledPermanent filter = new FilterControlledPermanent("creature you control"); - ; - static { filter.add(new CardTypePredicate(CardType.CREATURE)); } diff --git a/Mage.Sets/src/mage/cards/g/GallowsAtWillowHill.java b/Mage.Sets/src/mage/cards/g/GallowsAtWillowHill.java index c606c022f1..bc1b3f797e 100644 --- a/Mage.Sets/src/mage/cards/g/GallowsAtWillowHill.java +++ b/Mage.Sets/src/mage/cards/g/GallowsAtWillowHill.java @@ -103,7 +103,7 @@ class GallowsAtWillowHillEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { int affectedTargets = 0; - if (targetPointer.getTargets(game, source).size() > 0) { + if (!targetPointer.getTargets(game, source).isEmpty()) { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java b/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java index 1708f3fa98..b2497bfad8 100644 --- a/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java +++ b/Mage.Sets/src/mage/cards/g/GarrukTheVeilCursed.java @@ -179,7 +179,7 @@ class GarrukTheVeilCursedEffect extends OneShotEffect { } } // reveal - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.revealCards("Garruk, the Veil-Cursed", cards, game); } // shuffle diff --git a/Mage.Sets/src/mage/cards/g/GatherThePack.java b/Mage.Sets/src/mage/cards/g/GatherThePack.java index b252689598..cb9f66ad2a 100644 --- a/Mage.Sets/src/mage/cards/g/GatherThePack.java +++ b/Mage.Sets/src/mage/cards/g/GatherThePack.java @@ -100,13 +100,13 @@ class GatherThePackEffect extends OneShotEffect { TargetCard target = new TargetCard(0, max, Zone.LIBRARY, new FilterCreatureCard("creature card" + (max > 1 ? "s" : "") + " to put into your hand")); if (controller.choose(Outcome.PutCreatureInPlay, cards, target, game)) { Cards cardsToHand = new CardsImpl(target.getTargets()); - if (cardsToHand.size() > 0) { + if (!cardsToHand.isEmpty()) { cards.removeAll(cardsToHand); controller.moveCards(cardsToHand, Zone.HAND, source, game); } } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.moveCards(cards, Zone.GRAVEYARD, source, game); } } diff --git a/Mage.Sets/src/mage/cards/g/GenesisHydra.java b/Mage.Sets/src/mage/cards/g/GenesisHydra.java index 73194b72df..244fe9ec2f 100644 --- a/Mage.Sets/src/mage/cards/g/GenesisHydra.java +++ b/Mage.Sets/src/mage/cards/g/GenesisHydra.java @@ -116,7 +116,7 @@ class GenesisHydraPutOntoBattlefieldEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.revealCards("Genesis Hydra", cards, game); } diff --git a/Mage.Sets/src/mage/cards/g/GenesisWave.java b/Mage.Sets/src/mage/cards/g/GenesisWave.java index 183df0353e..858acc2c07 100644 --- a/Mage.Sets/src/mage/cards/g/GenesisWave.java +++ b/Mage.Sets/src/mage/cards/g/GenesisWave.java @@ -101,7 +101,7 @@ class GenesisWaveEffect extends OneShotEffect { Card card = controller.getLibrary().removeFromTop(game); cards.add(card); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.revealCards(sourceObject.getIdName(), cards, game); FilterCard filter = new FilterCard("cards with converted mana cost " + xValue + " or less to put onto the battlefield"); filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, xValue + 1)); diff --git a/Mage.Sets/src/mage/cards/g/GhastlyDemise.java b/Mage.Sets/src/mage/cards/g/GhastlyDemise.java index 94cbed67e1..dd644caf35 100644 --- a/Mage.Sets/src/mage/cards/g/GhastlyDemise.java +++ b/Mage.Sets/src/mage/cards/g/GhastlyDemise.java @@ -107,7 +107,7 @@ class GhastlyDemiseEffect extends OneShotEffect { } } } - } else if (targetPointer.getTargets(game, source).size() > 0) { + } else if (!targetPointer.getTargets(game, source).isEmpty()) { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null && permanent.getToughness().getValue() <= game.getPlayer(source.getControllerId()).getGraveyard().size()) { diff --git a/Mage.Sets/src/mage/cards/g/GiftsUngiven.java b/Mage.Sets/src/mage/cards/g/GiftsUngiven.java index 10cdeca2ff..4b4db14aa8 100644 --- a/Mage.Sets/src/mage/cards/g/GiftsUngiven.java +++ b/Mage.Sets/src/mage/cards/g/GiftsUngiven.java @@ -98,7 +98,7 @@ class GiftsUngivenEffect extends OneShotEffect { } GiftsUngivenTarget target = new GiftsUngivenTarget(); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = player.getLibrary().remove(cardId, game); diff --git a/Mage.Sets/src/mage/cards/g/GlimpseTheFuture.java b/Mage.Sets/src/mage/cards/g/GlimpseTheFuture.java index cc35524d20..73ce9ae8a4 100644 --- a/Mage.Sets/src/mage/cards/g/GlimpseTheFuture.java +++ b/Mage.Sets/src/mage/cards/g/GlimpseTheFuture.java @@ -97,7 +97,7 @@ class GlimpseTheFutureEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.lookAtCards("Glimpse the Future", cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand")); diff --git a/Mage.Sets/src/mage/cards/g/Godsend.java b/Mage.Sets/src/mage/cards/g/Godsend.java index f0743615e1..209aa26341 100644 --- a/Mage.Sets/src/mage/cards/g/Godsend.java +++ b/Mage.Sets/src/mage/cards/g/Godsend.java @@ -139,7 +139,7 @@ class GodsendTriggeredAbility extends TriggeredAbilityImpl { } targetName = "a creature blocked by creature "; } - if (possibleTargets.size() > 0) { + if (!possibleTargets.isEmpty()) { this.getTargets().clear(); if (possibleTargets.size() == 1) { this.getEffects().get(0).setTargetPointer(new FixedTarget(possibleTargets.iterator().next())); diff --git a/Mage.Sets/src/mage/cards/g/GrinningTotem.java b/Mage.Sets/src/mage/cards/g/GrinningTotem.java index d9512b0b62..039ce0bd4a 100644 --- a/Mage.Sets/src/mage/cards/g/GrinningTotem.java +++ b/Mage.Sets/src/mage/cards/g/GrinningTotem.java @@ -189,7 +189,7 @@ class GrinningTotemDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkInterveningIfClause(Game game) { ExileZone exileZone = game.getExile().getExileZone(exileZoneId); - return exileZone != null && exileZone.getCards(game).size() > 0; + return exileZone != null && !exileZone.getCards(game).isEmpty(); } @Override diff --git a/Mage.Sets/src/mage/cards/g/GripOfChaos.java b/Mage.Sets/src/mage/cards/g/GripOfChaos.java index 33a5f086aa..545f620cba 100644 --- a/Mage.Sets/src/mage/cards/g/GripOfChaos.java +++ b/Mage.Sets/src/mage/cards/g/GripOfChaos.java @@ -153,7 +153,7 @@ class GripOfChaosEffect extends OneShotEffect { for (Target target : mode.getTargets()) { UUID oldTargetId = target.getFirstTarget(); Set possibleTargets = target.possibleTargets(stackObject.getSourceId(), stackObject.getControllerId(), game); - if (possibleTargets.size() > 0) { + if (!possibleTargets.isEmpty()) { int i = 0; int rnd = RandomUtil.nextInt(possibleTargets.size()); Iterator it = possibleTargets.iterator(); diff --git a/Mage.Sets/src/mage/cards/g/Grozoth.java b/Mage.Sets/src/mage/cards/g/Grozoth.java index 813fab3682..def98cb16b 100644 --- a/Mage.Sets/src/mage/cards/g/Grozoth.java +++ b/Mage.Sets/src/mage/cards/g/Grozoth.java @@ -118,7 +118,7 @@ class GrozothEffect extends SearchEffect { Player player = game.getPlayer(source.getControllerId()); Card sourceCard = game.getCard(source.getSourceId()); if (sourceCard != null && player != null && player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = player.getLibrary().remove(cardId, game); diff --git a/Mage.Sets/src/mage/cards/g/GurmagDrowner.java b/Mage.Sets/src/mage/cards/g/GurmagDrowner.java index 2b8798788e..af4e2cfee9 100644 --- a/Mage.Sets/src/mage/cards/g/GurmagDrowner.java +++ b/Mage.Sets/src/mage/cards/g/GurmagDrowner.java @@ -100,7 +100,7 @@ class GurmagDrownerEffect extends OneShotEffect { if (controller != null && sourceObject != null) { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 4)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.lookAtCards(sourceObject.getName(), cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand")); if (controller.choose(Outcome.Benefit, cards, target, game)) { diff --git a/Mage.Sets/src/mage/cards/h/HarmonyOfNature.java b/Mage.Sets/src/mage/cards/h/HarmonyOfNature.java index 87ebd0c15e..253f807c78 100644 --- a/Mage.Sets/src/mage/cards/h/HarmonyOfNature.java +++ b/Mage.Sets/src/mage/cards/h/HarmonyOfNature.java @@ -99,7 +99,7 @@ class HarmonyOfNatureEffect extends OneShotEffect { Map options = new HashMap<>(); options.put("UI.right.btn.text", "Tapping complete"); controller.choose(outcome, target, source.getControllerId(), game, options); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID creature = target.getFirstTarget(); if (creature != null) { game.getPermanent(creature).tap(game); diff --git a/Mage.Sets/src/mage/cards/h/HeartOfKiran.java b/Mage.Sets/src/mage/cards/h/HeartOfKiran.java index fe0875e982..96741ab7e2 100644 --- a/Mage.Sets/src/mage/cards/h/HeartOfKiran.java +++ b/Mage.Sets/src/mage/cards/h/HeartOfKiran.java @@ -137,7 +137,7 @@ class HeartOfKiranAlternateCrewCost extends CostImpl { @Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return game.getBattlefield().getAllActivePermanents(filter, game).size() > 0; + return !game.getBattlefield().getAllActivePermanents(filter, game).isEmpty(); } @Override diff --git a/Mage.Sets/src/mage/cards/h/HellcarverDemon.java b/Mage.Sets/src/mage/cards/h/HellcarverDemon.java index 760dca3e2e..0c8feae870 100644 --- a/Mage.Sets/src/mage/cards/h/HellcarverDemon.java +++ b/Mage.Sets/src/mage/cards/h/HellcarverDemon.java @@ -100,7 +100,7 @@ class HellcarverDemonEffect extends OneShotEffect { } } - if (player != null && player.getHand().size() > 0) { + if (player != null && !player.getHand().isEmpty()) { int cardsInHand = player.getHand().size(); player.discard(cardsInHand, source, game); } diff --git a/Mage.Sets/src/mage/cards/h/HeroesPodium.java b/Mage.Sets/src/mage/cards/h/HeroesPodium.java index 883483e22d..dc9f3c4e89 100644 --- a/Mage.Sets/src/mage/cards/h/HeroesPodium.java +++ b/Mage.Sets/src/mage/cards/h/HeroesPodium.java @@ -188,7 +188,7 @@ class HeroesPodiumEffect extends OneShotEffect { } // Put the rest on the bottom of your library in a random order - while (cards.size() > 0) { + while (!cards.isEmpty()) { Card card = cards.getRandom(game); if (card != null) { cards.remove(card); diff --git a/Mage.Sets/src/mage/cards/h/HiredTorturer.java b/Mage.Sets/src/mage/cards/h/HiredTorturer.java index 71176b413b..ed955f4a01 100644 --- a/Mage.Sets/src/mage/cards/h/HiredTorturer.java +++ b/Mage.Sets/src/mage/cards/h/HiredTorturer.java @@ -101,7 +101,7 @@ class HiredTorturerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); - if (player != null && player.getHand().size() > 0) { + if (player != null && !player.getHand().isEmpty()) { Cards revealed = new CardsImpl(); revealed.add(player.getHand().getRandom(game)); player.revealCards("Hired Torturer", revealed, game); diff --git a/Mage.Sets/src/mage/cards/h/HisokasGuard.java b/Mage.Sets/src/mage/cards/h/HisokasGuard.java index bbcdd1d19f..235531f887 100644 --- a/Mage.Sets/src/mage/cards/h/HisokasGuard.java +++ b/Mage.Sets/src/mage/cards/h/HisokasGuard.java @@ -122,7 +122,7 @@ class HisokasGuardGainAbilityTargetEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { Permanent hisokasGuard = game.getPermanent(source.getSourceId()); - if (hisokasGuard != null && hisokasGuard.getConnectedCards("HisokasGuard").size() > 0) { + if (hisokasGuard != null && !hisokasGuard.getConnectedCards("HisokasGuard").isEmpty()) { Permanent guardedCreature = game.getPermanent(hisokasGuard.getConnectedCards("HisokasGuard").get(0)); if (guardedCreature != null && hisokasGuard.isTapped()) { guardedCreature.addAbility(ability, game); diff --git a/Mage.Sets/src/mage/cards/h/HoardingDragon.java b/Mage.Sets/src/mage/cards/h/HoardingDragon.java index fd21d13219..6f378c83f1 100644 --- a/Mage.Sets/src/mage/cards/h/HoardingDragon.java +++ b/Mage.Sets/src/mage/cards/h/HoardingDragon.java @@ -105,7 +105,7 @@ class HoardingDragonEffect extends OneShotEffect { if (controller != null && sourceObject != null) { TargetCardInLibrary target = new TargetCardInLibrary(new FilterArtifactCard()); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); if (card != null) { controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); diff --git a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java index a34d13da76..c69e10b666 100644 --- a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java +++ b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java @@ -84,7 +84,7 @@ public class HopeOfGhirapur extends CardImpl { @Override public void adjustTargets(Ability ability, Game game) { if (ability instanceof SimpleActivatedAbility) { - if (ability.getEffects().size() > 0 && (ability.getEffects().get(0) instanceof HopeOfGhirapurCantCastEffect)) { + if (!ability.getEffects().isEmpty() && (ability.getEffects().get(0) instanceof HopeOfGhirapurCantCastEffect)) { MageObject sourceObject = ability.getSourceObject(game); if (sourceObject != null) { ability.getTargets().clear(); diff --git a/Mage.Sets/src/mage/cards/i/IgniteMemories.java b/Mage.Sets/src/mage/cards/i/IgniteMemories.java index 616f6f3590..54329cb74e 100644 --- a/Mage.Sets/src/mage/cards/i/IgniteMemories.java +++ b/Mage.Sets/src/mage/cards/i/IgniteMemories.java @@ -85,7 +85,7 @@ class IgniteMemoriesEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); - if (player != null && player.getHand().size() > 0) { + if (player != null && !player.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = player.getHand().getRandom(game); revealed.add(card); diff --git a/Mage.Sets/src/mage/cards/i/InameDeathAspect.java b/Mage.Sets/src/mage/cards/i/InameDeathAspect.java index cdd3b385e3..808d84c9fc 100644 --- a/Mage.Sets/src/mage/cards/i/InameDeathAspect.java +++ b/Mage.Sets/src/mage/cards/i/InameDeathAspect.java @@ -96,7 +96,7 @@ class InameDeathAspectEffect extends SearchEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { player.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game); } player.shuffleLibrary(source, game); diff --git a/Mage.Sets/src/mage/cards/i/IncreasingAmbition.java b/Mage.Sets/src/mage/cards/i/IncreasingAmbition.java index b7d934ad75..7046603a20 100644 --- a/Mage.Sets/src/mage/cards/i/IncreasingAmbition.java +++ b/Mage.Sets/src/mage/cards/i/IncreasingAmbition.java @@ -103,7 +103,7 @@ class IncreasingAmbitionEffect extends SearchEffect { target = new TargetCardInLibrary(); } if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId: (List)target.getTargets()) { Card card = player.getLibrary().remove(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/i/IndomitableCreativity.java b/Mage.Sets/src/mage/cards/i/IndomitableCreativity.java index c1b9e70a5c..ce5746db67 100644 --- a/Mage.Sets/src/mage/cards/i/IndomitableCreativity.java +++ b/Mage.Sets/src/mage/cards/i/IndomitableCreativity.java @@ -147,7 +147,7 @@ class IndomitableCreativityEffect extends OneShotEffect { controllerOfDestroyedCreature.moveCards(card, Zone.BATTLEFIELD, source, game); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { revealCards.addAll(cards); Set cardsToShuffle = cards.getCards(game); cardsToShuffle.remove(card); diff --git a/Mage.Sets/src/mage/cards/i/InfernalKirin.java b/Mage.Sets/src/mage/cards/i/InfernalKirin.java index c4dd60d086..3051106b59 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalKirin.java +++ b/Mage.Sets/src/mage/cards/i/InfernalKirin.java @@ -108,7 +108,7 @@ class InfernalKirinEffect extends OneShotEffect { } } if (targetPlayer != null) { - if (targetPlayer.getHand().size() > 0) { + if (!targetPlayer.getHand().isEmpty()) { targetPlayer.revealCards("Infernal Kirin", targetPlayer.getHand(), game); for (UUID uuid: targetPlayer.getHand().copy()) { Card card = game.getCard(uuid); diff --git a/Mage.Sets/src/mage/cards/i/InfernalTutor.java b/Mage.Sets/src/mage/cards/i/InfernalTutor.java index 11e8cc98ee..070aae33cb 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalTutor.java +++ b/Mage.Sets/src/mage/cards/i/InfernalTutor.java @@ -101,7 +101,7 @@ class InfernalTutorEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { Card cardToReveal = null; if (controller.getHand().size() > 1) { Target target = new TargetCardInHand(new FilterCard()); diff --git a/Mage.Sets/src/mage/cards/i/InvaderParasite.java b/Mage.Sets/src/mage/cards/i/InvaderParasite.java index 9f9197a62b..96995cc295 100644 --- a/Mage.Sets/src/mage/cards/i/InvaderParasite.java +++ b/Mage.Sets/src/mage/cards/i/InvaderParasite.java @@ -133,7 +133,7 @@ class InvaderParasiteTriggeredAbility extends TriggeredAbilityImpl { Permanent targetPermanent = game.getPermanent(event.getTargetId()); Permanent sourcePermanent = game.getPermanent(getSourceId()); if (targetPermanent != null && sourcePermanent != null) { - if (sourcePermanent.getImprinted().size() > 0) { + if (!sourcePermanent.getImprinted().isEmpty()) { Card imprintedCard = game.getCard(sourcePermanent.getImprinted().get(0)); if (imprintedCard != null && targetPermanent.getName().equals(imprintedCard.getName())) { for (Effect effect : this.getEffects()) { diff --git a/Mage.Sets/src/mage/cards/i/IsochronScepter.java b/Mage.Sets/src/mage/cards/i/IsochronScepter.java index 96407d8af2..1ff39c48c8 100644 --- a/Mage.Sets/src/mage/cards/i/IsochronScepter.java +++ b/Mage.Sets/src/mage/cards/i/IsochronScepter.java @@ -103,7 +103,7 @@ class IsochronScepterImprintEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, filter); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.Benefit, controller.getHand(), target, game)) { diff --git a/Mage.Sets/src/mage/cards/j/JacesMindseeker.java b/Mage.Sets/src/mage/cards/j/JacesMindseeker.java index e29c9725b1..c4d89b23ff 100644 --- a/Mage.Sets/src/mage/cards/j/JacesMindseeker.java +++ b/Mage.Sets/src/mage/cards/j/JacesMindseeker.java @@ -122,7 +122,7 @@ class JaceMindseekerEffect extends OneShotEffect { } // cast an instant or sorcery for free - if (cardsToCast.size() > 0) { + if (!cardsToCast.isEmpty()) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { TargetCard target = new TargetCard(Zone.GRAVEYARD, filter); // zone should be ignored here diff --git a/Mage.Sets/src/mage/cards/j/JaradsOrders.java b/Mage.Sets/src/mage/cards/j/JaradsOrders.java index 949bc6fadd..f9a2c5a8e0 100644 --- a/Mage.Sets/src/mage/cards/j/JaradsOrders.java +++ b/Mage.Sets/src/mage/cards/j/JaradsOrders.java @@ -92,7 +92,7 @@ class JaradsOrdersEffect extends OneShotEffect { if (controller != null) { TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterCreatureCard("creature cards")); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(); for (UUID cardId: (List)target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); diff --git a/Mage.Sets/src/mage/cards/j/JestersScepter.java b/Mage.Sets/src/mage/cards/j/JestersScepter.java index cdf0ba8a8a..ac65cbeec8 100644 --- a/Mage.Sets/src/mage/cards/j/JestersScepter.java +++ b/Mage.Sets/src/mage/cards/j/JestersScepter.java @@ -191,7 +191,7 @@ class JestersScepterCost extends CostImpl { TargetCardInExile target = new TargetCardInExile(new FilterCard(), CardUtil.getCardExileZoneId(game, ability)); target.setNotTarget(true); Cards cards = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, ability)); - if (cards.size() > 0 + if (!cards.isEmpty() && controller.choose(Outcome.Benefit, cards, target, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/k/KaaliaOfTheVast.java b/Mage.Sets/src/mage/cards/k/KaaliaOfTheVast.java index e17ecfa1c4..8ef906ed08 100644 --- a/Mage.Sets/src/mage/cards/k/KaaliaOfTheVast.java +++ b/Mage.Sets/src/mage/cards/k/KaaliaOfTheVast.java @@ -153,7 +153,7 @@ class KaaliaOfTheVastEffect extends OneShotEffect { } TargetCardInHand target = new TargetCardInHand(filter); if (target.canChoose(controller.getId(), game) && target.choose(getOutcome(), controller.getId(), source.getSourceId(), game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID cardId = target.getFirstTarget(); Card card = game.getCard(cardId); if (card != null && game.getCombat() != null) { diff --git a/Mage.Sets/src/mage/cards/k/KahoMinamoHistorian.java b/Mage.Sets/src/mage/cards/k/KahoMinamoHistorian.java index b3aa1ddbc5..1a1620da81 100644 --- a/Mage.Sets/src/mage/cards/k/KahoMinamoHistorian.java +++ b/Mage.Sets/src/mage/cards/k/KahoMinamoHistorian.java @@ -117,7 +117,7 @@ class KahoMinamoHistorianEffect extends SearchEffect { if (controller != null && sourceObject != null) { if (controller.searchLibrary(target, game)) { UUID exileZone = CardUtil.getCardExileZoneId(game, source); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { controller.moveCardsToExile(new CardsImpl(target.getTargets()).getCards(game), source, game, true, exileZone, sourceObject.getIdName()); } } @@ -153,7 +153,7 @@ class KahoMinamoHistorianCastEffect extends OneShotEffect { filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, source.getManaCostsToPay().getX())); TargetCardInExile target = new TargetCardInExile(filter, CardUtil.getCardExileZoneId(game, source)); Cards cards = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source)); - if (cards.size() > 0 && controller.choose(Outcome.PlayForFree, cards, target, game)) { + if (!cards.isEmpty() && controller.choose(Outcome.PlayForFree, cards, target, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { controller.cast(card.getSpellAbility(), game, true); diff --git a/Mage.Sets/src/mage/cards/k/KangeeAerieKeeper.java b/Mage.Sets/src/mage/cards/k/KangeeAerieKeeper.java index e97a890b5b..f257303cb8 100644 --- a/Mage.Sets/src/mage/cards/k/KangeeAerieKeeper.java +++ b/Mage.Sets/src/mage/cards/k/KangeeAerieKeeper.java @@ -127,10 +127,10 @@ class KangeeAerieKeeperGetKickerXValue implements DynamicValue { @Override public String toString() { return "X"; - }; + } @Override public String getMessage() { return "X"; - }; + } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/k/KodamasReach.java b/Mage.Sets/src/mage/cards/k/KodamasReach.java index cfe8e345ae..3a5563c709 100644 --- a/Mage.Sets/src/mage/cards/k/KodamasReach.java +++ b/Mage.Sets/src/mage/cards/k/KodamasReach.java @@ -97,7 +97,7 @@ class KodamasReachEffect extends OneShotEffect { } TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard()); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); diff --git a/Mage.Sets/src/mage/cards/k/KrovikanSorcerer.java b/Mage.Sets/src/mage/cards/k/KrovikanSorcerer.java index 8d94ccdfd7..c4135aeb14 100644 --- a/Mage.Sets/src/mage/cards/k/KrovikanSorcerer.java +++ b/Mage.Sets/src/mage/cards/k/KrovikanSorcerer.java @@ -121,7 +121,7 @@ class KrovikanSorcererEffect extends OneShotEffect { drawnCards.add(cardId); } } - if (drawnCards.size() > 0) { + if (!drawnCards.isEmpty()) { TargetCard cardToDiscard = new TargetCard(Zone.HAND, new FilterCard("card to discard")); cardToDiscard.setNotTarget(true); if (player.choose(Outcome.Discard, drawnCards, cardToDiscard, game)) { diff --git a/Mage.Sets/src/mage/cards/l/Leashling.java b/Mage.Sets/src/mage/cards/l/Leashling.java index 502becf9fc..0dc1975c39 100644 --- a/Mage.Sets/src/mage/cards/l/Leashling.java +++ b/Mage.Sets/src/mage/cards/l/Leashling.java @@ -98,7 +98,7 @@ class PutCardFromHandOnTopOfLibrary extends CostImpl { public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { - return controller.getHand().size() > 0; + return !controller.getHand().isEmpty(); } return false; } diff --git a/Mage.Sets/src/mage/cards/l/LifesLegacy.java b/Mage.Sets/src/mage/cards/l/LifesLegacy.java index b583144215..154414cdbc 100644 --- a/Mage.Sets/src/mage/cards/l/LifesLegacy.java +++ b/Mage.Sets/src/mage/cards/l/LifesLegacy.java @@ -87,7 +87,7 @@ class LifesLegacyEffect extends OneShotEffect { } int power = 0; for (Cost cost: source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { power = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue(); break; } diff --git a/Mage.Sets/src/mage/cards/l/LordOfTheVoid.java b/Mage.Sets/src/mage/cards/l/LordOfTheVoid.java index 7b3c30be4d..44bf64d920 100644 --- a/Mage.Sets/src/mage/cards/l/LordOfTheVoid.java +++ b/Mage.Sets/src/mage/cards/l/LordOfTheVoid.java @@ -104,7 +104,7 @@ class LordOfTheVoidEffect extends OneShotEffect { Cards cards = new CardsImpl(); cards.addAll(player.getLibrary().getTopCards(game, 7)); controller.moveCards(cards, Zone.EXILED, source, game); - if (cards.getCards(new FilterCreatureCard(), game).size() > 0) { + if (!cards.getCards(new FilterCreatureCard(), game).isEmpty()) { TargetCard target = new TargetCard(Zone.EXILED, new FilterCreatureCard()); if (controller.chooseTarget(outcome, cards, target, source, game)) { Card card = cards.get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/m/MadcapExperiment.java b/Mage.Sets/src/mage/cards/m/MadcapExperiment.java index 380e4956cc..df5a0f7a38 100644 --- a/Mage.Sets/src/mage/cards/m/MadcapExperiment.java +++ b/Mage.Sets/src/mage/cards/m/MadcapExperiment.java @@ -107,7 +107,7 @@ class MadcapExperimentEffect extends OneShotEffect { cards.remove(card); } // Put the rest on the bottom of your library in a random order - while (cards.size() > 0) { + while (!cards.isEmpty()) { card = cards.getRandom(game); if (card != null) { cards.remove(card); diff --git a/Mage.Sets/src/mage/cards/m/MagneticMountain.java b/Mage.Sets/src/mage/cards/m/MagneticMountain.java index 5d5fedaaec..cc0e843740 100644 --- a/Mage.Sets/src/mage/cards/m/MagneticMountain.java +++ b/Mage.Sets/src/mage/cards/m/MagneticMountain.java @@ -116,7 +116,7 @@ class MagneticMountainEffect extends DoIfCostPaid { filter.add(new ColorPredicate(ObjectColor.BLUE)); filter.add(new MagneticMountainPredicate()); - if (game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).size()>0){ + if (!game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).isEmpty()){ this.copy(); } return true; diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheJar.java b/Mage.Sets/src/mage/cards/m/MagusOfTheJar.java index dd06363b97..221cf6a6b3 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheJar.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheJar.java @@ -99,7 +99,7 @@ class MagusoftheJarEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { Cards hand = player.getHand(); - while (hand.size() > 0) { + while (!hand.isEmpty()) { Card card = hand.get(hand.iterator().next(), game); if (card != null) { card.moveToExile(getId(), "Magus of the Jar", source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/m/MagusOfTheScroll.java b/Mage.Sets/src/mage/cards/m/MagusOfTheScroll.java index 4cbe91aaf8..4de52b4a1a 100644 --- a/Mage.Sets/src/mage/cards/m/MagusOfTheScroll.java +++ b/Mage.Sets/src/mage/cards/m/MagusOfTheScroll.java @@ -97,7 +97,7 @@ class MagusOfTheScrollEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY); if (sourceObject != null && you != null && cardName != null && !cardName.isEmpty()) { - if (you.getHand().size() > 0) { + if (!you.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = you.getHand().getRandom(game); revealed.add(card); diff --git a/Mage.Sets/src/mage/cards/m/ManaSeverance.java b/Mage.Sets/src/mage/cards/m/ManaSeverance.java index e5b7012cd0..a923481dff 100644 --- a/Mage.Sets/src/mage/cards/m/ManaSeverance.java +++ b/Mage.Sets/src/mage/cards/m/ManaSeverance.java @@ -65,7 +65,7 @@ class ManaSeveranceEffect extends SearchEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/m/ManifoldInsights.java b/Mage.Sets/src/mage/cards/m/ManifoldInsights.java index a0aa5f2b82..019bbbbc91 100644 --- a/Mage.Sets/src/mage/cards/m/ManifoldInsights.java +++ b/Mage.Sets/src/mage/cards/m/ManifoldInsights.java @@ -113,7 +113,7 @@ class ManifoldInsightsEffect extends OneShotEffect { } } controller.moveCards(chosenCards, Zone.HAND, source, game); - while (topLib.size() > 0 && controller.isInGame()) { + while (!topLib.isEmpty() && controller.isInGame()) { Card card = topLib.getRandom(game); if (card != null) { topLib.remove(card); diff --git a/Mage.Sets/src/mage/cards/m/MarshalingTheTroops.java b/Mage.Sets/src/mage/cards/m/MarshalingTheTroops.java index 038ed6e99d..214b130c2f 100644 --- a/Mage.Sets/src/mage/cards/m/MarshalingTheTroops.java +++ b/Mage.Sets/src/mage/cards/m/MarshalingTheTroops.java @@ -99,7 +99,7 @@ class MarshalingTheTroopsEffect extends OneShotEffect { Map options = new HashMap<>(); options.put("UI.right.btn.text", "Tapping complete"); controller.choose(outcome, target, source.getControllerId(), game, options); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID creature = target.getFirstTarget(); if (creature != null) { game.getPermanent(creature).tap(game); diff --git a/Mage.Sets/src/mage/cards/m/MasterOfPredicaments.java b/Mage.Sets/src/mage/cards/m/MasterOfPredicaments.java index 4edce4a979..7815eca796 100644 --- a/Mage.Sets/src/mage/cards/m/MasterOfPredicaments.java +++ b/Mage.Sets/src/mage/cards/m/MasterOfPredicaments.java @@ -93,7 +93,7 @@ class MasterOfPredicamentsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { Card cardFromHand = null; if (controller.getHand().size() > 1) { TargetCard target = new TargetCardInHand(new FilterCard()); diff --git a/Mage.Sets/src/mage/cards/m/MemoryJar.java b/Mage.Sets/src/mage/cards/m/MemoryJar.java index 2071f7c386..e4461295e0 100644 --- a/Mage.Sets/src/mage/cards/m/MemoryJar.java +++ b/Mage.Sets/src/mage/cards/m/MemoryJar.java @@ -96,7 +96,7 @@ class MemoryJarEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { Cards hand = player.getHand(); - while (hand.size() > 0) { + while (!hand.isEmpty()) { Card card = hand.get(hand.iterator().next(), game); if (card != null) { card.moveToExile(getId(), "Memory Jar", source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/m/MerfolkSpy.java b/Mage.Sets/src/mage/cards/m/MerfolkSpy.java index 2ab3c1f059..8ff48fa1a2 100644 --- a/Mage.Sets/src/mage/cards/m/MerfolkSpy.java +++ b/Mage.Sets/src/mage/cards/m/MerfolkSpy.java @@ -87,7 +87,7 @@ class MerfolkSpyEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); - if (player != null && player.getHand().size() > 0) { + if (player != null && !player.getHand().isEmpty()) { Cards revealed = new CardsImpl(); revealed.add(player.getHand().getRandom(game)); player.revealCards("Merfolk Spy", revealed, game); diff --git a/Mage.Sets/src/mage/cards/m/Metamorphosis.java b/Mage.Sets/src/mage/cards/m/Metamorphosis.java index 116ff7f009..cd3a5e68d2 100644 --- a/Mage.Sets/src/mage/cards/m/Metamorphosis.java +++ b/Mage.Sets/src/mage/cards/m/Metamorphosis.java @@ -84,7 +84,7 @@ class MetamorphosisEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = 0; for (Cost cost: source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost)cost).getPermanents().get(0).getConvertedManaCost()+1; break; } diff --git a/Mage.Sets/src/mage/cards/m/MeteorBlast.java b/Mage.Sets/src/mage/cards/m/MeteorBlast.java index 508e1121ea..f872e2e6fd 100644 --- a/Mage.Sets/src/mage/cards/m/MeteorBlast.java +++ b/Mage.Sets/src/mage/cards/m/MeteorBlast.java @@ -87,7 +87,7 @@ class MeteorBlastEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { for (UUID targetId : this.getTargetPointer().getTargets(game, source)) { Permanent creature = game.getPermanent(targetId); if (creature != null) { diff --git a/Mage.Sets/src/mage/cards/m/MeteorCrater.java b/Mage.Sets/src/mage/cards/m/MeteorCrater.java index 40d5f321de..5140e0e7ff 100644 --- a/Mage.Sets/src/mage/cards/m/MeteorCrater.java +++ b/Mage.Sets/src/mage/cards/m/MeteorCrater.java @@ -118,7 +118,7 @@ class MeteorCraterEffect extends ManaEffect { choice.getChoices().add("White"); } } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); diff --git a/Mage.Sets/src/mage/cards/m/MimicVat.java b/Mage.Sets/src/mage/cards/m/MimicVat.java index eb3e2df711..f78fc358f6 100644 --- a/Mage.Sets/src/mage/cards/m/MimicVat.java +++ b/Mage.Sets/src/mage/cards/m/MimicVat.java @@ -198,7 +198,7 @@ class MimicVatCreateTokenEffect extends OneShotEffect { return false; } - if (permanent.getImprinted().size() > 0) { + if (!permanent.getImprinted().isEmpty()) { Card card = game.getCard(permanent.getImprinted().get(0)); if (card != null) { PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(source.getControllerId(), null, true); diff --git a/Mage.Sets/src/mage/cards/m/MindclawShaman.java b/Mage.Sets/src/mage/cards/m/MindclawShaman.java index 6565ea86e7..65ef519ba8 100644 --- a/Mage.Sets/src/mage/cards/m/MindclawShaman.java +++ b/Mage.Sets/src/mage/cards/m/MindclawShaman.java @@ -107,7 +107,7 @@ class MindclawShamanEffect extends OneShotEffect { Player targetOpponent = game.getPlayer(source.getFirstTarget()); MageObject sourceObject = source.getSourceObject(game); if (targetOpponent != null && sourceObject != null) { - if (targetOpponent.getHand().size() > 0) { + if (!targetOpponent.getHand().isEmpty()) { targetOpponent.revealCards(sourceObject.getName(), targetOpponent.getHand(), game); Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { diff --git a/Mage.Sets/src/mage/cards/m/MindleechMass.java b/Mage.Sets/src/mage/cards/m/MindleechMass.java index 3ee2cb7299..7c76532829 100644 --- a/Mage.Sets/src/mage/cards/m/MindleechMass.java +++ b/Mage.Sets/src/mage/cards/m/MindleechMass.java @@ -100,8 +100,8 @@ class MindleechMassEffect extends OneShotEffect { Cards cardsInHand = new CardsImpl(); cardsInHand.addAll(opponent.getHand()); opponent.revealCards("Opponents hand", cardsInHand, game); - if (cardsInHand.size() > 0 - && cardsInHand.getCards(new FilterNonlandCard(), game).size() > 0) { + if (!cardsInHand.isEmpty() + && !cardsInHand.getCards(new FilterNonlandCard(), game).isEmpty()) { TargetCard target = new TargetCard(1, Zone.HAND, new FilterNonlandCard()); if (you.chooseTarget(Outcome.PlayForFree, cardsInHand, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/m/MizzixsMastery.java b/Mage.Sets/src/mage/cards/m/MizzixsMastery.java index 91f8c07348..665830c4e7 100644 --- a/Mage.Sets/src/mage/cards/m/MizzixsMastery.java +++ b/Mage.Sets/src/mage/cards/m/MizzixsMastery.java @@ -155,7 +155,7 @@ class MizzixsMasteryOverloadEffect extends OneShotEffect { } } } - continueCasting = copiedCards.size() > 0 + continueCasting = !copiedCards.isEmpty() && controller.chooseUse(outcome, "Cast one of the copied cards without paying its mana cost?", source, game); } } diff --git a/Mage.Sets/src/mage/cards/m/MomentousFall.java b/Mage.Sets/src/mage/cards/m/MomentousFall.java index ebfff8a3a7..6696a2256e 100644 --- a/Mage.Sets/src/mage/cards/m/MomentousFall.java +++ b/Mage.Sets/src/mage/cards/m/MomentousFall.java @@ -87,7 +87,7 @@ class MomentousFallEffect extends OneShotEffect { int toughness = 0; for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { power = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue(); toughness = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue(); break; diff --git a/Mage.Sets/src/mage/cards/m/MoonringMirror.java b/Mage.Sets/src/mage/cards/m/MoonringMirror.java index a29182d6fa..6f0c7f78ff 100644 --- a/Mage.Sets/src/mage/cards/m/MoonringMirror.java +++ b/Mage.Sets/src/mage/cards/m/MoonringMirror.java @@ -139,7 +139,7 @@ class MoonringMirrorEffect extends OneShotEffect { if (controller != null && sourceObject != null) { UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); Cards cardsToHand = null; - if (game.getExile().getExileZone(exileZoneId) != null && game.getExile().getExileZone(exileZoneId).size() > 0) { + if (game.getExile().getExileZone(exileZoneId) != null && !game.getExile().getExileZone(exileZoneId).isEmpty()) { cardsToHand = new CardsImpl(game.getExile().getExileZone(exileZoneId)); } for (Card card : controller.getHand().getCards(game)) { diff --git a/Mage.Sets/src/mage/cards/m/MyrBattlesphere.java b/Mage.Sets/src/mage/cards/m/MyrBattlesphere.java index d83fe1e9a2..183dc20def 100644 --- a/Mage.Sets/src/mage/cards/m/MyrBattlesphere.java +++ b/Mage.Sets/src/mage/cards/m/MyrBattlesphere.java @@ -114,7 +114,7 @@ class MyrBattlesphereEffect extends OneShotEffect { Map options = new HashMap<>(); options.put("UI.right.btn.text", "Myr tapping complete"); controller.choose(outcome, target, source.getControllerId(), game, options); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID creature = target.getFirstTarget(); if (creature != null) { game.getPermanent(creature).tap(game); diff --git a/Mage.Sets/src/mage/cards/n/NahiriTheHarbinger.java b/Mage.Sets/src/mage/cards/n/NahiriTheHarbinger.java index fd22afd9ae..d7a89fd850 100644 --- a/Mage.Sets/src/mage/cards/n/NahiriTheHarbinger.java +++ b/Mage.Sets/src/mage/cards/n/NahiriTheHarbinger.java @@ -135,7 +135,7 @@ class NahiriTheHarbingerEffect extends SearchEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); controller.moveCards(card, Zone.BATTLEFIELD, source, game); Permanent permanent = game.getPermanent(card.getId()); diff --git a/Mage.Sets/src/mage/cards/n/NezumiShortfang.java b/Mage.Sets/src/mage/cards/n/NezumiShortfang.java index 2ae123ad16..a40a7193df 100644 --- a/Mage.Sets/src/mage/cards/n/NezumiShortfang.java +++ b/Mage.Sets/src/mage/cards/n/NezumiShortfang.java @@ -137,7 +137,8 @@ class StabwhiskerLoseLifeEffect extends OneShotEffect { class CardsInTargetOpponentHandCondition implements Condition { - public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO }; + public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO } + private Condition condition; private CountType type; private int count; diff --git a/Mage.Sets/src/mage/cards/n/NissaNaturesArtisan.java b/Mage.Sets/src/mage/cards/n/NissaNaturesArtisan.java index 9bffb54a45..170befcb90 100644 --- a/Mage.Sets/src/mage/cards/n/NissaNaturesArtisan.java +++ b/Mage.Sets/src/mage/cards/n/NissaNaturesArtisan.java @@ -109,7 +109,7 @@ class NissaNaturesArtisanEffect extends OneShotEffect { } Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 2)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.revealCards(sourceObject.getIdName(), cards, game); Set toBattlefield = new LinkedHashSet<>(); for (Card card : cards.getCards(new FilterLandCard(), source.getSourceId(), source.getControllerId(), game)) { diff --git a/Mage.Sets/src/mage/cards/n/NissaWorldwaker.java b/Mage.Sets/src/mage/cards/n/NissaWorldwaker.java index 22a4d7a10f..7cb8b2589a 100644 --- a/Mage.Sets/src/mage/cards/n/NissaWorldwaker.java +++ b/Mage.Sets/src/mage/cards/n/NissaWorldwaker.java @@ -117,7 +117,7 @@ class NissaWorldwakerSearchEffect extends OneShotEffect { } TargetCardInLibrary target = new TargetCardInLibrary(0, Integer.MAX_VALUE, new FilterBasicLandCard()); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/o/OrcishLibrarian.java b/Mage.Sets/src/mage/cards/o/OrcishLibrarian.java index 19327eb1ff..1c374256af 100644 --- a/Mage.Sets/src/mage/cards/o/OrcishLibrarian.java +++ b/Mage.Sets/src/mage/cards/o/OrcishLibrarian.java @@ -107,10 +107,10 @@ class OrcishLibrarianEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { for (int i = 0; i < 4; i++) { - if (cards.size() > 0) + if (!cards.isEmpty()) { Card card = cards.getRandom(game); player.moveCardToExileWithInfo(card, null, null, source.getId(), game, Zone.LIBRARY, true); @@ -119,7 +119,7 @@ class OrcishLibrarianEffect extends OneShotEffect { } player.lookAtCards("OrcishLibrarian", cards, game); TargetCard target = new TargetCard (Zone.LIBRARY, new FilterCard("card to put on the top of target player's library")); - while (player.canRespond() && cards.size() > 0) { + while (player.canRespond() && !cards.isEmpty()) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/PainfulMemories.java b/Mage.Sets/src/mage/cards/p/PainfulMemories.java index 35610e2544..f4d91414b5 100644 --- a/Mage.Sets/src/mage/cards/p/PainfulMemories.java +++ b/Mage.Sets/src/mage/cards/p/PainfulMemories.java @@ -90,7 +90,7 @@ class PainfulMemoriesEffect extends OneShotEffect { if (targetPlayer != null && you != null) { targetPlayer.revealCards("Painful Memories", targetPlayer.getHand(), game); - if (targetPlayer.getHand().size() > 0) { + if (!targetPlayer.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, new FilterCard()); if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) { Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/p/PanopticMirror.java b/Mage.Sets/src/mage/cards/p/PanopticMirror.java index aea3ef21da..9b200b3410 100644 --- a/Mage.Sets/src/mage/cards/p/PanopticMirror.java +++ b/Mage.Sets/src/mage/cards/p/PanopticMirror.java @@ -151,7 +151,7 @@ class PanopticMirrorCastEffect extends OneShotEffect { if (PanopticMirror == null) { PanopticMirror = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } - if (PanopticMirror != null && PanopticMirror.getImprinted() != null && PanopticMirror.getImprinted().size() > 0 && controller != null) { + if (PanopticMirror != null && PanopticMirror.getImprinted() != null && !PanopticMirror.getImprinted().isEmpty() && controller != null) { CardsImpl cards = new CardsImpl(); for(UUID uuid : PanopticMirror.getImprinted()){ Card card = game.getCard(uuid); diff --git a/Mage.Sets/src/mage/cards/p/Peregrination.java b/Mage.Sets/src/mage/cards/p/Peregrination.java index e6720de47b..207b133d07 100644 --- a/Mage.Sets/src/mage/cards/p/Peregrination.java +++ b/Mage.Sets/src/mage/cards/p/Peregrination.java @@ -101,7 +101,7 @@ class PeregrinationEffect extends OneShotEffect { } TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard()); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); diff --git a/Mage.Sets/src/mage/cards/p/PerishTheThought.java b/Mage.Sets/src/mage/cards/p/PerishTheThought.java index 2b55118e8d..aad7daa150 100644 --- a/Mage.Sets/src/mage/cards/p/PerishTheThought.java +++ b/Mage.Sets/src/mage/cards/p/PerishTheThought.java @@ -89,7 +89,7 @@ class PerishTheThoughtEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetOpponent = game.getPlayer(source.getFirstTarget()); if (targetOpponent != null) { - if (targetOpponent.getHand().size() > 0) { + if (!targetOpponent.getHand().isEmpty()) { targetOpponent.revealCards("Perish the Thought", targetOpponent.getHand(), game); Player you = game.getPlayer(source.getControllerId()); if (you != null) { diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java b/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java index 1e86090338..6af4f923ee 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java @@ -97,7 +97,7 @@ class PhyrexianDelverEffect extends OneShotEffect { if (creatureCard != null && controller != null) { boolean result = false; if (game.getState().getZone(creatureCard.getId()).equals(Zone.GRAVEYARD)) { - result = controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game);; + result = controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game); } controller.loseLife(creatureCard.getConvertedManaCost(), game, false); return result; diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianGrimoire.java b/Mage.Sets/src/mage/cards/p/PhyrexianGrimoire.java index b397e58158..bc9f1e3f85 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianGrimoire.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianGrimoire.java @@ -96,7 +96,7 @@ class PhyrexianGrimoireEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Player opponent = game.getPlayer(source.getFirstTarget()); if (controller != null && opponent != null) { - if(controller.getGraveyard().size() > 0) + if(!controller.getGraveyard().isEmpty()) { Cards cards = new CardsImpl(); diff --git a/Mage.Sets/src/mage/cards/p/PlaneswalkersFavor.java b/Mage.Sets/src/mage/cards/p/PlaneswalkersFavor.java index 4d8b53a07a..bfdc0a2bf9 100644 --- a/Mage.Sets/src/mage/cards/p/PlaneswalkersFavor.java +++ b/Mage.Sets/src/mage/cards/p/PlaneswalkersFavor.java @@ -92,7 +92,7 @@ class PlaneswalkersFavorEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(source.getTargets().get(0).getFirstTarget()); - if (opponent != null && opponent.getHand().size() > 0) { + if (opponent != null && !opponent.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = opponent.getHand().getRandom(game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/PlaneswalkersFury.java b/Mage.Sets/src/mage/cards/p/PlaneswalkersFury.java index 3b4fb8a6d7..ca92fba3da 100644 --- a/Mage.Sets/src/mage/cards/p/PlaneswalkersFury.java +++ b/Mage.Sets/src/mage/cards/p/PlaneswalkersFury.java @@ -83,7 +83,7 @@ class PlaneswalkersFuryEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(targetPointer.getFirst(game, source)); - if (opponent != null && opponent.getHand().size() > 0) { + if (opponent != null && !opponent.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = opponent.getHand().getRandom(game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/PlaneswalkersMirth.java b/Mage.Sets/src/mage/cards/p/PlaneswalkersMirth.java index 3c7b62b2bf..0e4783a325 100644 --- a/Mage.Sets/src/mage/cards/p/PlaneswalkersMirth.java +++ b/Mage.Sets/src/mage/cards/p/PlaneswalkersMirth.java @@ -84,7 +84,7 @@ class PlaneswalkersMirthEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(targetPointer.getFirst(game, source)); Player player = game.getPlayer(source.getControllerId()); - if (opponent != null && player!= null && opponent.getHand().size() > 0) { + if (opponent != null && player!= null && !opponent.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = opponent.getHand().getRandom(game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/PlaneswalkersScorn.java b/Mage.Sets/src/mage/cards/p/PlaneswalkersScorn.java index e5784acbb4..0d20028aee 100644 --- a/Mage.Sets/src/mage/cards/p/PlaneswalkersScorn.java +++ b/Mage.Sets/src/mage/cards/p/PlaneswalkersScorn.java @@ -92,7 +92,7 @@ class PlaneswalkersScornEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(source.getTargets().get(0).getFirstTarget()); - if (opponent != null && opponent.getHand().size() > 0) { + if (opponent != null && !opponent.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = opponent.getHand().getRandom(game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/PolukranosWorldEater.java b/Mage.Sets/src/mage/cards/p/PolukranosWorldEater.java index 5a4afb473f..420a70e748 100644 --- a/Mage.Sets/src/mage/cards/p/PolukranosWorldEater.java +++ b/Mage.Sets/src/mage/cards/p/PolukranosWorldEater.java @@ -129,7 +129,7 @@ class PolukranosWorldEaterEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { Target multiTarget = source.getTargets().get(0); Set permanents = new HashSet<>(); for (UUID target: multiTarget.getTargets()) { diff --git a/Mage.Sets/src/mage/cards/p/Polymorph.java b/Mage.Sets/src/mage/cards/p/Polymorph.java index bbdd68b73c..83c62f1d5b 100644 --- a/Mage.Sets/src/mage/cards/p/Polymorph.java +++ b/Mage.Sets/src/mage/cards/p/Polymorph.java @@ -109,7 +109,7 @@ class PolymorphEffect extends OneShotEffect { card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId()); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { player.revealCards("Polymorph", cards, game); Set cardsToShuffle = cards.getCards(game); cardsToShuffle.remove(card); diff --git a/Mage.Sets/src/mage/cards/p/PreeminentCaptain.java b/Mage.Sets/src/mage/cards/p/PreeminentCaptain.java index fc678157cc..4b059077ce 100644 --- a/Mage.Sets/src/mage/cards/p/PreeminentCaptain.java +++ b/Mage.Sets/src/mage/cards/p/PreeminentCaptain.java @@ -98,7 +98,7 @@ class PreeminentCaptainEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); TargetCardInHand target = new TargetCardInHand(filter); if (target.canChoose(player.getId(), game) && target.choose(getOutcome(), player.getId(), source.getSourceId(), game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID cardId = target.getFirstTarget(); Card card = player.getHand().get(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/ProteusStaff.java b/Mage.Sets/src/mage/cards/p/ProteusStaff.java index 89279bdc4b..257dea02e7 100644 --- a/Mage.Sets/src/mage/cards/p/ProteusStaff.java +++ b/Mage.Sets/src/mage/cards/p/ProteusStaff.java @@ -117,7 +117,7 @@ class ProteusStaffEffect extends OneShotEffect { controller.revealCards("Proteus Staff", cards, game); // and the rest on the bottom of his or her library in any order. - while (cards.size() > 0 && controller.canRespond()) { + while (!cards.isEmpty() && controller.canRespond()) { if (cards.size() == 1) { Card card = cards.get(cards.iterator().next(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/p/PrototypePortal.java b/Mage.Sets/src/mage/cards/p/PrototypePortal.java index a6e710e4da..2335153ab5 100644 --- a/Mage.Sets/src/mage/cards/p/PrototypePortal.java +++ b/Mage.Sets/src/mage/cards/p/PrototypePortal.java @@ -77,7 +77,7 @@ public class PrototypePortal extends CardImpl { public void adjustCosts(Ability ability, Game game) { Permanent card = game.getPermanent(ability.getSourceId()); if (card != null) { - if (card.getImprinted().size() > 0) { + if (!card.getImprinted().isEmpty()) { Card imprinted = game.getCard(card.getImprinted().get(0)); if (imprinted != null) { ability.getManaCostsToPay().add(0, new GenericManaCost(imprinted.getConvertedManaCost())); @@ -115,7 +115,7 @@ class PrototypePortalEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, StaticFilters.FILTER_CARD_ARTIFACT); controller.choose(Outcome.Benefit, controller.getHand(), target, game); Card card = controller.getHand().get(target.getFirstTarget(), game); @@ -162,7 +162,7 @@ class PrototypePortalCreateTokenEffect extends OneShotEffect { return false; } - if (permanent.getImprinted().size() > 0) { + if (!permanent.getImprinted().isEmpty()) { Card card = game.getCard(permanent.getImprinted().get(0)); if (card != null) { EmptyToken token = new EmptyToken(); diff --git a/Mage.Sets/src/mage/cards/p/PryingQuestions.java b/Mage.Sets/src/mage/cards/p/PryingQuestions.java index f5375d6990..dd4d76eaa1 100644 --- a/Mage.Sets/src/mage/cards/p/PryingQuestions.java +++ b/Mage.Sets/src/mage/cards/p/PryingQuestions.java @@ -88,7 +88,7 @@ class PryingQuestionsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetOpponent = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetOpponent != null) { - if (targetOpponent.getHand().size() > 0) { + if (!targetOpponent.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); target.setNotTarget(true); target.setTargetName("a card from your hand to put on top of your library"); diff --git a/Mage.Sets/src/mage/cards/q/QasaliAmbusher.java b/Mage.Sets/src/mage/cards/q/QasaliAmbusher.java index 4d83300785..a229767c96 100644 --- a/Mage.Sets/src/mage/cards/q/QasaliAmbusher.java +++ b/Mage.Sets/src/mage/cards/q/QasaliAmbusher.java @@ -107,8 +107,8 @@ class QasaliAmbusherAbility extends ActivatedAbilityImpl { @Override public boolean canActivate(UUID playerId, Game game) { if (super.canActivate(playerId, game)) { - if (game.getBattlefield().getActivePermanents(filterPlains, this.getControllerId(), this.getSourceId(), game).size() > 0 - && game.getBattlefield().getActivePermanents(filterForest, this.getControllerId(), this.getSourceId(), game).size() > 0) { + if (!game.getBattlefield().getActivePermanents(filterPlains, this.getControllerId(), this.getSourceId(), game).isEmpty() + && !game.getBattlefield().getActivePermanents(filterForest, this.getControllerId(), this.getSourceId(), game).isEmpty()) { for (CombatGroup group : game.getCombat().getGroups()) { if (getControllerId().equals(group.getDefenderId())) { return true; diff --git a/Mage.Sets/src/mage/cards/q/QuietSpeculation.java b/Mage.Sets/src/mage/cards/q/QuietSpeculation.java index 96b1aaeeec..1eb466e8ae 100644 --- a/Mage.Sets/src/mage/cards/q/QuietSpeculation.java +++ b/Mage.Sets/src/mage/cards/q/QuietSpeculation.java @@ -97,7 +97,7 @@ class SearchLibraryPutInGraveEffect extends SearchEffect { Player controller = game.getPlayer(source.getControllerId()); UUID targetPlayerID = source.getFirstTarget(); if (controller != null && targetPlayerID != null && controller.searchLibrary(target, game, targetPlayerID)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(target.getTargets()); controller.revealCards("Quiet Speculation", cards, game); controller.moveCards(cards, Zone.GRAVEYARD, source, game); diff --git a/Mage.Sets/src/mage/cards/r/RealmsUncharted.java b/Mage.Sets/src/mage/cards/r/RealmsUncharted.java index bc14505632..274d366bb7 100644 --- a/Mage.Sets/src/mage/cards/r/RealmsUncharted.java +++ b/Mage.Sets/src/mage/cards/r/RealmsUncharted.java @@ -98,7 +98,7 @@ class RealmsUnchartedEffect extends OneShotEffect { RealmsUnchartedTarget target = new RealmsUnchartedTarget(); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); diff --git a/Mage.Sets/src/mage/cards/r/ReflectingPool.java b/Mage.Sets/src/mage/cards/r/ReflectingPool.java index f9326c079a..11f6e8f7a8 100644 --- a/Mage.Sets/src/mage/cards/r/ReflectingPool.java +++ b/Mage.Sets/src/mage/cards/r/ReflectingPool.java @@ -139,7 +139,7 @@ class ReflectingPoolEffect extends ManaEffect { choice.getChoices().add("White"); choice.getChoices().add("Colorless"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); diff --git a/Mage.Sets/src/mage/cards/r/RenownedWeaponsmith.java b/Mage.Sets/src/mage/cards/r/RenownedWeaponsmith.java index f66539f6af..11dec6ef28 100644 --- a/Mage.Sets/src/mage/cards/r/RenownedWeaponsmith.java +++ b/Mage.Sets/src/mage/cards/r/RenownedWeaponsmith.java @@ -144,7 +144,7 @@ class RenownedWeaponsmithEffect extends OneShotEffect { if (sourceObject != null && controller != null) { TargetCardInLibrary target = new TargetCardInLibrary(filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = game.getCard(target.getFirstTarget()); Cards revealed = new CardsImpl(); revealed.add(card); diff --git a/Mage.Sets/src/mage/cards/r/Reweave.java b/Mage.Sets/src/mage/cards/r/Reweave.java index 224d657aad..edee2c3a17 100644 --- a/Mage.Sets/src/mage/cards/r/Reweave.java +++ b/Mage.Sets/src/mage/cards/r/Reweave.java @@ -125,7 +125,7 @@ class ReweaveEffect extends OneShotEffect { permanentController.moveCards(card, Zone.BATTLEFIELD, source, game); } - if (cards.size() > 0) { + if (!cards.isEmpty()) { permanentController.revealCards(sourceObject.getIdName(), cards, game); if (cardFound && card != null) { cards.remove(card); diff --git a/Mage.Sets/src/mage/cards/r/RiseFall.java b/Mage.Sets/src/mage/cards/r/RiseFall.java index 3616f693d3..6c8f8bd8e5 100644 --- a/Mage.Sets/src/mage/cards/r/RiseFall.java +++ b/Mage.Sets/src/mage/cards/r/RiseFall.java @@ -137,7 +137,7 @@ class FallEffect extends OneShotEffect { if (controller != null) { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { - if (targetPlayer.getHand().size() > 0) { + if (!targetPlayer.getHand().isEmpty()) { Cards cards = new CardsImpl(); Card card = targetPlayer.getHand().getRandom(game); cards.add(card); diff --git a/Mage.Sets/src/mage/cards/r/RoninWarclub.java b/Mage.Sets/src/mage/cards/r/RoninWarclub.java index cddbdadda7..a6684af41e 100644 --- a/Mage.Sets/src/mage/cards/r/RoninWarclub.java +++ b/Mage.Sets/src/mage/cards/r/RoninWarclub.java @@ -100,7 +100,7 @@ public class RoninWarclub extends CardImpl { if (!this.getTargets().isEmpty()) { // remove previous target - if (this.getTargets().get(0).getTargets().size() > 0) { + if (!this.getTargets().get(0).getTargets().isEmpty()) { this.getTargets().clear(); this.addTarget(new TargetCreaturePermanent()); } diff --git a/Mage.Sets/src/mage/cards/r/RootwaterThief.java b/Mage.Sets/src/mage/cards/r/RootwaterThief.java index 99b4037829..efbdd7ffdd 100644 --- a/Mage.Sets/src/mage/cards/r/RootwaterThief.java +++ b/Mage.Sets/src/mage/cards/r/RootwaterThief.java @@ -102,7 +102,7 @@ class RootwaterThiefEffect extends OneShotEffect { { TargetCardInLibrary target = new TargetCardInLibrary(); if (controller.searchLibrary(target, game, damagedPlayer.getId())) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = damagedPlayer.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true); diff --git a/Mage.Sets/src/mage/cards/s/SadisticAugermage.java b/Mage.Sets/src/mage/cards/s/SadisticAugermage.java index 1e2c4033e1..25512c88b5 100644 --- a/Mage.Sets/src/mage/cards/s/SadisticAugermage.java +++ b/Mage.Sets/src/mage/cards/s/SadisticAugermage.java @@ -92,7 +92,7 @@ class WidespreadPanicEffect extends OneShotEffect { for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - if (player.getHand().size() > 0) { + if (!player.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); target.setTargetName("a card from your hand to put on top of your library"); player.choose(Outcome.Detriment, target, source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/cards/s/SanguinePraetor.java b/Mage.Sets/src/mage/cards/s/SanguinePraetor.java index b30de0ca5a..ab972b0fc4 100644 --- a/Mage.Sets/src/mage/cards/s/SanguinePraetor.java +++ b/Mage.Sets/src/mage/cards/s/SanguinePraetor.java @@ -92,7 +92,7 @@ class SanguinePraetorEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int cmc = 0; for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { cmc = ((SacrificeTargetCost) cost).getPermanents().get(0).getConvertedManaCost(); break; } diff --git a/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java b/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java index 4a90ae0a6c..bd1bc9cf55 100644 --- a/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java +++ b/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java @@ -183,7 +183,7 @@ class SasayasEssenceManaEffectEffect extends ManaEffect { choice.getChoices().add("Colorless"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Mana newMana = new Mana(); for (int i = 0; i < count; i++) { choice.clearChoice(); diff --git a/Mage.Sets/src/mage/cards/s/SavageSummoning.java b/Mage.Sets/src/mage/cards/s/SavageSummoning.java index 1633ecd3f6..5923ea13f3 100644 --- a/Mage.Sets/src/mage/cards/s/SavageSummoning.java +++ b/Mage.Sets/src/mage/cards/s/SavageSummoning.java @@ -151,7 +151,6 @@ class SavageSummoningAsThoughEffect extends AsThoughEffectImpl { class SavageSummoningWatcher extends Watcher { private Set savageSummoningSpells = new HashSet<>(); - ; private Map> spellsCastWithSavageSummoning = new LinkedHashMap<>(); private Map> cardsCastWithSavageSummoning = new LinkedHashMap<>(); diff --git a/Mage.Sets/src/mage/cards/s/SecretSalvage.java b/Mage.Sets/src/mage/cards/s/SecretSalvage.java index 113581f721..bb8e34288e 100644 --- a/Mage.Sets/src/mage/cards/s/SecretSalvage.java +++ b/Mage.Sets/src/mage/cards/s/SecretSalvage.java @@ -101,7 +101,7 @@ class SecretSalvageEffect extends OneShotEffect { nameFilter.add(new NamePredicate(targetCard.getName())); TargetCardInLibrary target = new TargetCardInLibrary(0, Integer.MAX_VALUE, nameFilter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().remove(cardId, game); diff --git a/Mage.Sets/src/mage/cards/s/SeeBeyond.java b/Mage.Sets/src/mage/cards/s/SeeBeyond.java index c0db7992f8..bc2c47236b 100644 --- a/Mage.Sets/src/mage/cards/s/SeeBeyond.java +++ b/Mage.Sets/src/mage/cards/s/SeeBeyond.java @@ -79,7 +79,7 @@ class SeeBeyondEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); controller.drawCards(2, game); - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, new FilterCard("card to shuffle into your library")); controller.choose(Outcome.Detriment, controller.getHand(), target, game); Card card = controller.getHand().get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/s/SemblanceAnvil.java b/Mage.Sets/src/mage/cards/s/SemblanceAnvil.java index f514d966f2..a1c0dee10e 100644 --- a/Mage.Sets/src/mage/cards/s/SemblanceAnvil.java +++ b/Mage.Sets/src/mage/cards/s/SemblanceAnvil.java @@ -90,7 +90,7 @@ class SemblanceAnvilEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - if (player.getHand().size() > 0) { + if (!player.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, filter); player.choose(Outcome.Benefit, player.getHand(), target, game); Card card = player.getHand().get(target.getFirstTarget(), game); @@ -141,7 +141,7 @@ class SemblanceAnvilCostReductionEffect extends CostModificationEffectImpl { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { List imprinted = permanent.getImprinted(); - if (imprinted.size() > 0) { + if (!imprinted.isEmpty()) { Card imprintedCard = game.getCard(imprinted.get(0)); if (imprintedCard != null && CardUtil.shareTypes(imprintedCard, sourceCard)) { return true; diff --git a/Mage.Sets/src/mage/cards/s/SerrasSanctum.java b/Mage.Sets/src/mage/cards/s/SerrasSanctum.java index 0f6c12cc3d..f29332aa91 100644 --- a/Mage.Sets/src/mage/cards/s/SerrasSanctum.java +++ b/Mage.Sets/src/mage/cards/s/SerrasSanctum.java @@ -45,7 +45,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate; public class SerrasSanctum extends CardImpl { - private static final FilterControlledPermanent filter = new FilterControlledPermanent("enchantment you control");; + private static final FilterControlledPermanent filter = new FilterControlledPermanent("enchantment you control"); static { filter.add(new CardTypePredicate(CardType.ENCHANTMENT)); diff --git a/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java b/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java index 0e6b52f772..3128c1187f 100644 --- a/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java +++ b/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java @@ -113,7 +113,7 @@ class ShimatsuTheBloodcloakedEffect extends ReplacementEffectImpl { return false; } controller.chooseTarget(Outcome.Detriment, target, source, game); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { int sacrificedCreatures = target.getTargets().size(); game.informPlayers(controller.getLogName() + " sacrifices " + sacrificedCreatures + " creatures for " + creature.getLogName()); for (UUID targetId : target.getTargets()) { diff --git a/Mage.Sets/src/mage/cards/s/SignalTheClans.java b/Mage.Sets/src/mage/cards/s/SignalTheClans.java index e244e8912e..3841b82410 100644 --- a/Mage.Sets/src/mage/cards/s/SignalTheClans.java +++ b/Mage.Sets/src/mage/cards/s/SignalTheClans.java @@ -94,7 +94,7 @@ class SignalTheClansEffect extends SearchEffect { } //Search your library for three creature cards if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(); for (UUID cardId: (List)target.getTargets()) { Card card = player.getLibrary().remove(cardId, game); diff --git a/Mage.Sets/src/mage/cards/s/SilentBladeOni.java b/Mage.Sets/src/mage/cards/s/SilentBladeOni.java index 6ce471816e..b34542386e 100644 --- a/Mage.Sets/src/mage/cards/s/SilentBladeOni.java +++ b/Mage.Sets/src/mage/cards/s/SilentBladeOni.java @@ -101,7 +101,7 @@ class SilentBladeOniEffect extends OneShotEffect { if (opponent != null && controller != null) { Cards cardsInHand = new CardsImpl(); cardsInHand.addAll(opponent.getHand()); - if (cardsInHand.size() > 0) { + if (!cardsInHand.isEmpty()) { TargetCard target = new TargetCard(1, Zone.HAND, new FilterNonlandCard()); if (controller.chooseTarget(outcome, cardsInHand, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java b/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java index 4e1f706e01..35ac026dc9 100644 --- a/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java +++ b/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java @@ -92,7 +92,7 @@ class SkyshipWeatherlightEffect extends SearchEffect { if (sourceObject != null && controller != null) { if (controller.searchLibrary(target, game)) { UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardID : target.getTargets()) { Card card = controller.getLibrary().getCard(cardID, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/s/SlumberingTora.java b/Mage.Sets/src/mage/cards/s/SlumberingTora.java index 8b6c8ed60d..5cfbe12df7 100644 --- a/Mage.Sets/src/mage/cards/s/SlumberingTora.java +++ b/Mage.Sets/src/mage/cards/s/SlumberingTora.java @@ -106,7 +106,7 @@ public class SlumberingTora extends CardImpl { if (sublayer == SubLayer.SetPT_7b) { int convManaCosts = 0; for (Cost cost: source.getCosts()) { - if (cost instanceof DiscardTargetCost && ((DiscardTargetCost)cost).getCards().size() > 0) { + if (cost instanceof DiscardTargetCost && !((DiscardTargetCost) cost).getCards().isEmpty()) { convManaCosts = ((DiscardTargetCost)cost).getCards().get(0).getConvertedManaCost(); break; } diff --git a/Mage.Sets/src/mage/cards/s/SoldeviSage.java b/Mage.Sets/src/mage/cards/s/SoldeviSage.java index fbc56bb837..cffd08ee12 100644 --- a/Mage.Sets/src/mage/cards/s/SoldeviSage.java +++ b/Mage.Sets/src/mage/cards/s/SoldeviSage.java @@ -108,7 +108,7 @@ class SoldeviSageEffect extends OneShotEffect { } } - if (drawnCards.size() > 0) { + if (!drawnCards.isEmpty()) { TargetCard cardToDiscard = new TargetCard(Zone.HAND, new FilterCard("card to discard")); cardToDiscard.setNotTarget(true); if (player.choose(Outcome.Discard, drawnCards, cardToDiscard, game)) { diff --git a/Mage.Sets/src/mage/cards/s/SoulFoundry.java b/Mage.Sets/src/mage/cards/s/SoulFoundry.java index 1b2c712dba..c2cf92f80f 100644 --- a/Mage.Sets/src/mage/cards/s/SoulFoundry.java +++ b/Mage.Sets/src/mage/cards/s/SoulFoundry.java @@ -81,7 +81,7 @@ public class SoulFoundry extends CardImpl { if (ability instanceof SimpleActivatedAbility) { Permanent sourcePermanent = game.getPermanent(ability.getSourceId()); if (sourcePermanent != null) { - if (sourcePermanent.getImprinted().size() > 0) { + if (!sourcePermanent.getImprinted().isEmpty()) { Card imprinted = game.getCard(sourcePermanent.getImprinted().get(0)); if (imprinted != null) { ability.getManaCostsToPay().clear(); @@ -127,7 +127,7 @@ class SoulFoundryImprintEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, filter); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.Benefit, controller.getHand(), target, game)) { diff --git a/Mage.Sets/src/mage/cards/s/Spellbinder.java b/Mage.Sets/src/mage/cards/s/Spellbinder.java index 482c7e4d19..1134a3b661 100644 --- a/Mage.Sets/src/mage/cards/s/Spellbinder.java +++ b/Mage.Sets/src/mage/cards/s/Spellbinder.java @@ -137,7 +137,7 @@ class SpellbinderImprintEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, filter); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.Benefit, controller.getHand(), target, game)) { diff --git a/Mage.Sets/src/mage/cards/s/Spellshift.java b/Mage.Sets/src/mage/cards/s/Spellshift.java index b33b9200fe..ca5d31fb2a 100644 --- a/Mage.Sets/src/mage/cards/s/Spellshift.java +++ b/Mage.Sets/src/mage/cards/s/Spellshift.java @@ -111,7 +111,7 @@ class SpellshiftEffect extends OneShotEffect { } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { library.addAll(cards.getCards(game), game); } } diff --git a/Mage.Sets/src/mage/cards/s/SpiritOfResistance.java b/Mage.Sets/src/mage/cards/s/SpiritOfResistance.java index b7aad6b8fb..0cde764d31 100644 --- a/Mage.Sets/src/mage/cards/s/SpiritOfResistance.java +++ b/Mage.Sets/src/mage/cards/s/SpiritOfResistance.java @@ -79,7 +79,7 @@ class SpiritOfResistanceCondition implements Condition { public static SpiritOfResistanceCondition getInstance() { return fInstance; - }; + } private SpiritOfResistanceCondition() {} diff --git a/Mage.Sets/src/mage/cards/s/SquanderedResources.java b/Mage.Sets/src/mage/cards/s/SquanderedResources.java index 4d6f3b42fd..89893b24c2 100644 --- a/Mage.Sets/src/mage/cards/s/SquanderedResources.java +++ b/Mage.Sets/src/mage/cards/s/SquanderedResources.java @@ -128,7 +128,7 @@ class SquanderedResourcesEffect extends ManaEffect { choice.getChoices().add("White"); choice.getChoices().add("Colorless"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); @@ -194,7 +194,7 @@ class SquanderedResourcesEffect extends ManaEffect { Mana types = new Mana(); for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { Permanent land = ((SacrificeTargetCost) cost).getPermanents().get(0); if (land != null) { Abilities manaAbilities = land.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD); diff --git a/Mage.Sets/src/mage/cards/s/StarCompass.java b/Mage.Sets/src/mage/cards/s/StarCompass.java index 0a699f3807..1bf4c6f8c9 100644 --- a/Mage.Sets/src/mage/cards/s/StarCompass.java +++ b/Mage.Sets/src/mage/cards/s/StarCompass.java @@ -146,7 +146,7 @@ class StarCompassManaEffect extends ManaEffect { choice.getChoices().add("White"); choice.getChoices().add("Colorless"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); diff --git a/Mage.Sets/src/mage/cards/s/StarlitSanctum.java b/Mage.Sets/src/mage/cards/s/StarlitSanctum.java index 1efbe9f249..1caded637b 100644 --- a/Mage.Sets/src/mage/cards/s/StarlitSanctum.java +++ b/Mage.Sets/src/mage/cards/s/StarlitSanctum.java @@ -96,7 +96,7 @@ class StarlitSanctumWhiteEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = 0; for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue(); break; } @@ -132,7 +132,7 @@ class StarlitSanctumBlackEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int amount = 0; for (Cost cost : source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) { + if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue(); break; } diff --git a/Mage.Sets/src/mage/cards/s/SteelcladSerpent.java b/Mage.Sets/src/mage/cards/s/SteelcladSerpent.java index 731a104d4b..88b6413f6b 100644 --- a/Mage.Sets/src/mage/cards/s/SteelcladSerpent.java +++ b/Mage.Sets/src/mage/cards/s/SteelcladSerpent.java @@ -102,7 +102,7 @@ class SteelcladSerpentEffect extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.getId().equals(source.getSourceId())) { - if (game.getBattlefield().getActivePermanents(filter, source.getControllerId(), permanent.getId(), game).size() > 0) { + if (!game.getBattlefield().getActivePermanents(filter, source.getControllerId(), permanent.getId(), game).isEmpty()) { return false; } return true; diff --git a/Mage.Sets/src/mage/cards/s/StompingSlabs.java b/Mage.Sets/src/mage/cards/s/StompingSlabs.java index c75f72b98e..e40c876495 100644 --- a/Mage.Sets/src/mage/cards/s/StompingSlabs.java +++ b/Mage.Sets/src/mage/cards/s/StompingSlabs.java @@ -90,7 +90,7 @@ class StompingSlabsEffect extends OneShotEffect { if (controller != null) { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 7)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.revealCards("Stomping Slabs", cards, game); boolean stompingSlabsFound = false; for (UUID cardId : cards) { diff --git a/Mage.Sets/src/mage/cards/s/StrataScythe.java b/Mage.Sets/src/mage/cards/s/StrataScythe.java index 83ca064d59..54d661c597 100644 --- a/Mage.Sets/src/mage/cards/s/StrataScythe.java +++ b/Mage.Sets/src/mage/cards/s/StrataScythe.java @@ -95,7 +95,7 @@ class StrataScytheImprintEffect extends OneShotEffect { return false; TargetCardInLibrary target = new TargetCardInLibrary(new FilterLandCard()); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { UUID cardId = target.getTargets().get(0); Card card = player.getLibrary().remove(cardId, game); if (card != null) { @@ -132,7 +132,7 @@ class SameNameAsExiledCountValue implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { int value = 0; Permanent permanent = game.getPermanent(sourceAbility.getSourceId()); - if (permanent != null && permanent.getImprinted().size() > 0) { + if (permanent != null && !permanent.getImprinted().isEmpty()) { FilterPermanent filterPermanent = new FilterPermanent(); filterPermanent.add(new NamePredicate(game.getCard(permanent.getImprinted().get(0)).getName())); value = game.getBattlefield().count(filterPermanent, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); diff --git a/Mage.Sets/src/mage/cards/s/StrategicPlanning.java b/Mage.Sets/src/mage/cards/s/StrategicPlanning.java index d4717c34cd..3318cba98e 100644 --- a/Mage.Sets/src/mage/cards/s/StrategicPlanning.java +++ b/Mage.Sets/src/mage/cards/s/StrategicPlanning.java @@ -90,7 +90,7 @@ class StrategicPlanningEffect extends OneShotEffect { if (controller != null) { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 3)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.lookAtCards("Strategic Planning", cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand")); if (controller.choose(Outcome.Benefit, cards, target, game)) { diff --git a/Mage.Sets/src/mage/cards/s/StripBare.java b/Mage.Sets/src/mage/cards/s/StripBare.java index 13e8a81d5e..e62468c9ed 100644 --- a/Mage.Sets/src/mage/cards/s/StripBare.java +++ b/Mage.Sets/src/mage/cards/s/StripBare.java @@ -92,7 +92,7 @@ class StripBareEffect extends OneShotEffect { new SubtypePredicate("Aura"))); Permanent targetCreature = game.getPermanent(source.getFirstTarget()); if (targetCreature != null - && targetCreature.getAttachments().size() > 0) { + && !targetCreature.getAttachments().isEmpty()) { for (Permanent attachment : game.getBattlefield().getAllActivePermanents(filter, game)) { if (attachment != null && targetCreature.getAttachments().contains(attachment.getId())) { diff --git a/Mage.Sets/src/mage/cards/s/StrongholdGambit.java b/Mage.Sets/src/mage/cards/s/StrongholdGambit.java index f1b9620544..13301cdcdd 100644 --- a/Mage.Sets/src/mage/cards/s/StrongholdGambit.java +++ b/Mage.Sets/src/mage/cards/s/StrongholdGambit.java @@ -92,7 +92,7 @@ class StrongholdGambitEffect extends OneShotEffect { Map choosenCard = new LinkedHashMap<>(); for (UUID playerId : game.getState().getPlayerList(controller.getId())) { Player player = game.getPlayer(playerId); - if (player != null && player.getHand().size() > 0) { + if (player != null && !player.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); if (player.choose(Outcome.Benefit, target, source.getSourceId(), game)) { choosenCard.put(playerId, target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/s/SuddenDisappearance.java b/Mage.Sets/src/mage/cards/s/SuddenDisappearance.java index 4a4581d7c2..3deff653c2 100644 --- a/Mage.Sets/src/mage/cards/s/SuddenDisappearance.java +++ b/Mage.Sets/src/mage/cards/s/SuddenDisappearance.java @@ -93,7 +93,7 @@ class SuddenDisappearanceEffect extends OneShotEffect { MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { Set permsSet = new HashSet<>(game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget(), game)); - if (permsSet.size() > 0) { + if (!permsSet.isEmpty()) { controller.moveCardsToExile(permsSet, source, game, true, source.getSourceId(), sourceObject.getIdName()); Cards targets = new CardsImpl(); for (Card card : permsSet) { diff --git a/Mage.Sets/src/mage/cards/s/SultaiSoothsayer.java b/Mage.Sets/src/mage/cards/s/SultaiSoothsayer.java index fa4ea972a6..4a49263699 100644 --- a/Mage.Sets/src/mage/cards/s/SultaiSoothsayer.java +++ b/Mage.Sets/src/mage/cards/s/SultaiSoothsayer.java @@ -97,7 +97,7 @@ class SultaiSoothsayerEffect extends OneShotEffect { if (controller != null && sourceObject != null) { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 4)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.lookAtCards(sourceObject.getName(), cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand")); if (controller.choose(Outcome.Benefit, cards, target, game)) { diff --git a/Mage.Sets/src/mage/cards/s/SummonersEgg.java b/Mage.Sets/src/mage/cards/s/SummonersEgg.java index e371ae4940..e92603be7d 100644 --- a/Mage.Sets/src/mage/cards/s/SummonersEgg.java +++ b/Mage.Sets/src/mage/cards/s/SummonersEgg.java @@ -90,7 +90,7 @@ class SummonersEggImprintEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null) { - if (controller.getHand().size() > 0) { + if (!controller.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, new FilterCard()); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.Benefit, controller.getHand(), target, game)) { diff --git a/Mage.Sets/src/mage/cards/s/SummoningTrap.java b/Mage.Sets/src/mage/cards/s/SummoningTrap.java index e56ca4b7c9..28829addab 100644 --- a/Mage.Sets/src/mage/cards/s/SummoningTrap.java +++ b/Mage.Sets/src/mage/cards/s/SummoningTrap.java @@ -183,7 +183,7 @@ class SummoningTrapEffect extends OneShotEffect { controller.moveCards(card, Zone.BATTLEFIELD, source, game); } } - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.putCardsOnBottomOfLibrary(cards, game, source, true); } } diff --git a/Mage.Sets/src/mage/cards/s/SuturedGhoul.java b/Mage.Sets/src/mage/cards/s/SuturedGhoul.java index eb2dd94dcd..58eb9dda62 100644 --- a/Mage.Sets/src/mage/cards/s/SuturedGhoul.java +++ b/Mage.Sets/src/mage/cards/s/SuturedGhoul.java @@ -106,7 +106,7 @@ class SuturedGhoulEffect extends OneShotEffect { if (permanent == null) { return false; } - if (controller.getGraveyard().size() > 0) { + if (!controller.getGraveyard().isEmpty()) { TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, new FilterCreatureCard("creature cards from your graveyard")); if (controller.chooseTarget(Outcome.Benefit, target, source, game)) { int count = 0; diff --git a/Mage.Sets/src/mage/cards/s/SyphonMind.java b/Mage.Sets/src/mage/cards/s/SyphonMind.java index 2639d65a90..6c4622419f 100644 --- a/Mage.Sets/src/mage/cards/s/SyphonMind.java +++ b/Mage.Sets/src/mage/cards/s/SyphonMind.java @@ -89,7 +89,7 @@ class SyphonMindEffect extends OneShotEffect { for (UUID playerId : you.getInRange()) { if (!playerId.equals(source.getControllerId())) { Player otherPlayer = game.getPlayer(playerId); - if (otherPlayer != null && otherPlayer.getHand().size() > 0) { + if (otherPlayer != null && !otherPlayer.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); if (otherPlayer.choose(Outcome.Discard, target, source.getSourceId(), game)) { Card card = game.getCard(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/t/TalentOfTheTelepath.java b/Mage.Sets/src/mage/cards/t/TalentOfTheTelepath.java index 7294433ad6..67d4da6078 100644 --- a/Mage.Sets/src/mage/cards/t/TalentOfTheTelepath.java +++ b/Mage.Sets/src/mage/cards/t/TalentOfTheTelepath.java @@ -111,7 +111,7 @@ class TalentOfTheTelepathEffect extends OneShotEffect { } } // cast an instant or sorcery for free - if (cardsToCast.size() > 0) { + if (!cardsToCast.isEmpty()) { int numberOfSpells = 1; if (SpellMasteryCondition.getInstance().apply(game, source)) { numberOfSpells++; @@ -122,7 +122,7 @@ class TalentOfTheTelepathEffect extends OneShotEffect { TargetCard target = new TargetCard(Zone.LIBRARY, filter); // zone should be ignored here target.setNotTarget(true); while (numberOfSpells > 0 - && cardsToCast.size() > 0 + && !cardsToCast.isEmpty() && controller.chooseUse(outcome, "Cast an instant or sorcery card from among them for free?", source, game) && controller.choose(outcome, cardsToCast, target, game)) { Card card = cardsToCast.get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/t/TemptWithReflections.java b/Mage.Sets/src/mage/cards/t/TemptWithReflections.java index 5c2ae9ed00..ad80e9bc86 100644 --- a/Mage.Sets/src/mage/cards/t/TemptWithReflections.java +++ b/Mage.Sets/src/mage/cards/t/TemptWithReflections.java @@ -116,7 +116,7 @@ class TemptWithReflectionsEffect extends OneShotEffect { effect.apply(game, source); } - if (playersSaidYes.size() > 0) { + if (!playersSaidYes.isEmpty()) { effect = new PutTokenOntoBattlefieldCopyTargetEffect(); effect.setTargetPointer(getTargetPointer()); effect.apply(game, source); diff --git a/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java b/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java index e03ce71e6b..7cc2779d3c 100644 --- a/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java +++ b/Mage.Sets/src/mage/cards/t/TestamentOfFaith.java @@ -109,7 +109,7 @@ class TestamentOfFaithBecomesCreatureSourceEffect extends ContinuousEffectImpl i switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { - if (token.getCardType().size() > 0) { + if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); @@ -119,7 +119,7 @@ class TestamentOfFaithBecomesCreatureSourceEffect extends ContinuousEffectImpl i if ("".equals(type) || type == null) { permanent.getSubtype(game).clear(); } - if (token.getSubtype(game).size() > 0) { + if (!token.getSubtype(game).isEmpty()) { permanent.getSubtype(game).addAll(token.getSubtype(game)); } } @@ -133,7 +133,7 @@ class TestamentOfFaithBecomesCreatureSourceEffect extends ContinuousEffectImpl i break; case AbilityAddingRemovingEffects_6: if (sublayer == SubLayer.NA) { - if (token.getAbilities().size() > 0) { + if (!token.getAbilities().isEmpty()) { for (Ability ability: token.getAbilities()) { permanent.addAbility(ability, source.getSourceId(), game, false); } diff --git a/Mage.Sets/src/mage/cards/t/ThadaAdelAcquisitor.java b/Mage.Sets/src/mage/cards/t/ThadaAdelAcquisitor.java index b25cdc5950..c9a9bf02f6 100644 --- a/Mage.Sets/src/mage/cards/t/ThadaAdelAcquisitor.java +++ b/Mage.Sets/src/mage/cards/t/ThadaAdelAcquisitor.java @@ -103,7 +103,7 @@ class ThadaAdelAcquisitorEffect extends OneShotEffect { } TargetCardInLibrary target = new TargetCardInLibrary(new FilterArtifactCard()); if (controller.searchLibrary(target, game, damagedPlayer.getId())) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = damagedPlayer.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); diff --git a/Mage.Sets/src/mage/cards/t/ThoughtGorger.java b/Mage.Sets/src/mage/cards/t/ThoughtGorger.java index 30901e7944..e5f460f1d7 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtGorger.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtGorger.java @@ -99,7 +99,7 @@ class ThoughtGorgerEffectEnters extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent thoughtGorger = game.getPermanent(source.getSourceId()); - if (player != null && player.getHand().size() > 0 && thoughtGorger != null ) { + if (player != null && !player.getHand().isEmpty() && thoughtGorger != null ) { int cardsInHand = player.getHand().size(); thoughtGorger.addCounters(CounterType.P1P1.createInstance(cardsInHand), source, game); player.discard(cardsInHand, false, source, game); diff --git a/Mage.Sets/src/mage/cards/t/ThoughtpickerWitch.java b/Mage.Sets/src/mage/cards/t/ThoughtpickerWitch.java index f0dd5f9c50..44345b0320 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtpickerWitch.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtpickerWitch.java @@ -105,7 +105,7 @@ class ThoughtpickerWitchEffect extends OneShotEffect { if (controller != null && opponent != null) { Cards cards = new CardsImpl(); cards.addAll(opponent.getLibrary().getTopCards(game, 2)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { TargetCard target = new TargetCardInLibrary(new FilterCard("card to exile")); if (controller.choose(Outcome.Exile, cards, target, game)) { Card card = cards.get(target.getFirstTarget(), game); diff --git a/Mage.Sets/src/mage/cards/t/TransmuteArtifact.java b/Mage.Sets/src/mage/cards/t/TransmuteArtifact.java index deefc68378..9372da3348 100644 --- a/Mage.Sets/src/mage/cards/t/TransmuteArtifact.java +++ b/Mage.Sets/src/mage/cards/t/TransmuteArtifact.java @@ -105,7 +105,7 @@ class TransmuteArtifactEffect extends SearchEffect { } //If you do, search your library for an artifact card. if (sacrifice && controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId : target.getTargets()) { Card card = controller.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/v/VastwoodHydra.java b/Mage.Sets/src/mage/cards/v/VastwoodHydra.java index b3245f7864..59a59a5223 100644 --- a/Mage.Sets/src/mage/cards/v/VastwoodHydra.java +++ b/Mage.Sets/src/mage/cards/v/VastwoodHydra.java @@ -104,7 +104,7 @@ class VastwoodHydraDistributeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { Target multiTarget = source.getTargets().get(0); for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); diff --git a/Mage.Sets/src/mage/cards/v/VerdelothTheAncient.java b/Mage.Sets/src/mage/cards/v/VerdelothTheAncient.java index 2f2bc85cc6..a2424fdb7d 100644 --- a/Mage.Sets/src/mage/cards/v/VerdelothTheAncient.java +++ b/Mage.Sets/src/mage/cards/v/VerdelothTheAncient.java @@ -124,10 +124,10 @@ class GetKickerXValue implements DynamicValue { @Override public String toString() { return "X"; - }; + } @Override public String getMessage() { return "X"; - }; + } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/v/VeteranExplorer.java b/Mage.Sets/src/mage/cards/v/VeteranExplorer.java index 958639aa48..f0c740eda3 100644 --- a/Mage.Sets/src/mage/cards/v/VeteranExplorer.java +++ b/Mage.Sets/src/mage/cards/v/VeteranExplorer.java @@ -117,7 +117,7 @@ class VeteranExplorerEffect extends OneShotEffect { usingPlayers.add(player); TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard()); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { for (UUID cardId: (List)target.getTargets()) { Card card = player.getLibrary().getCard(cardId, game); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/w/WaveOfVitriol.java b/Mage.Sets/src/mage/cards/w/WaveOfVitriol.java index a79673bde5..e4addada03 100644 --- a/Mage.Sets/src/mage/cards/w/WaveOfVitriol.java +++ b/Mage.Sets/src/mage/cards/w/WaveOfVitriol.java @@ -131,7 +131,7 @@ class WaveOfVitriolEffect extends OneShotEffect { TargetCardInLibrary target = new TargetCardInLibrary(0, entry.getValue(), new FilterBasicLandCard()); if (entry.getKey().searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { toBattlefield.addAll(target.getTargets()); playersToShuffle.add(entry.getKey()); } diff --git a/Mage.Sets/src/mage/cards/w/WeirdHarvest.java b/Mage.Sets/src/mage/cards/w/WeirdHarvest.java index 96091a99d6..ffc88e8a92 100644 --- a/Mage.Sets/src/mage/cards/w/WeirdHarvest.java +++ b/Mage.Sets/src/mage/cards/w/WeirdHarvest.java @@ -115,7 +115,7 @@ class WeirdHarvestEffect extends OneShotEffect { usingPlayers.add(player); TargetCardInLibrary target = new TargetCardInLibrary(0, xValue, new FilterCreatureCard()); if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(target.getTargets()); player.moveCards(cards, Zone.HAND, source, game); player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', cards, game); diff --git a/Mage.Sets/src/mage/cards/w/WerewolfRansacker.java b/Mage.Sets/src/mage/cards/w/WerewolfRansacker.java index 0d6f76f1f1..c15582d68d 100644 --- a/Mage.Sets/src/mage/cards/w/WerewolfRansacker.java +++ b/Mage.Sets/src/mage/cards/w/WerewolfRansacker.java @@ -145,7 +145,7 @@ class WerewolfRansackerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { int affectedTargets = 0; - if (targetPointer.getTargets(game, source).size() > 0) { + if (!targetPointer.getTargets(game, source).isEmpty()) { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/w/WidespreadPanic.java b/Mage.Sets/src/mage/cards/w/WidespreadPanic.java index 4e8900ee53..9020117af3 100644 --- a/Mage.Sets/src/mage/cards/w/WidespreadPanic.java +++ b/Mage.Sets/src/mage/cards/w/WidespreadPanic.java @@ -125,7 +125,7 @@ class WidespreadPanicEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player shuffler = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (shuffler != null) { - if (shuffler.getHand().size() > 0) { + if (!shuffler.getHand().isEmpty()) { TargetCardInHand target = new TargetCardInHand(); target.setNotTarget(true); target.setTargetName("a card from your hand to put on top of your library"); diff --git a/Mage.Sets/src/mage/cards/w/WildEvocation.java b/Mage.Sets/src/mage/cards/w/WildEvocation.java index 9a075eba55..90399ae0a1 100644 --- a/Mage.Sets/src/mage/cards/w/WildEvocation.java +++ b/Mage.Sets/src/mage/cards/w/WildEvocation.java @@ -84,7 +84,7 @@ class WildEvocationEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); - if (player != null && player.getHand().size() > 0) { + if (player != null && !player.getHand().isEmpty()) { Card card = player.getHand().getRandom(game); Cards cards = new CardsImpl(); cards.add(card); diff --git a/Mage.Sets/src/mage/cards/w/WildPair.java b/Mage.Sets/src/mage/cards/w/WildPair.java index 9adad2f38b..3813014b4d 100644 --- a/Mage.Sets/src/mage/cards/w/WildPair.java +++ b/Mage.Sets/src/mage/cards/w/WildPair.java @@ -114,7 +114,7 @@ class WildPairEffect extends OneShotEffect { filter.add(new TotalPowerAndToughnessPredicate(Filter.ComparisonType.Equal, totalPT)); TargetCardInLibrary target = new TargetCardInLibrary(1, filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { controller.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game); } } diff --git a/Mage.Sets/src/mage/cards/w/WildResearch.java b/Mage.Sets/src/mage/cards/w/WildResearch.java index ec74952991..e70a4aa59b 100644 --- a/Mage.Sets/src/mage/cards/w/WildResearch.java +++ b/Mage.Sets/src/mage/cards/w/WildResearch.java @@ -109,7 +109,7 @@ class WildResearchEffect extends OneShotEffect { if (controller != null && sourceObject != null) { TargetCardInLibrary target = new TargetCardInLibrary(filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { controller.moveCards(card, Zone.HAND, source, game); diff --git a/Mage.Sets/src/mage/cards/w/WoodlandBellower.java b/Mage.Sets/src/mage/cards/w/WoodlandBellower.java index a230e94042..84b0cfac0a 100644 --- a/Mage.Sets/src/mage/cards/w/WoodlandBellower.java +++ b/Mage.Sets/src/mage/cards/w/WoodlandBellower.java @@ -100,7 +100,7 @@ class WoodlandBellowerEffect extends OneShotEffect { filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, 4)); TargetCardInLibrary target = new TargetCardInLibrary(filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); controller.moveCards(card, Zone.BATTLEFIELD, source, game); } diff --git a/Mage.Sets/src/mage/cards/x/XenagosTheReveler.java b/Mage.Sets/src/mage/cards/x/XenagosTheReveler.java index bf5f0f5422..0a761cd441 100644 --- a/Mage.Sets/src/mage/cards/x/XenagosTheReveler.java +++ b/Mage.Sets/src/mage/cards/x/XenagosTheReveler.java @@ -186,7 +186,7 @@ class XenagosExileEffect extends OneShotEffect { filter.add(Predicates.or(new CardTypePredicate(CardType.CREATURE), new CardTypePredicate(CardType.LAND))); TargetCard target1 = new TargetCard(0, Integer.MAX_VALUE, Zone.EXILED, filter); - if (exiledCards.size() > 0 + if (!exiledCards.isEmpty() && target1.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.PutCardInPlay, exiledCards, target1, game)) { controller.moveCards(new CardsImpl(target1.getTargets()), Zone.BATTLEFIELD, source, game); diff --git a/Mage.Sets/src/mage/cards/y/YavimayaDryad.java b/Mage.Sets/src/mage/cards/y/YavimayaDryad.java index 12cf702b40..ccab7b91e9 100644 --- a/Mage.Sets/src/mage/cards/y/YavimayaDryad.java +++ b/Mage.Sets/src/mage/cards/y/YavimayaDryad.java @@ -106,7 +106,7 @@ class YavimayaDryadEffect extends SearchEffect { return false; } if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { targetPlayer.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/equipped/HeavyArbalestTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/equipped/HeavyArbalestTest.java index d86589240d..42fdaf9ab3 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/equipped/HeavyArbalestTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/equipped/HeavyArbalestTest.java @@ -33,7 +33,7 @@ public class HeavyArbalestTest extends CardTestPlayerBase { assertLife(playerB, 18); Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA.getId()); - Assert.assertTrue(eliteVanguard.getAttachments().size() > 0); + Assert.assertTrue(!eliteVanguard.getAttachments().isEmpty()); Assert.assertTrue(eliteVanguard.isTapped()); } diff --git a/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java index 821954e2d9..ff3efe5d65 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java @@ -125,7 +125,7 @@ public class RandomPlayer extends ComputerPlayer { ability = options.get(rnd.nextInt(options.size())); } } - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { int amount = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost(); if (amount > 0) { ability = ability.copy(); @@ -225,7 +225,7 @@ public class RandomPlayer extends ComputerPlayer { int check = rnd.nextInt(numGroups + 1); if (check < numGroups) { CombatGroup group = game.getCombat().getGroups().get(check); - if (group.getAttackers().size() > 0) { + if (!group.getAttackers().isEmpty()) { this.declareBlocker(this.getId(), blocker.getId(), group.getAttackers().get(0), game); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 5d98013248..f3cd2172f3 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -175,7 +175,7 @@ public class TestPlayer implements Player { protected Permanent findPermanent(FilterPermanent filter, UUID controllerId, Game game) { List permanents = game.getBattlefield().getAllActivePermanents(filter, controllerId, game); - if (permanents.size() > 0) { + if (!permanents.isEmpty()) { return permanents.get(0); } return null; @@ -200,7 +200,7 @@ public class TestPlayer implements Player { return true; } else if (groups[2].startsWith("spellOnTopOfStack=")) { String spellOnTopOFStack = groups[2].substring(18); - if (game.getStack().size() > 0) { + if (!game.getStack().isEmpty()) { StackObject stackObject = game.getStack().getFirst(); if (stackObject != null && stackObject.getStackAbility().toString().contains(spellOnTopOFStack)) { return true; diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index 9aa176560d..8892244611 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -987,7 +987,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement public enum StackClause { WHILE_ON_STACK, - WHILE_NOT_ON_STACK; + WHILE_NOT_ON_STACK } /** diff --git a/Mage/src/main/java/mage/abilities/AbilitiesImpl.java b/Mage/src/main/java/mage/abilities/AbilitiesImpl.java index f2406cf8ce..ffe5fff8e3 100644 --- a/Mage/src/main/java/mage/abilities/AbilitiesImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilitiesImpl.java @@ -93,7 +93,7 @@ public class AbilitiesImpl extends ArrayList implements Ab continue; } if (ability instanceof SpellAbility) { - if (ability.getAdditionalCostsRuleVisible() && ability.getCosts().size() > 0) { + if (ability.getAdditionalCostsRuleVisible() && !ability.getCosts().isEmpty()) { StringBuilder sbRule = threadLocalBuilder.get(); for (Cost cost : ability.getCosts()) { if (cost.getText() != null && !cost.getText().isEmpty()) { @@ -107,7 +107,7 @@ public class AbilitiesImpl extends ArrayList implements Ab } String rule = ability.getRule(); if (rule != null) { - if (rule.length() > 0) { + if (!rule.isEmpty()) { rules.add(Character.toUpperCase(rule.charAt(0)) + rule.substring(1)); } } else { // logging so we can still can be made aware of rule problems a card has diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index 2ccc13de25..ac6c231700 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -274,7 +274,7 @@ public abstract class AbilityImpl implements Ability { // if ability can be cast for no mana, clear the mana costs now, because additional mana costs must be paid. // For Flashback ability can be set X before, so the X costs have to be restored for the flashbacked ability if (noMana) { - if (this.getManaCostsToPay().getVariableCosts().size() > 0) { + if (!this.getManaCostsToPay().getVariableCosts().isEmpty()) { int xValue = this.getManaCostsToPay().getX(); this.getManaCostsToPay().clear(); VariableManaCost xCosts = new VariableManaCost(); @@ -333,7 +333,7 @@ public abstract class AbilityImpl implements Ability { } // Flashback abilities haven't made the choices the underlying spell might need for targeting. if (!(this instanceof FlashbackAbility) - && getTargets().size() > 0) { + && !getTargets().isEmpty()) { Outcome outcome = getEffects().isEmpty() ? Outcome.Detriment : getEffects().get(0).getOutcome(); if (getTargets().chooseTargets(outcome, this.controllerId, this, noMana, game) == false) { if ((variableManaCost != null || announceString != null) && !game.isSimulation()) { @@ -740,10 +740,10 @@ public abstract class AbilityImpl implements Ability { public String getRule(boolean all) { StringBuilder sbRule = threadLocalBuilder.get(); if (all || this.abilityType != AbilityType.SPELL) { - if (manaCosts.size() > 0) { + if (!manaCosts.isEmpty()) { sbRule.append(manaCosts.getText()); } - if (costs.size() > 0) { + if (!costs.isEmpty()) { if (sbRule.length() > 0) { sbRule.append(','); } @@ -1038,7 +1038,7 @@ public abstract class AbilityImpl implements Ability { } else { half = " right"; } - if (spellAbility.getTargets().size() > 0) { + if (!spellAbility.getTargets().isEmpty()) { sb.append(half).append(" half targeting "); for (Target target : spellAbility.getTargets()) { sb.append(target.getTargetedName(game)); @@ -1088,7 +1088,7 @@ public abstract class AbilityImpl implements Ability { protected String getTargetDescriptionForLog(Targets targets, Game game) { StringBuilder sb = new StringBuilder(); // threadLocal StringBuilder can't be used because calling method already uses it - if (targets.size() > 0) { + if (!targets.isEmpty()) { String usedVerb = null; for (Target target : targets) { if (!target.getTargets().isEmpty()) { diff --git a/Mage/src/main/java/mage/abilities/DelayedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/DelayedTriggeredAbility.java index a4bef097ef..8183a81bb8 100644 --- a/Mage/src/main/java/mage/abilities/DelayedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/DelayedTriggeredAbility.java @@ -92,8 +92,6 @@ public abstract class DelayedTriggeredAbility extends TriggeredAbilityImpl { } } - ; - public boolean isInactive(Game game) { return false; } diff --git a/Mage/src/main/java/mage/abilities/Modes.java b/Mage/src/main/java/mage/abilities/Modes.java index 7fc169dfd9..d8c8e42fd7 100644 --- a/Mage/src/main/java/mage/abilities/Modes.java +++ b/Mage/src/main/java/mage/abilities/Modes.java @@ -207,7 +207,7 @@ public class Modes extends LinkedHashMap { if (isEachModeOnlyOnce()) { setAlreadySelectedModes(selectedModes, source, game); } - return selectedModes.size() > 0; + return !selectedModes.isEmpty(); } // 700.2d diff --git a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAbility.java b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAbility.java index 1c064ddfc5..a7cb368a6c 100644 --- a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAbility.java +++ b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAbility.java @@ -88,7 +88,7 @@ public class EntersBattlefieldAbility extends StaticAbility { @Override public void addEffect(Effect effect) { - if (getEffects().size() > 0) { + if (!getEffects().isEmpty()) { Effect entersBattlefieldEffect = this.getEffects().get(0); if (entersBattlefieldEffect instanceof EntersBattlefieldEffect) { ((EntersBattlefieldEffect) entersBattlefieldEffect).addEffect(effect); diff --git a/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java b/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java index 34fa110bb9..ebb6bf0aa4 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java @@ -46,7 +46,7 @@ public class CardsInHandCondition implements Condition { public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO - }; + } private Condition condition; private CountType type; diff --git a/Mage/src/main/java/mage/abilities/condition/common/FerociousCondition.java b/Mage/src/main/java/mage/abilities/condition/common/FerociousCondition.java index 3df1138743..c0a93cd97a 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/FerociousCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/FerociousCondition.java @@ -49,7 +49,7 @@ public class FerociousCondition implements Condition { private static final FerociousCondition fInstance = new FerociousCondition(); - private FerociousCondition() {}; + private FerociousCondition() {} public static FerociousCondition getInstance() { return fInstance; diff --git a/Mage/src/main/java/mage/abilities/condition/common/OpponentControlsPermanentCondition.java b/Mage/src/main/java/mage/abilities/condition/common/OpponentControlsPermanentCondition.java index e09e0ed915..681b9a9c9b 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/OpponentControlsPermanentCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/OpponentControlsPermanentCondition.java @@ -44,8 +44,8 @@ import mage.game.Game; public class OpponentControlsPermanentCondition implements Condition { - public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO }; - + public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO } + private FilterPermanent filter; private CountType type; private int count; diff --git a/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java b/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java index 91609cc857..2deef0afb1 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java @@ -43,7 +43,7 @@ public class PermanentHasCounterCondition implements Condition { public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO - }; + } private CounterType counterType; private int amount; diff --git a/Mage/src/main/java/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java b/Mage/src/main/java/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java index c23a98553e..67ee9d4b7b 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java @@ -45,7 +45,8 @@ import mage.game.Game; */ public class PermanentsOnTheBattlefieldCondition implements Condition { - public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO }; + public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO } + private FilterPermanent filter; private Condition condition; private CountType type; diff --git a/Mage/src/main/java/mage/abilities/condition/common/TenOrLessLifeCondition.java b/Mage/src/main/java/mage/abilities/condition/common/TenOrLessLifeCondition.java index 8b727aa593..c65ab45368 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/TenOrLessLifeCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/TenOrLessLifeCondition.java @@ -40,7 +40,7 @@ import mage.players.PlayerList; */ public class TenOrLessLifeCondition implements Condition { - public static enum CheckType { AN_OPPONENT, CONTROLLER, TARGET_OPPONENT, EACH_PLAYER }; + public static enum CheckType { AN_OPPONENT, CONTROLLER, TARGET_OPPONENT, EACH_PLAYER } private final CheckType type; diff --git a/Mage/src/main/java/mage/abilities/condition/common/TopLibraryCardTypeCondition.java b/Mage/src/main/java/mage/abilities/condition/common/TopLibraryCardTypeCondition.java index e9f92e58ec..1e9a9d5356 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/TopLibraryCardTypeCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/TopLibraryCardTypeCondition.java @@ -41,7 +41,7 @@ public class TopLibraryCardTypeCondition implements Condition { public static enum CheckType { CREATURE, LAND, SORCERY, INSTANT - }; + } private TopLibraryCardTypeCondition.CheckType type; diff --git a/Mage/src/main/java/mage/abilities/costs/AlternativeCost2Impl.java b/Mage/src/main/java/mage/abilities/costs/AlternativeCost2Impl.java index 4a4e251444..28e7aa9e4f 100644 --- a/Mage/src/main/java/mage/abilities/costs/AlternativeCost2Impl.java +++ b/Mage/src/main/java/mage/abilities/costs/AlternativeCost2Impl.java @@ -145,8 +145,6 @@ public class AlternativeCost2Impl> extends Cos return activated; } - ; - @Override public AlternativeCost2Impl copy() { return new AlternativeCost2Impl(this); diff --git a/Mage/src/main/java/mage/abilities/costs/CostsImpl.java b/Mage/src/main/java/mage/abilities/costs/CostsImpl.java index f17c7b9b2f..538ca56b09 100644 --- a/Mage/src/main/java/mage/abilities/costs/CostsImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/CostsImpl.java @@ -152,7 +152,7 @@ public class CostsImpl extends ArrayList implements Costs protected T getFirstUnpaid() { Costs unpaid = getUnpaid(); - if (unpaid.size() > 0) { + if (!unpaid.isEmpty()) { return unpaid.get(0); } return null; diff --git a/Mage/src/main/java/mage/abilities/costs/OptionalAdditionalCostImpl.java b/Mage/src/main/java/mage/abilities/costs/OptionalAdditionalCostImpl.java index 649ca77384..5a4fda252e 100644 --- a/Mage/src/main/java/mage/abilities/costs/OptionalAdditionalCostImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/OptionalAdditionalCostImpl.java @@ -130,8 +130,6 @@ public class OptionalAdditionalCostImpl ex ++activatedCounter; } - ; - /** * Reset the activate and count information * @@ -162,8 +160,6 @@ public class OptionalAdditionalCostImpl ex return repeatable; } - ; - /** * Returns if the cost was activated * @@ -174,8 +170,6 @@ public class OptionalAdditionalCostImpl ex return activated; } - ; - /** * Returns the number of times the cost was activated * @return @@ -185,8 +179,6 @@ public class OptionalAdditionalCostImpl ex return activatedCounter; } - ; - @Override public OptionalAdditionalCostImpl copy() { diff --git a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java index 336dddaabb..87061d8696 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java @@ -72,7 +72,7 @@ public class PutCountersSourceCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { - this.paid = permanent.addCounters(counter, null, game);; + this.paid = permanent.addCounters(counter, null, game); } return paid; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java index f24a5dbf47..3e7c557e8e 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java @@ -93,7 +93,7 @@ public class RemoveCounterCost extends CostImpl { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - if (permanent.getCounters(game).size() > 0 && (counterTypeToRemove == null || permanent.getCounters(game).containsKey(counterTypeToRemove))) { + if (!permanent.getCounters(game).isEmpty() && (counterTypeToRemove == null || permanent.getCounters(game).containsKey(counterTypeToRemove))) { String counterName = null; if (counterTypeToRemove != null) { diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java index 2d14c311a7..1e541429cc 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java @@ -326,7 +326,7 @@ public class ManaCostsImpl extends ArrayList implements M String[] symbols = mana.split("^\\{|\\}\\{|\\}$"); int modifierForX = 0; for (String symbol : symbols) { - if (symbol.length() > 0) { + if (!symbol.isEmpty()) { if (symbol.length() == 1 || isNumeric(symbol)) { if (Character.isDigit(symbol.charAt(0))) { this.add(new GenericManaCost(Integer.valueOf(symbol))); diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/MultikickerCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/MultikickerCount.java index 6846c52d14..51c0562924 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/MultikickerCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/MultikickerCount.java @@ -65,10 +65,10 @@ public class MultikickerCount implements DynamicValue { @Override public String toString() { return "a"; - }; - + } + @Override public String getMessage() { return "time it was kicked"; - }; + } } diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java index 3450de2385..c5da9a1849 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java @@ -688,7 +688,7 @@ public class ContinuousEffects implements Serializable { } // check if player wants to use splice - if (spliceAbilities.size() > 0) { + if (!spliceAbilities.isEmpty()) { Player controller = game.getPlayer(abilityToModify.getControllerId()); if (controller.chooseUse(Outcome.Benefit, "Splice a card?", abilityToModify, game)) { Cards cardsToReveal = new CardsImpl(); @@ -899,7 +899,7 @@ public class ContinuousEffects implements Serializable { } } //Reload layerEffect if copy effects were applied - if (layer.size() > 0) { + if (!layer.isEmpty()) { activeLayerEffects = getLayeredEffects(game); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyTypeProducedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyTypeProducedEffect.java index da0143299f..a07f02e8d8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyTypeProducedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/AddManaOfAnyTypeProducedEffect.java @@ -80,7 +80,7 @@ public class AddManaOfAnyTypeProducedEffect extends ManaEffect { if (types.getColorless() > 0) { choice.getChoices().add("Colorless"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java index 955ed8c3c4..05bbaaf28e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CopySpellForEachItCouldTargetEffect.java @@ -170,7 +170,7 @@ public abstract class CopySpellForEachItCouldTargetEffect ex if (playerTargetCopyMap.containsKey(player.getId())) { Map targetCopyMap = playerTargetCopyMap.get(player.getId()); if (targetCopyMap != null) { - while (targetCopyMap.size() > 0) { + while (!targetCopyMap.isEmpty()) { FilterInPlay setFilter = filter.copy(); setFilter.add(new FromSetPredicate(targetCopyMap.keySet())); Target target = new TargetWithAdditionalFilter(sampleTarget, setFilter); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java index 28a8e93b1c..72d6841715 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java @@ -134,7 +134,7 @@ public class CreateTokenEffect extends OneShotEffect { sb.append(" attacking"); } String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { if (amount.toString().equals("X")) { sb.append(", where X is "); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java index 5243e83300..863528dbbe 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenTargetEffect.java @@ -80,7 +80,7 @@ public class CreateTokenTargetEffect extends OneShotEffect { sb.append(" attacking"); } String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageAllEffect.java index e537e7b304..320440e48d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageAllEffect.java @@ -81,7 +81,7 @@ public class DamageAllEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("{source} deals ").append(amount.toString()).append(" damage to each ").append(filter.getMessage()); String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { if (amount.toString().equals("X")) { sb.append(", where X is "); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java index 0cf6291395..3e863503a1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java @@ -103,7 +103,7 @@ public class DamageControllerEffect extends OneShotEffect { sb.append(amount); } sb.append(" damage to you"); - if (message.length() > 0) { + if (!message.isEmpty()) { if (message.equals("1")) { sb.append(" equal to the number of "); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageMultiEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageMultiEffect.java index 61baaaa19d..a03689a13b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageMultiEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageMultiEffect.java @@ -68,7 +68,7 @@ public class DamageMultiEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { Target multiTarget = source.getTargets().get(0); for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java index 017ba21128..8bd6b77230 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java @@ -152,12 +152,12 @@ public class DamageTargetEffect extends OneShotEffect { sb.append(amount); } sb.append(" damage to "); - if (targetDescription.length() > 0) { + if (!targetDescription.isEmpty()) { sb.append(targetDescription); } else { sb.append("target ").append(mode.getTargets().get(0).getTargetName()); } - if (message.length() > 0) { + if (!message.isEmpty()) { if (message.equals("1")) { sb.append(" equal to the number of "); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java index fdadf86629..2ff1d23aad 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java @@ -112,7 +112,7 @@ public class DevourEffect extends ReplacementEffectImpl { } if (controller.chooseUse(Outcome.Detriment, "Devour creatures?", source, game)) { controller.chooseTarget(Outcome.Detriment, target, source, game); - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { List> cardSubtypes = new ArrayList<>(); int devouredCreatures = target.getTargets().size(); if (!game.isSimulation()) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java index cc27e9ca5c..02a31543f2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java @@ -56,7 +56,7 @@ public class DoIfCostPaid extends OneShotEffect { String message; if (chooseUseText == null) { String effectText = executingEffects.getText(source.getModes().getMode()); - if (effectText.length() > 0 && effectText.charAt(effectText.length() - 1) == '.') { + if (!effectText.isEmpty() && effectText.charAt(effectText.length() - 1) == '.') { effectText = effectText.substring(0, effectText.length() - 1); } message = getCostText() + " and " + effectText + '?'; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java index d77a8abdb9..9cda89ce6b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java @@ -158,7 +158,7 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR if (staticText != null && !staticText.isEmpty()) { return staticText; } - if (targetName != null && targetName.length() > 0) { + if (targetName != null && !targetName.isEmpty()) { if (targetName.equals("Those creatures") || targetName.equals("They")) { return targetName + " don't untap during their controller's next untap step"; } else diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java index 62da3f0a0d..bdc6a254cb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java @@ -83,7 +83,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect { sb.append('s'); } String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java index ae0c85ec39..0068c5a701 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java @@ -108,7 +108,7 @@ public class DrawCardTargetEffect extends OneShotEffect { return staticText; } StringBuilder sb = new StringBuilder(); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { Target target; if (targetPointer instanceof SecondTargetPointer && mode.getTargets().size() > 1) { target = mode.getTargets().get(1); @@ -136,7 +136,7 @@ public class DrawCardTargetEffect extends OneShotEffect { sb.append('s'); } String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java index 1734937692..e4ae7ecb0d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java @@ -26,7 +26,7 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect { public static enum Gender { MALE, FEMAL - }; + } protected Effect additionalEffect; diff --git a/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java index af86ff288c..fc30f8ad1d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GainLifeEffect.java @@ -92,7 +92,7 @@ public class GainLifeEffect extends OneShotEffect { sb.append(life).append(' '); } sb.append("life"); - if (message.length() > 0 && !message.startsWith("that")) { + if (!message.isEmpty() && !message.startsWith("that")) { sb.append(message.equals("1") ? " equal to the number of " : " for each "); sb.append(message); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java index 3e965d01ee..b9c694dd7c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GainLifeTargetEffect.java @@ -85,7 +85,7 @@ public class GainLifeTargetEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); String message = life.getMessage(); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { sb.append("Target ").append(mode.getTargets().get(0).getTargetName()); } else { sb.append("that player"); @@ -95,7 +95,7 @@ public class GainLifeTargetEffect extends OneShotEffect { sb.append(life.toString()).append(' '); } sb.append("life"); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(message.equals("1") ? " equal to the number of " : " for each "); sb.append(message); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java index 5cb76793a6..dd22576549 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java @@ -88,7 +88,7 @@ public class LoseLifeControllerAttachedEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("its controller loses ").append(amount.toString()).append(" life"); String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); sb.append(message); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java index 7537b12f15..7a9eb8ae37 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeOpponentsEffect.java @@ -87,7 +87,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect { sb.append(amount).append(' '); } sb.append("life"); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(message.equals("1") || message.startsWith("the ") ? " equal to the number of " : " for each "); sb.append(message); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java index 83b9fa7b7f..7e5dbad663 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java @@ -78,7 +78,7 @@ public class LoseLifeSourceControllerEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("you lose ").append(amount.toString()).append(" life"); String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java index 2909da13cb..1e0069a9e4 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java @@ -81,7 +81,7 @@ public class LoseLifeTargetEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); String message = amount.getMessage(); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { sb.append("target ").append(mode.getTargets().get(0).getTargetName()); } else { sb.append("that player"); @@ -91,7 +91,7 @@ public class LoseLifeTargetEffect extends OneShotEffect { sb.append(amount).append(' '); } sb.append("life"); - if (message.length() > 0) { + if (!message.isEmpty()) { if (amount.toString().equals("X")) { sb.append(", where X is "); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PhaseOutTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PhaseOutTargetEffect.java index 6584922a1c..79dce240e2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PhaseOutTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PhaseOutTargetEffect.java @@ -73,7 +73,7 @@ public class PhaseOutTargetEffect extends OneShotEffect { } StringBuilder sb = new StringBuilder(); - if (targetDescription != null && targetDescription.length() > 0) { + if (targetDescription != null && !targetDescription.isEmpty()) { sb.append(targetDescription); } else { sb.append("Target ").append(mode.getTargets().get(0).getTargetName()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PlayTargetWithoutPayingManaEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PlayTargetWithoutPayingManaEffect.java index 2042d607c5..08612e5e18 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PlayTargetWithoutPayingManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PlayTargetWithoutPayingManaEffect.java @@ -70,7 +70,7 @@ public class PlayTargetWithoutPayingManaEffect extends OneShotEffect { @Override public String getText(Mode mode) { StringBuilder sb = new StringBuilder(); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { Target target = mode.getTargets().get(0); if (mode.getTargets().get(0).getZone() == Zone.HAND) { sb.append("you may put ").append(target.getTargetName()).append(" from your hand onto the battlefield"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java index 46cf419611..4a61c9e6db 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PopulateEffect.java @@ -70,7 +70,7 @@ public class PopulateEffect extends OneShotEffect { public PopulateEffect(String prefixText) { super(Outcome.Copy); - this.staticText = (prefixText.length() > 0 ? prefixText + " p" : "P") + "opulate (Put a token onto the battlefield that's a copy of a creature token you control.)"; + this.staticText = (!prefixText.isEmpty() ? prefixText + " p" : "P") + "opulate (Put a token onto the battlefield that's a copy of a creature token you control.)"; } public PopulateEffect(final PopulateEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PutLibraryIntoGraveTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PutLibraryIntoGraveTargetEffect.java index 8caeff03b8..08eafb24e7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PutLibraryIntoGraveTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PutLibraryIntoGraveTargetEffect.java @@ -101,7 +101,7 @@ public class PutLibraryIntoGraveTargetEffect extends OneShotEffect { } sb.append("of his or her library into his or her graveyard"); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(", where X is the number of "); sb.append(message); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java index 5394ae0137..c21f31c9e1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java @@ -73,7 +73,7 @@ public class RecruiterEffect extends OneShotEffect { controller.revealCards(staticText, cards, game); controller.shuffleLibrary(source, game); - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.putCardsOnTopOfLibrary(cards, game, source, true); } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java index aff6df4dab..d7cd05e914 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RevealCardsFromLibraryUntilEffect.java @@ -111,7 +111,7 @@ public class RevealCardsFromLibraryUntilEffect extends OneShotEffect { // Put the rest in correct zone switch (zoneToPutRest) { case LIBRARY: { - if (cards.size() > 0) { + if (!cards.isEmpty()) { if (shuffleRestInto) { library.addAll(cards.getCards(game), game); } else { @@ -121,7 +121,7 @@ public class RevealCardsFromLibraryUntilEffect extends OneShotEffect { break; } default: - if (cards.size() > 0) { + if (!cards.isEmpty()) { controller.moveCards(cards, zoneToPutRest, source, game); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SkipNextPlayerUntapStepEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SkipNextPlayerUntapStepEffect.java index 0e1269c1af..2aadf12f97 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SkipNextPlayerUntapStepEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SkipNextPlayerUntapStepEffect.java @@ -61,7 +61,7 @@ public class SkipNextPlayerUntapStepEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = null; if (targetPointer != null) { - if (targetPointer.getTargets(game, source).size() > 0) { + if (!targetPointer.getTargets(game, source).isEmpty()) { player = game.getPlayer(targetPointer.getFirst(game, source)); } else { player = game.getPlayer(source.getControllerId()); @@ -82,7 +82,7 @@ public class SkipNextPlayerUntapStepEffect extends OneShotEffect { @Override public String getText(Mode mode) { StringBuilder sb = new StringBuilder(); - if (staticText.length() > 0) { + if (!staticText.isEmpty()) { sb.append(staticText).append(" player skips his or her next untap step"); } else { sb.append("You skip your next untap step"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java index d92c01d4c7..764ac42531 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java @@ -76,7 +76,7 @@ public class TapTargetEffect extends OneShotEffect { @Override public String getText(Mode mode) { - if (staticText.length() > 0) { + if (!staticText.isEmpty()) { return "tap " + staticText; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/TransformTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TransformTargetEffect.java index 1508c07afc..e23df12250 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TransformTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TransformTargetEffect.java @@ -73,7 +73,7 @@ public class TransformTargetEffect extends OneShotEffect { @Override public String getText(Mode mode) { - if (staticText != null && staticText.length() > 0) { + if (staticText != null && !staticText.isEmpty()) { return staticText; } if (mode.getTargets().isEmpty()) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardSubTypeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardSubTypeTargetEffect.java index 7a988a5bbc..f58836f257 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardSubTypeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AddCardSubTypeTargetEffect.java @@ -77,7 +77,7 @@ public class AddCardSubTypeTargetEffect extends ContinuousEffectImpl { @Override public String getText(Mode mode) { StringBuilder sb = new StringBuilder(); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { sb.append("Target ").append(mode.getTargets().get(0).getTargetName()); } else { sb.append("It "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java index 9961a6f614..39f4519160 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/AssignNoCombatDamageSourceEffect.java @@ -106,7 +106,7 @@ public class AssignNoCombatDamageSourceEffect extends ReplacementEffectImpl { text += " this combat"; break; default: - if (duration.toString().length() > 0) { + if (!duration.toString().isEmpty()) { text += ' ' + duration.toString(); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java index a9312c85d3..d7be01a950 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java @@ -118,11 +118,11 @@ public class BecomesColorOrColorsTargetEffect extends OneShotEffect { return staticText; } StringBuilder sb = new StringBuilder(); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { sb.append("target "); sb.append(mode.getTargets().get(0).getFilter().getMessage()); sb.append(" becomes the color or colors of your choice"); - if (duration.toString().length() > 0) { + if (!duration.toString().isEmpty()) { sb.append(' ').append(duration.toString()); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java index 13610ddd45..c249c52eec 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java @@ -76,7 +76,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { - if (token.getCardType().size() > 0) { + if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); @@ -86,7 +86,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { if (type == null) { permanent.getSubtype(game).clear(); } - if (token.getSubtype(game).size() > 0) { + if (!token.getSubtype(game).isEmpty()) { permanent.getSubtype(game).addAll(token.getSubtype(game)); } } @@ -100,7 +100,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { break; case AbilityAddingRemovingEffects_6: if (sublayer == SubLayer.NA) { - if (token.getAbilities().size() > 0) { + if (!token.getAbilities().isEmpty()) { for (Ability ability : token.getAbilities()) { permanent.addAbility(ability, source.getSourceId(), game); } @@ -146,7 +146,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { sb.append(" become "); } sb.append(token.getDescription()); - if (type != null && type.length() > 0) { + if (type != null && !type.isEmpty()) { sb.append(". They are still ").append(type); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java index 454f0000e6..d946b6869f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAttachedEffect.java @@ -48,7 +48,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { public enum LoseType { NONE, ALL, ALL_BUT_COLOR, ABILITIES, ABILITIES_SUBTYPE_AND_PT - }; + } protected Token token; protected String type; @@ -86,7 +86,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { - if (token.getSupertype().size() > 0) { + if (!token.getSupertype().isEmpty()) { for (String t : token.getSupertype()) { if (!permanent.getSupertype().contains(t)) { permanent.getSupertype().add(t); @@ -100,7 +100,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { permanent.getCardType().clear(); break; } - if (token.getCardType().size() > 0) { + if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); @@ -115,7 +115,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes()); break; } - if (token.getSubtype(game).size() > 0) { + if (!token.getSubtype(game).isEmpty()) { for (String t : token.getSubtype(game)) { if (!permanent.getSubtype(game).contains(t)) { permanent.getSubtype(game).add(t); @@ -148,7 +148,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { permanent.removeAllAbilities(source.getSourceId(), game); break; } - if (token.getAbilities().size() > 0) { + if (!token.getAbilities().isEmpty()) { for (Ability ability : token.getAbilities()) { permanent.addAbility(ability, source.getSourceId(), game); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java index 23c90cd686..de5a79aff9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java @@ -113,7 +113,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements if (losePreviousTypes) { permanent.getCardType().clear(); } - if (token.getCardType().size() > 0) { + if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); @@ -123,7 +123,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements if ("".equals(type) || type == null && permanent.getCardType().contains(CardType.LAND)) { permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes()); } - if (token.getSubtype(game).size() > 0) { + if (!token.getSubtype(game).isEmpty()) { permanent.getSubtype(game).addAll(token.getSubtype(game)); } } @@ -137,7 +137,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements break; case AbilityAddingRemovingEffects_6: if (sublayer == SubLayer.NA) { - if (token.getAbilities().size() > 0) { + if (!token.getAbilities().isEmpty()) { for (Ability ability : token.getAbilities()) { permanent.addAbility(ability, source.getSourceId(), game); } @@ -172,7 +172,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements } private void setText() { - if (type != null && type.length() > 0) { + if (type != null && !type.isEmpty()) { staticText = duration.toString() + " {this} becomes a " + token.getDescription() + " that's still a " + this.type; } else { staticText = duration.toString() + " {this} becomes a " + token.getDescription(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java index e16b52adcc..833597d81a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java @@ -91,7 +91,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes()); permanent.getSubtype(game).addAll(token.getSubtype(game)); } else { - if (token.getSubtype(game).size() > 0) { + if (!token.getSubtype(game).isEmpty()) { for (String subtype : token.getSubtype(game)) { if (!permanent.getSubtype(game).contains(subtype)) { permanent.getSubtype(game).add(subtype); @@ -100,7 +100,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { } } - if (token.getCardType().size() > 0) { + if (!token.getCardType().isEmpty()) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); @@ -128,7 +128,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { permanent.removeAllAbilities(source.getSourceId(), game); } if (sublayer == SubLayer.NA) { - if (token.getAbilities().size() > 0) { + if (!token.getAbilities().isEmpty()) { for (Ability ability : token.getAbilities()) { permanent.addAbility(ability, source.getSourceId(), game); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java index 33eff81c6a..796fa3060c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEquippedEffect.java @@ -132,7 +132,7 @@ public class BoostEquippedEffect extends ContinuousEffectImpl { if (duration != Duration.WhileOnBattlefield) sb.append(' ').append(duration.toString()); String message = power.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java index 66320f7a27..513fe0f5ae 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java @@ -197,7 +197,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl { if (quotes) { sb.append('"'); } - if (duration.toString().length() > 0) { + if (!duration.toString().isEmpty()) { sb.append(' ').append(duration.toString()); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java index b689d1224d..19ef23b8fb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java @@ -71,7 +71,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl { public GainAbilityTargetEffect(Ability ability, Duration duration, String rule, boolean onCard, Layer layer, SubLayer subLayer) { super(duration, layer, subLayer, - ability.getEffects().size() > 0 ? ability.getEffects().get(0).getOutcome() : Outcome.AddAbility); + !ability.getEffects().isEmpty() ? ability.getEffects().get(0).getOutcome() : Outcome.AddAbility); this.ability = ability; staticText = rule; this.onCard = onCard; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java index e479cfaa5c..8ea40207d6 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java @@ -48,7 +48,7 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl { public static enum HandSizeModification { SET, INCREASE, REDUCE - }; + } protected DynamicValue handSize; protected HandSizeModification handSizeModification; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java index 20554668e2..2824f7f5e7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java @@ -101,7 +101,7 @@ public class AddCountersAttachedEffect extends OneShotEffect { } sb.append(counter.getName().toLowerCase()).append(" counter on "); sb.append(textEnchanted); - if (amount.getMessage().length() > 0) { + if (!amount.getMessage().isEmpty()) { sb.append(" for each ").append(amount.getMessage()); } staticText = sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index f2f40afefd..de633168c2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -146,7 +146,7 @@ public class AddCountersTargetEffect extends OneShotEffect { } sb.append(" on "); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { Target target = mode.getTargets().get(0); if (target.getNumberOfTargets() == 0) { sb.append("up to "); @@ -164,7 +164,7 @@ public class AddCountersTargetEffect extends OneShotEffect { sb.append("that creature"); } - if (amount.getMessage().length() > 0) { + if (!amount.getMessage().isEmpty()) { sb.append(" for each ").append(amount.getMessage()); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java index 6cb3f44bb1..9a02457659 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java @@ -74,7 +74,7 @@ public class DistributeCountersEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { Target multiTarget = source.getTargets().get(0); for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); @@ -135,7 +135,7 @@ class RemoveCountersAtEndOfTurn extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { Target multiTarget = source.getTargets().get(0); for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java index b67caad706..c18d4030f0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java @@ -75,7 +75,7 @@ public class ProliferateEffect extends OneShotEffect { UUID chosen = (UUID) target.getTargets().get(idx); Permanent permanent = game.getPermanent(chosen); if (permanent != null) { - if (permanent.getCounters(game).size() > 0) { + if (!permanent.getCounters(game).isEmpty()) { if (permanent.getCounters(game).size() == 1) { for (Counter counter : permanent.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName()); @@ -102,7 +102,7 @@ public class ProliferateEffect extends OneShotEffect { } else { Player player = game.getPlayer(chosen); if (player != null) { - if (player.getCounters().size() > 0) { + if (!player.getCounters().isEmpty()) { if (player.getCounters().size() == 1) { for (Counter counter : player.getCounters().values()) { Counter newCounter = new Counter(counter.getName()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java index 3647644a9d..5820f6166d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java @@ -93,7 +93,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { private Counter selectCounterType(Game game, Ability source, Permanent permanent) { Player controller = game.getPlayer(source.getControllerId()); - if(controller != null && permanent.getCounters(game).size() > 0) { + if(controller != null && !permanent.getCounters(game).isEmpty()) { String counterName = null; if(permanent.getCounters(game).size() > 1) { Choice choice = new ChoiceImpl(true); diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java index e21c7574d8..69297f115d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardControllerEffect.java @@ -116,7 +116,7 @@ public class DiscardControllerEffect extends OneShotEffect { sb.append(" at random"); } String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandTargetEffect.java index 83d5d9526c..22bee765e9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardHandTargetEffect.java @@ -84,7 +84,7 @@ public class DiscardHandTargetEffect extends OneShotEffect { return staticText; } StringBuilder sb = new StringBuilder(); - if (targetDescription.length() > 0) { + if (!targetDescription.isEmpty()) { sb.append(targetDescription); } else { sb.append("target ").append(mode.getTargets().get(0).getTargetName()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardTargetEffect.java index 65a390a537..a053e6f256 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardTargetEffect.java @@ -116,7 +116,7 @@ public class DiscardTargetEffect extends OneShotEffect { sb.append(" at random"); } String message = amount.getMessage(); - if (message.length() > 0) { + if (!message.isEmpty()) { sb.append(" for each "); } sb.append(message); diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java index 656a47b3e7..2d5d1769de 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryGraveyardPutInHandEffect.java @@ -82,7 +82,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect { TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter); target.clearChosen(); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { cardFound = game.getCard(target.getFirstTarget()); } } @@ -93,7 +93,7 @@ public class SearchLibraryGraveyardPutInHandEffect extends OneShotEffect { TargetCard target = new TargetCard(0, 1, Zone.GRAVEYARD, filter); target.clearChosen(); if (controller.choose(outcome, controller.getGraveyard(), target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { cardFound = game.getCard(target.getFirstTarget()); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java index 8ce316cfc5..f456b96dfd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java @@ -90,7 +90,7 @@ public class SearchLibraryPutInHandEffect extends SearchEffect { } target.clearChosen(); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards cards = new CardsImpl(); for (UUID cardId : target.getTargets()) { Card card = game.getCard(cardId); diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java index 39d26abaf5..52f45373b0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java @@ -88,7 +88,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect { return false; } if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, tapped, false, false, null); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java index 0b851ee858..0d3c6776b0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInPlayTargetPlayerEffect.java @@ -71,7 +71,7 @@ public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect { Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); if (player != null) { if (player.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, tapped, false, ownerIsController, null); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryWithLessCMCPutInPlayEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryWithLessCMCPutInPlayEffect.java index 70f656a01b..889ca401dc 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryWithLessCMCPutInPlayEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryWithLessCMCPutInPlayEffect.java @@ -70,7 +70,7 @@ public class SearchLibraryWithLessCMCPutInPlayEffect extends OneShotEffect { advancedFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, source.getManaCostsToPay().getX() + 1)); TargetCardInLibrary target = new TargetCardInLibrary(advancedFilter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); if (card != null) { controller.moveCards(card, Zone.BATTLEFIELD, source, game); diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/FatesealEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/FatesealEffect.java index 03ca5be0ca..f4b8c95e87 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/FatesealEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/FatesealEffect.java @@ -89,7 +89,7 @@ public class FatesealEffect extends OneShotEffect { TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1); target1.setRequired(false); // move cards to the bottom of the library - while (cards.size() > 0 && controller.choose(Outcome.Detriment, cards, target1, game)) { + while (!cards.isEmpty() && controller.choose(Outcome.Detriment, cards, target1, game)) { if (!controller.canRespond() || !opponent.canRespond()) { return false; } diff --git a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java index d82935d0d7..c859c25351 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java @@ -134,7 +134,7 @@ class CascadeEffect extends OneShotEffect { Cards cardsFromExile = new CardsImpl(); Cards cardsToLibrary = new CardsImpl(); cardsFromExile.addAll(exile); - while (cardsFromExile.size() > 0) { + while (!cardsFromExile.isEmpty()) { card = cardsFromExile.getRandom(game); cardsFromExile.remove(card.getId()); cardsToLibrary.add(card); diff --git a/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java b/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java index f155d53c44..fd3f408d60 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java @@ -208,7 +208,7 @@ class ConvokeEffect extends OneShotEffect { if (!perm.isTapped() && perm.tap(game)) { ManaPool manaPool = controller.getManaPool(); Choice chooseManaType = buildChoice(perm.getColor(game), unpaid.getMana()); - if (chooseManaType.getChoices().size() > 0) { + if (!chooseManaType.getChoices().isEmpty()) { if (chooseManaType.getChoices().size() > 1) { chooseManaType.getChoices().add("Colorless"); chooseManaType.setMessage("Choose mana color to reduce from " + perm.getName()); diff --git a/Mage/src/main/java/mage/abilities/keyword/DelveAbility.java b/Mage/src/main/java/mage/abilities/keyword/DelveAbility.java index 69b0adcb46..a50e1bf0d4 100644 --- a/Mage/src/main/java/mage/abilities/keyword/DelveAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/DelveAbility.java @@ -93,13 +93,13 @@ public class DelveAbility extends SimpleStaticAbility implements AlternateManaPa @Override public String getRule() { - return "Delve (Each card you exile from your graveyard while casting this spell pays for {1}.)"; + return "Delve (Each card you exile from your graveyard while casting this spell pays for {1}.)"; } @Override public void addSpecialAction(Ability source, Game game, ManaCost unpaid) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && controller.getGraveyard().size() > 0) { + if (controller != null && !controller.getGraveyard().isEmpty()) { if (unpaid.getMana().getGeneric() > 0 && source.getAbilityType().equals(AbilityType.SPELL)) { SpecialAction specialAction = new DelveSpecialAction(); specialAction.setControllerId(source.getControllerId()); @@ -159,7 +159,7 @@ class DelveEffect extends OneShotEffect { ExileFromGraveCost exileFromGraveCost = (ExileFromGraveCost) source.getCosts().get(0); List exiledCards = exileFromGraveCost.getExiledCards(); - if (exiledCards.size() > 0) { + if (!exiledCards.isEmpty()) { Cards toDelve = new CardsImpl(); for (Card card : exiledCards) { toDelve.add(card); diff --git a/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java b/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java index 350cc8e517..3667b59832 100644 --- a/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/FlashbackAbility.java @@ -123,16 +123,16 @@ public class FlashbackAbility extends SpellAbility { @Override public String getRule() { StringBuilder sbRule = new StringBuilder("Flashback"); - if (costs.size() > 0) { + if (!costs.isEmpty()) { sbRule.append(" - "); } else { sbRule.append(' '); } - if (manaCosts.size() > 0) { + if (!manaCosts.isEmpty()) { sbRule.append(manaCosts.getText()); } - if (costs.size() > 0) { - if (manaCosts.size() > 0) { + if (!costs.isEmpty()) { + if (!manaCosts.isEmpty()) { sbRule.append(", "); } sbRule.append(costs.getText()); diff --git a/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java b/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java index bd839096a4..30e8ef3914 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HideawayAbility.java @@ -118,7 +118,7 @@ class HideawayExileEffect extends OneShotEffect { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 4)); - if (cards.size() > 0) { + if (!cards.isEmpty()) { TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1); if (controller.choose(Outcome.Detriment, cards, target1, game)) { Card card = cards.get(target1.getFirstTarget(), game); diff --git a/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java b/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java index 100c0e7473..5dc86dada7 100644 --- a/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java @@ -82,7 +82,7 @@ class TransmuteEffect extends OneShotEffect { filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, sourceObject.getConvertedManaCost())); TargetCardInLibrary target = new TargetCardInLibrary(1, filter); if (controller.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { + if (!target.getTargets().isEmpty()) { Cards revealed = new CardsImpl(target.getTargets()); controller.revealCards(sourceObject.getIdName(), revealed, game); controller.moveCards(revealed, Zone.HAND, source, game); diff --git a/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java b/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java index 1c7b4d6874..000aa8bdf5 100644 --- a/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java @@ -95,7 +95,7 @@ public abstract class ActivatedManaAbilityImpl extends ActivatedAbilityImpl impl */ @Override public boolean definesMana() { - return netMana.size() > 0; + return !netMana.isEmpty(); } /** diff --git a/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java b/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java index 8081221808..ea94f06ffc 100644 --- a/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java @@ -124,7 +124,7 @@ class AnyColorLandsProduceManaEffect extends ManaEffect { choice.getChoices().add("Green"); choice.getChoices().add("White"); } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); diff --git a/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java b/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java index d344dcfc96..8e2a7c2330 100644 --- a/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java @@ -148,7 +148,7 @@ class CommanderIdentityManaEffect extends ManaEffect { } } } - if (choice.getChoices().size() > 0) { + if (!choice.getChoices().isEmpty()) { if (choice.getChoices().size() == 1) { choice.setChoice(choice.getChoices().iterator().next()); } else { diff --git a/Mage/src/main/java/mage/abilities/mana/ManaOptions.java b/Mage/src/main/java/mage/abilities/mana/ManaOptions.java index 03e8bcd4ee..f5402422dc 100644 --- a/Mage/src/main/java/mage/abilities/mana/ManaOptions.java +++ b/Mage/src/main/java/mage/abilities/mana/ManaOptions.java @@ -46,8 +46,6 @@ public class ManaOptions extends ArrayList { public ManaOptions() { } - ; - public ManaOptions(final ManaOptions options) { for (Mana mana : options) { this.add(mana.copy()); diff --git a/Mage/src/main/java/mage/abilities/mana/TriggeredManaAbility.java b/Mage/src/main/java/mage/abilities/mana/TriggeredManaAbility.java index 4ef715e220..ab686c04d6 100644 --- a/Mage/src/main/java/mage/abilities/mana/TriggeredManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/TriggeredManaAbility.java @@ -97,6 +97,6 @@ public abstract class TriggeredManaAbility extends TriggeredAbilityImpl implemen */ @Override public boolean definesMana() { - return netMana.size() > 0; + return !netMana.isEmpty(); } } diff --git a/Mage/src/main/java/mage/cards/Sets.java b/Mage/src/main/java/mage/cards/Sets.java index 7fc0e1374e..afa3a1d565 100644 --- a/Mage/src/main/java/mage/cards/Sets.java +++ b/Mage/src/main/java/mage/cards/Sets.java @@ -146,10 +146,10 @@ public class Sets extends HashMap { Map deckCards = new HashMap<>(); Map sideboard = new HashMap<>(); try (PrintWriter out = new PrintWriter(file)) { - if (deck.getName() != null && deck.getName().length() > 0) { + if (deck.getName() != null && !deck.getName().isEmpty()) { out.println("NAME:" + deck.getName()); } - if (deck.getAuthor() != null && deck.getAuthor().length() > 0) { + if (deck.getAuthor() != null && !deck.getAuthor().isEmpty()) { out.println("AUTHOR:" + deck.getAuthor()); } for (DeckCardInfo deckCardInfo : deck.getCards()) { diff --git a/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java b/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java index 6593401fc1..67837022b8 100644 --- a/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java +++ b/Mage/src/main/java/mage/cards/decks/importer/DckDeckImporter.java @@ -73,7 +73,7 @@ public class DckDeckImporter extends DeckImporter { if (cardInfo == null) { // Try alternate based on name String cardName = m.group(5); - if (cardName != null && cardName.length() > 0) { + if (cardName != null && !cardName.isEmpty()) { cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(cardName, false); sbMessage.append("Could not find card '").append(cardName).append("' in set ").append(setCode).append(" of number ").append(cardNum).append(".\n"); if (cardInfo != null) { diff --git a/Mage/src/main/java/mage/filter/FilterCard.java b/Mage/src/main/java/mage/filter/FilterCard.java index a59885e990..035d6e8809 100644 --- a/Mage/src/main/java/mage/filter/FilterCard.java +++ b/Mage/src/main/java/mage/filter/FilterCard.java @@ -115,7 +115,7 @@ public class FilterCard extends FilterObject { } public boolean hasPredicates() { - return predicates.size() > 0; + return !predicates.isEmpty(); } @Override diff --git a/Mage/src/main/java/mage/game/GameCommanderImpl.java b/Mage/src/main/java/mage/game/GameCommanderImpl.java index 3be3b93eb9..44c61134d5 100644 --- a/Mage/src/main/java/mage/game/GameCommanderImpl.java +++ b/Mage/src/main/java/mage/game/GameCommanderImpl.java @@ -72,7 +72,7 @@ public abstract class GameCommanderImpl extends GameImpl { for (UUID playerId : state.getPlayerList(startingPlayerId)) { Player player = getPlayer(playerId); if (player != null) { - while (player.getSideboard().size() > 0) { + while (!player.getSideboard().isEmpty()) { Card commander = this.getCard(player.getSideboard().iterator().next()); if (commander != null) { player.addCommanderId(commander.getId()); diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index d63b9eacc2..981b743f15 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -1899,7 +1899,7 @@ public abstract class GameImpl implements Game, Serializable { //20091005 - 704.5q If a creature is attached to an object or player, it becomes unattached and remains on the battlefield. // Similarly, if a permanent thatÂ’s neither an Aura, an Equipment, nor a Fortification is attached to an object or player, // it becomes unattached and remains on the battlefield. - if (perm.getAttachments().size() > 0) { + if (!perm.getAttachments().isEmpty()) { for (UUID attachmentId : perm.getAttachments()) { Permanent attachment = getPermanent(attachmentId); if (attachment != null diff --git a/Mage/src/main/java/mage/game/GameStates.java b/Mage/src/main/java/mage/game/GameStates.java index b65cbccea3..e4e82b2efb 100644 --- a/Mage/src/main/java/mage/game/GameStates.java +++ b/Mage/src/main/java/mage/game/GameStates.java @@ -60,7 +60,7 @@ public class GameStates implements Serializable { } public GameState rollback(int index) { - if (states.size() > 0 && index < states.size()) { + if (!states.isEmpty() && index < states.size()) { while (states.size() > index + 1) { states.remove(states.size() - 1); } @@ -72,8 +72,8 @@ public class GameStates implements Serializable { } public int remove(int index) { - if (states.size() > 0 && index < states.size()) { - while (states.size() > index && states.size() > 0) { + if (!states.isEmpty() && index < states.size()) { + while (states.size() > index && !states.isEmpty()) { states.remove(states.size() - 1); } } diff --git a/Mage/src/main/java/mage/game/ZonesHandler.java b/Mage/src/main/java/mage/game/ZonesHandler.java index fc733a970b..9f293231bd 100644 --- a/Mage/src/main/java/mage/game/ZonesHandler.java +++ b/Mage/src/main/java/mage/game/ZonesHandler.java @@ -34,7 +34,7 @@ public class ZonesHandler { public static boolean moveCard(ZoneChangeInfo info, Game game) { List list = new ArrayList<>(); list.add(info); - return moveCards(list, game).size() > 0; + return !moveCards(list, game).isEmpty(); } public static List moveCards(List zoneChangeInfos, Game game) { diff --git a/Mage/src/main/java/mage/game/combat/Combat.java b/Mage/src/main/java/mage/game/combat/Combat.java index edd139d5ab..fdf52a3d69 100644 --- a/Mage/src/main/java/mage/game/combat/Combat.java +++ b/Mage/src/main/java/mage/game/combat/Combat.java @@ -514,7 +514,7 @@ public class Combat implements Serializable, Copyable { } } if (attackerExists) { - if (group.getBlockers().size() > 0) { + if (!group.getBlockers().isEmpty()) { sb.append("blocked by "); for (UUID blockingCreatureId : group.getBlockerOrder()) { Permanent blockingCreature = game.getPermanent(blockingCreatureId); diff --git a/Mage/src/main/java/mage/game/combat/CombatGroup.java b/Mage/src/main/java/mage/game/combat/CombatGroup.java index c0fca4fbb1..455f7fb608 100644 --- a/Mage/src/main/java/mage/game/combat/CombatGroup.java +++ b/Mage/src/main/java/mage/game/combat/CombatGroup.java @@ -134,7 +134,7 @@ public class CombatGroup implements Serializable, Copyable { } public void assignDamageToBlockers(boolean first, Game game) { - if (attackers.size() > 0 && (!first || hasFirstOrDoubleStrike(game))) { + if (!attackers.isEmpty() && (!first || hasFirstOrDoubleStrike(game))) { if (blockers.isEmpty()) { unblockedDamage(first, game); } else { @@ -156,7 +156,7 @@ public class CombatGroup implements Serializable, Copyable { } public void assignDamageToAttackers(boolean first, Game game) { - if (blockers.size() > 0 && (!first || hasFirstOrDoubleStrike(game))) { + if (!blockers.isEmpty() && (!first || hasFirstOrDoubleStrike(game))) { if (attackers.size() == 1) { singleAttackerDamage(first, game); } else { @@ -583,7 +583,7 @@ public class CombatGroup implements Serializable, Copyable { for (UUID uuid : attackers) { Permanent attacker = game.getPermanent(uuid); // Check if there are enough blockers to have a legal block - if (attacker != null && this.blocked && attacker.getMinBlockedBy() > 1 && blockers.size() > 0 && blockers.size() < attacker.getMinBlockedBy()) { + if (attacker != null && this.blocked && attacker.getMinBlockedBy() > 1 && !blockers.isEmpty() && blockers.size() < attacker.getMinBlockedBy()) { for (UUID blockerId : blockers) { Permanent blocker = game.getPermanent(blockerId); if (blocker != null) { diff --git a/Mage/src/main/java/mage/game/draft/DraftCube.java b/Mage/src/main/java/mage/game/draft/DraftCube.java index b120bb0a94..8a9c1cb647 100644 --- a/Mage/src/main/java/mage/game/draft/DraftCube.java +++ b/Mage/src/main/java/mage/game/draft/DraftCube.java @@ -108,7 +108,7 @@ public abstract class DraftCube { if (!cardId.getExtension().isEmpty()) { CardCriteria criteria = new CardCriteria().name(cardId.getName()).setCodes(cardId.extension); List cardList = CardRepository.instance.findCards(criteria); - if (cardList != null && cardList.size() > 0) { + if (cardList != null && !cardList.isEmpty()) { cardInfo = cardList.get(0); } } else { diff --git a/Mage/src/main/java/mage/game/draft/RandomBoosterDraft.java b/Mage/src/main/java/mage/game/draft/RandomBoosterDraft.java index bc50b7a72f..887f1bed3d 100644 --- a/Mage/src/main/java/mage/game/draft/RandomBoosterDraft.java +++ b/Mage/src/main/java/mage/game/draft/RandomBoosterDraft.java @@ -63,7 +63,7 @@ public class RandomBoosterDraft extends BoosterDraft { } private ExpansionSet getNextBooster() { - if (0 == useBoosters.size()){ + if (useBoosters.isEmpty()){ resetBoosters(); } ExpansionSet theBooster = useBoosters.get(0); diff --git a/Mage/src/main/java/mage/game/match/MatchPlayer.java b/Mage/src/main/java/mage/game/match/MatchPlayer.java index f2c5d483dd..3bc8a66edd 100644 --- a/Mage/src/main/java/mage/game/match/MatchPlayer.java +++ b/Mage/src/main/java/mage/game/match/MatchPlayer.java @@ -105,7 +105,7 @@ public class MatchPlayer implements Serializable { public Deck generateDeck() { //TODO: improve this - while (deck.getCards().size() < 40 && deck.getSideboard().size() > 0) { + while (deck.getCards().size() < 40 && !deck.getSideboard().isEmpty()) { Card card = deck.getSideboard().iterator().next(); deck.getCards().add(card); deck.getSideboard().remove(card); diff --git a/Mage/src/main/java/mage/game/permanent/token/Token.java b/Mage/src/main/java/mage/game/permanent/token/Token.java index ef5f13c824..46b7fd4918 100644 --- a/Mage/src/main/java/mage/game/permanent/token/Token.java +++ b/Mage/src/main/java/mage/game/permanent/token/Token.java @@ -284,7 +284,7 @@ public class Token extends MageObjectImpl { } public void setExpansionSetCodeForImage(String code) { - if (availableImageSetCodes.size() > 0) { + if (!availableImageSetCodes.isEmpty()) { if (availableImageSetCodes.contains(code)) { setOriginalExpansionSetCode(code); } else // we should not set random set if appropriate set is already used diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index 38c49d6ded..2f2871b641 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -315,7 +315,7 @@ public class Spell extends StackObjImpl implements Card { boolean legalTargetedMode = false; for (UUID modeId : spellAbility.getModes().getSelectedModes()) { Mode mode = spellAbility.getModes().get(modeId); - if (mode.getTargets().size() > 0) { + if (!mode.getTargets().isEmpty()) { targetedMode = true; if (mode.getTargets().stillLegal(spellAbility, game)) { legalTargetedMode = true; diff --git a/Mage/src/main/java/mage/game/stack/StackAbility.java b/Mage/src/main/java/mage/game/stack/StackAbility.java index 2ba1f248d6..430820956f 100644 --- a/Mage/src/main/java/mage/game/stack/StackAbility.java +++ b/Mage/src/main/java/mage/game/stack/StackAbility.java @@ -589,7 +589,7 @@ public class StackAbility extends StackObjImpl implements Ability { newAbility.newId(); StackAbility newStackAbility = new StackAbility(newAbility, newControllerId); game.getStack().push(newStackAbility); - if (chooseNewTargets && newAbility.getTargets().size() > 0) { + if (chooseNewTargets && !newAbility.getTargets().isEmpty()) { Player controller = game.getPlayer(newControllerId); Outcome outcome = newAbility.getEffects().isEmpty() ? Outcome.Detriment : newAbility.getEffects().get(0).getOutcome(); if (controller.chooseUse(outcome, "Choose new targets?", source, game)) { diff --git a/Mage/src/main/java/mage/game/tournament/TournamentImpl.java b/Mage/src/main/java/mage/game/tournament/TournamentImpl.java index a227b82421..3c48e1611b 100644 --- a/Mage/src/main/java/mage/game/tournament/TournamentImpl.java +++ b/Mage/src/main/java/mage/game/tournament/TournamentImpl.java @@ -202,7 +202,7 @@ public abstract class TournamentImpl implements Tournament { round.addPairing(new TournamentPairing(player1, player2)); } - if (roundPlayers.size() > 0) { + if (!roundPlayers.isEmpty()) { // player free round - add to bye players of this round TournamentPlayer player1 = roundPlayers.get(0); round.getPlayerByes().add(player1); diff --git a/Mage/src/main/java/mage/game/tournament/pairing/SwissPairingSimple.java b/Mage/src/main/java/mage/game/tournament/pairing/SwissPairingSimple.java index 0af702e22c..249fa0b116 100644 --- a/Mage/src/main/java/mage/game/tournament/pairing/SwissPairingSimple.java +++ b/Mage/src/main/java/mage/game/tournament/pairing/SwissPairingSimple.java @@ -67,7 +67,7 @@ public class SwissPairingSimple { }); // create pairings - while (players.size() > 0) { + while (!players.isEmpty()) { TournamentPlayer player1 = players.get(0); players.remove(0); TournamentPlayer playerForPossibleSecondPairing = null; diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index f9bc0cb6ae..9f972c8c36 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -680,7 +680,7 @@ public abstract class PlayerImpl implements Player, Serializable { } if (this.getHand().size() == 1 || this.getHand().size() == amount) { discardedCards.addAll(this.getHand()); - while (this.getHand().size() > 0) { + while (!this.getHand().isEmpty()) { discard(this.getHand().get(this.getHand().iterator().next(), game), source, game); } return discardedCards; @@ -1495,7 +1495,7 @@ public abstract class PlayerImpl implements Player, Serializable { filter.add(Predicates.not(new PermanentIdPredicate(permanent.getId()))); } // while targets left and there is still allowed to untap - while (canRespond() && leftForUntap.size() > 0 && numberToUntap > 0) { + while (canRespond() && !leftForUntap.isEmpty() && numberToUntap > 0) { // player has to select the permanent he wants to untap for this restriction Ability ability = handledEntry.getKey().getValue().iterator().next(); if (ability != null) { @@ -2817,14 +2817,14 @@ public abstract class PlayerImpl implements Player, Serializable { if (ability.isModal()) { addModeOptions(options, ability, game); - } else if (ability.getTargets().getUnchosen().size() > 0) { + } else if (!ability.getTargets().getUnchosen().isEmpty()) { // TODO: Handle other variable costs than mana costs - if (ability.getManaCosts().getVariableCosts().size() > 0) { + if (!ability.getManaCosts().getVariableCosts().isEmpty()) { addVariableXOptions(options, ability, 0, game); } else { addTargetOptions(options, ability, 0, game); } - } else if (ability.getCosts().getTargets().getUnchosen().size() > 0) { + } else if (!ability.getCosts().getTargets().getUnchosen().isEmpty()) { addCostTargetOptions(options, ability, 0, game); } @@ -2838,13 +2838,13 @@ public abstract class PlayerImpl implements Player, Serializable { newOption.getModes().getSelectedModes().clear(); newOption.getModes().getSelectedModes().add(mode.getId()); newOption.getModes().setActiveMode(mode); - if (newOption.getTargets().getUnchosen().size() > 0) { - if (newOption.getManaCosts().getVariableCosts().size() > 0) { + if (!newOption.getTargets().getUnchosen().isEmpty()) { + if (!newOption.getManaCosts().getVariableCosts().isEmpty()) { addVariableXOptions(options, newOption, 0, game); } else { addTargetOptions(options, newOption, 0, game); } - } else if (newOption.getCosts().getTargets().getUnchosen().size() > 0) { + } else if (!newOption.getCosts().getTargets().getUnchosen().isEmpty()) { addCostTargetOptions(options, newOption, 0, game); } else { options.add(newOption); @@ -2871,7 +2871,7 @@ public abstract class PlayerImpl implements Player, Serializable { } if (targetNum < option.getTargets().size() - 2) { addTargetOptions(options, newOption, targetNum + 1, game); - } else if (option.getCosts().getTargets().size() > 0) { + } else if (!option.getCosts().getTargets().isEmpty()) { addCostTargetOptions(options, newOption, 0, game); } else { options.add(newOption); @@ -3115,7 +3115,7 @@ public abstract class PlayerImpl implements Player, Serializable { case GRAVEYARD: fromZone = game.getState().getZone(cards.iterator().next().getId()); successfulMovedCards = moveCardsToGraveyardWithInfo(cards, source, game, fromZone); - return successfulMovedCards.size() > 0; + return !successfulMovedCards.isEmpty(); case BATTLEFIELD: // new logic that does not yet add the permanents to battlefield while replacement effects are handled List infoList = new ArrayList<>(); for (Card card : cards) { @@ -3175,7 +3175,7 @@ public abstract class PlayerImpl implements Player, Serializable { default: throw new UnsupportedOperationException("to Zone" + toZone.toString() + " not supported yet"); } - return successfulMovedCards.size() > 0; + return !successfulMovedCards.isEmpty(); } @Override diff --git a/Mage/src/main/java/mage/target/TargetImpl.java b/Mage/src/main/java/mage/target/TargetImpl.java index 38996f4128..88c29215ac 100644 --- a/Mage/src/main/java/mage/target/TargetImpl.java +++ b/Mage/src/main/java/mage/target/TargetImpl.java @@ -314,7 +314,7 @@ public abstract class TargetImpl implements Target { chosen = targets.size() >= getNumberOfTargets(); if (isRandom()) { Set possibleTargets = possibleTargets(source.getSourceId(), playerId, game); - if (possibleTargets.size() > 0) { + if (!possibleTargets.isEmpty()) { int i = 0; int rnd = RandomUtil.nextInt(possibleTargets.size()); Iterator it = possibleTargets.iterator(); @@ -370,7 +370,7 @@ public abstract class TargetImpl implements Target { } } - return targets.size() > 0; + return !targets.isEmpty(); } /** @@ -483,7 +483,7 @@ public abstract class TargetImpl implements Target { @Override public UUID getFirstTarget() { - if (targets.size() > 0) { + if (!targets.isEmpty()) { return targets.keySet().iterator().next(); } return null; diff --git a/Mage/src/main/java/mage/target/targetpointer/FirstTargetPointer.java b/Mage/src/main/java/mage/target/targetpointer/FirstTargetPointer.java index d9b1db245e..01d2b3c7db 100644 --- a/Mage/src/main/java/mage/target/targetpointer/FirstTargetPointer.java +++ b/Mage/src/main/java/mage/target/targetpointer/FirstTargetPointer.java @@ -30,7 +30,7 @@ public class FirstTargetPointer implements TargetPointer { @Override public void init(Game game, Ability source) { - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { for (UUID target : source.getTargets().get(0).getTargets()) { Card card = game.getCard(target); if (card != null) { @@ -43,7 +43,7 @@ public class FirstTargetPointer implements TargetPointer { @Override public List getTargets(Game game, Ability source) { ArrayList target = new ArrayList<>(); - if (source.getTargets().size() > 0) { + if (!source.getTargets().isEmpty()) { for (UUID targetId : source.getTargets().get(0).getTargets()) { Card card = game.getCard(targetId); if (card != null && zoneChangeCounter.containsKey(targetId) diff --git a/Mage/src/main/java/mage/util/TournamentUtil.java b/Mage/src/main/java/mage/util/TournamentUtil.java index 2448a3277a..ccf6c18673 100644 --- a/Mage/src/main/java/mage/util/TournamentUtil.java +++ b/Mage/src/main/java/mage/util/TournamentUtil.java @@ -61,7 +61,7 @@ public class TournamentUtil { // if sets have no basic lands and also it has no parent or parent has no lands get last set with lands // select a set with basic lands by random List basicLandSets = ExpansionRepository.instance.getSetsWithBasicLandsByReleaseDate(); - if (basicLandSets.size() > 0) { + if (!basicLandSets.isEmpty()) { landSetCodes.add(basicLandSets.get(RandomUtil.nextInt(basicLandSets.size())).getCode()); } } diff --git a/Mage/src/main/java/mage/util/trace/TraceUtil.java b/Mage/src/main/java/mage/util/trace/TraceUtil.java index b4da8fb985..ca1df9ea87 100644 --- a/Mage/src/main/java/mage/util/trace/TraceUtil.java +++ b/Mage/src/main/java/mage/util/trace/TraceUtil.java @@ -66,7 +66,7 @@ public class TraceUtil { } } if (cantBeBlocked(attacker)) { - if (group.getBlockers().size() > 0) { + if (!group.getBlockers().isEmpty()) { Permanent blocker = game.getPermanent(group.getBlockers().get(0)); if (blocker != null) { log.warn("Found creature that can't be blocked by some other creature"); From 076045d862922edae65eb6834cb04349f7e14961 Mon Sep 17 00:00:00 2001 From: vraskulin Date: Mon, 6 Feb 2017 14:36:09 +0300 Subject: [PATCH 11/12] Fixed merge conflict --- .../main/java/mage/abilities/keyword/CascadeAbility.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java index c859c25351..39d83eeca9 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java @@ -44,16 +44,14 @@ import mage.game.stack.Spell; import mage.players.Player; /** - * * @author BetaSteward_at_googlemail.com */ public class CascadeAbility extends TriggeredAbilityImpl { //20091005 - 702.82 - private boolean withReminder; - private final static String reminderText = " (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less." + " You may cast it without paying its mana cost. Put the exiled cards on the bottom in a random order.)"; + private boolean withReminder; public CascadeAbility() { this(true); @@ -121,7 +119,8 @@ class CascadeEffect extends OneShotEffect { break; } controller.moveCardsToExile(card, source, game, true, exile.getId(), exile.getName()); - } while (controller.isInGame() && (card.getCardType().contains(CardType.LAND) || !cardThatCostsLess(sourceCost, card, game))); + } + while (controller.isInGame() && (card.getCardType().contains(CardType.LAND) || !cardThatCostsLess(sourceCost, card, game))); controller.getLibrary().reset(); // set back empty draw state if that caused an empty draw From 1ce40e7d316789595766eb9de1379d3524f18f65 Mon Sep 17 00:00:00 2001 From: spjspj Date: Mon, 6 Feb 2017 23:41:32 +1100 Subject: [PATCH 12/12] Add New Frontiers [ODY] --- Mage.Sets/src/mage/cards/n/NewFrontiers.java | 111 +++++++++++++++++++ Mage.Sets/src/mage/sets/Odyssey.java | 1 + 2 files changed, 112 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/n/NewFrontiers.java diff --git a/Mage.Sets/src/mage/cards/n/NewFrontiers.java b/Mage.Sets/src/mage/cards/n/NewFrontiers.java new file mode 100644 index 0000000000..d8f370b0d9 --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NewFrontiers.java @@ -0,0 +1,111 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.n; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.common.FilterBasicLandCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author spjspj + */ +public class NewFrontiers extends CardImpl { + + public NewFrontiers(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{G}"); + + // Each player may search his or her library for up to X basic land cards and put them onto the battlefield tapped. Then each player who searched his or her library this way shuffles it. + this.getSpellAbility().addEffect(new NewFrontiersEffect()); + } + + public NewFrontiers(final NewFrontiers card) { + super(card); + } + + @Override + public NewFrontiers copy() { + return new NewFrontiers(this); + } +} + +class NewFrontiersEffect extends OneShotEffect { + + public NewFrontiersEffect() { + super(Outcome.Detriment); + this.staticText = "Each player may search his or her library for up to X basic land cards and put them onto the battlefield tapped. Then each player who searched his or her library this way shuffles it"; + } + + public NewFrontiersEffect(final NewFrontiersEffect effect) { + super(effect); + } + + @Override + public NewFrontiersEffect copy() { + return new NewFrontiersEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int amount = source.getManaCostsToPay().getX(); + + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null) { + TargetCardInLibrary target = new TargetCardInLibrary(0, amount, new FilterBasicLandCard()); + if (player.searchLibrary(target, game)) { + for (UUID cardId : target.getTargets()) { + Card card = player.getLibrary().getCard(cardId, game); + if (card != null) { + card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId(), true); + } + } + player.shuffleLibrary(source, game); + } + + } + } + // prevent undo + controller.resetStoredBookmark(game); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Odyssey.java b/Mage.Sets/src/mage/sets/Odyssey.java index 592c4d43b1..3ae78d7de9 100644 --- a/Mage.Sets/src/mage/sets/Odyssey.java +++ b/Mage.Sets/src/mage/sets/Odyssey.java @@ -238,6 +238,7 @@ public class Odyssey extends ExpansionSet { cards.add(new SetCardInfo("Nantuko Mentor", 255, Rarity.RARE, mage.cards.n.NantukoMentor.class)); cards.add(new SetCardInfo("Need for Speed", 209, Rarity.RARE, mage.cards.n.NeedForSpeed.class)); cards.add(new SetCardInfo("Nefarious Lich", 153, Rarity.RARE, mage.cards.n.NefariousLich.class)); + cards.add(new SetCardInfo("New Frontiers", 257, Rarity.RARE, mage.cards.n.NewFrontiers.class)); cards.add(new SetCardInfo("Nimble Mongoose", 258, Rarity.UNCOMMON, mage.cards.n.NimbleMongoose.class)); cards.add(new SetCardInfo("Nomad Decoy", 37, Rarity.UNCOMMON, mage.cards.n.NomadDecoy.class)); cards.add(new SetCardInfo("Nomad Stadium", 322, Rarity.UNCOMMON, mage.cards.n.NomadStadium.class));