Changed Object to MageItem in FilterPermanentOrPlayer and FilterPermanentOrPlayerWithCounter since that is the more specific class that both Permanent and Player inherit from.

This commit is contained in:
Duncan Townsend 2015-01-29 01:16:28 -05:00
parent bdafb4a003
commit 7f22f527fe
No known key found for this signature in database
GPG key ID: C00ECDF315F7A593
2 changed files with 7 additions and 5 deletions

View file

@ -37,11 +37,12 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import java.util.UUID; import java.util.UUID;
import mage.MageItem;
/** /**
* @author nantuko * @author nantuko
*/ */
public class FilterPermanentOrPlayer extends FilterImpl<Object> implements FilterInPlay<Object> { public class FilterPermanentOrPlayer extends FilterImpl<MageItem> implements FilterInPlay<MageItem> {
protected FilterPermanent permanentFilter; protected FilterPermanent permanentFilter;
protected FilterPlayer playerFilter; protected FilterPlayer playerFilter;
@ -63,7 +64,7 @@ public class FilterPermanentOrPlayer extends FilterImpl<Object> implements Filte
} }
@Override @Override
public boolean match(Object o, Game game) { public boolean match(MageItem o, Game game) {
if (o instanceof Player) { if (o instanceof Player) {
return playerFilter.match((Player) o, game); return playerFilter.match((Player) o, game);
} else if (o instanceof Permanent) { } else if (o instanceof Permanent) {
@ -73,7 +74,7 @@ public class FilterPermanentOrPlayer extends FilterImpl<Object> implements Filte
} }
@Override @Override
public boolean match(Object o, UUID sourceId, UUID playerId, Game game) { public boolean match(MageItem o, UUID sourceId, UUID playerId, Game game) {
if (o instanceof Player) { if (o instanceof Player) {
return playerFilter.match((Player) o, sourceId, playerId, game); return playerFilter.match((Player) o, sourceId, playerId, game);
} else if (o instanceof Permanent) { } else if (o instanceof Permanent) {

View file

@ -33,6 +33,7 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import java.util.UUID; import java.util.UUID;
import mage.MageItem;
/** /**
* @author nantuko * @author nantuko
@ -52,7 +53,7 @@ public class FilterPermanentOrPlayerWithCounter extends FilterPermanentOrPlayer
} }
@Override @Override
public boolean match(Object o, Game game) { public boolean match(MageItem o, Game game) {
if (o instanceof Player) { if (o instanceof Player) {
if (((Player)o).getCounters().size() == 0) { if (((Player)o).getCounters().size() == 0) {
return false; return false;
@ -66,7 +67,7 @@ public class FilterPermanentOrPlayerWithCounter extends FilterPermanentOrPlayer
} }
@Override @Override
public boolean match(Object o, UUID sourceId, UUID playerId, Game game) { public boolean match(MageItem o, UUID sourceId, UUID playerId, Game game) {
if (o instanceof Player) { if (o instanceof Player) {
return playerFilter.match((Player) o, sourceId, playerId, game); return playerFilter.match((Player) o, sourceId, playerId, game);
} else if (o instanceof Permanent) { } else if (o instanceof Permanent) {