style: remove some static imports

This commit is contained in:
xenohedron 2024-06-11 23:46:51 -04:00
parent d61de05eb8
commit b85d2883e3
11 changed files with 18 additions and 34 deletions

View file

@ -1,8 +1,6 @@
package mage.abilities.effects.common;
import static java.lang.Integer.min;
import java.util.UUID;
import mage.abilities.Ability;
@ -41,7 +39,7 @@ public class ReplaceOpponentCardsInHandWithSelectedEffect extends OneShotEffect
targetOpponent.putCardsOnTopOfLibrary(targetOpponent.getHand(), game, source, false);
int librarySize = targetOpponent.getLibrary().size();
int searchLibraryForNum = min(originalHandSize, librarySize);
int searchLibraryForNum = Integer.min(originalHandSize, librarySize);
TargetCardInLibrary target = new TargetCardInLibrary(searchLibraryForNum, searchLibraryForNum, new FilterCard());
@ -66,4 +64,4 @@ public class ReplaceOpponentCardsInHandWithSelectedEffect extends OneShotEffect
return new ReplaceOpponentCardsInHandWithSelectedEffect(this);
}
}
}

View file

@ -12,8 +12,6 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static mage.cards.decks.CardNameUtil.CARD_NAME_PATTERN;
/**
* Deck import: MTGA official app
*/
@ -23,7 +21,7 @@ public class MtgaImporter extends PlainTextDeckImporter {
private static final Pattern MTGA_PATTERN = Pattern.compile(
"(\\p{Digit}+)" +
"\\p{javaWhitespace}+" +
"(" + CARD_NAME_PATTERN.pattern() + ")" +
"(" + CardNameUtil.CARD_NAME_PATTERN.pattern() + ")" +
"(?:\\p{javaWhitespace}+\\()?" +
"(\\p{Alnum}+)?" +
"(?:\\)\\p{javaWhitespace}+)?" +

View file

@ -9,6 +9,7 @@ import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import java.io.File;
@ -16,8 +17,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static javax.xml.xpath.XPathConstants.NODESET;
/**
* Deck import: helper class for all xml base formats
*/
@ -27,7 +26,7 @@ public abstract class XmlDeckImporter extends DeckImporter {
private final DocumentBuilder builder = getDocumentBuilder();
protected List<Node> getNodes(Document doc, String xpathExpression) throws XPathExpressionException {
NodeList nodes = (NodeList) xpathFactory.newXPath().evaluate(xpathExpression, doc, NODESET);
NodeList nodes = (NodeList) xpathFactory.newXPath().evaluate(xpathExpression, doc, XPathConstants.NODESET);
List<Node> list = new ArrayList<>();
for (int i = 0; i < nodes.getLength(); i++) {
list.add(nodes.item(i));

View file

@ -1,6 +1,5 @@
package mage.game;
import static java.util.Collections.emptyList;
import mage.MageObject;
import mage.MageObjectReference;
import mage.abilities.*;
@ -1639,7 +1638,7 @@ public class GameState implements Serializable, Copyable<GameState> {
}
public List<FilterCreaturePermanent> getActivePowerInsteadOfToughnessForDamageLethalityFilters() {
return usePowerInsteadOfToughnessForDamageLethalityFilters.isEmpty() ? emptyList() : getBattlefield().getAllActivePermanents().stream()
return usePowerInsteadOfToughnessForDamageLethalityFilters.isEmpty() ? Collections.emptyList() : getBattlefield().getAllActivePermanents().stream()
.map(Card::getId)
.filter(usePowerInsteadOfToughnessForDamageLethalityFilters::containsKey)
.map(usePowerInsteadOfToughnessForDamageLethalityFilters::get)

View file

@ -5,7 +5,6 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.constants.EnterEventType;
import static mage.constants.EnterEventType.SELF;
import mage.constants.Zone;
import mage.game.permanent.Permanent;

View file

@ -1,5 +1,6 @@
package mage.players;
import com.google.common.collect.Iterables;
import mage.MageItem;
import mage.abilities.Ability;
import mage.abilities.Mode;
@ -33,8 +34,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import static com.google.common.collect.Iterables.getOnlyElement;
/**
* Empty player, do nothing, used for tests only
*/
@ -61,7 +60,7 @@ public class StubPlayer extends PlayerImpl {
@Override
public boolean chooseTarget(Outcome outcome, Cards cards, TargetCard target, Ability source, Game game) {
UUID cardId = getOnlyElement(cards.getCards(game)).getId();
UUID cardId = Iterables.getOnlyElement(cards.getCards(game)).getId();
if (chooseScry(game, cardId)) {
target.add(cardId, game);
return true;
@ -240,4 +239,4 @@ public class StubPlayer extends PlayerImpl {
public FilterMana getPhyrexianColors() {
return (new FilterMana());
}
}
}