mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 18:50:06 -08:00
* Choose an ability - fixed not working cards like Argivian Avenger, Atraxas Skitterfang, Steel Seraph (#10115)
This commit is contained in:
parent
ea10b025e0
commit
6b05562336
9 changed files with 68 additions and 23 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package mage.choices;
|
||||
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.RandomUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -111,6 +112,7 @@ public class ChoiceImpl implements Choice {
|
|||
|
||||
@Override
|
||||
public void setChoices(Set<String> choices) {
|
||||
CardUtil.checkSetParamForSerializationCompatibility(choices);
|
||||
this.choices = choices;
|
||||
protectFromEmptyChoices();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import mage.cards.Card;
|
|||
import mage.cards.Cards;
|
||||
import mage.choices.Choice;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -65,6 +66,9 @@ public class PlayerQueryEvent extends EventObject implements ExternalEvent, Seri
|
|||
Set<UUID> targets, Cards cards, QueryType queryType, int min, int max, boolean required,
|
||||
Map<String, Serializable> options, List<String> messages) {
|
||||
super(playerId);
|
||||
|
||||
CardUtil.checkSetParamForSerializationCompatibility(choices);
|
||||
|
||||
this.queryType = queryType;
|
||||
this.message = message;
|
||||
this.playerId = playerId;
|
||||
|
|
|
|||
|
|
@ -1733,4 +1733,12 @@ public final class CardUtil {
|
|||
return "" + startingLoyalty;
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkSetParamForSerializationCompatibility(Set<String> data) {
|
||||
// HashMap uses inner class for Keys without serialization support,
|
||||
// so you can't use it for client-server data
|
||||
if (data != null && data.getClass().getName().endsWith("$KeySet")) {
|
||||
throw new IllegalArgumentException("Can't use KeySet as param, use new HashSet<>(data.keySet()) instead");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue