From d7dd635bca4ee0ae16531723542cf710ad3979d7 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 16 Sep 2016 23:55:54 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"introduced=20StringUtil=20class=20wit?= =?UTF-8?q?h=20.isEmpty(String=20input)=20and=20.isNotEmp=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/mage/client/cards/Card.java | 3 +- .../main/java/mage/client/cards/CardArea.java | 2 +- .../java/mage/client/cards/Permanent.java | 3 +- .../java/mage/client/chat/ChatPanelBasic.java | 7 ++- .../mage/client/components/MageTextArea.java | 2 +- .../components/ability/AbilityPicker.java | 2 +- .../mage/client/dialog/NewTableDialog.java | 40 +++++++++------- .../main/java/mage/client/game/GamePanel.java | 2 +- .../mage/client/table/TablePlayerPanel.java | 4 +- .../mage/client/util/gui/GuiDisplayUtil.java | 3 +- .../java/org/mage/card/arcane/CardPanel.java | 3 +- Mage.Common/src/mage/view/ChatMessage.java | 12 +---- .../src/main/java/mage/server/User.java | 16 +++---- .../mage/sets/kaladesh/GlimmerOfGenius.java | 33 ------------- .../sets/kaladesh/RevolutionaryRebuff.java | 46 ------------------- .../mage/sets/kaladesh/RushOfVitality.java | 42 ----------------- .../sets/kaladesh/VedalkenBlademaster.java | 41 ----------------- Mage/src/main/java/mage/ConditionalMana.java | 7 ++- .../java/mage/abilities/AbilitiesImpl.java | 6 +-- .../abilities/costs/mana/ManaCostsImpl.java | 5 +- .../ConditionalReplacementEffect.java | 3 +- .../effects/common/CreateTokenEffect.java | 2 +- .../common/CreateTokenTargetEffect.java | 2 +- .../common/DamageControllerEffect.java | 3 +- .../effects/common/DamageTargetEffect.java | 7 ++- ...nControllersNextUntapStepTargetEffect.java | 2 +- .../DrawCardSourceControllerEffect.java | 3 +- .../effects/common/DrawCardTargetEffect.java | 2 +- .../LoseLifeControllerAttachedEffect.java | 3 +- .../common/LoseLifeOpponentsEffect.java | 2 +- .../LoseLifeSourceControllerEffect.java | 3 +- .../effects/common/LoseLifeTargetEffect.java | 5 +- .../PutLibraryIntoGraveTargetEffect.java | 2 +- .../common/SkipNextPlayerUntapStepEffect.java | 3 +- .../effects/common/TapTargetEffect.java | 3 +- .../effects/common/TransformTargetEffect.java | 3 +- .../AssignNoCombatDamageSourceEffect.java | 2 +- .../BecomesColorOrColorsTargetEffect.java | 4 +- .../continuous/BecomesCreatureAllEffect.java | 5 +- .../BecomesCreatureSourceEffect.java | 2 +- .../continuous/BoostEnchantedEffect.java | 2 +- .../continuous/BoostEquippedEffect.java | 3 +- .../counter/AddCountersAttachedEffect.java | 3 +- .../counter/AddCountersTargetEffect.java | 3 +- .../discard/DiscardControllerEffect.java | 3 +- .../discard/DiscardHandTargetEffect.java | 5 +- .../common/discard/DiscardTargetEffect.java | 5 +- .../keyword/ManifestTargetPlayerEffect.java | 3 +- .../abilities/keyword/CascadeAbility.java | 2 +- Mage/src/main/java/mage/cards/Sets.java | 6 +-- Mage/src/main/java/mage/util/StringUtil.java | 15 ------ 51 files changed, 96 insertions(+), 294 deletions(-) delete mode 100644 Mage.Sets/src/mage/sets/kaladesh/GlimmerOfGenius.java delete mode 100644 Mage.Sets/src/mage/sets/kaladesh/RevolutionaryRebuff.java delete mode 100644 Mage.Sets/src/mage/sets/kaladesh/RushOfVitality.java delete mode 100644 Mage.Sets/src/mage/sets/kaladesh/VedalkenBlademaster.java delete mode 100644 Mage/src/main/java/mage/util/StringUtil.java 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 ad71011abd..f87c03bbeb 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Card.java +++ b/Mage.Client/src/main/java/mage/client/cards/Card.java @@ -87,7 +87,6 @@ import mage.client.util.gui.ArrowBuilder; import mage.constants.CardType; import mage.constants.EnlargeMode; import mage.remote.Session; -import mage.util.StringUtil; import mage.view.AbilityView; import mage.view.CardView; import mage.view.CounterView; @@ -249,7 +248,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis for (String rule : getRules()) { sb.append("\n").append(rule); } - if (StringUtil.isNotEmpty(card.getExpansionSetCode())) { + if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) { sb.append("\n").append(card.getCardNumber()).append(" - "); sb.append(Sets.getInstance().get(card.getExpansionSetCode()).getName()).append(" - "); sb.append(card.getRarity().toString()); 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 eb80fef3e2..6fad717b2a 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.isEmpty()) { + if (showCards != null && showCards.size() > 0) { 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/Permanent.java b/Mage.Client/src/main/java/mage/client/cards/Permanent.java index 3ecce83a08..0db10e5887 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Permanent.java +++ b/Mage.Client/src/main/java/mage/client/cards/Permanent.java @@ -54,7 +54,6 @@ import static mage.client.constants.Constants.POWBOX_TEXT_MAX_TOP; import mage.client.util.Config; import mage.client.util.ImageHelper; import mage.constants.CardType; -import mage.util.StringUtil; import mage.view.CounterView; import mage.view.PermanentView; import org.mage.plugins.card.images.ImageCache; @@ -125,7 +124,7 @@ public class Permanent extends Card { for (String rule: getRules()) { sb.append("\n").append(rule); } - if (StringUtil.isNotEmpty(permanent.getOriginal().getExpansionSetCode())) { + 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(permanent.getOriginal().getRarity().toString()); diff --git a/Mage.Client/src/main/java/mage/client/chat/ChatPanelBasic.java b/Mage.Client/src/main/java/mage/client/chat/ChatPanelBasic.java index 2e4d67bd3e..26f0ab1a0f 100644 --- a/Mage.Client/src/main/java/mage/client/chat/ChatPanelBasic.java +++ b/Mage.Client/src/main/java/mage/client/chat/ChatPanelBasic.java @@ -42,7 +42,6 @@ import javax.swing.JTextField; import mage.client.MageFrame; import mage.client.SessionHandler; import mage.client.util.GUISizeHelper; -import mage.util.StringUtil; import mage.view.ChatMessage.MessageColor; import mage.view.ChatMessage.MessageType; import org.mage.card.arcane.ManaSymbols; @@ -222,13 +221,13 @@ public class ChatPanelBasic extends javax.swing.JPanel { textColor = MESSAGE_COLOR; userSeparator = ": "; } - if (color == MessageColor.ORANGE) { + if (color.equals(MessageColor.ORANGE)) { textColor = "Orange"; } - if (color == MessageColor.YELLOW) { + if (color.equals(MessageColor.YELLOW)) { textColor = "Yellow"; } - if (StringUtil.isNotEmpty(username)) { + if (username != null && !username.isEmpty()) { text.append(getColoredText(userColor, username + userSeparator)); } text.append(getColoredText(textColor, ManaSymbols.replaceSymbolsWithHTML(message, ManaSymbols.Type.CHAT))); 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 78da53cc46..219e0f72d7 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.isEmpty()) { + if (text.length() > 0) { 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 17571fd14f..9c06eb63d2 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.isEmpty()) { + if (text.length() > 0) { buffer.append(ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.DIALOG)); } 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 fe845ff318..7fa024953d 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java @@ -405,25 +405,33 @@ public class NewTableDialog extends MageDialog { JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error creating table.", "Error", JOptionPane.ERROR_MESSAGE); return; } - if (SessionHandler.joinTable( - roomId, - table.getTableId(), - this.player1Panel.getPlayerName(), - "Human", 1, - DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()), - this.txtPassword.getText())) { - for (TablePlayerPanel player : players) { - if (!player.getPlayerType().equals("Human")) { - if (!player.joinTable(roomId, table.getTableId())) { - // error message must be send by the server - SessionHandler.removeTable(roomId, table.getTableId()); - table = null; - return; + try { + if (SessionHandler.joinTable( + roomId, + table.getTableId(), + this.player1Panel.getPlayerName(), + "Human", 1, + DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()), + this.txtPassword.getText())) { + for (TablePlayerPanel player : players) { + if (!player.getPlayerType().equals("Human")) { + if (!player.joinTable(roomId, table.getTableId())) { + // error message must be send by the server + SessionHandler.removeTable(roomId, table.getTableId()); + table = null; + return; + } } } + this.hideDialog(); + return; } - this.hideDialog(); - return; + } catch (FileNotFoundException ex) { + handleError(ex); + } catch (IOException ex) { + handleError(ex); + } catch (ClassNotFoundException ex) { + handleError(ex); } // JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error joining table.", "Error", JOptionPane.ERROR_MESSAGE); SessionHandler.removeTable(roomId, table.getTableId()); 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 d73c0b1f26..3597ba0b40 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -2173,7 +2173,7 @@ public final class GamePanel extends javax.swing.JPanel { choices, this.chosenHandKey); - if (newChosenHandKey != null && !newChosenHandKey.isEmpty()) { + if (newChosenHandKey != null && newChosenHandKey.length() > 0) { this.chosenHandKey = newChosenHandKey; CardsView cards = handCards.get(chosenHandKey); handContainer.loadCards(cards, bigCard, gameId); diff --git a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java index fa5e32f586..aefca569cf 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java @@ -69,7 +69,7 @@ public class TablePlayerPanel extends javax.swing.JPanel { cbPlayerType.setSelectedIndex(cbPlayerType.getItemCount() - 1); } else { - int index = Integer.parseInt(Config.defaultOtherPlayerIndex); + Integer index = Integer.parseInt(Config.defaultOtherPlayerIndex); cbPlayerType.setSelectedIndex(index); } } @@ -78,7 +78,7 @@ public class TablePlayerPanel extends javax.swing.JPanel { } } - public boolean joinTable(UUID roomId, UUID tableId) { + public boolean joinTable(UUID roomId, UUID tableId) throws FileNotFoundException, IOException, ClassNotFoundException { if (!this.cbPlayerType.getSelectedItem().equals("Human")) { return SessionHandler.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), (String)this.cbPlayerType.getSelectedItem(), this.newPlayerPanel.getLevel(), DeckImporterUtil.importDeck(this.newPlayerPanel.getDeckFile()),""); } 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 c57665406d..8cc83f0589 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 @@ -18,7 +18,6 @@ import mage.constants.CardType; import mage.constants.MageObjectType; import mage.constants.Rarity; import mage.constants.Zone; -import mage.util.StringUtil; import mage.utils.CardUtil; import mage.view.CardView; import mage.view.CounterView; @@ -340,7 +339,7 @@ public class GuiDisplayUtil { } String legal = rule.toString(); - if (StringUtil.isNotEmpty(legal)) { + if (legal.length() > 0) { 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)); 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 282d73bb5f..23520e6a83 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 @@ -32,7 +32,6 @@ import mage.client.plugins.impl.Plugins; import mage.client.util.audio.AudioManager; import mage.constants.CardType; import mage.constants.EnlargeMode; -import mage.util.StringUtil; import mage.view.AbilityView; import mage.view.CardView; import mage.view.PermanentView; @@ -726,7 +725,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener, for (String rule : card.getRules()) { sb.append("\n").append(rule); } - if (StringUtil.isNotEmpty(card.getExpansionSetCode())) { + if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) { sb.append("\n").append(card.getCardNumber()).append(" - "); sb.append(card.getExpansionSetCode()).append(" - "); sb.append(card.getRarity().toString()); diff --git a/Mage.Common/src/mage/view/ChatMessage.java b/Mage.Common/src/mage/view/ChatMessage.java index 3cf09c78e3..a0dbd1e1d8 100644 --- a/Mage.Common/src/mage/view/ChatMessage.java +++ b/Mage.Common/src/mage/view/ChatMessage.java @@ -45,17 +45,7 @@ public class ChatMessage implements Serializable { private MessageType messageType; public enum MessageColor { - BLACK("Black"), RED("Red"), GREEN("Green"), BLUE("Blue"), ORANGE("Orange"), YELLOW("Yellow"); - - private String color; - - MessageColor(String t){ - color = t; - } - - public String toString(){ - return color; - } + BLACK, RED, GREEN, BLUE, ORANGE, YELLOW; } public enum MessageType { diff --git a/Mage.Server/src/main/java/mage/server/User.java b/Mage.Server/src/main/java/mage/server/User.java index aded99de5b..644440b976 100644 --- a/Mage.Server/src/main/java/mage/server/User.java +++ b/Mage.Server/src/main/java/mage/server/User.java @@ -597,15 +597,15 @@ public class User { builder.append(proto.getMatches()); List quit = new ArrayList<>(); if (proto.getMatchesIdleTimeout() > 0) { - quit.add("I:" + proto.getMatchesIdleTimeout());//Integer.toString(proto.getMatchesIdleTimeout())); + quit.add("I:" + Integer.toString(proto.getMatchesIdleTimeout())); } if (proto.getMatchesTimerTimeout() > 0) { - quit.add("T:" + proto.getMatchesTimerTimeout());//Integer.toString(proto.getMatchesTimerTimeout())); + quit.add("T:" + Integer.toString(proto.getMatchesTimerTimeout())); } if (proto.getMatchesQuit() > 0) { - quit.add("Q:" + proto.getMatchesQuit());//Integer.toString(proto.getMatchesQuit())); + quit.add("Q:" + Integer.toString(proto.getMatchesQuit())); } - if (!quit.isEmpty()) { + if (quit.size() > 0) { builder.append(" ("); joinStrings(builder, quit, " "); builder.append(")"); @@ -629,15 +629,15 @@ public class User { builder.append(proto.getTourneys()); List quit = new ArrayList<>(); if (proto.getTourneysQuitDuringDrafting() > 0) { - quit.add("D:" + proto.getTourneysQuitDuringDrafting());//Integer.toString(proto.getTourneysQuitDuringDrafting())); + quit.add("D:" + Integer.toString(proto.getTourneysQuitDuringDrafting())); } if (proto.getTourneysQuitDuringConstruction() > 0) { - quit.add("C:" + proto.getTourneysQuitDuringConstruction());//Integer.toString(proto.getTourneysQuitDuringConstruction())); + quit.add("C:" + Integer.toString(proto.getTourneysQuitDuringConstruction())); } if (proto.getTourneysQuitDuringRound() > 0) { - quit.add("R:" + proto.getTourneysQuitDuringRound());//Integer.toString(proto.getTourneysQuitDuringRound())); + quit.add("R:" + Integer.toString(proto.getTourneysQuitDuringRound())); } - if (!quit.isEmpty()) { + if (quit.size() > 0) { builder.append(" ("); joinStrings(builder, quit, " "); builder.append(")"); diff --git a/Mage.Sets/src/mage/sets/kaladesh/GlimmerOfGenius.java b/Mage.Sets/src/mage/sets/kaladesh/GlimmerOfGenius.java deleted file mode 100644 index f316211fbc..0000000000 --- a/Mage.Sets/src/mage/sets/kaladesh/GlimmerOfGenius.java +++ /dev/null @@ -1,33 +0,0 @@ -package mage.sets.kaladesh; - -import mage.abilities.effects.common.DrawCardSourceControllerEffect; -import mage.abilities.effects.common.counter.GetEnergyCountersControllerEffect; -import mage.abilities.effects.keyword.ScryEffect; -import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Rarity; - -import java.util.UUID; - -/** - * Created by IGOUDT on 16-9-2016. - */ -public class GlimmerOfGenius extends CardImpl { - - public GlimmerOfGenius(final UUID ownerId){ - super(ownerId,49,"Glimmer of Genius", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT},"{3U}"); - this.expansionSetCode = "KLD"; - this.getSpellAbility().addEffect(new ScryEffect(2)); - this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2)); - this.getSpellAbility().addEffect(new GetEnergyCountersControllerEffect(2)); - } - - public GlimmerOfGenius(final GlimmerOfGenius glimmerOfGenius){ - super(glimmerOfGenius); - } - - public GlimmerOfGenius copy(){ - return new GlimmerOfGenius(this); - } - -} diff --git a/Mage.Sets/src/mage/sets/kaladesh/RevolutionaryRebuff.java b/Mage.Sets/src/mage/sets/kaladesh/RevolutionaryRebuff.java deleted file mode 100644 index 97e0df27d5..0000000000 --- a/Mage.Sets/src/mage/sets/kaladesh/RevolutionaryRebuff.java +++ /dev/null @@ -1,46 +0,0 @@ -package mage.sets.kaladesh; - -import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.common.CounterUnlessPaysEffect; -import mage.cards.Card; -import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.filter.Filter; -import mage.filter.FilterSpell; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.target.TargetSpell; -import mage.target.common.TargetNonBasicLandPermanent; - -import java.util.UUID; - -/** - * Created by IGOUDT on 16-9-2016. - */ -public class RevolutionaryRebuff extends CardImpl { - - - - public RevolutionaryRebuff(final UUID ownerId){ - super(ownerId, 61, "Revolutionary Rebuff", Rarity.COMMON, new CardType[]{CardType.INSTANT},"{1U}"); - this.expansionSetCode = "KLD"; - - FilterSpell filter = new FilterSpell(); - filter.add(Predicates.not(new SubtypePredicate("Artifact"))); - - this.getSpellAbility().addTarget(new TargetSpell(filter) ); - - this.getSpellAbility().addEffect(new CounterUnlessPaysEffect(new GenericManaCost(2))); - - } - - public RevolutionaryRebuff(final RevolutionaryRebuff revolutionaryRebuff){ - super(revolutionaryRebuff); - } - - @Override - public RevolutionaryRebuff copy() { - return new RevolutionaryRebuff(this); - } -} diff --git a/Mage.Sets/src/mage/sets/kaladesh/RushOfVitality.java b/Mage.Sets/src/mage/sets/kaladesh/RushOfVitality.java deleted file mode 100644 index a184029f12..0000000000 --- a/Mage.Sets/src/mage/sets/kaladesh/RushOfVitality.java +++ /dev/null @@ -1,42 +0,0 @@ -package mage.sets.kaladesh; - -import mage.abilities.effects.common.continuous.BoostTargetEffect; -import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; -import mage.abilities.keyword.DeathtouchAbility; -import mage.abilities.keyword.IndestructibleAbility; -import mage.abilities.keyword.LifelinkAbility; -import mage.cards.Card; -import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.target.common.TargetCreaturePermanent; - -import java.util.UUID; - -/** - * Created by IGOUDT on 16-9-2016. - */ -public class RushOfVitality extends CardImpl { - - public RushOfVitality(final UUID ownerId){ - super(ownerId,99,"Rush of Vitality", Rarity.COMMON, new CardType[]{CardType.INSTANT},"{1B}"); - - this.expansionSetCode = "KLD"; - - this.getSpellAbility().addTarget(new TargetCreaturePermanent()); - this.getSpellAbility().addEffect(new BoostTargetEffect(1, 0, Duration.EndOfTurn)); - this.getSpellAbility().addEffect(new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn)); - this.getSpellAbility().addEffect(new GainAbilityTargetEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn)); - - } - - public RushOfVitality(final RushOfVitality rushOfVitality){ - super(rushOfVitality); - } - - @Override - public RushOfVitality copy() { - return new RushOfVitality(this); - } -} diff --git a/Mage.Sets/src/mage/sets/kaladesh/VedalkenBlademaster.java b/Mage.Sets/src/mage/sets/kaladesh/VedalkenBlademaster.java deleted file mode 100644 index 37de678737..0000000000 --- a/Mage.Sets/src/mage/sets/kaladesh/VedalkenBlademaster.java +++ /dev/null @@ -1,41 +0,0 @@ -package mage.sets.kaladesh; - -import mage.MageInt; -import mage.abilities.keyword.FlyingAbility; -import mage.abilities.keyword.ProwessAbility; -import mage.cards.Card; -import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Rarity; - -import java.util.UUID; - -/** - * Created by IGOUDT on 16-9-2016. - */ -public class VedalkenBlademaster extends CardImpl { - - public VedalkenBlademaster(final UUID ownerId){ - super(ownerId, 68, "Vedalken Blademaster", Rarity.COMMON, new CardType[]{CardType.CREATURE},"{2U}"); - - this.expansionSetCode = "KLD"; - - this.subtype.add("Vedalken"); - this.subtype.add("Soldier"); - this.power = new MageInt(2); - this.toughness = new MageInt(3); - - this.addAbility(new ProwessAbility()); - - - } - - public VedalkenBlademaster(final VedalkenBlademaster card){ - super(card); - } - - @Override - public VedalkenBlademaster copy() { - return new VedalkenBlademaster(this); - } -} diff --git a/Mage/src/main/java/mage/ConditionalMana.java b/Mage/src/main/java/mage/ConditionalMana.java index b7ed91dc05..f9ed230c47 100644 --- a/Mage/src/main/java/mage/ConditionalMana.java +++ b/Mage/src/main/java/mage/ConditionalMana.java @@ -206,21 +206,26 @@ public class ConditionalMana extends Mana implements Serializable { break; case BLUE: blue += amount; + ; break; case GREEN: green += amount; + ; break; case RED: red += amount; + ; break; case WHITE: white += amount; + ; break; case COLORLESS: colorless += amount; - + ; case GENERIC: generic += amount; + ; break; } } diff --git a/Mage/src/main/java/mage/abilities/AbilitiesImpl.java b/Mage/src/main/java/mage/abilities/AbilitiesImpl.java index f6c5350fbf..cf0a14bac5 100644 --- a/Mage/src/main/java/mage/abilities/AbilitiesImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilitiesImpl.java @@ -39,7 +39,6 @@ import mage.abilities.keyword.ProtectionAbility; import mage.abilities.mana.ManaAbility; import mage.constants.Zone; import mage.game.Game; -import mage.util.StringUtil; import mage.util.ThreadLocalStringBuilder; import org.apache.log4j.Logger; @@ -106,10 +105,11 @@ public class AbilitiesImpl extends ArrayList implements Ab rules.add(sbRule.toString()); } String rule = ability.getRule(); - if (StringUtil.isNotEmpty(rule)){ + if (rule != null) { + if (rule.length() > 0) { 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 + } else { // logging so we can still can be made aware of rule problems a card has String cardName = ((SpellAbility) ability).getCardName(); logger.fatal("Error in rule text generation of " + cardName + ": Create a bug report or fix the source code"); } 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 01960afbe8..2d14c311a7 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java @@ -44,7 +44,6 @@ import mage.players.ManaPool; import mage.players.Player; import mage.target.Targets; import mage.util.ManaUtil; -import mage.util.StringUtil; /** * @author BetaSteward_at_googlemail.com @@ -321,13 +320,13 @@ public class ManaCostsImpl extends ArrayList implements M this.add(cost.copy()); } } else { - if (StringUtil.isNotEmpty(mana)) { + if (mana == null || mana.isEmpty()) { return; } String[] symbols = mana.split("^\\{|\\}\\{|\\}$"); int modifierForX = 0; for (String symbol : symbols) { - if (StringUtil.isNotEmpty(symbol)) { + if (symbol.length() > 0) { 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/decorator/ConditionalReplacementEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalReplacementEffect.java index 513e9768c9..156a4a47ef 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalReplacementEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalReplacementEffect.java @@ -37,7 +37,6 @@ import mage.abilities.effects.ReplacementEffectImpl; import mage.constants.Duration; import mage.game.Game; import mage.game.events.GameEvent; -import mage.util.StringUtil; /** * @@ -144,7 +143,7 @@ public class ConditionalReplacementEffect extends ReplacementEffectImpl { @Override public String getText(Mode mode) { - if (StringUtil.isEmpty(staticText) && this.effect != null) { // usefull for conditional night/day card abilities + if (staticText == null || staticText.isEmpty() && this.effect != null) { // usefull for conditional night/day card abilities return effect.getText(mode); } return staticText; 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 6c43861606..5b61e675d2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java @@ -129,7 +129,7 @@ public class CreateTokenEffect extends OneShotEffect { sb.append(" attacking"); } String message = amount.getMessage(); - if (!message.isEmpty()) { + if (message.length() > 0) { 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 f0d2fb7249..0132ebf36b 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.isEmpty()) { + if (message.length() > 0) { sb.append(" for each "); } sb.append(message); 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 a66a546041..0cf6291395 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageControllerEffect.java @@ -36,7 +36,6 @@ import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; import mage.game.Game; import mage.players.Player; -import mage.util.StringUtil; /** * @@ -104,7 +103,7 @@ public class DamageControllerEffect extends OneShotEffect { sb.append(amount); } sb.append(" damage to you"); - if (StringUtil.isNotEmpty(message)) { + if (message.length() > 0) { if (message.equals("1")) { sb.append(" equal to the number of "); } else { 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 a59ff0eec2..017ba21128 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java @@ -37,7 +37,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; -import mage.util.StringUtil; import java.util.UUID; @@ -143,7 +142,7 @@ public class DamageTargetEffect extends OneShotEffect { @Override public String getText(Mode mode) { - if (StringUtil.isNotEmpty(staticText)) { + if (staticText != null && !staticText.isEmpty()) { return staticText; } StringBuilder sb = new StringBuilder(); @@ -153,12 +152,12 @@ public class DamageTargetEffect extends OneShotEffect { sb.append(amount); } sb.append(" damage to "); - if (StringUtil.isNotEmpty(targetDescription)){ + if (targetDescription.length() > 0) { sb.append(targetDescription); } else { sb.append("target ").append(mode.getTargets().get(0).getTargetName()); } - if (StringUtil.isNotEmpty(message)) { + if (message.length() > 0) { if (message.equals("1")) { sb.append(" equal to the number of "); } else { 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 68471954af..f59773e1e4 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.isEmpty()) { + if (targetName != null && targetName.length() > 0) { 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 7ec1998833..2a152eebc1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardSourceControllerEffect.java @@ -36,7 +36,6 @@ import mage.constants.Outcome; import mage.game.Game; import mage.players.Player; import mage.util.CardUtil; -import mage.util.StringUtil; /** * @author BetaSteward_at_googlemail.com @@ -84,7 +83,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect { sb.append("s"); } String message = amount.getMessage(); - if (StringUtil.isNotEmpty(message)) { + if (message.length() > 0) { 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 70deb1fac9..76558defd9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DrawCardTargetEffect.java @@ -136,7 +136,7 @@ public class DrawCardTargetEffect extends OneShotEffect { sb.append("s"); } String message = amount.getMessage(); - if (!message.isEmpty()) { + if (message.length() > 0) { sb.append(" 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 79850cc927..089a366ac0 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeControllerAttachedEffect.java @@ -36,7 +36,6 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; -import mage.util.StringUtil; public class LoseLifeControllerAttachedEffect extends OneShotEffect { @@ -89,7 +88,7 @@ public class LoseLifeControllerAttachedEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); sb.append("it's controller loses ").append(amount.toString()).append(" life"); String message = amount.getMessage(); - if (StringUtil.isNotEmpty(message)) { + if (message.length() > 0) { 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 aa100100bd..c988359476 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.isEmpty()) { + if (message.length() > 0) { 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 da2f86a794..f9239424cd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java @@ -35,7 +35,6 @@ import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; import mage.game.Game; import mage.players.Player; -import mage.util.StringUtil; /** * @@ -79,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 (StringUtil.isNotEmpty(message)) { + if (message.length() > 0) { 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 8a3d6c3793..501f385095 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LoseLifeTargetEffect.java @@ -35,7 +35,6 @@ import mage.abilities.effects.OneShotEffect; import mage.constants.Outcome; import mage.game.Game; import mage.players.Player; -import mage.util.StringUtil; /** * @@ -82,7 +81,7 @@ public class LoseLifeTargetEffect extends OneShotEffect { StringBuilder sb = new StringBuilder(); String message = amount.getMessage(); - if (!mode.getTargets().isEmpty()) { + if (mode.getTargets().size() > 0) { sb.append("target ").append(mode.getTargets().get(0).getTargetName()); } else { sb.append("that player"); @@ -92,7 +91,7 @@ public class LoseLifeTargetEffect extends OneShotEffect { sb.append(amount).append(" "); } sb.append("life"); - if (StringUtil.isNotEmpty(message)) { + if (message.length() > 0) { if (amount.toString().equals("X")) { sb.append(", where X is "); } else { 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 08eafb24e7..8caeff03b8 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.isEmpty()) { + if (message.length() > 0) { sb.append(", where X is the number of "); sb.append(message); } 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 ac36f9fcca..6f04248e43 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SkipNextPlayerUntapStepEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SkipNextPlayerUntapStepEffect.java @@ -37,7 +37,6 @@ import mage.abilities.effects.OneShotEffect; import mage.game.Game; import mage.game.turn.TurnMod; import mage.players.Player; -import mage.util.StringUtil; /** * @@ -78,7 +77,7 @@ public class SkipNextPlayerUntapStepEffect extends OneShotEffect { @Override public String getText(Mode mode) { StringBuilder sb = new StringBuilder(); - if (StringUtil.isNotEmpty(staticText)) { + if (staticText.length() > 0) { sb.append(staticText); } else { sb.append("target"); 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 96ae066c90..efc2b9321d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TapTargetEffect.java @@ -37,7 +37,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.Target; import mage.util.CardUtil; -import mage.util.StringUtil; /** * @author BetaSteward_at_googlemail.com @@ -77,7 +76,7 @@ public class TapTargetEffect extends OneShotEffect { @Override public String getText(Mode mode) { - if (StringUtil.isNotEmpty(staticText)) { + if (staticText.length() > 0) { 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 6d24b7050b..2de2466cbf 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TransformTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TransformTargetEffect.java @@ -14,7 +14,6 @@ import mage.game.permanent.Permanent; import mage.game.permanent.PermanentCard; import mage.target.Target; import mage.util.CardUtil; -import mage.util.StringUtil; /** * @@ -74,7 +73,7 @@ public class TransformTargetEffect extends OneShotEffect { @Override public String getText(Mode mode) { - if (StringUtil.isNotEmpty(staticText)) { + if (staticText != null && staticText.length() > 0) { return staticText; } if (mode.getTargets().isEmpty()) { 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 72f193c36f..380b3a1fff 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().isEmpty()) { + if (duration.toString().length() > 0) { 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 9f3369c8de..0f5244ef2b 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().isEmpty()) { + if (mode.getTargets().size() > 0) { sb.append("target "); sb.append(mode.getTargets().get(0).getFilter().getMessage()); sb.append(" becomes the color or colors of your choice"); - if (!duration.toString().isEmpty()) { + if (duration.toString().length() > 0) { 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 d02f818a3b..49d348290d 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 @@ -39,7 +39,6 @@ import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; -import mage.util.StringUtil; /** * @author LevelX2 @@ -77,11 +76,13 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { + if (token.getCardType().size() > 0) { for (CardType t : token.getCardType()) { if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); } } + } if (type == null) { permanent.getSubtype(game).clear(); } @@ -139,7 +140,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { } sb.append(filter.getMessage()); sb.append(" become a ").append(token.getDescription()); - if (StringUtil.isNotEmpty(type)) { + if (type != null && type.length() > 0) { sb.append(". They are still ").append(type); } return sb.toString(); 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 793ac990c1..23c90cd686 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 @@ -172,7 +172,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements } private void setText() { - if (type != null && !type.isEmpty()) { + if (type != null && type.length() > 0) { 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/BoostEnchantedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostEnchantedEffect.java index 92016378ee..461dd0e13d 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 @@ -134,7 +134,7 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl { sb.append(" ").append(duration.toString()); } String message = power.getMessage(); - if (!message.isEmpty()) { + if (message.length() > 0) { sb.append(" for each "); } sb.append(message); 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 ed8c79ab80..dd3150b62e 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 @@ -39,7 +39,6 @@ import mage.abilities.effects.ContinuousEffectImpl; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; -import mage.util.StringUtil; /** * @author BetaSteward_at_googlemail.com @@ -133,7 +132,7 @@ public class BoostEquippedEffect extends ContinuousEffectImpl { if (duration != Duration.WhileOnBattlefield) sb.append(" ").append(duration.toString()); String message = power.getMessage(); - if (StringUtil.isNotEmpty(message)) { + if (message.length() > 0) { sb.append(" for each "); } sb.append(message); 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 56cfbc3df3..c50a023a5a 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 @@ -36,7 +36,6 @@ import mage.counters.Counter; import mage.game.Game; import mage.game.permanent.Permanent; import mage.util.CardUtil; -import mage.util.StringUtil; /** * @@ -102,7 +101,7 @@ public class AddCountersAttachedEffect extends OneShotEffect { } sb.append(counter.getName().toLowerCase()).append(" counter on "); sb.append(textEnchanted); - if (StringUtil.isNotEmpty(amount.getMessage())) { + if (amount.getMessage().length() > 0) { 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 81e6735eed..0056700064 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 @@ -43,7 +43,6 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; import mage.util.CardUtil; -import mage.util.StringUtil; /** * @@ -165,7 +164,7 @@ public class AddCountersTargetEffect extends OneShotEffect { sb.append("that creature"); } - if (StringUtil.isNotEmpty(amount.getMessage())) { + if (amount.getMessage().length() > 0) { sb.append(" for each ").append(amount.getMessage()); } return sb.toString(); 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 fbff4f6175..fa9d314a21 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 @@ -36,7 +36,6 @@ import mage.constants.Outcome; import mage.game.Game; import mage.players.Player; import mage.util.CardUtil; -import mage.util.StringUtil; /** * @@ -117,7 +116,7 @@ public class DiscardControllerEffect extends OneShotEffect { sb.append(" at random"); } String message = amount.getMessage(); - if (StringUtil.isNotEmpty(message)) { + if (message.length() > 0) { 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 a69f78c19e..83d5d9526c 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 @@ -35,7 +35,6 @@ import mage.abilities.effects.OneShotEffect; import mage.constants.Outcome; import mage.game.Game; import mage.players.Player; -import mage.util.StringUtil; /** * @@ -81,11 +80,11 @@ public class DiscardHandTargetEffect extends OneShotEffect { @Override public String getText(Mode mode) { - if (StringUtil.isNotEmpty(staticText)) { + if (staticText != null && !staticText.isEmpty()) { return staticText; } StringBuilder sb = new StringBuilder(); - if (StringUtil.isNotEmpty(targetDescription)) { + if (targetDescription.length() > 0) { 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 f2a373f677..0b7b1eea3d 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 @@ -36,7 +36,6 @@ import mage.constants.Outcome; import mage.game.Game; import mage.players.Player; import mage.util.CardUtil; -import mage.util.StringUtil; /** * @@ -96,7 +95,7 @@ public class DiscardTargetEffect extends OneShotEffect { @Override public String getText(Mode mode) { - if (StringUtil.isNotEmpty(staticText)) { + if (staticText != null && !staticText.isEmpty()) { return staticText; } StringBuilder sb = new StringBuilder(); @@ -115,7 +114,7 @@ public class DiscardTargetEffect extends OneShotEffect { sb.append(" at random"); } String message = amount.getMessage(); - if (StringUtil.isNotEmpty(message)) { + if (message.length() > 0) { sb.append(" for each "); } sb.append(message); 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 4b24c87a82..1f7ed73df7 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java @@ -44,7 +44,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.util.CardUtil; -import mage.util.StringUtil; /** * @@ -105,7 +104,7 @@ public class ManifestTargetPlayerEffect extends OneShotEffect { private String setText() { StringBuilder sb = new StringBuilder(); - if (StringUtil.isNotEmpty(prefix)) { + if (prefix != null && !prefix.isEmpty()) { sb.append(prefix).append(" "); } sb.append("manifest the top "); diff --git a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java index 1a3c802336..4076c112dd 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CascadeAbility.java @@ -133,7 +133,7 @@ class CascadeEffect extends OneShotEffect { Cards cardsFromExile = new CardsImpl(); Cards cardsToLibrary = new CardsImpl(); cardsFromExile.addAll(exile); - while (!cardsFromExile.isEmpty()) { + while (cardsFromExile.size() > 0) { card = cardsFromExile.getRandom(game); cardsFromExile.remove(card.getId()); cardsToLibrary.add(card); diff --git a/Mage/src/main/java/mage/cards/Sets.java b/Mage/src/main/java/mage/cards/Sets.java index b0fa63fa36..41b605973e 100644 --- a/Mage/src/main/java/mage/cards/Sets.java +++ b/Mage/src/main/java/mage/cards/Sets.java @@ -46,7 +46,6 @@ import mage.constants.ColoredManaSymbol; import mage.util.ClassScanner; import mage.util.RandomUtil; -import mage.util.StringUtil; import org.apache.log4j.Logger; /** @@ -139,11 +138,10 @@ public class Sets extends HashMap { Map deckCards = new HashMap<>(); Map sideboard = new HashMap<>(); try { - - if (StringUtil.isNotEmpty(deck.getName())) { + if (deck.getName() != null && deck.getName().length() > 0) { out.println("NAME:" + deck.getName()); } - if (StringUtil.isNotEmpty(deck.getAuthor())) { + if (deck.getAuthor() != null && deck.getAuthor().length() > 0) { out.println("AUTHOR:" + deck.getAuthor()); } for (DeckCardInfo deckCardInfo: deck.getCards()) { diff --git a/Mage/src/main/java/mage/util/StringUtil.java b/Mage/src/main/java/mage/util/StringUtil.java deleted file mode 100644 index bcb021339f..0000000000 --- a/Mage/src/main/java/mage/util/StringUtil.java +++ /dev/null @@ -1,15 +0,0 @@ -package mage.util; - -/** - * Created by IGOUDT on 16-9-2016. - */ -public class StringUtil { - - public static boolean isEmpty(String input){ - return (input == null) || input.isEmpty(); - } - - public static boolean isNotEmpty(String input){ - return !isEmpty(input); - } -}