mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
replaced instances of Optional::of with Optional::ofNullable (fixes #9183)
This commit is contained in:
parent
015444d00f
commit
deb29c0659
28 changed files with 36 additions and 71 deletions
|
|
@ -9,7 +9,6 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
|
|
@ -41,8 +40,7 @@ public class BecomesBlockedAttachedTriggeredAbility extends TriggeredAbilityImpl
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = Optional
|
||||
.of(getSourcePermanentOrLKI(game))
|
||||
.filter(Objects::nonNull)
|
||||
.ofNullable(getSourcePermanentOrLKI(game))
|
||||
.map(Permanent::getAttachedTo)
|
||||
.map(game::getPermanent)
|
||||
.orElse(null);
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class CastExiledFromHandCardEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Optional.of(getValue("exiledHandCardRef"))
|
||||
Optional.ofNullable(getValue("exiledHandCardRef"))
|
||||
.filter(Objects::nonNull)
|
||||
.map(MageObjectReference.class::cast)
|
||||
.map(mor -> mor.getCard(game))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue