Lint: fix 'declarations should use interfaces instead of classes' bugs (#11082)

This commit is contained in:
arcox 2023-08-31 13:42:45 -04:00 committed by GitHub
parent e3229d7eab
commit 2f0c1d84c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 31 additions and 26 deletions

View file

@ -9,6 +9,7 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.EnumSet;
import java.util.Set;
/**
*
@ -18,13 +19,13 @@ import java.util.EnumSet;
public class EquippedHasSupertypeCondition implements Condition {
private SuperType superType;
private EnumSet<SuperType> superTypes = EnumSet.noneOf(SuperType.class); // scope = Any
private Set<SuperType> superTypes = EnumSet.noneOf(SuperType.class); // scope = Any
public EquippedHasSupertypeCondition(SuperType supertype) {
this.superType = supertype;
}
public EquippedHasSupertypeCondition(EnumSet<SuperType> superTypes) {
public EquippedHasSupertypeCondition(Set<SuperType> superTypes) {
this.superTypes = superTypes;
}

View file

@ -811,7 +811,7 @@ public interface Player extends MageItem, Copyable<Player> {
PlayableObjectsList getPlayableObjects(Game game, Zone zone);
LinkedHashMap<UUID, ActivatedAbility> getPlayableActivatedAbilities(MageObject object, Zone zone, Game game);
Map<UUID, ActivatedAbility> getPlayableActivatedAbilities(MageObject object, Zone zone, Game game);
boolean addCounters(Counter counter, UUID playerAddingCounters, Ability source, Game game);

View file

@ -1534,7 +1534,7 @@ public abstract class PlayerImpl implements Player, Serializable {
* @param noMana
* @return
*/
public static LinkedHashMap<UUID, SpellAbility> getCastableSpellAbilities(Game game, UUID playerId, MageObject object, Zone zone, boolean noMana) {
public static Map<UUID, SpellAbility> getCastableSpellAbilities(Game game, UUID playerId, MageObject object, Zone zone, boolean noMana) {
// it uses simple check from spellCanBeActivatedRegularlyNow
// reason: no approved info here (e.g. forced to choose spell ability from cast card)
LinkedHashMap<UUID, SpellAbility> useable = new LinkedHashMap<>();
@ -1607,7 +1607,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
@Override
public LinkedHashMap<UUID, ActivatedAbility> getPlayableActivatedAbilities(MageObject object, Zone zone, Game game) {
public Map<UUID, ActivatedAbility> getPlayableActivatedAbilities(MageObject object, Zone zone, Game game) {
LinkedHashMap<UUID, ActivatedAbility> useable = new LinkedHashMap<>();
// stack abilities - can't activate anything
// spell ability - can activate additional abilities (example: "Lightning Storm")
@ -1634,7 +1634,7 @@ public abstract class PlayerImpl implements Player, Serializable {
return useable;
}
protected LinkedHashMap<UUID, ActivatedManaAbilityImpl> getUseableManaAbilities(MageObject object, Zone zone, Game game) {
protected Map<UUID, ActivatedManaAbilityImpl> getUseableManaAbilities(MageObject object, Zone zone, Game game) {
LinkedHashMap<UUID, ActivatedManaAbilityImpl> useable = new LinkedHashMap<>();
boolean canUse = !(object instanceof Permanent) || ((Permanent) object).canUseActivatedAbilities(game);
for (ActivatedManaAbilityImpl ability : object.getAbilities().getActivatedManaAbilities(zone)) {

View file

@ -62,10 +62,10 @@ public final class ManaUtil {
*
* @param unpaid Mana we need to pay. Can be null (it is for X costs now).
* @param useableAbilities List of mana abilities permanent may produce
* @return List of mana abilities permanent may produce and are reasonable
* @return Map of mana abilities permanent may produce and are reasonable
* for unpaid mana
*/
public static LinkedHashMap<UUID, ActivatedManaAbilityImpl> tryToAutoPay(ManaCost unpaid, LinkedHashMap<UUID, ActivatedManaAbilityImpl> useableAbilities) {
public static Map<UUID, ActivatedManaAbilityImpl> tryToAutoPay(ManaCost unpaid, Map<UUID, ActivatedManaAbilityImpl> useableAbilities) {
// first check if we have only basic mana abilities
for (ActivatedManaAbilityImpl ability : useableAbilities.values()) {
@ -141,7 +141,7 @@ public final class ManaUtil {
return false;
}
private static LinkedHashMap<UUID, ActivatedManaAbilityImpl> getManaAbilitiesUsingManaSymbols(LinkedHashMap<UUID, ActivatedManaAbilityImpl> useableAbilities, ManaSymbols symbols, Mana unpaidMana) {
private static Map<UUID, ActivatedManaAbilityImpl> getManaAbilitiesUsingManaSymbols(Map<UUID, ActivatedManaAbilityImpl> useableAbilities, ManaSymbols symbols, Mana unpaidMana) {
Set<ManaSymbol> countColored = new HashSet<>();
ActivatedManaAbilityImpl chosenManaAbility = null;
@ -355,7 +355,7 @@ public final class ManaUtil {
* @param useableAbilities
* @return
*/
private static LinkedHashMap<UUID, ActivatedManaAbilityImpl> getManaAbilitiesUsingMana(ManaCost unpaid, LinkedHashMap<UUID, ActivatedManaAbilityImpl> useableAbilities) {
private static Map<UUID, ActivatedManaAbilityImpl> getManaAbilitiesUsingMana(ManaCost unpaid, Map<UUID, ActivatedManaAbilityImpl> useableAbilities) {
Mana mana = unpaid.getMana();
int countColorfull = 0;
@ -408,7 +408,7 @@ public final class ManaUtil {
return replace(useableAbilities, chosenManaAbility);
}
private static LinkedHashMap<UUID, ActivatedManaAbilityImpl> replace(LinkedHashMap<UUID, ActivatedManaAbilityImpl> useableAbilities, ActivatedManaAbilityImpl chosenManaAbility) {
private static Map<UUID, ActivatedManaAbilityImpl> replace(Map<UUID, ActivatedManaAbilityImpl> useableAbilities, ActivatedManaAbilityImpl chosenManaAbility) {
// modify the map with the chosen mana ability
useableAbilities.clear();
useableAbilities.put(chosenManaAbility.getId(), chosenManaAbility);