mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Merge pull request #2268 from ingmargoudt/master
replace [list].size() == 0 and [string].length() == 0 to use .isEmpty…
This commit is contained in:
commit
eae53c0cfc
48 changed files with 90 additions and 109 deletions
|
@ -85,7 +85,7 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
|
|||
}
|
||||
|
||||
public void loadBooster(CardsView booster, BigCard bigCard) {
|
||||
if (booster instanceof CardsView && booster.size() == 0) {
|
||||
if (booster instanceof CardsView && booster.isEmpty()) {
|
||||
emptyGrid = true;
|
||||
} else {
|
||||
if (!emptyGrid) {
|
||||
|
|
|
@ -126,7 +126,7 @@ public class ChoiceDialog extends IDialogPanel {
|
|||
}
|
||||
|
||||
private void displayCards(CardsView cards, UUID gameId, BigCard bigCard) {
|
||||
if (cards.size() == 0) {
|
||||
if (cards.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ public class StackDialog extends IDialogPanel {
|
|||
|
||||
private void displayStack(CardsView cards, UUID gameId, BigCard bigCard) {
|
||||
|
||||
if (cards == null || cards.size() == 0) {
|
||||
if (cards == null || cards.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ public class ResetPasswordDialog extends MageDialog {
|
|||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnGetAuthTokenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGetAuthTokenActionPerformed
|
||||
if (this.txtEmail.getText().length() == 0) {
|
||||
if (this.txtEmail.getText().isEmpty()) {
|
||||
MageFrame.getInstance().showError("Please enter an email address.");
|
||||
return;
|
||||
}
|
||||
|
@ -275,15 +275,15 @@ public class ResetPasswordDialog extends MageDialog {
|
|||
}//GEN-LAST:event_btnGetAuthTokenActionPerformed
|
||||
|
||||
private void btnSubmitNewPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSubmitNewPasswordActionPerformed
|
||||
if (this.txtEmail.getText().length() == 0) {
|
||||
if (this.txtEmail.getText().isEmpty()) {
|
||||
MageFrame.getInstance().showError("Please enter an email address.");
|
||||
return;
|
||||
}
|
||||
if (this.txtAuthToken.getText().length() == 0) {
|
||||
if (this.txtAuthToken.getText().isEmpty()) {
|
||||
MageFrame.getInstance().showError("Please enter an auth token.");
|
||||
return;
|
||||
}
|
||||
if (this.txtPassword.getText().length() == 0) {
|
||||
if (this.txtPassword.getText().isEmpty()) {
|
||||
MageFrame.getInstance().showError("Please enter a new password.");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ public class TournamentPlayerPanel extends javax.swing.JPanel {
|
|||
private void cbPlayerTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbPlayerTypeActionPerformed
|
||||
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
|
||||
this.pnlPlayerName.setVisible(true);
|
||||
if (this.txtPlayerName.getText().length() == 0) {
|
||||
if (this.txtPlayerName.getText().isEmpty()) {
|
||||
this.txtPlayerName.setText("Computer " + this.lblPlayerNum.getText());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ public class GlowText extends JLabel {
|
|||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
if (getText().length() == 0) {
|
||||
if (getText().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ public class ManaSymbols {
|
|||
loadSymbolsImages(symbolWidth);
|
||||
}
|
||||
Map<String, BufferedImage> sizedSymbols = manaImages.get(symbolWidth);
|
||||
if (manaCost.length() == 0) {
|
||||
if (manaCost.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
manaCost = manaCost.replace("\\", "");
|
||||
|
|
|
@ -98,7 +98,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
ArrayList<CardDownloadData> cards = getNeededCards(allCards);
|
||||
|
||||
/*
|
||||
* if (cards == null || cards.size() == 0) {
|
||||
* if (cards == null || cards.isEmpty()) {
|
||||
* JOptionPane.showMessageDialog(null,
|
||||
* "All card pictures have been downloaded."); return; }
|
||||
*/
|
||||
|
|
|
@ -27,22 +27,6 @@
|
|||
*/
|
||||
package mage.remote;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.UndeclaredThrowableException;
|
||||
import java.net.Authenticator;
|
||||
import java.net.ConnectException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import mage.MageException;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.cards.decks.InvalidDeckException;
|
||||
|
@ -62,22 +46,9 @@ import mage.interfaces.ServerState;
|
|||
import mage.interfaces.callback.ClientCallback;
|
||||
import mage.players.net.UserData;
|
||||
import mage.utils.CompressUtil;
|
||||
import mage.view.DraftPickView;
|
||||
import mage.view.GameTypeView;
|
||||
import mage.view.MatchView;
|
||||
import mage.view.RoomUsersView;
|
||||
import mage.view.TableView;
|
||||
import mage.view.TournamentTypeView;
|
||||
import mage.view.TournamentView;
|
||||
import mage.view.UserView;
|
||||
import mage.view.*;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jboss.remoting.CannotConnectException;
|
||||
import org.jboss.remoting.Client;
|
||||
import org.jboss.remoting.ConnectionListener;
|
||||
import org.jboss.remoting.ConnectionValidator;
|
||||
import org.jboss.remoting.InvocationFailureException;
|
||||
import org.jboss.remoting.InvokerLocator;
|
||||
import org.jboss.remoting.Remoting;
|
||||
import org.jboss.remoting.*;
|
||||
import org.jboss.remoting.callback.Callback;
|
||||
import org.jboss.remoting.callback.HandleCallbackException;
|
||||
import org.jboss.remoting.callback.InvokerCallbackHandler;
|
||||
|
@ -85,6 +56,12 @@ import org.jboss.remoting.transport.bisocket.Bisocket;
|
|||
import org.jboss.remoting.transport.socket.SocketWrapper;
|
||||
import org.jboss.remoting.transporter.TransporterClient;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.UndeclaredThrowableException;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
|
@ -185,7 +185,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
if (logger.isInfoEnabled()) {
|
||||
printOutState(game);
|
||||
}
|
||||
if (actions.size() == 0) {
|
||||
if (actions.isEmpty()) {
|
||||
calculateActions(game);
|
||||
}
|
||||
act(game);
|
||||
|
@ -351,7 +351,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
|
||||
/*
|
||||
* // Try to fix horizon effect if (root.combat == null ||
|
||||
* root.combat.getAttackers().size() == 0) {
|
||||
* root.combat.getAttackers().isEmpty()) {
|
||||
* FilterCreatureForAttack attackFilter = new
|
||||
* FilterCreatureForAttack();
|
||||
* attackFilter.getControllerId().add(playerId); List<Permanent>
|
||||
|
|
|
@ -105,7 +105,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
case PRECOMBAT_MAIN:
|
||||
if (game.getActivePlayerId().equals(playerId)) {
|
||||
printOutState(game);
|
||||
if (actions.size() == 0) {
|
||||
if (actions.isEmpty()) {
|
||||
logger.info("Sim Calculate pre combat actions ----------------------------------------------------- ");
|
||||
calculatePreCombatActions(game);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
case DECLARE_ATTACKERS:
|
||||
if (!game.getActivePlayerId().equals(playerId)) {
|
||||
printOutState(game);
|
||||
if (actions.size() == 0) {
|
||||
if (actions.isEmpty()) {
|
||||
logger.info("Sim Calculate declare attackers actions ----------------------------------------------------- ");
|
||||
calculatePreCombatActions(game);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
case POSTCOMBAT_MAIN:
|
||||
// if (game.getActivePlayerId().equals(playerId)) {
|
||||
printOutState(game);
|
||||
if (actions.size() == 0) {
|
||||
if (actions.isEmpty()) {
|
||||
calculatePostCombatActions(game);
|
||||
}
|
||||
act(game);
|
||||
|
|
|
@ -117,7 +117,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
|||
case COMBAT_DAMAGE:
|
||||
case END_COMBAT:
|
||||
case POSTCOMBAT_MAIN:
|
||||
if (actions.size() == 0) {
|
||||
if (actions.isEmpty()) {
|
||||
calculateActions(game);
|
||||
}
|
||||
act(game);
|
||||
|
@ -131,7 +131,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
|||
}
|
||||
|
||||
protected void act(Game game) {
|
||||
if (actions == null || actions.size() == 0)
|
||||
if (actions == null || actions.isEmpty())
|
||||
pass(game);
|
||||
else {
|
||||
boolean usedStack = false;
|
||||
|
|
|
@ -78,7 +78,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player {
|
|||
return false;
|
||||
case PRECOMBAT_MAIN:
|
||||
if (game.getActivePlayerId().equals(playerId)) {
|
||||
if (actions.size() == 0) {
|
||||
if (actions.isEmpty()) {
|
||||
calculatePreCombatActions(game);
|
||||
}
|
||||
act(game);
|
||||
|
@ -92,7 +92,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player {
|
|||
return false;
|
||||
case DECLARE_ATTACKERS:
|
||||
if (!game.getActivePlayerId().equals(playerId)) {
|
||||
if (actions.size() == 0) {
|
||||
if (actions.isEmpty()) {
|
||||
calculatePreCombatActions(game);
|
||||
}
|
||||
act(game);
|
||||
|
@ -109,7 +109,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player {
|
|||
return false;
|
||||
case POSTCOMBAT_MAIN:
|
||||
if (game.getActivePlayerId().equals(playerId)) {
|
||||
if (actions.size() == 0) {
|
||||
if (actions.isEmpty()) {
|
||||
calculatePostCombatActions(game);
|
||||
}
|
||||
act(game);
|
||||
|
|
|
@ -63,7 +63,7 @@ public class GmailClient {
|
|||
}
|
||||
|
||||
public static boolean sendMessage(String email, String subject, String text) {
|
||||
if (email.length() == 0) {
|
||||
if (email.isEmpty()) {
|
||||
logger.info("Email is not sent because the address is empty");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public class MailClient {
|
|||
private static final Logger logger = Logger.getLogger(Main.class);
|
||||
|
||||
public static boolean sendMessage(String email, String subject, String text) {
|
||||
if (email.length() == 0) {
|
||||
if (email.isEmpty()) {
|
||||
logger.info("Email is not sent because the address is empty");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class MailgunClient {
|
|||
private static final Logger logger = Logger.getLogger(Main.class);
|
||||
|
||||
public static boolean sendMessage(String email, String subject, String text) {
|
||||
if (email.length() == 0) {
|
||||
if (email.isEmpty()) {
|
||||
logger.info("Email is not sent because the address is empty");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class SystemUtil {
|
|||
try {
|
||||
while (scanner.hasNextLine()) {
|
||||
String line = scanner.nextLine().trim();
|
||||
if (line.trim().length() == 0 || line.startsWith("#")) {
|
||||
if (line.trim().isEmpty() || line.startsWith("#")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class CreaturesYouControlBecomesTargetTriggeredAbility extends TriggeredAbilityI
|
|||
if (object != null && object instanceof Spell) {
|
||||
Card c = (Spell) object;
|
||||
if (c.getCardType().contains(CardType.INSTANT) || c.getCardType().contains(CardType.SORCERY)) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ class NezumiGraverobberFlipEffect extends OneShotEffect {
|
|||
if (card != null) {
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player != null) {
|
||||
if (player.getGraveyard().size() == 0) {
|
||||
if (player.getGraveyard().isEmpty()) {
|
||||
return new FlipSourceEffect(new NighteyesTheDesecratorToken()).apply(game, source);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class DesecratorHagEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (cards.size() == 0) {
|
||||
if (cards.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if (cards.size() > 1
|
||||
|
|
|
@ -85,7 +85,7 @@ class OpponentHasNoCardsInHandCondition implements Condition {
|
|||
if (player != null) {
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
Player opponent = game.getPlayer(playerId);
|
||||
if (opponent != null && opponent.getHand().size() == 0) {
|
||||
if (opponent != null && opponent.getHand().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class DingusEggTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (zEvent.getFromZone() == Zone.BATTLEFIELD
|
||||
&& zEvent.getToZone() == Zone.GRAVEYARD
|
||||
&& zEvent.getTarget().getCardType().contains(CardType.LAND)) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
UUID targetId = zEvent.getTarget().getControllerId();
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(targetId));
|
||||
|
|
|
@ -84,7 +84,7 @@ class GorillaTitanCondition implements Condition {
|
|||
Player p = game.getPlayer(source.getControllerId());
|
||||
if (p != null)
|
||||
{
|
||||
return p.getGraveyard().size() == 0;
|
||||
return p.getGraveyard().isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ class CloneShellEffect extends OneShotEffect {
|
|||
cards.add(card);
|
||||
}
|
||||
|
||||
if (cards.size() == 0) {
|
||||
if (cards.isEmpty()) {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ class AEtherFlashTriggeredAbility extends TriggeredAbilityImpl {
|
|||
UUID targetId = event.getTargetId();
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(targetId));
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ class HollowbornBarghestTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
|
||||
Player opponent = game.getPlayer(event.getPlayerId());
|
||||
if (opponent != null && opponent.getHand().size() == 0) {
|
||||
if (opponent != null && opponent.getHand().isEmpty()) {
|
||||
opponent.loseLife(2, game);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class ImmortalCoilAbility extends StateTriggeredAbility {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Player player = game.getPlayer(this.getControllerId());
|
||||
return player != null && player.getGraveyard().size() == 0;
|
||||
return player != null && player.getGraveyard().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -94,7 +94,7 @@ class RivalryTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ class QuestForTheNihilStoneTriggeredAbility2 extends TriggeredAbilityImpl {
|
|||
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
|
||||
Player opponent = game.getPlayer(event.getPlayerId());
|
||||
if (opponent != null
|
||||
&& opponent.getHand().size() == 0
|
||||
&& opponent.getHand().isEmpty()
|
||||
&& quest.getCounters(game).getCount(CounterType.QUEST) >= 2) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(opponent.getId()));
|
||||
|
|
|
@ -90,7 +90,7 @@ class GuulDrazSpecterCondition implements Condition {
|
|||
|
||||
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
||||
for (UUID opponentId : opponents) {
|
||||
result |= game.getPlayer(opponentId).getHand().size() == 0;
|
||||
result |= game.getPlayer(opponentId).getHand().isEmpty();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -45,7 +45,7 @@ public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl {
|
|||
case YOU:
|
||||
boolean yours = event.getPlayerId().equals(this.controllerId);
|
||||
if (yours && setTargetPointer) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
|
|||
case YOU:
|
||||
boolean yours = event.getPlayerId().equals(this.controllerId);
|
||||
if (yours) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return yours;
|
||||
case OPPONENT:
|
||||
if (game.getPlayer(this.controllerId).hasOpponent(event.getPlayerId(), game)) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
|
|||
break;
|
||||
case NOT_YOU:
|
||||
if (!this.controllerId.equals(event.getPlayerId())) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (attachment != null && attachment.getAttachedTo() != null) {
|
||||
Permanent attachedTo = game.getPermanent(attachment.getAttachedTo());
|
||||
if (attachedTo != null && attachedTo.getControllerId().equals(event.getPlayerId())) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
break;
|
||||
case ANY:
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class BeginningOfPreCombatMainTriggeredAbility extends TriggeredAbilityIm
|
|||
case YOU:
|
||||
boolean yours = event.getPlayerId().equals(this.controllerId);
|
||||
if (yours && setTargetPointer) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class BeginningOfUntapTriggeredAbility extends TriggeredAbilityImpl {
|
|||
break;
|
||||
case OPPONENT:
|
||||
if (game.getPlayer(this.controllerId).hasOpponent(event.getPlayerId(), game)) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class BeginningOfUntapTriggeredAbility extends TriggeredAbilityImpl {
|
|||
case ANY:
|
||||
controller = game.getPlayer(this.getControllerId());
|
||||
if (controller != null && controller.getInRange().contains(event.getPlayerId())) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (getTargets().isEmpty()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class HellbentCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return game.getPlayer(source.getControllerId()).getHand().size() == 0;
|
||||
return game.getPlayer(source.getControllerId()).getHand().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -70,7 +70,7 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
|
|||
if (text != null) {
|
||||
return text;
|
||||
}
|
||||
if (this.size() == 0) {
|
||||
if (this.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
@ -262,11 +262,11 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
// First try only to pay colored mana with the pool
|
||||
for (ManaCost cost : this) {
|
||||
if (!cost.isPaid() && cost instanceof MonoHybridManaCost) {
|
||||
if (((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.W)) && pool.getWhite() > 0)
|
||||
|| ((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.B)) && pool.getBlack() > 0)
|
||||
|| ((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.R)) && pool.getRed() > 0)
|
||||
|| ((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.G)) && pool.getGreen() > 0)
|
||||
|| ((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.U)) && pool.getBlue() > 0)) {
|
||||
if (((cost.containsColor(ColoredManaSymbol.W)) && pool.getWhite() > 0)
|
||||
|| ((cost.containsColor(ColoredManaSymbol.B)) && pool.getBlack() > 0)
|
||||
|| ((cost.containsColor(ColoredManaSymbol.R)) && pool.getRed() > 0)
|
||||
|| ((cost.containsColor(ColoredManaSymbol.G)) && pool.getGreen() > 0)
|
||||
|| ((cost.containsColor(ColoredManaSymbol.U)) && pool.getBlue() > 0)) {
|
||||
cost.assignPayment(game, ability, pool, costToPay);
|
||||
if (pool.count() == 0) {
|
||||
return;
|
||||
|
@ -315,12 +315,12 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
public final void load(String mana) {
|
||||
this.clear();
|
||||
if (costs.containsKey(mana)) {
|
||||
ManaCosts<T> savedCosts = costs.get(mana);
|
||||
ManaCosts<ManaCost> savedCosts = costs.get(mana);
|
||||
for (ManaCost cost : savedCosts) {
|
||||
this.add((T) cost.copy());
|
||||
this.add(cost.copy());
|
||||
}
|
||||
} else {
|
||||
if (mana == null || mana.length() == 0) {
|
||||
if (mana == null || mana.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String[] symbols = mana.split("^\\{|\\}\\{|\\}$");
|
||||
|
@ -347,11 +347,11 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
this.add(new VariableManaCost(modifierForX));
|
||||
} //TODO: handle multiple {X} and/or {Y} symbols
|
||||
} else if (Character.isDigit(symbol.charAt(0))) {
|
||||
this.add((T) new MonoHybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(2))));
|
||||
this.add(new MonoHybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(2))));
|
||||
} else if (symbol.contains("P")) {
|
||||
this.add((T) new PhyrexianManaCost(ColoredManaSymbol.lookup(symbol.charAt(0))));
|
||||
this.add(new PhyrexianManaCost(ColoredManaSymbol.lookup(symbol.charAt(0))));
|
||||
} else {
|
||||
this.add((T) new HybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(0)), ColoredManaSymbol.lookup(symbol.charAt(2))));
|
||||
this.add(new HybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(0)), ColoredManaSymbol.lookup(symbol.charAt(2))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
if (text != null) {
|
||||
return text;
|
||||
}
|
||||
if (this.size() == 0) {
|
||||
if (this.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ public class CounterUnlessPaysEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (mode.getTargets().size() == 0) {
|
||||
if (mode.getTargets().isEmpty()) {
|
||||
sb.append("counter it");
|
||||
} else {
|
||||
sb.append("Counter target ").append(mode.getTargets().get(0).getTargetName());
|
||||
|
|
|
@ -45,7 +45,7 @@ public class DckDeckImporter extends DeckImporter {
|
|||
@Override
|
||||
protected void readLine(String line, DeckCardLists deckList) {
|
||||
|
||||
if (line.length() == 0 || line.startsWith("#")) {
|
||||
if (line.isEmpty() || line.startsWith("#")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class DecDeckImporter extends DeckImporter {
|
|||
|
||||
@Override
|
||||
protected void readLine(String line, DeckCardLists deckList) {
|
||||
if (line.length() == 0 || line.startsWith("//")) {
|
||||
if (line.isEmpty() || line.startsWith("//")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ public class DekDeckImporter extends DeckImporter {
|
|||
@Override
|
||||
protected void readLine(String line, DeckCardLists deckList) {
|
||||
|
||||
if (line.length() == 0 || line.startsWith("#") || !line.contains("<Cards CatID")) {
|
||||
if (line.isEmpty() || line.startsWith("#") || !line.contains("<Cards CatID")) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -44,7 +44,7 @@ public class MWSDeckImporter extends DeckImporter {
|
|||
|
||||
@Override
|
||||
protected void readLine(String line, DeckCardLists deckList) {
|
||||
if (line.length() == 0 || line.startsWith("//")) {
|
||||
if (line.isEmpty() || line.startsWith("//")) {
|
||||
return;
|
||||
}
|
||||
boolean sideboard = false;
|
||||
|
|
|
@ -61,7 +61,7 @@ public class TxtDeckImporter extends DeckImporter {
|
|||
|
||||
// Start the sideboard on empty line that follows
|
||||
// at least 1 non-empty line
|
||||
if (line.length() == 0 && nonEmptyLinesTotal > 0) {
|
||||
if (line.isEmpty() && nonEmptyLinesTotal > 0) {
|
||||
sideboard = true;
|
||||
return;
|
||||
} else {
|
||||
|
|
|
@ -55,11 +55,11 @@ public class FilterPermanentOrPlayerWithCounter extends FilterPermanentOrPlayer
|
|||
@Override
|
||||
public boolean match(MageItem o, Game game) {
|
||||
if (o instanceof Player) {
|
||||
if (((Player)o).getCounters().size() == 0) {
|
||||
if (((Player)o).getCounters().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
} else if (o instanceof Permanent) {
|
||||
if (((Permanent)o).getCounters(game).size() == 0) {
|
||||
if (((Permanent)o).getCounters(game).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
package mage.game.tournament;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.TournamentPlayerState;
|
||||
|
@ -49,7 +49,7 @@ public abstract class TournamentSwiss extends TournamentImpl {
|
|||
|
||||
@Override
|
||||
protected void runTournament() {
|
||||
for (Map.Entry<UUID, TournamentPlayer> entry : players.entrySet()) {
|
||||
for (Entry<UUID, TournamentPlayer> entry : players.entrySet()) {
|
||||
if (entry.getValue().getPlayer().autoLoseGame()) {
|
||||
entry.getValue().setEliminated();
|
||||
entry.getValue().setResults("Auto Eliminated");
|
||||
|
|
|
@ -474,4 +474,8 @@ public class ManaPool implements Serializable {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isEmpty(){
|
||||
return count() == 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2536,7 +2536,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
if (manaCosts.size() == 0) {
|
||||
if (manaCosts.isEmpty()) {
|
||||
return true;
|
||||
} else {
|
||||
if (available == null) {
|
||||
|
@ -2567,7 +2567,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
if (manaCosts.size() == 0) {
|
||||
if (manaCosts.isEmpty()) {
|
||||
return true;
|
||||
} else {
|
||||
for (Mana mana : manaCosts.getOptions()) {
|
||||
|
@ -2604,7 +2604,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
if (manaCosts.size() == 0) {
|
||||
if (manaCosts.isEmpty()) {
|
||||
return true;
|
||||
} else {
|
||||
for (Mana mana : manaCosts.getOptions()) {
|
||||
|
|
|
@ -80,13 +80,13 @@ public class TargetPermanentOrPlayerWithCounter extends TargetPermanentOrPlayer
|
|||
public boolean canTarget(UUID id, Game game) {
|
||||
Permanent permanent = game.getPermanent(id);
|
||||
if (permanent != null) {
|
||||
if (permanent.getCounters(game).size() == 0) {
|
||||
if (permanent.getCounters(game).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Player player = game.getPlayer(id);
|
||||
if (player != null) {
|
||||
if (player.getCounters().size() == 0) {
|
||||
if (player.getCounters().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -97,13 +97,13 @@ public class TargetPermanentOrPlayerWithCounter extends TargetPermanentOrPlayer
|
|||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(id);
|
||||
if (permanent != null) {
|
||||
if (permanent.getCounters(game).size() == 0) {
|
||||
if (permanent.getCounters(game).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Player player = game.getPlayer(id);
|
||||
if (player != null) {
|
||||
if (player.getCounters().size() == 0) {
|
||||
if (player.getCounters().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue