diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index 69e89b0c08..1e934e1915 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -727,7 +727,10 @@ public class HumanPlayer extends PlayerImpl { // It's end of turn phase if (!skippedAtLeastOnce || (playerId.equals(game.getActivePlayerId()) - && !controllingPlayer.getUserData().getUserSkipPrioritySteps().isStopOnAllEndPhases())) { + && !controllingPlayer + .getUserData() + .getUserSkipPrioritySteps() + .isStopOnAllEndPhases())) { skippedAtLeastOnce = true; if (passWithManaPoolCheck(game)) { return false; @@ -1060,7 +1063,9 @@ public class HumanPlayer extends PlayerImpl { while (!abort) { if (passedAllTurns || passedUntilEndStepBeforeMyTurn - || (!getControllingPlayersUserData(game).getUserSkipPrioritySteps().isStopOnDeclareAttackersDuringSkipAction() + || (!getControllingPlayersUserData(game) + .getUserSkipPrioritySteps() + .isStopOnDeclareAttackersDuringSkipAction() && (passedTurn || passedTurnSkipStack || passedUntilEndOfTurn diff --git a/Mage/src/main/java/mage/abilities/AbilitiesImpl.java b/Mage/src/main/java/mage/abilities/AbilitiesImpl.java index 9f2fba4438..7a1dfba19d 100644 --- a/Mage/src/main/java/mage/abilities/AbilitiesImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilitiesImpl.java @@ -27,6 +27,8 @@ */ package mage.abilities; +import java.util.*; +import java.util.stream.Collectors; import mage.abilities.common.ZoneChangeTriggeredAbility; import mage.abilities.costs.Cost; import mage.abilities.keyword.ProtectionAbility; @@ -37,9 +39,6 @@ import mage.game.Game; import mage.util.ThreadLocalStringBuilder; import org.apache.log4j.Logger; -import java.util.*; -import java.util.stream.Collectors; - /** * @param * @author BetaSteward_at_googlemail.com @@ -164,7 +163,6 @@ public class AbilitiesImpl extends ArrayList implements Ab .filter(ability -> ability.getZone().match(zone)) .collect(Collectors.toCollection(AbilitiesImpl::new)); - } @Override @@ -241,7 +239,7 @@ public class AbilitiesImpl extends ArrayList implements Ab @Override public boolean contains(T ability) { - for (Iterator iterator = this.iterator(); iterator.hasNext(); ) { // simple loop can cause java.util.ConcurrentModificationException + for (Iterator iterator = this.iterator(); iterator.hasNext();) { // simple loop can cause java.util.ConcurrentModificationException T test = iterator.next(); // Checking also by getRule() without other restrictions is a problem when a triggered ability will be copied to a permanent that had the same ability // already before the copy. Because then it keeps the triggered ability twice and it triggers twice. @@ -280,7 +278,7 @@ public class AbilitiesImpl extends ArrayList implements Ab @Override public boolean containsKey(UUID abilityId) { - return stream().anyMatch(ability -> ability.getId().equals(abilityId)); + return stream().anyMatch(ability -> abilityId.equals(ability.getId())); } @Override @@ -295,7 +293,7 @@ public class AbilitiesImpl extends ArrayList implements Ab @Override public int getOutcomeTotal() { return stream().mapToInt(ability -> ability.getEffects().getOutcomeTotal()).sum(); - } + } @Override public String getValue() { diff --git a/Mage/src/main/java/mage/choices/ChoiceColorOrArtifact.java b/Mage/src/main/java/mage/choices/ChoiceColorOrArtifact.java index 5cef5dd467..eb4f52699d 100644 --- a/Mage/src/main/java/mage/choices/ChoiceColorOrArtifact.java +++ b/Mage/src/main/java/mage/choices/ChoiceColorOrArtifact.java @@ -1,6 +1,7 @@ package mage.choices; public class ChoiceColorOrArtifact extends ChoiceColor { + public ChoiceColorOrArtifact() { this.choices.add("Artifacts"); this.message = "Choose protection from"; @@ -16,6 +17,6 @@ public class ChoiceColorOrArtifact extends ChoiceColor { } public boolean isArtifactSelected() { - return choice.equals("Artifacts"); + return "Artifacts".equals(choice); } } diff --git a/Mage/src/main/java/mage/players/net/SkipPrioritySteps.java b/Mage/src/main/java/mage/players/net/SkipPrioritySteps.java index c5c5e13a3c..1ad2853d17 100644 --- a/Mage/src/main/java/mage/players/net/SkipPrioritySteps.java +++ b/Mage/src/main/java/mage/players/net/SkipPrioritySteps.java @@ -35,13 +35,14 @@ import mage.constants.PhaseStep; * @author LevelX2 */ public class SkipPrioritySteps implements Serializable { - boolean upkeep; - boolean draw; - boolean main1; - boolean beforeCombat; - boolean endOfCombat; - boolean main2; - boolean endOfTurn; + + boolean upkeep = false; + boolean draw = false; + boolean main1 = true; + boolean beforeCombat = false; + boolean endOfCombat = false; + boolean main2 = true; + boolean endOfTurn = false; public boolean isUpkeep() { return upkeep; @@ -100,7 +101,7 @@ public class SkipPrioritySteps implements Serializable { } public boolean isPhaseStepSet(PhaseStep phaseStep) { - switch(phaseStep) { + switch (phaseStep) { case UPKEEP: return isUpkeep(); case DRAW: @@ -119,5 +120,5 @@ public class SkipPrioritySteps implements Serializable { return true; } } - + } diff --git a/Mage/src/main/java/mage/players/net/UserData.java b/Mage/src/main/java/mage/players/net/UserData.java index 888ca6b158..fec7fbcba2 100644 --- a/Mage/src/main/java/mage/players/net/UserData.java +++ b/Mage/src/main/java/mage/players/net/UserData.java @@ -79,7 +79,7 @@ public class UserData implements Serializable { } public static UserData getDefaultUserDataView() { - return new UserData(UserGroup.DEFAULT, 0, false, false, true, null, getDefaultFlagName(), false, true, true, false, false, false, false, ""); + return new UserData(UserGroup.DEFAULT, 0, false, false, true, new UserSkipPrioritySteps(), getDefaultFlagName(), false, true, true, false, false, false, false, ""); } public void setGroupId(int groupId) { diff --git a/Mage/src/main/java/mage/players/net/UserSkipPrioritySteps.java b/Mage/src/main/java/mage/players/net/UserSkipPrioritySteps.java index 9e405cc603..ee51ded5e5 100644 --- a/Mage/src/main/java/mage/players/net/UserSkipPrioritySteps.java +++ b/Mage/src/main/java/mage/players/net/UserSkipPrioritySteps.java @@ -33,15 +33,15 @@ import java.io.Serializable; * * @author LevelX2 */ - public class UserSkipPrioritySteps implements Serializable { + final SkipPrioritySteps yourTurn; final SkipPrioritySteps opponentTurn; - boolean stopOnDeclareAttackersDuringSkipAction; - boolean stopOnDeclareBlockerIfNoneAvailable; - boolean stopOnAllMainPhases; - boolean stopOnAllEndPhases; + boolean stopOnDeclareAttackersDuringSkipAction = true; + boolean stopOnDeclareBlockerIfNoneAvailable = true; + boolean stopOnAllMainPhases = true; + boolean stopOnAllEndPhases = true; public UserSkipPrioritySteps() { yourTurn = new SkipPrioritySteps();