forked from External/mage
Added game.getControllerId(uuid) method
This commit is contained in:
parent
47b63c87f4
commit
8d673217e7
2 changed files with 20 additions and 4 deletions
|
|
@ -79,6 +79,7 @@ public interface Game extends MageItem, Serializable {
|
|||
public Object getCustomData();
|
||||
public void setCustomData(Object data);
|
||||
public MageObject getObject(UUID objectId);
|
||||
public UUID getControllerId(UUID objectId);
|
||||
public Permanent getPermanent(UUID permanentId);
|
||||
public Card getCard(UUID cardId);
|
||||
public Zone getZone(UUID objectId);
|
||||
|
|
|
|||
|
|
@ -45,9 +45,7 @@ import mage.filter.common.*;
|
|||
import mage.game.combat.Combat;
|
||||
import mage.game.events.*;
|
||||
import mage.game.events.TableEvent.EventType;
|
||||
import mage.game.permanent.Battlefield;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.game.permanent.*;
|
||||
import mage.game.stack.SpellStack;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.game.turn.Phase;
|
||||
|
|
@ -62,7 +60,7 @@ import mage.watchers.Watcher;
|
|||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import mage.game.permanent.PermanentImpl;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializable {
|
||||
|
|
@ -207,6 +205,23 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getControllerId(UUID objectId) {
|
||||
if (objectId == null) {
|
||||
return null;
|
||||
}
|
||||
MageObject object = getObject(objectId);
|
||||
if (object != null) {
|
||||
if (object instanceof Permanent) {
|
||||
return ((Permanent)object).getControllerId();
|
||||
}
|
||||
if (object instanceof Card) {
|
||||
return ((Card)object).getOwnerId();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Permanent getPermanent(UUID permanentId) {
|
||||
if (permanentId == null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue