mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
style: remove some static imports
This commit is contained in:
parent
d61de05eb8
commit
b85d2883e3
11 changed files with 18 additions and 34 deletions
|
|
@ -25,8 +25,6 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static mage.server.DisconnectReason.LostConnection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com, JayDi85
|
* @author BetaSteward_at_googlemail.com, JayDi85
|
||||||
*/
|
*/
|
||||||
|
|
@ -456,13 +454,13 @@ public class Session {
|
||||||
|
|
||||||
// do not send data anymore (user must reconnect)
|
// do not send data anymore (user must reconnect)
|
||||||
this.valid = false;
|
this.valid = false;
|
||||||
managerFactory.sessionManager().disconnect(sessionId, LostConnection, true);
|
managerFactory.sessionManager().disconnect(sessionId, DisconnectReason.LostConnection, true);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
logger.error("SESSION CALLBACK UNKNOWN EXCEPTION - " + ThreadUtils.findRootException(ex) + ", userId " + userId + ", messageId: " + call.getMessageId(), ex);
|
logger.error("SESSION CALLBACK UNKNOWN EXCEPTION - " + ThreadUtils.findRootException(ex) + ", userId " + userId + ", messageId: " + call.getMessageId(), ex);
|
||||||
|
|
||||||
// do not send data anymore (user must reconnect)
|
// do not send data anymore (user must reconnect)
|
||||||
this.valid = false;
|
this.valid = false;
|
||||||
managerFactory.sessionManager().disconnect(sessionId, LostConnection, true);
|
managerFactory.sessionManager().disconnect(sessionId, DisconnectReason.LostConnection, true);
|
||||||
} finally {
|
} finally {
|
||||||
if (lockSet) {
|
if (lockSet) {
|
||||||
callBackLock.unlock();
|
callBackLock.unlock();
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,6 @@ import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
import static mage.cards.l.LostInThought.keyString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author xenohedron
|
* @author xenohedron
|
||||||
|
|
@ -175,7 +173,7 @@ class LostInThoughtIgnoreEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
String key = source.getSourceId().toString() + source.getSourceObjectZoneChangeCounter() + keyString + game.getTurnNum() + ((ActivatedAbilityImpl) source).getActivatorId();
|
String key = source.getSourceId().toString() + source.getSourceObjectZoneChangeCounter() + LostInThought.keyString + game.getTurnNum() + ((ActivatedAbilityImpl) source).getActivatorId();
|
||||||
game.getState().setValue(key, true);
|
game.getState().setValue(key, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
import static java.lang.Integer.min;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
@ -69,7 +68,7 @@ class RansackEffect extends OneShotEffect {
|
||||||
Player player = game.getPlayer(source.getFirstTarget());
|
Player player = game.getPlayer(source.getFirstTarget());
|
||||||
FilterCard filter = new FilterCard("cards to put on the bottom of your library");
|
FilterCard filter = new FilterCard("cards to put on the bottom of your library");
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
int number = min(player.getLibrary().size(), 5);
|
int number = Integer.min(player.getLibrary().size(), 5);
|
||||||
Set<Card> cards = player.getLibrary().getTopCards(game, number);
|
Set<Card> cards = player.getLibrary().getTopCards(game, number);
|
||||||
Cards cardsRemaining = new CardsImpl();
|
Cards cardsRemaining = new CardsImpl();
|
||||||
cardsRemaining.addAllCards(cards);
|
cardsRemaining.addAllCards(cards);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import static mage.cards.u.UnstableShapeshifter.filterAnotherCreature;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
|
@ -77,7 +76,7 @@ class UnstableShapeshifterEffect extends OneShotEffect {
|
||||||
if (targetCreature != null && permanent != null) {
|
if (targetCreature != null && permanent != null) {
|
||||||
Permanent blueprintPermanent = game.copyPermanent(Duration.Custom, targetCreature, permanent.getId(), source, new EmptyCopyApplier());
|
Permanent blueprintPermanent = game.copyPermanent(Duration.Custom, targetCreature, permanent.getId(), source, new EmptyCopyApplier());
|
||||||
blueprintPermanent.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD,
|
blueprintPermanent.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD,
|
||||||
new UnstableShapeshifterEffect(), filterAnotherCreature, false, SetTargetPointer.PERMANENT), source.getSourceId(), game);
|
new UnstableShapeshifterEffect(), UnstableShapeshifter.filterAnotherCreature, false, SetTargetPointer.PERMANENT), source.getSourceId(), game);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@ import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static mage.cards.v.VolrathsCurse.keyString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
|
@ -82,7 +80,7 @@ class VolrathsCurseRestrictionEffect extends RestrictionEffect {
|
||||||
Permanent attachment = game.getPermanent(source.getSourceId());
|
Permanent attachment = game.getPermanent(source.getSourceId());
|
||||||
if (attachment != null && attachment.getAttachedTo() != null
|
if (attachment != null && attachment.getAttachedTo() != null
|
||||||
&& permanent.getId().equals(attachment.getAttachedTo())) {
|
&& permanent.getId().equals(attachment.getAttachedTo())) {
|
||||||
String key = source.getSourceId().toString() + attachment.getZoneChangeCounter(game) + keyString + game.getTurnNum() + permanent.getControllerId();
|
String key = source.getSourceId().toString() + attachment.getZoneChangeCounter(game) + VolrathsCurse.keyString + game.getTurnNum() + permanent.getControllerId();
|
||||||
return game.getState().getValue(key) == null;
|
return game.getState().getValue(key) == null;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -132,7 +130,7 @@ class VolrathsCurseCantActivateAbilitiesEffect extends ContinuousRuleModifyingEf
|
||||||
if (event.getSourceId().equals(enchantment.getAttachedTo())) {
|
if (event.getSourceId().equals(enchantment.getAttachedTo())) {
|
||||||
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
||||||
if (enchanted != null) {
|
if (enchanted != null) {
|
||||||
String key = source.getSourceId().toString() + enchantment.getZoneChangeCounter(game) + keyString + game.getTurnNum() + enchanted.getControllerId();
|
String key = source.getSourceId().toString() + enchantment.getZoneChangeCounter(game) + VolrathsCurse.keyString + game.getTurnNum() + enchanted.getControllerId();
|
||||||
return game.getState().getValue(key) == null;
|
return game.getState().getValue(key) == null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -146,7 +144,7 @@ class VolrathsCurseSpecialAction extends SpecialAction {
|
||||||
public VolrathsCurseSpecialAction() {
|
public VolrathsCurseSpecialAction() {
|
||||||
super(Zone.BATTLEFIELD);
|
super(Zone.BATTLEFIELD);
|
||||||
this.addCost(new SacrificeTargetCost(StaticFilters.FILTER_PERMANENT));
|
this.addCost(new SacrificeTargetCost(StaticFilters.FILTER_PERMANENT));
|
||||||
this.addEffect(new VolrathsCurseIgnoreEffect(keyString));
|
this.addEffect(new VolrathsCurseIgnoreEffect(VolrathsCurse.keyString));
|
||||||
this.setMayActivate(TargetController.CONTROLLER_ATTACHED_TO);
|
this.setMayActivate(TargetController.CONTROLLER_ATTACHED_TO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -178,7 +176,7 @@ class VolrathsCurseIgnoreEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
String key = source.getSourceId().toString() + source.getSourceObjectZoneChangeCounter() + keyString + game.getTurnNum() + ((ActivatedAbilityImpl) source).getActivatorId();
|
String key = source.getSourceId().toString() + source.getSourceObjectZoneChangeCounter() + VolrathsCurse.keyString + game.getTurnNum() + ((ActivatedAbilityImpl) source).getActivatorId();
|
||||||
game.getState().setValue(key, true);
|
game.getState().setValue(key, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import static java.lang.Integer.min;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
@ -41,7 +39,7 @@ public class ReplaceOpponentCardsInHandWithSelectedEffect extends OneShotEffect
|
||||||
targetOpponent.putCardsOnTopOfLibrary(targetOpponent.getHand(), game, source, false);
|
targetOpponent.putCardsOnTopOfLibrary(targetOpponent.getHand(), game, source, false);
|
||||||
|
|
||||||
int librarySize = targetOpponent.getLibrary().size();
|
int librarySize = targetOpponent.getLibrary().size();
|
||||||
int searchLibraryForNum = min(originalHandSize, librarySize);
|
int searchLibraryForNum = Integer.min(originalHandSize, librarySize);
|
||||||
|
|
||||||
TargetCardInLibrary target = new TargetCardInLibrary(searchLibraryForNum, searchLibraryForNum, new FilterCard());
|
TargetCardInLibrary target = new TargetCardInLibrary(searchLibraryForNum, searchLibraryForNum, new FilterCard());
|
||||||
|
|
||||||
|
|
@ -66,4 +64,4 @@ public class ReplaceOpponentCardsInHandWithSelectedEffect extends OneShotEffect
|
||||||
return new ReplaceOpponentCardsInHandWithSelectedEffect(this);
|
return new ReplaceOpponentCardsInHandWithSelectedEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@ import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static mage.cards.decks.CardNameUtil.CARD_NAME_PATTERN;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deck import: MTGA official app
|
* Deck import: MTGA official app
|
||||||
*/
|
*/
|
||||||
|
|
@ -23,7 +21,7 @@ public class MtgaImporter extends PlainTextDeckImporter {
|
||||||
private static final Pattern MTGA_PATTERN = Pattern.compile(
|
private static final Pattern MTGA_PATTERN = Pattern.compile(
|
||||||
"(\\p{Digit}+)" +
|
"(\\p{Digit}+)" +
|
||||||
"\\p{javaWhitespace}+" +
|
"\\p{javaWhitespace}+" +
|
||||||
"(" + CARD_NAME_PATTERN.pattern() + ")" +
|
"(" + CardNameUtil.CARD_NAME_PATTERN.pattern() + ")" +
|
||||||
"(?:\\p{javaWhitespace}+\\()?" +
|
"(?:\\p{javaWhitespace}+\\()?" +
|
||||||
"(\\p{Alnum}+)?" +
|
"(\\p{Alnum}+)?" +
|
||||||
"(?:\\)\\p{javaWhitespace}+)?" +
|
"(?:\\)\\p{javaWhitespace}+)?" +
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import javax.xml.XMLConstants;
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import javax.xml.xpath.XPathConstants;
|
||||||
import javax.xml.xpath.XPathExpressionException;
|
import javax.xml.xpath.XPathExpressionException;
|
||||||
import javax.xml.xpath.XPathFactory;
|
import javax.xml.xpath.XPathFactory;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -16,8 +17,6 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static javax.xml.xpath.XPathConstants.NODESET;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deck import: helper class for all xml base formats
|
* Deck import: helper class for all xml base formats
|
||||||
*/
|
*/
|
||||||
|
|
@ -27,7 +26,7 @@ public abstract class XmlDeckImporter extends DeckImporter {
|
||||||
private final DocumentBuilder builder = getDocumentBuilder();
|
private final DocumentBuilder builder = getDocumentBuilder();
|
||||||
|
|
||||||
protected List<Node> getNodes(Document doc, String xpathExpression) throws XPathExpressionException {
|
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<>();
|
List<Node> list = new ArrayList<>();
|
||||||
for (int i = 0; i < nodes.getLength(); i++) {
|
for (int i = 0; i < nodes.getLength(); i++) {
|
||||||
list.add(nodes.item(i));
|
list.add(nodes.item(i));
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package mage.game;
|
package mage.game;
|
||||||
|
|
||||||
import static java.util.Collections.emptyList;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.*;
|
import mage.abilities.*;
|
||||||
|
|
@ -1639,7 +1638,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FilterCreaturePermanent> getActivePowerInsteadOfToughnessForDamageLethalityFilters() {
|
public List<FilterCreaturePermanent> getActivePowerInsteadOfToughnessForDamageLethalityFilters() {
|
||||||
return usePowerInsteadOfToughnessForDamageLethalityFilters.isEmpty() ? emptyList() : getBattlefield().getAllActivePermanents().stream()
|
return usePowerInsteadOfToughnessForDamageLethalityFilters.isEmpty() ? Collections.emptyList() : getBattlefield().getAllActivePermanents().stream()
|
||||||
.map(Card::getId)
|
.map(Card::getId)
|
||||||
.filter(usePowerInsteadOfToughnessForDamageLethalityFilters::containsKey)
|
.filter(usePowerInsteadOfToughnessForDamageLethalityFilters::containsKey)
|
||||||
.map(usePowerInsteadOfToughnessForDamageLethalityFilters::get)
|
.map(usePowerInsteadOfToughnessForDamageLethalityFilters::get)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import java.util.UUID;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.constants.EnterEventType;
|
import mage.constants.EnterEventType;
|
||||||
import static mage.constants.EnterEventType.SELF;
|
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.players;
|
package mage.players;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
import mage.MageItem;
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
|
|
@ -33,8 +34,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty player, do nothing, used for tests only
|
* Empty player, do nothing, used for tests only
|
||||||
*/
|
*/
|
||||||
|
|
@ -61,7 +60,7 @@ public class StubPlayer extends PlayerImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseTarget(Outcome outcome, Cards cards, TargetCard target, Ability source, Game game) {
|
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)) {
|
if (chooseScry(game, cardId)) {
|
||||||
target.add(cardId, game);
|
target.add(cardId, game);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -240,4 +239,4 @@ public class StubPlayer extends PlayerImpl {
|
||||||
public FilterMana getPhyrexianColors() {
|
public FilterMana getPhyrexianColors() {
|
||||||
return (new FilterMana());
|
return (new FilterMana());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue