mirror of
https://github.com/correl/mage.git
synced 2024-11-22 03:00:11 +00:00
Refactor: added edit protection for some unmodifiable lists
This commit is contained in:
parent
1d17895caa
commit
cfd7464b49
9 changed files with 22 additions and 34 deletions
|
@ -23,7 +23,7 @@ import java.util.*;
|
|||
*/
|
||||
public final class CombatUtil {
|
||||
|
||||
private static final List<Permanent> emptyList = new ArrayList<>();
|
||||
private static final List<Permanent> emptyList = Collections.unmodifiableList(new ArrayList<>());
|
||||
|
||||
private static final Logger log = Logger.getLogger(CombatUtil.class);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ enum CodespellClericCondition implements Condition {
|
|||
class CodespellClericWatcher extends Watcher {
|
||||
|
||||
private final Map<UUID, List<MageObjectReference>> spellMap = new HashMap<>();
|
||||
private static final List<MageObjectReference> emptyList = new ArrayList<>();
|
||||
private static final List<MageObjectReference> emptyList = Collections.unmodifiableList(new ArrayList<>());
|
||||
|
||||
CodespellClericWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
|
|
|
@ -57,7 +57,7 @@ public final class HotheadedGiant extends CardImpl {
|
|||
class HotheadedGiantWatcher extends Watcher {
|
||||
|
||||
private final Map<UUID, List<MageObjectReference>> spellMap = new HashMap<>();
|
||||
private static final List<MageObjectReference> emptyList = new ArrayList<>();
|
||||
private static final List<MageObjectReference> emptyList = Collections.unmodifiableList(new ArrayList<>());
|
||||
|
||||
HotheadedGiantWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
|
|
|
@ -91,7 +91,7 @@ class SoulReapEffect extends OneShotEffect {
|
|||
class SoulReapWatcher extends Watcher {
|
||||
|
||||
private final Map<UUID, List<MageObjectReference>> spellMap = new HashMap<>();
|
||||
private static final List<MageObjectReference> emptyList = new ArrayList<>();
|
||||
private static final List<MageObjectReference> emptyList = Collections.unmodifiableList(new ArrayList<>());
|
||||
|
||||
SoulReapWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
|
|
|
@ -18,17 +18,14 @@ import mage.game.events.ZoneChangeEvent;
|
|||
import mage.util.GameLog;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
public abstract class Designation implements MageObject {
|
||||
|
||||
private static final List<CardType> emptySet = new ArrayList<>();
|
||||
private static final List<CardType> emptyList = Collections.unmodifiableList(new ArrayList<>());
|
||||
private static final ObjectColor emptyColor = new ObjectColor();
|
||||
private static final ManaCostsImpl emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
|
@ -155,7 +152,7 @@ public abstract class Designation implements MageObject {
|
|||
|
||||
@Override
|
||||
public List<CardType> getCardType(Game game) {
|
||||
return emptySet;
|
||||
return emptyList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -45,7 +45,7 @@ public class Dungeon implements CommandObject {
|
|||
dungeonNames.add("Dungeon of the Mad Mage");
|
||||
}
|
||||
|
||||
private static final List<CardType> emptySet = Arrays.asList(CardType.DUNGEON);
|
||||
private static final List<CardType> emptyList = Collections.unmodifiableList(Arrays.asList(CardType.DUNGEON));
|
||||
private static final ObjectColor emptyColor = new ObjectColor();
|
||||
private static final ManaCosts<ManaCost> emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
|
@ -240,7 +240,7 @@ public class Dungeon implements CommandObject {
|
|||
|
||||
@Override
|
||||
public List<CardType> getCardType(Game game) {
|
||||
return emptySet;
|
||||
return emptyList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,19 +22,16 @@ import mage.util.GameLog;
|
|||
import mage.util.RandomUtil;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
public class Emblem implements CommandObject {
|
||||
|
||||
private static List<CardType> emptySet = new ArrayList<>();
|
||||
private static ObjectColor emptyColor = new ObjectColor();
|
||||
private static ManaCosts emptyCost = new ManaCostsImpl<>();
|
||||
private static final List<CardType> emptyList = Collections.unmodifiableList(new ArrayList<>());
|
||||
private static final ObjectColor emptyColor = new ObjectColor();
|
||||
private static final ManaCosts emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
private String name = "";
|
||||
private UUID id;
|
||||
|
@ -159,7 +156,7 @@ public class Emblem implements CommandObject {
|
|||
|
||||
@Override
|
||||
public List<CardType> getCardType(Game game) {
|
||||
return emptySet;
|
||||
return emptyList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,19 +24,16 @@ import mage.util.RandomUtil;
|
|||
import mage.util.SubTypes;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author spjspj
|
||||
*/
|
||||
public class Plane implements CommandObject {
|
||||
|
||||
private static List<CardType> emptySet = new ArrayList<>();
|
||||
private static ObjectColor emptyColor = new ObjectColor();
|
||||
private static ManaCosts emptyCost = new ManaCostsImpl<>();
|
||||
private static final List<CardType> emptyList = Collections.unmodifiableList(new ArrayList<>());
|
||||
private static final ObjectColor emptyColor = new ObjectColor();
|
||||
private static final ManaCosts emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
private Planes planeType = null;
|
||||
private UUID id;
|
||||
|
@ -158,7 +155,7 @@ public class Plane implements CommandObject {
|
|||
|
||||
@Override
|
||||
public List<CardType> getCardType(Game game) {
|
||||
return emptySet;
|
||||
return emptyList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,18 +34,15 @@ import mage.util.SubTypes;
|
|||
import mage.util.functions.StackObjectCopyApplier;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class StackAbility extends StackObjectImpl implements Ability {
|
||||
|
||||
private static final List<CardType> emptyCardType = new ArrayList<>();
|
||||
private static final List<String> emptyString = new ArrayList<>();
|
||||
private static final List<CardType> emptyCardType = Collections.unmodifiableList(new ArrayList<>());
|
||||
private static final List<String> emptyString = Collections.unmodifiableList(new ArrayList<>());
|
||||
private static final ObjectColor emptyColor = new ObjectColor();
|
||||
private static final ManaCosts<ManaCost> emptyCost = new ManaCostsImpl<>();
|
||||
private static final Costs<Cost> emptyCosts = new CostsImpl<>();
|
||||
|
|
Loading…
Reference in a new issue