mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
remove redundant null checks before instanceof
This commit is contained in:
parent
d3aea0270c
commit
f04d7c9b03
72 changed files with 184 additions and 186 deletions
|
|
@ -538,7 +538,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
// Always hide not hidden popup window or enlarged card view if a frame is set to active
|
||||
try {
|
||||
ActionCallback callback = Plugins.instance.getActionCallback();
|
||||
if (callback != null && callback instanceof MageActionCallback) {
|
||||
if (callback instanceof MageActionCallback) {
|
||||
((MageActionCallback) callback).hideEnlargedCard();
|
||||
}
|
||||
Component container = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER);
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ public class DialogManager extends JComponent implements MouseListener,
|
|||
if (e.getButton() == MouseEvent.BUTTON1) {
|
||||
j = (JComponent) getComponentAt(e.getX(), e.getY());
|
||||
|
||||
if (j != null && j instanceof DialogContainer) {
|
||||
if (j instanceof DialogContainer) {
|
||||
rec = j.getBounds();
|
||||
bDragged = true;
|
||||
mx = e.getX();
|
||||
|
|
|
|||
|
|
@ -530,7 +530,7 @@ public class MageBook extends JComponent {
|
|||
Class<?> c = Class.forName(className);
|
||||
Constructor<?> cons = c.getConstructor();
|
||||
Object newToken = cons.newInstance();
|
||||
if (newToken != null && newToken instanceof mage.game.permanent.token.Token) {
|
||||
if (newToken instanceof Token) {
|
||||
((Token) newToken).setExpansionSetCodeForImage(set);
|
||||
((Token) newToken).setOriginalExpansionSetCode(set);
|
||||
((Token) newToken).setTokenType(token.getType());
|
||||
|
|
@ -580,7 +580,7 @@ public class MageBook extends JComponent {
|
|||
Class<?> c = Class.forName(className);
|
||||
Constructor<?> cons = c.getConstructor();
|
||||
Object newEmblem = cons.newInstance();
|
||||
if (newEmblem != null && newEmblem instanceof mage.game.command.Emblem) {
|
||||
if (newEmblem instanceof Emblem) {
|
||||
((Emblem) newEmblem).setExpansionSetCodeForImage(set);
|
||||
|
||||
emblems.add((Emblem) newEmblem);
|
||||
|
|
@ -637,7 +637,7 @@ public class MageBook extends JComponent {
|
|||
Class<?> c = Class.forName(className);
|
||||
Constructor<?> cons = c.getConstructor();
|
||||
Object newPlane = cons.newInstance();
|
||||
if (newPlane != null && newPlane instanceof mage.game.command.Plane) {
|
||||
if (newPlane instanceof Plane) {
|
||||
((Plane) newPlane).setExpansionSetCodeForImage(set);
|
||||
|
||||
planes.add((Plane) newPlane);
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
if (!card.getId().equals(bigCard.getCardId())) {
|
||||
if (!MageFrame.isLite()) {
|
||||
Image image = Plugins.instance.getOriginalImage(card);
|
||||
if (image != null && image instanceof BufferedImage) {
|
||||
if (image instanceof BufferedImage) {
|
||||
// XXX: scaled to fit width
|
||||
bigCard.setCard(card.getId(), EnlargeMode.NORMAL, image, new ArrayList<>(), false);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -617,7 +617,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
}
|
||||
|
||||
private void displayCardInfo(MageCard mageCard, Image image, BigCard bigCard) {
|
||||
if (image != null && image instanceof BufferedImage) {
|
||||
if (image instanceof BufferedImage) {
|
||||
// XXX: scaled to fit width
|
||||
bigCard.setCard(mageCard.getOriginal().getId(), enlargeMode, image, mageCard.getOriginal().getRules(), mageCard.getOriginal().isToRotate());
|
||||
// if it's an ability, show only the ability text as overlay
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class CountryItemEditor extends BasicComboBoxEditor {
|
|||
|
||||
@Override
|
||||
public void setItem(Object item) {
|
||||
if (item == null || !(item instanceof String[])) {
|
||||
if (!(item instanceof String[])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -800,7 +800,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
|||
// this update removes the isChoosable mark from targetCardsInLibrary
|
||||
// so only done for permanents because it's needed to redraw counters in different size, if window size was changed
|
||||
// no perfect solution yet (maybe also other not wanted effects for PermanentView objects)
|
||||
if (updateCard != null && (updateCard instanceof PermanentView)) {
|
||||
if ((updateCard instanceof PermanentView)) {
|
||||
update(updateCard);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue