[minor] access modifer order

This commit is contained in:
North 2013-03-10 14:47:13 +02:00
parent ec546a5ae6
commit a7a565bb8f
549 changed files with 1032 additions and 1040 deletions

View file

@ -43,7 +43,7 @@ import org.apache.log4j.Logger;
*/ */
public abstract class MagePane extends javax.swing.JInternalFrame { public abstract class MagePane extends javax.swing.JInternalFrame {
private final static Logger logger = Logger.getLogger(MagePane.class); private static final Logger logger = Logger.getLogger(MagePane.class);
/** Creates new form MagePane */ /** Creates new form MagePane */
public MagePane() { public MagePane() {

View file

@ -38,24 +38,24 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// Used in the constructor // Used in the constructor
public final static int X_AXIS = 0; public static final int X_AXIS = 0;
public final static int Y_AXIS = 1; public static final int Y_AXIS = 1;
// See setAlignment() method // See setAlignment() method
public final static float LEADING = 0.0f; public static final float LEADING = 0.0f;
public final static float CENTER = 0.5f; public static final float CENTER = 0.5f;
public final static float TRAILING = 1.0f; public static final float TRAILING = 1.0f;
public final static float COMPONENT = -1.0f; public static final float COMPONENT = -1.0f;
// See setRoundingPolicy() method // See setRoundingPolicy() method
public final static int DO_NOTHING = 0; public static final int DO_NOTHING = 0;
public final static int FIRST = 1; public static final int FIRST = 1;
public final static int LAST = 2; public static final int LAST = 2;
public final static int LARGEST = 3; public static final int LARGEST = 3;
public final static int EQUAL = 4; public static final int EQUAL = 4;
private final static int MINIMUM = 0; private static final int MINIMUM = 0;
private final static int PREFERRED = 1; private static final int PREFERRED = 1;
private Map<Component, Float> constraints = new HashMap<Component, Float>(); private Map<Component, Float> constraints = new HashMap<Component, Float>();
@ -657,11 +657,9 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
for (int i = 0; i < relativeSpace.length; i++) { for (int i = 0; i < relativeSpace.length; i++) {
int space = relativeSpace[i]; int space = relativeSpace[i];
if (space > 0) { if (space > 0 && largestSpace < space) {
if (largestSpace < space) { largestSpace = space;
largestSpace = space; largest = i;
largest = i;
}
} }
} }

View file

@ -71,7 +71,7 @@ import java.util.concurrent.ExecutionException;
*/ */
public class DeckEditorPanel extends javax.swing.JPanel { public class DeckEditorPanel extends javax.swing.JPanel {
private final static Logger logger = Logger.getLogger(DeckEditorPanel.class); private static final Logger logger = Logger.getLogger(DeckEditorPanel.class);
private JFileChooser fcSelectDeck; private JFileChooser fcSelectDeck;
private JFileChooser fcImportDeck; private JFileChooser fcImportDeck;
@ -697,7 +697,7 @@ class ImportFilter extends FileFilter {
class UpdateDeckTask extends SwingWorker<Void, Void> { class UpdateDeckTask extends SwingWorker<Void, Void> {
private final static Logger logger = Logger.getLogger(UpdateDeckTask.class); private static final Logger logger = Logger.getLogger(UpdateDeckTask.class);
private Session session; private Session session;
private UUID tableId; private UUID tableId;

View file

@ -60,7 +60,7 @@ import java.util.concurrent.ExecutionException;
*/ */
public class ConnectDialog extends MageDialog { public class ConnectDialog extends MageDialog {
private final static Logger logger = Logger.getLogger(ConnectDialog.class); private static final Logger logger = Logger.getLogger(ConnectDialog.class);
private Connection connection; private Connection connection;
private ConnectTask task; private ConnectTask task;

View file

@ -40,7 +40,7 @@ import org.apache.log4j.Logger;
*/ */
public class JoinTableDialog extends MageDialog { public class JoinTableDialog extends MageDialog {
private final static Logger logger = Logger.getLogger(JoinTableDialog.class); private static final Logger logger = Logger.getLogger(JoinTableDialog.class);
private UUID tableId; private UUID tableId;
private UUID roomId; private UUID roomId;

View file

@ -47,7 +47,7 @@ import java.lang.reflect.InvocationTargetException;
*/ */
public class MageDialog extends javax.swing.JInternalFrame { public class MageDialog extends javax.swing.JInternalFrame {
private final static Logger logger = Logger.getLogger(MageDialog.class); private static final Logger logger = Logger.getLogger(MageDialog.class);
protected boolean modal = false; protected boolean modal = false;

View file

@ -54,7 +54,7 @@ import java.util.UUID;
*/ */
public class NewTableDialog extends MageDialog { public class NewTableDialog extends MageDialog {
private final static Logger logger = Logger.getLogger(NewTableDialog.class); private static final Logger logger = Logger.getLogger(NewTableDialog.class);
private TableView table; private TableView table;
private UUID playerId; private UUID playerId;

View file

@ -60,7 +60,7 @@ import java.util.UUID;
*/ */
public class NewTournamentDialog extends MageDialog { public class NewTournamentDialog extends MageDialog {
private final static Logger logger = Logger.getLogger(NewTournamentDialog.class); private static final Logger logger = Logger.getLogger(NewTournamentDialog.class);
private TableView table; private TableView table;
private UUID playerId; private UUID playerId;

View file

@ -56,7 +56,7 @@ import java.util.concurrent.ExecutionException;
*/ */
public class TableWaitingDialog extends MageDialog { public class TableWaitingDialog extends MageDialog {
private final static Logger logger = Logger.getLogger(TableWaitingDialog.class); private static final Logger logger = Logger.getLogger(TableWaitingDialog.class);
private UUID tableId; private UUID tableId;
private UUID roomId; private UUID roomId;
@ -363,7 +363,7 @@ class UpdateSeatsTask extends SwingWorker<Void, TableView> {
private TableWaitingDialog dialog; private TableWaitingDialog dialog;
private int count = 0; private int count = 0;
private final static Logger logger = Logger.getLogger(TableWaitingDialog.class); private static final Logger logger = Logger.getLogger(TableWaitingDialog.class);
UpdateSeatsTask(Session session, UUID roomId, UUID tableId, TableWaitingDialog dialog) { UpdateSeatsTask(Session session, UUID roomId, UUID tableId, TableWaitingDialog dialog) {
this.session = session; this.session = session;

View file

@ -59,7 +59,7 @@ import org.apache.log4j.Logger;
*/ */
public class FeedbackPanel extends javax.swing.JPanel { public class FeedbackPanel extends javax.swing.JPanel {
private final static Logger logger = Logger.getLogger(FeedbackPanel.class); private static final Logger logger = Logger.getLogger(FeedbackPanel.class);
public enum FeedbackMode { public enum FeedbackMode {
INFORM, QUESTION, CONFIRM, CANCEL, SELECT, END INFORM, QUESTION, CONFIRM, CANCEL, SELECT, END

View file

@ -1255,7 +1255,7 @@ class ReplayTask extends SwingWorker<Void, Collection<MatchView>> {
private Session session; private Session session;
private UUID gameId; private UUID gameId;
private final static Logger logger = Logger.getLogger(ReplayTask.class); private static final Logger logger = Logger.getLogger(ReplayTask.class);
ReplayTask(Session session, UUID gameId) { ReplayTask(Session session, UUID gameId) {
this.session = session; this.session = session;

View file

@ -33,8 +33,8 @@ public class Plugins implements MagePlugins {
public static final String PLUGINS_DIRECTORY = "plugins/"; public static final String PLUGINS_DIRECTORY = "plugins/";
private final static MagePlugins fINSTANCE = new Plugins(); private static final MagePlugins fINSTANCE = new Plugins();
private final static Logger logger = Logger.getLogger(Plugins.class); private static final Logger logger = Logger.getLogger(Plugins.class);
private static PluginManager pm; private static PluginManager pm;
private ThemePlugin themePlugin = null; private ThemePlugin themePlugin = null;

View file

@ -53,7 +53,7 @@ import java.util.UUID;
*/ */
public class CallbackClientImpl implements CallbackClient { public class CallbackClientImpl implements CallbackClient {
private final static Logger logger = Logger.getLogger(CallbackClientImpl.class); private static final Logger logger = Logger.getLogger(CallbackClientImpl.class);
private UUID clientId; private UUID clientId;
private MageFrame frame; private MageFrame frame;

View file

@ -59,7 +59,7 @@ import org.apache.log4j.Logger;
*/ */
public class TournamentPanel extends javax.swing.JPanel { public class TournamentPanel extends javax.swing.JPanel {
private final static Logger logger = Logger.getLogger(TournamentPanel.class); private static final Logger logger = Logger.getLogger(TournamentPanel.class);
private UUID tournamentId; private UUID tournamentId;
private Session session; private Session session;
@ -334,7 +334,7 @@ class UpdateTournamentTask extends SwingWorker<Void, TournamentView> {
private UUID tournamentId; private UUID tournamentId;
private TournamentPanel panel; private TournamentPanel panel;
private final static Logger logger = Logger.getLogger(UpdateTournamentTask.class); private static final Logger logger = Logger.getLogger(UpdateTournamentTask.class);
UpdateTournamentTask(Session session, UUID tournamentId, TournamentPanel panel) { UpdateTournamentTask(Session session, UUID tournamentId, TournamentPanel panel) {
this.session = session; this.session = session;

View file

@ -42,7 +42,7 @@ import java.util.Properties;
*/ */
public class Config { public class Config {
private final static Logger logger = Logger.getLogger(Config.class); private static final Logger logger = Logger.getLogger(Config.class);
public static final String remoteServer; public static final String remoteServer;
public static final String serverName; public static final String serverName;

View file

@ -38,7 +38,7 @@ import org.apache.log4j.Logger;
*/ */
public class EDTExceptionHandler implements Thread.UncaughtExceptionHandler { public class EDTExceptionHandler implements Thread.UncaughtExceptionHandler {
private final static Logger logger = Logger.getLogger(EDTExceptionHandler.class); private static final Logger logger = Logger.getLogger(EDTExceptionHandler.class);
@Override @Override
public void uncaughtException(Thread t, Throwable e) { public void uncaughtException(Thread t, Throwable e) {

View file

@ -7,7 +7,7 @@ import java.awt.*;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
abstract public class Animation { public abstract class Animation {
private static final long TARGET_MILLIS_PER_FRAME = 30; private static final long TARGET_MILLIS_PER_FRAME = 30;
private static Timer timer = new Timer("Animation", true); private static Timer timer = new Timer("Animation", true);
@ -46,7 +46,7 @@ abstract public class Animation {
timer.scheduleAtFixedRate(timerTask, delay, TARGET_MILLIS_PER_FRAME); timer.scheduleAtFixedRate(timerTask, delay, TARGET_MILLIS_PER_FRAME);
} }
abstract protected void update (float percentage); protected abstract void update (float percentage);
protected void cancel () { protected void cancel () {
timerTask.cancel(); timerTask.cancel();
@ -102,7 +102,7 @@ abstract public class Animation {
} }
} }
static public void tapCardToggle (final CardPanel panel, final MagePermanent parent, final boolean tapped, final boolean flipped) { public static void tapCardToggle (final CardPanel panel, final MagePermanent parent, final boolean tapped, final boolean flipped) {
new Animation(300) { new Animation(300) {
@Override @Override
protected void start () { protected void start () {
@ -177,7 +177,7 @@ abstract public class Animation {
}; };
} }
static public void moveCardToPlay (final int startX, final int startY, final int startWidth, final int endX, final int endY, public static void moveCardToPlay (final int startX, final int startY, final int startWidth, final int endX, final int endY,
final int endWidth, final CardPanel animationPanel, final CardPanel placeholder, final JLayeredPane layeredPane, final int endWidth, final CardPanel animationPanel, final CardPanel placeholder, final JLayeredPane layeredPane,
final int speed) { final int speed) {
UI.invokeLater(new Runnable() { UI.invokeLater(new Runnable() {
@ -247,7 +247,7 @@ abstract public class Animation {
}); });
} }
static public void moveCard (final int startX, final int startY, final int startWidth, final int endX, final int endY, public static void moveCard (final int startX, final int startY, final int startWidth, final int endX, final int endY,
final int endWidth, final CardPanel animationPanel, final CardPanel placeholder, final JLayeredPane layeredPane, final int endWidth, final CardPanel animationPanel, final CardPanel placeholder, final JLayeredPane layeredPane,
final int speed) { final int speed) {
UI.invokeLater(new Runnable() { UI.invokeLater(new Runnable() {
@ -294,11 +294,9 @@ abstract public class Animation {
}); });
} }
static public void shrinkCard () { public static void shrinkCard () {
final CardPanel overPanel, animationPanel; final CardPanel overPanel, animationPanel;
synchronized (enlargeLock) { synchronized (enlargeLock) {
//delayedCardPanel = null;
//delayedTime = 0;
overPanel = Animation.enlargedCardPanel; overPanel = Animation.enlargedCardPanel;
animationPanel = Animation.enlargedAnimationPanel; animationPanel = Animation.enlargedAnimationPanel;
if (animationPanel == null) { if (animationPanel == null) {
@ -348,15 +346,15 @@ abstract public class Animation {
}; };
} }
static public boolean isShowingEnlargedCard () { public static boolean isShowingEnlargedCard () {
synchronized (enlargeLock) { synchronized (enlargeLock) {
return enlargedAnimationPanel != null; return enlargedAnimationPanel != null;
} }
} }
static public void showCard(final MagePermanent card, int count) { public static void showCard(final MagePermanent card, int count) {
if (count == 0) { if (count == 0) {
count = 1; return;
} }
new Animation(600 / count) { new Animation(600 / count) {
@Override @Override
@ -377,9 +375,9 @@ abstract public class Animation {
}; };
} }
static public void hideCard(final MagePermanent card, int count) { public static void hideCard(final MagePermanent card, int count) {
if (count == 0) { if (count == 0) {
count = 1; return;
} }
new Animation(600 / count) { new Animation(600 / count) {
@Override @Override

View file

@ -46,12 +46,12 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
public static final Rectangle CARD_SIZE_FULL = new Rectangle(101, 149); public static final Rectangle CARD_SIZE_FULL = new Rectangle(101, 149);
static private final float ROUNDED_CORNER_SIZE = 0.1f; private static final float ROUNDED_CORNER_SIZE = 0.1f;
static private final float BLACK_BORDER_SIZE = 0.03f; private static final float BLACK_BORDER_SIZE = 0.03f;
static private final int TEXT_GLOW_SIZE = 6; private static final int TEXT_GLOW_SIZE = 6;
static private final float TEXT_GLOW_INTENSITY = 3f; private static final float TEXT_GLOW_INTENSITY = 3f;
static private final float ROT_CENTER_TO_TOP_CORNER = 1.0295630140987000315797369464196f; private static final float ROT_CENTER_TO_TOP_CORNER = 1.0295630140987000315797369464196f;
static private final float ROT_CENTER_TO_BOTTOM_CORNER = 0.7071067811865475244008443621048f; private static final float ROT_CENTER_TO_BOTTOM_CORNER = 0.7071067811865475244008443621048f;
public CardView gameCard; public CardView gameCard;
@ -236,7 +236,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
public void setImage(final CardPanel panel) { public void setImage(final CardPanel panel) {
synchronized (panel.imagePanel) { synchronized (panel.imagePanel) {
if (panel.imagePanel.hasImage()) { if (panel.imagePanel.hasImage()) {
setImage(panel.imagePanel.srcImage); setImage(panel.imagePanel.getSrcImage());
} }
} }
} }
@ -747,7 +747,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
return data; return data;
} }
final protected String getType(CardView card) { protected final String getType(CardView card) {
StringBuilder sbType = new StringBuilder(); StringBuilder sbType = new StringBuilder();
for (String superType : card.getSuperTypes()) { for (String superType : card.getSuperTypes()) {
@ -768,7 +768,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
return sbType.toString(); return sbType.toString();
} }
final protected String getText(String cardType, CardView card) { protected final String getText(String cardType, CardView card) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (card instanceof StackAbilityView || card instanceof AbilityView) { if (card instanceof StackAbilityView || card instanceof AbilityView) {
for (String rule : card.getRules()) { for (String rule : card.getRules()) {

View file

@ -10,7 +10,7 @@ import javax.swing.JPanel;
public class ScaledImagePanel extends JPanel { public class ScaledImagePanel extends JPanel {
private static final long serialVersionUID = -1523279873208605664L; private static final long serialVersionUID = -1523279873208605664L;
public volatile Image srcImage; private volatile Image srcImage;
private ScalingType scalingType = ScalingType.bilinear; private ScalingType scalingType = ScalingType.bilinear;
private boolean scaleLarger; private boolean scaleLarger;
@ -101,7 +101,6 @@ public class ScaledImagePanel extends JPanel {
} }
private void scaleWithGetScaledInstance (Graphics2D g2, ScalingInfo info, int hints) { private void scaleWithGetScaledInstance (Graphics2D g2, ScalingInfo info, int hints) {
Image srcImage = getSourceImage(info);
Image scaledImage = srcImage.getScaledInstance(info.targetWidth, info.targetHeight, hints); Image scaledImage = srcImage.getScaledInstance(info.targetWidth, info.targetHeight, hints);
g2.drawImage(scaledImage, info.x, info.y, null); g2.drawImage(scaledImage, info.x, info.y, null);
} }
@ -117,8 +116,6 @@ public class ScaledImagePanel extends JPanel {
tempDestHeight = info.targetHeight; tempDestHeight = info.targetHeight;
} }
Image srcImage = getSourceImage(info);
// If not doing multipass or multipass only needs a single pass, just scale it once directly to the panel surface. // If not doing multipass or multipass only needs a single pass, just scale it once directly to the panel surface.
if (multiPassType == MultipassType.none || (tempDestWidth == info.targetWidth && tempDestHeight == info.targetHeight)) { if (multiPassType == MultipassType.none || (tempDestWidth == info.targetWidth && tempDestHeight == info.targetHeight)) {
g2.drawImage(srcImage, info.x, info.y, info.targetWidth, info.targetHeight, null); g2.drawImage(srcImage, info.x, info.y, info.targetWidth, info.targetHeight, null);
@ -174,15 +171,11 @@ public class ScaledImagePanel extends JPanel {
tempSrcHeight, null); tempSrcHeight, null);
} }
private Image getSourceImage (ScalingInfo info) {
return srcImage;
}
public Image getSrcImage() { public Image getSrcImage() {
return srcImage; return srcImage;
} }
static private class ScalingInfo { private static class ScalingInfo {
public int targetWidth; public int targetWidth;
public int targetHeight; public int targetHeight;
public int srcWidth; public int srcWidth;
@ -191,11 +184,11 @@ public class ScaledImagePanel extends JPanel {
public int y; public int y;
} }
static public enum MultipassType { public static enum MultipassType {
none, nearestNeighbor, bilinear, bicubic none, nearestNeighbor, bilinear, bicubic
} }
static public enum ScalingType { public static enum ScalingType {
nearestNeighbor, replicate, bilinear, bicubic, areaAveraging nearestNeighbor, replicate, bilinear, bicubic, areaAveraging
} }
} }

View file

@ -10,8 +10,8 @@ import static org.mage.plugins.card.dl.DownloadJob.toFile;
public class GathererSets implements Iterable<DownloadJob> { public class GathererSets implements Iterable<DownloadJob> {
private final static String SETS_PATH = File.separator + "sets"; private static final String SETS_PATH = File.separator + "sets";
private final static File DEFAULT_OUT_DIR = new File("plugins" + File.separator + "images" + SETS_PATH); private static final File DEFAULT_OUT_DIR = new File("plugins" + File.separator + "images" + SETS_PATH);
private static File outDir = DEFAULT_OUT_DIR; private static File outDir = DEFAULT_OUT_DIR;
private static final String[] symbols = {"10E", "9ED", "8ED", "7ED", "6ED", "5ED", "4ED", "3ED", "2ED", "LEB", "LEA", private static final String[] symbols = {"10E", "9ED", "8ED", "7ED", "6ED", "5ED", "4ED", "3ED", "2ED", "LEB", "LEA",

View file

@ -28,8 +28,8 @@ public class GathererSymbols implements Iterable<DownloadJob> {
//TODO chaos and planeswalker symbol //TODO chaos and planeswalker symbol
//chaos: http://gatherer.wizards.com/Images/Symbols/chaos.gif //chaos: http://gatherer.wizards.com/Images/Symbols/chaos.gif
private final static String SYMBOLS_PATH = File.separator + "symbols"; private static final String SYMBOLS_PATH = File.separator + "symbols";
private final static File DEFAULT_OUT_DIR = new File("plugins" + File.separator + "images" + SYMBOLS_PATH); private static final File DEFAULT_OUT_DIR = new File("plugins" + File.separator + "images" + SYMBOLS_PATH);
private static File outDir = DEFAULT_OUT_DIR; private static File outDir = DEFAULT_OUT_DIR;
private static final String urlFmt = "http://gatherer.wizards.com/handlers/image.ashx?size=%1$s&name=%2$s&type=symbol"; private static final String urlFmt = "http://gatherer.wizards.com/handlers/image.ashx?size=%1$s&name=%2$s&type=symbol";

View file

@ -21,16 +21,16 @@ import org.junit.Ignore;
@Ignore @Ignore
public class MultiConnectTest { public class MultiConnectTest {
private final static Logger logger = Logger.getLogger(MultiConnectTest.class); private static final Logger logger = Logger.getLogger(MultiConnectTest.class);
/** /**
* Amount of games to be started from this test. * Amount of games to be started from this test.
*/ */
private final static Integer USER_CONNECT_COUNT = 200; private static final Integer USER_CONNECT_COUNT = 200;
private final static CountDownLatch latch = new CountDownLatch(USER_CONNECT_COUNT); private static final CountDownLatch latch = new CountDownLatch(USER_CONNECT_COUNT);
private final static MageVersion version = new MageVersion(1, 0, 1, ""); private static final MageVersion version = new MageVersion(1, 0, 1, "");
private static volatile int connected; private static volatile int connected;

View file

@ -13,12 +13,12 @@ import org.junit.Ignore;
@Ignore @Ignore
public class StartMultiGamesTest { public class StartMultiGamesTest {
private final static Logger logger = Logger.getLogger(StartMultiGamesTest.class); private static final Logger logger = Logger.getLogger(StartMultiGamesTest.class);
/** /**
* Amount of games to be started from this test. * Amount of games to be started from this test.
*/ */
private final static Integer GAME_START_COUNT = 10; private static final Integer GAME_START_COUNT = 10;
private MageFrame frame = null; private MageFrame frame = null;
private Object sync = new Object(); private Object sync = new Object();

View file

@ -60,7 +60,7 @@ import java.util.*;
*/ */
public class SessionImpl implements Session { public class SessionImpl implements Session {
private final static Logger logger = Logger.getLogger(SessionImpl.class); private static final Logger logger = Logger.getLogger(SessionImpl.class);
private String sessionId; private String sessionId;
private MageServer server; private MageServer server;

View file

@ -20,7 +20,7 @@ import java.util.Map;
@Author(name = "nantuko") @Author(name = "nantuko")
public class ThemePluginImpl implements ThemePlugin { public class ThemePluginImpl implements ThemePlugin {
private final static Logger log = Logger.getLogger(ThemePluginImpl.class); private static final Logger log = Logger.getLogger(ThemePluginImpl.class);
private static BufferedImage background; private static BufferedImage background;
@Init @Init

View file

@ -55,7 +55,7 @@ import java.util.concurrent.ExecutionException;
*/ */
public class ConnectDialog extends JDialog { public class ConnectDialog extends JDialog {
private final static Logger logger = Logger.getLogger(ConnectDialog.class); private static final Logger logger = Logger.getLogger(ConnectDialog.class);
private ConsoleFrame console; private ConsoleFrame console;
private Connection connection; private Connection connection;
private ConnectTask task; private ConnectTask task;

View file

@ -52,12 +52,12 @@ import java.util.prefs.Preferences;
*/ */
public class ConsoleFrame extends javax.swing.JFrame implements MageClient { public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
private final static Logger logger = Logger.getLogger(ConsoleFrame.class); private static final Logger logger = Logger.getLogger(ConsoleFrame.class);
private static Session session; private static Session session;
private ConnectDialog connectDialog; private ConnectDialog connectDialog;
private static Preferences prefs = Preferences.userNodeForPackage(ConsoleFrame.class); private static Preferences prefs = Preferences.userNodeForPackage(ConsoleFrame.class);
private final static MageVersion version = new MageVersion(1, 0, 1, ""); private static final MageVersion version = new MageVersion(1, 0, 1, "");
/** /**
* @return the session * @return the session

View file

@ -43,7 +43,7 @@ import mage.util.Logging;
*/ */
public class Config2 { public class Config2 {
private final static Logger logger = Logging.getLogger(Config2.class.getName()); private static final Logger logger = Logging.getLogger(Config2.class.getName());
// public static final int maxDepth; // public static final int maxDepth;
public static final int maxNodes; public static final int maxNodes;

View file

@ -24,7 +24,7 @@ import java.util.logging.Logger;
*/ */
public class GameStateEvaluator2 { public class GameStateEvaluator2 {
private final static transient Logger logger = Logging.getLogger(GameStateEvaluator2.class.getName()); private static final transient Logger logger = Logging.getLogger(GameStateEvaluator2.class.getName());
static { static {
logger.setLevel(Level.ALL); logger.setLevel(Level.ALL);

View file

@ -56,7 +56,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
*/ */
public class SimulatedPlayer2 extends ComputerPlayer<SimulatedPlayer2> { public class SimulatedPlayer2 extends ComputerPlayer<SimulatedPlayer2> {
private final static transient Logger logger = Logger.getLogger(SimulatedPlayer2.class); private static final transient Logger logger = Logger.getLogger(SimulatedPlayer2.class);
private boolean isSimulatedPlayer; private boolean isSimulatedPlayer;
private transient ConcurrentLinkedQueue<Ability> allActions; private transient ConcurrentLinkedQueue<Ability> allActions;
private boolean forced; private boolean forced;

View file

@ -41,7 +41,7 @@ import mage.util.Logging;
*/ */
public class SimulationWorker2 implements Callable { public class SimulationWorker2 implements Callable {
private final static Logger logger = Logging.getLogger(SimulationWorker2.class.getName()); private static final Logger logger = Logging.getLogger(SimulationWorker2.class.getName());
private Game game; private Game game;
private SimulatedAction2 previousActions; private SimulatedAction2 previousActions;

View file

@ -64,7 +64,7 @@ public class ComputerPlayerMCTS extends ComputerPlayer<ComputerPlayerMCTS> imple
protected transient MCTSNode root; protected transient MCTSNode root;
protected int maxThinkTime; protected int maxThinkTime;
private final static transient Logger logger = Logger.getLogger(ComputerPlayerMCTS.class); private static final transient Logger logger = Logger.getLogger(ComputerPlayerMCTS.class);
private transient ExecutorService pool; private transient ExecutorService pool;
private int cores; private int cores;

View file

@ -42,7 +42,7 @@ public class MCTSExecutor implements Callable<Boolean> {
protected int thinkTime; protected int thinkTime;
protected UUID playerId; protected UUID playerId;
private final static transient Logger logger = Logger.getLogger(ComputerPlayerMCTS.class); private static final transient Logger logger = Logger.getLogger(ComputerPlayerMCTS.class);
public MCTSExecutor(Game sim, UUID playerId, int thinkTime) { public MCTSExecutor(Game sim, UUID playerId, int thinkTime) {
this.playerId = playerId; this.playerId = playerId;

View file

@ -53,7 +53,7 @@ public class MCTSNode {
private static final double selectionCoefficient = 1.0; private static final double selectionCoefficient = 1.0;
private static final double passRatioTolerance = 0.0; private static final double passRatioTolerance = 0.0;
private final static transient Logger logger = Logger.getLogger(MCTSNode.class); private static final transient Logger logger = Logger.getLogger(MCTSNode.class);
private int visits = 0; private int visits = 0;
private int wins = 0; private int wins = 0;

View file

@ -45,7 +45,7 @@ import java.util.UUID;
*/ */
public class MCTSPlayer extends ComputerPlayer<MCTSPlayer> { public class MCTSPlayer extends ComputerPlayer<MCTSPlayer> {
private final static transient Logger logger = Logger.getLogger(MCTSPlayer.class); private static final transient Logger logger = Logger.getLogger(MCTSPlayer.class);
protected PassAbility pass = new PassAbility(); protected PassAbility pass = new PassAbility();

View file

@ -64,7 +64,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer {
private boolean isSimulatedPlayer; private boolean isSimulatedPlayer;
private static Random rnd = new Random(); private static Random rnd = new Random();
private int actionCount = 0; private int actionCount = 0;
private final static transient Logger logger = Logger.getLogger(SimulatedPlayerMCTS.class); private static final transient Logger logger = Logger.getLogger(SimulatedPlayerMCTS.class);
public SimulatedPlayerMCTS(UUID id, boolean isSimulatedPlayer) { public SimulatedPlayerMCTS(UUID id, boolean isSimulatedPlayer) {
super(id); super(id);

View file

@ -41,7 +41,7 @@ import org.apache.log4j.Logger;
*/ */
public class Config { public class Config {
private final static Logger logger = Logger.getLogger(Config.class); private static final Logger logger = Logger.getLogger(Config.class);
// public static final int maxDepth; // public static final int maxDepth;
public static final int maxNodes; public static final int maxNodes;

View file

@ -53,7 +53,7 @@ import org.apache.log4j.Logger;
*/ */
public class GameStateEvaluator { public class GameStateEvaluator {
private final static transient Logger logger = Logger.getLogger(GameStateEvaluator.class); private static final transient Logger logger = Logger.getLogger(GameStateEvaluator.class);
private static final int LIFE_FACTOR = Config.evaluatorLifeFactor; private static final int LIFE_FACTOR = Config.evaluatorLifeFactor;
private static final int PERMANENT_FACTOR = Config.evaluatorPermanentFactor; private static final int PERMANENT_FACTOR = Config.evaluatorPermanentFactor;

View file

@ -39,7 +39,7 @@ import mage.util.Logging;
*/ */
public class SimulateBlockWorker implements Callable { public class SimulateBlockWorker implements Callable {
private final static Logger logger = Logging.getLogger(SimulationWorker.class.getName()); private static final Logger logger = Logging.getLogger(SimulationWorker.class.getName());
private SimulationNode node; private SimulationNode node;
private ComputerPlayer3 player; private ComputerPlayer3 player;

View file

@ -59,7 +59,7 @@ import org.apache.log4j.Logger;
*/ */
public class SimulatedPlayer extends ComputerPlayer<SimulatedPlayer> { public class SimulatedPlayer extends ComputerPlayer<SimulatedPlayer> {
private final static transient Logger logger = Logger.getLogger(SimulatedPlayer.class); private static final transient Logger logger = Logger.getLogger(SimulatedPlayer.class);
private boolean isSimulatedPlayer; private boolean isSimulatedPlayer;
private transient ConcurrentLinkedQueue<Ability> allActions; private transient ConcurrentLinkedQueue<Ability> allActions;
private static PassAbility pass = new PassAbility(); private static PassAbility pass = new PassAbility();

View file

@ -41,7 +41,7 @@ import mage.util.Logging;
*/ */
public class SimulationWorker implements Callable { public class SimulationWorker implements Callable {
private final static Logger logger = Logging.getLogger(SimulationWorker.class.getName()); private static final Logger logger = Logging.getLogger(SimulationWorker.class.getName());
private Game game; private Game game;
private SimulatedAction previousActions; private SimulatedAction previousActions;

View file

@ -39,7 +39,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
public class ChatManager { public class ChatManager {
private final static ChatManager INSTANCE = new ChatManager(); private static final ChatManager INSTANCE = new ChatManager();
public static ChatManager getInstance() { public static ChatManager getInstance() {
return INSTANCE; return INSTANCE;

View file

@ -45,7 +45,7 @@ import org.apache.log4j.Logger;
*/ */
public class ChatSession { public class ChatSession {
private final static Logger logger = Logger.getLogger(ChatSession.class); private static final Logger logger = Logger.getLogger(ChatSession.class);
private ConcurrentHashMap<UUID, String> clients = new ConcurrentHashMap<UUID, String>(); private ConcurrentHashMap<UUID, String> clients = new ConcurrentHashMap<UUID, String>();
private UUID chatId; private UUID chatId;
private DateFormat timeFormatter = SimpleDateFormat.getTimeInstance(SimpleDateFormat.SHORT); private DateFormat timeFormatter = SimpleDateFormat.getTimeInstance(SimpleDateFormat.SHORT);

View file

@ -66,7 +66,7 @@ import java.util.concurrent.ExecutorService;
*/ */
public class MageServerImpl implements MageServer { public class MageServerImpl implements MageServer {
private final static Logger logger = Logger.getLogger(MageServerImpl.class); private static final Logger logger = Logger.getLogger(MageServerImpl.class);
private static ExecutorService callExecutor = ThreadExecutor.getInstance().getCallExecutor(); private static ExecutorService callExecutor = ThreadExecutor.getInstance().getCallExecutor();
private String password; private String password;

View file

@ -1,311 +1,314 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.server; package mage.server;
import mage.cards.repository.CardScanner; import mage.cards.repository.CardScanner;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.tournament.TournamentType; import mage.game.tournament.TournamentType;
import mage.interfaces.MageServer; import mage.interfaces.MageServer;
import mage.remote.Connection; import mage.remote.Connection;
import mage.server.game.DeckValidatorFactory; import mage.server.game.DeckValidatorFactory;
import mage.server.game.GameFactory; import mage.server.game.GameFactory;
import mage.server.game.PlayerFactory; import mage.server.game.PlayerFactory;
import mage.server.tournament.TournamentFactory; import mage.server.tournament.TournamentFactory;
import mage.server.util.ConfigSettings; import mage.server.util.ConfigSettings;
import mage.server.util.PluginClassLoader; import mage.server.util.PluginClassLoader;
import mage.server.util.ServerMessagesUtil; import mage.server.util.ServerMessagesUtil;
import mage.server.util.SystemUtil; import mage.server.util.SystemUtil;
import mage.server.util.config.GamePlugin; import mage.server.util.config.GamePlugin;
import mage.server.util.config.Plugin; import mage.server.util.config.Plugin;
import mage.utils.MageVersion; import mage.utils.MageVersion;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jboss.remoting.*; import org.jboss.remoting.*;
import org.jboss.remoting.callback.InvokerCallbackHandler; import org.jboss.remoting.callback.InvokerCallbackHandler;
import org.jboss.remoting.callback.ServerInvokerCallbackHandler; import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
import org.jboss.remoting.transport.Connector; import org.jboss.remoting.transport.Connector;
import org.jboss.remoting.transport.socket.SocketWrapper; import org.jboss.remoting.transport.socket.SocketWrapper;
import org.jboss.remoting.transporter.TransporterClient; import org.jboss.remoting.transporter.TransporterClient;
import org.jboss.remoting.transporter.TransporterServer; import org.jboss.remoting.transporter.TransporterServer;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import javax.management.MBeanServer; import javax.management.MBeanServer;
import java.io.File; import java.io.File;
import java.io.FilenameFilter; import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class Main { public class Main {
private static Logger logger = Logger.getLogger(Main.class); private static Logger logger = Logger.getLogger(Main.class);
private final static String testModeArg = "-testMode="; private static final String testModeArg = "-testMode=";
private final static String adminPasswordArg = "-adminPassword="; private static final String adminPasswordArg = "-adminPassword=";
private final static String pluginFolder = "plugins"; private static final String pluginFolder = "plugins";
private static MageVersion version = new MageVersion(1, 0, 1, ""); private static MageVersion version = new MageVersion(1, 0, 1, "");
public static PluginClassLoader classLoader = new PluginClassLoader(); public static PluginClassLoader classLoader = new PluginClassLoader();
public static TransporterServer server; public static TransporterServer server;
protected static boolean testMode; protected static boolean testMode;
/** /**
* @param args the command line arguments * @param args the command line arguments
*/ */
public static void main(String[] args) { public static void main(String[] args) {
logger.info("Starting MAGE server version " + version); logger.info("Starting MAGE server version " + version);
logger.info("Logging level: " + logger.getEffectiveLevel()); logger.info("Logging level: " + logger.getEffectiveLevel());
CardScanner.scan(); CardScanner.scan();
deleteSavedGames(); deleteSavedGames();
ConfigSettings config = ConfigSettings.getInstance(); ConfigSettings config = ConfigSettings.getInstance();
for (GamePlugin plugin: config.getGameTypes()) { for (GamePlugin plugin: config.getGameTypes()) {
GameFactory.getInstance().addGameType(plugin.getName(), loadGameType(plugin), loadPlugin(plugin)); GameFactory.getInstance().addGameType(plugin.getName(), loadGameType(plugin), loadPlugin(plugin));
} }
for (GamePlugin plugin: config.getTournamentTypes()) { for (GamePlugin plugin: config.getTournamentTypes()) {
TournamentFactory.getInstance().addTournamentType(plugin.getName(), loadTournamentType(plugin), loadPlugin(plugin)); TournamentFactory.getInstance().addTournamentType(plugin.getName(), loadTournamentType(plugin), loadPlugin(plugin));
} }
for (Plugin plugin: config.getPlayerTypes()) { for (Plugin plugin: config.getPlayerTypes()) {
PlayerFactory.getInstance().addPlayerType(plugin.getName(), loadPlugin(plugin)); PlayerFactory.getInstance().addPlayerType(plugin.getName(), loadPlugin(plugin));
} }
for (Plugin plugin: config.getDeckTypes()) { for (Plugin plugin: config.getDeckTypes()) {
DeckValidatorFactory.getInstance().addDeckType(plugin.getName(), loadPlugin(plugin)); DeckValidatorFactory.getInstance().addDeckType(plugin.getName(), loadPlugin(plugin));
} }
String adminPassword = ""; String adminPassword = "";
for (String arg: args) { for (String arg: args) {
if (arg.startsWith(testModeArg)) { if (arg.startsWith(testModeArg)) {
testMode = Boolean.valueOf(arg.replace(testModeArg, "")); testMode = Boolean.valueOf(arg.replace(testModeArg, ""));
} }
else if (arg.startsWith(adminPasswordArg)) { else if (arg.startsWith(adminPasswordArg)) {
adminPassword = arg.replace(adminPasswordArg, ""); adminPassword = arg.replace(adminPasswordArg, "");
adminPassword = SystemUtil.sanitize(adminPassword); adminPassword = SystemUtil.sanitize(adminPassword);
} }
} }
Connection connection = new Connection(); Connection connection = new Connection();
connection.setHost(config.getServerAddress()); connection.setHost(config.getServerAddress());
connection.setPort(config.getPort()); connection.setPort(config.getPort());
try { try {
InvokerLocator serverLocator = new InvokerLocator(connection.getURI()); InvokerLocator serverLocator = new InvokerLocator(connection.getURI());
if (!isAlreadyRunning(serverLocator)) { if (!isAlreadyRunning(serverLocator)) {
server = new MageTransporterServer(serverLocator, new MageServerImpl(adminPassword, testMode), MageServer.class.getName(), new MageServerInvocationHandler()); server = new MageTransporterServer(serverLocator, new MageServerImpl(adminPassword, testMode), MageServer.class.getName(), new MageServerInvocationHandler());
server.start(); server.start();
logger.info("Started MAGE server - listening on " + connection.toString()); logger.info("Started MAGE server - listening on " + connection.toString());
if (testMode) if (testMode) {
logger.info("MAGE server running in test mode"); logger.info("MAGE server running in test mode");
initStatistics(); }
} initStatistics();
else { }
logger.fatal("Unable to start MAGE server - another server is already started"); else {
} logger.fatal("Unable to start MAGE server - another server is already started");
} catch (IOException ex) { }
logger.fatal("Failed to start server - " + connection.toString(), ex); } catch (IOException ex) {
} catch (Exception ex) { logger.fatal("Failed to start server - " + connection.toString(), ex);
logger.fatal("Failed to start server - " + connection.toString(), ex); } catch (Exception ex) {
} logger.fatal("Failed to start server - " + connection.toString(), ex);
}
}
}
static void initStatistics() {
ServerMessagesUtil.getInstance().setStartDate(System.currentTimeMillis()); static void initStatistics() {
} ServerMessagesUtil.getInstance().setStartDate(System.currentTimeMillis());
}
static boolean isAlreadyRunning(InvokerLocator serverLocator) {
Map<String, String> metadata = new HashMap<String, String>(); static boolean isAlreadyRunning(InvokerLocator serverLocator) {
metadata.put(SocketWrapper.WRITE_TIMEOUT, "2000"); Map<String, String> metadata = new HashMap<String, String>();
metadata.put("generalizeSocketException", "true"); metadata.put(SocketWrapper.WRITE_TIMEOUT, "2000");
try { metadata.put("generalizeSocketException", "true");
MageServer testServer = (MageServer) TransporterClient.createTransporterClient(serverLocator.getLocatorURI(), MageServer.class, metadata); try {
if (testServer != null) { MageServer testServer = (MageServer) TransporterClient.createTransporterClient(serverLocator.getLocatorURI(), MageServer.class, metadata);
testServer.getServerState(); if (testServer != null) {
return true; testServer.getServerState();
} return true;
} catch (Throwable t) { }
// assume server is not running } catch (Throwable t) {
} // assume server is not running
return false; }
} return false;
}
static class ClientConnectionListener implements ConnectionListener {
@Override static class ClientConnectionListener implements ConnectionListener {
public void handleConnectionException(Throwable throwable, Client client) { @Override
Session session = SessionManager.getInstance().getSession(client.getSessionId()); public void handleConnectionException(Throwable throwable, Client client) {
if (session != null) { Session session = SessionManager.getInstance().getSession(client.getSessionId());
String sessionName; if (session != null) {
User user = UserManager.getInstance().getUser(session.getUserId()); String sessionName;
if (user != null) User user = UserManager.getInstance().getUser(session.getUserId());
sessionName = user.getName() + " at " + session.getHost(); if (user != null) {
else sessionName = user.getName() + " at " + session.getHost();
sessionName = session.getHost(); } else {
if (throwable instanceof ClientDisconnectedException) { sessionName = session.getHost();
SessionManager.getInstance().disconnect(client.getSessionId(), false); }
logger.info("client disconnected - " + sessionName); if (throwable instanceof ClientDisconnectedException) {
} SessionManager.getInstance().disconnect(client.getSessionId(), false);
else { logger.info("client disconnected - " + sessionName);
SessionManager.getInstance().disconnect(client.getSessionId(), false); }
logger.info("connection to client lost - " + sessionName); else {
} SessionManager.getInstance().disconnect(client.getSessionId(), false);
} logger.info("connection to client lost - " + sessionName);
} }
} }
}
static class MageTransporterServer extends TransporterServer { }
protected Connector connector; static class MageTransporterServer extends TransporterServer {
public MageTransporterServer(InvokerLocator locator, Object target, String subsystem, MageServerInvocationHandler callback) throws Exception { protected Connector connector;
super(locator, target, subsystem);
connector.addInvocationHandler("callback", callback); public MageTransporterServer(InvokerLocator locator, Object target, String subsystem, MageServerInvocationHandler callback) throws Exception {
connector.setLeasePeriod(5000); super(locator, target, subsystem);
connector.addConnectionListener(new ClientConnectionListener()); connector.addInvocationHandler("callback", callback);
} connector.setLeasePeriod(5000);
connector.addConnectionListener(new ClientConnectionListener());
public Connector getConnector() throws Exception { }
return connector;
} public Connector getConnector() throws Exception {
return connector;
@Override }
protected Connector getConnector(InvokerLocator locator, Map config, Element xmlConfig) throws Exception {
Connector c = super.getConnector(locator, config, xmlConfig); @Override
this.connector = c; protected Connector getConnector(InvokerLocator locator, Map config, Element xmlConfig) throws Exception {
return c; Connector c = super.getConnector(locator, config, xmlConfig);
} this.connector = c;
} return c;
}
static class MageServerInvocationHandler implements ServerInvocationHandler { }
@Override static class MageServerInvocationHandler implements ServerInvocationHandler {
public void setMBeanServer(MBeanServer server) {}
@Override
@Override public void setMBeanServer(MBeanServer server) {}
public void setInvoker(ServerInvoker invoker) {}
@Override
@Override public void setInvoker(ServerInvoker invoker) {}
public Object invoke(final InvocationRequest invocation) throws Throwable {
String sessionId = invocation.getSessionId(); @Override
Map map = invocation.getRequestPayload(); public Object invoke(final InvocationRequest invocation) throws Throwable {
String host; String sessionId = invocation.getSessionId();
if (map != null) { Map map = invocation.getRequestPayload();
InetAddress clientAddress = (InetAddress) invocation.getRequestPayload().get(Remoting.CLIENT_ADDRESS); String host;
host = clientAddress.getHostAddress(); if (map != null) {
} else { InetAddress clientAddress = (InetAddress) invocation.getRequestPayload().get(Remoting.CLIENT_ADDRESS);
host = "localhost"; host = clientAddress.getHostAddress();
} } else {
SessionManager.getInstance().getSession(sessionId).setHost(host); host = "localhost";
return null; }
} SessionManager.getInstance().getSession(sessionId).setHost(host);
return null;
@Override }
public void addListener(InvokerCallbackHandler callbackHandler) {
ServerInvokerCallbackHandler handler = (ServerInvokerCallbackHandler) callbackHandler; @Override
try { public void addListener(InvokerCallbackHandler callbackHandler) {
String sessionId = handler.getClientSessionId(); ServerInvokerCallbackHandler handler = (ServerInvokerCallbackHandler) callbackHandler;
SessionManager.getInstance().createSession(sessionId, callbackHandler); try {
} catch (Throwable ex) { String sessionId = handler.getClientSessionId();
logger.fatal("", ex); SessionManager.getInstance().createSession(sessionId, callbackHandler);
} } catch (Throwable ex) {
} logger.fatal("", ex);
}
@Override }
public void removeListener(InvokerCallbackHandler callbackHandler) {
logger.fatal("removeListener called"); @Override
// ServerInvokerCallbackHandler handler = (ServerInvokerCallbackHandler) callbackHandler; public void removeListener(InvokerCallbackHandler callbackHandler) {
// String sessionId = handler.getCallbackClient().getSessionId(); logger.fatal("removeListener called");
// SessionManager.getInstance().disconnect(sessionId); // ServerInvokerCallbackHandler handler = (ServerInvokerCallbackHandler) callbackHandler;
} // String sessionId = handler.getCallbackClient().getSessionId();
// SessionManager.getInstance().disconnect(sessionId);
} }
private static Class<?> loadPlugin(Plugin plugin) { }
try {
classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); private static Class<?> loadPlugin(Plugin plugin) {
logger.info("Loading plugin: " + plugin.getClassName()); try {
return Class.forName(plugin.getClassName(), true, classLoader); classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL());
} catch (ClassNotFoundException ex) { logger.info("Loading plugin: " + plugin.getClassName());
logger.warn("Plugin not Found:" + plugin.getJar() + " - check plugin folder"); return Class.forName(plugin.getClassName(), true, classLoader);
} catch (Exception ex) { } catch (ClassNotFoundException ex) {
logger.fatal("Error loading plugin " + plugin.getJar(), ex); logger.warn("Plugin not Found:" + plugin.getJar() + " - check plugin folder");
} } catch (Exception ex) {
return null; logger.fatal("Error loading plugin " + plugin.getJar(), ex);
} }
return null;
private static MatchType loadGameType(GamePlugin plugin) { }
try {
classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); private static MatchType loadGameType(GamePlugin plugin) {
logger.info("Loading game type: " + plugin.getClassName()); try {
return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance(); classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL());
} catch (ClassNotFoundException ex) { logger.info("Loading game type: " + plugin.getClassName());
logger.warn("Game type not found:" + plugin.getJar() + " - check plugin folder"); return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance();
} catch (Exception ex) { } catch (ClassNotFoundException ex) {
logger.fatal("Error loading game type " + plugin.getJar(), ex); logger.warn("Game type not found:" + plugin.getJar() + " - check plugin folder");
} } catch (Exception ex) {
return null; logger.fatal("Error loading game type " + plugin.getJar(), ex);
} }
return null;
private static TournamentType loadTournamentType(GamePlugin plugin) { }
try {
classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL()); private static TournamentType loadTournamentType(GamePlugin plugin) {
logger.info("Loading tournament type: " + plugin.getClassName()); try {
return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance(); classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL());
} catch (ClassNotFoundException ex) { logger.info("Loading tournament type: " + plugin.getClassName());
logger.warn("Tournament type not found:" + plugin.getJar() + " - check plugin folder"); return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance();
} catch (Exception ex) { } catch (ClassNotFoundException ex) {
logger.fatal("Error loading game type " + plugin.getJar(), ex); logger.warn("Tournament type not found:" + plugin.getJar() + " - check plugin folder");
} } catch (Exception ex) {
return null; logger.fatal("Error loading game type " + plugin.getJar(), ex);
} }
return null;
private static void deleteSavedGames() { }
File directory = new File("saved/");
if (!directory.exists()) private static void deleteSavedGames() {
directory.mkdirs(); File directory = new File("saved/");
File[] files = directory.listFiles( if (!directory.exists()) {
new FilenameFilter() { directory.mkdirs();
@Override }
public boolean accept(File dir, String name) { File[] files = directory.listFiles(
return name.endsWith(".game"); new FilenameFilter() {
} @Override
} public boolean accept(File dir, String name) {
); return name.endsWith(".game");
for (File file : files) }
{ }
file.delete(); );
} for (File file : files)
} {
file.delete();
public static MageVersion getVersion() { }
return version; }
}
public static MageVersion getVersion() {
public static boolean isTestMode() { return version;
return testMode; }
}
} public static boolean isTestMode() {
return testMode;
}
}

View file

@ -48,7 +48,7 @@ import java.util.UUID;
*/ */
public class Session { public class Session {
private final static Logger logger = Logger.getLogger(Session.class); private static final Logger logger = Logger.getLogger(Session.class);
private String sessionId; private String sessionId;
private UUID userId; private UUID userId;

View file

@ -45,8 +45,8 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
public class SessionManager { public class SessionManager {
private final static Logger logger = Logger.getLogger(SessionManager.class); private static final Logger logger = Logger.getLogger(SessionManager.class);
private final static SessionManager INSTANCE = new SessionManager(); private static final SessionManager INSTANCE = new SessionManager();
public static SessionManager getInstance() { public static SessionManager getInstance() {
return INSTANCE; return INSTANCE;

View file

@ -72,7 +72,7 @@ import java.util.concurrent.TimeUnit;
*/ */
public class TableController { public class TableController {
private final static Logger logger = Logger.getLogger(TableController.class); private static final Logger logger = Logger.getLogger(TableController.class);
private UUID userId; private UUID userId;
private UUID chatId; private UUID chatId;

View file

@ -56,8 +56,8 @@ public class TableManager {
protected static ScheduledExecutorService expireExecutor = Executors.newSingleThreadScheduledExecutor(); protected static ScheduledExecutorService expireExecutor = Executors.newSingleThreadScheduledExecutor();
private final static TableManager INSTANCE = new TableManager(); private static final TableManager INSTANCE = new TableManager();
private final static Logger logger = Logger.getLogger(TableManager.class); private static final Logger logger = Logger.getLogger(TableManager.class);
private ConcurrentHashMap<UUID, TableController> controllers = new ConcurrentHashMap<UUID, TableController>(); private ConcurrentHashMap<UUID, TableController> controllers = new ConcurrentHashMap<UUID, TableController>();
private ConcurrentHashMap<UUID, Table> tables = new ConcurrentHashMap<UUID, Table>(); private ConcurrentHashMap<UUID, Table> tables = new ConcurrentHashMap<UUID, Table>();

View file

@ -50,7 +50,7 @@ import java.util.UUID;
*/ */
public class User { public class User {
private final static Logger logger = Logger.getLogger(User.class); private static final Logger logger = Logger.getLogger(User.class);
public enum UserState { public enum UserState {
Created, Connected, Disconnected, Reconnected; Created, Connected, Disconnected, Reconnected;

View file

@ -49,8 +49,8 @@ public class UserManager {
protected static ScheduledExecutorService expireExecutor = Executors.newSingleThreadScheduledExecutor(); protected static ScheduledExecutorService expireExecutor = Executors.newSingleThreadScheduledExecutor();
private final static UserManager INSTANCE = new UserManager(); private static final UserManager INSTANCE = new UserManager();
private final static Logger logger = Logger.getLogger(UserManager.class); private static final Logger logger = Logger.getLogger(UserManager.class);
public static UserManager getInstance() { public static UserManager getInstance() {
return INSTANCE; return INSTANCE;

View file

@ -51,7 +51,7 @@ import org.apache.log4j.Logger;
*/ */
public class DraftController { public class DraftController {
private final static Logger logger = Logger.getLogger(GameController.class); private static final Logger logger = Logger.getLogger(GameController.class);
public static final String INIT_FILE_PATH = "config" + File.separator + "init.txt"; public static final String INIT_FILE_PATH = "config" + File.separator + "init.txt";
private ConcurrentHashMap<UUID, DraftSession> draftSessions = new ConcurrentHashMap<UUID, DraftSession>(); private ConcurrentHashMap<UUID, DraftSession> draftSessions = new ConcurrentHashMap<UUID, DraftSession>();

View file

@ -38,7 +38,7 @@ import mage.view.DraftPickView;
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class DraftManager { public class DraftManager {
private final static DraftManager INSTANCE = new DraftManager(); private static final DraftManager INSTANCE = new DraftManager();
public static DraftManager getInstance() { public static DraftManager getInstance() {
return INSTANCE; return INSTANCE;

View file

@ -41,8 +41,8 @@ import org.apache.log4j.Logger;
*/ */
public class DeckValidatorFactory { public class DeckValidatorFactory {
private final static DeckValidatorFactory INSTANCE = new DeckValidatorFactory(); private static final DeckValidatorFactory INSTANCE = new DeckValidatorFactory();
private final static Logger logger = Logger.getLogger(DeckValidatorFactory.class); private static final Logger logger = Logger.getLogger(DeckValidatorFactory.class);
private Map<String, Class> deckTypes = new LinkedHashMap<String, Class>(); private Map<String, Class> deckTypes = new LinkedHashMap<String, Class>();

View file

@ -70,7 +70,7 @@ import org.apache.log4j.Logger;
public class GameController implements GameCallback { public class GameController implements GameCallback {
private static ExecutorService gameExecutor = ThreadExecutor.getInstance().getGameExecutor(); private static ExecutorService gameExecutor = ThreadExecutor.getInstance().getGameExecutor();
private final static Logger logger = Logger.getLogger(GameController.class); private static final Logger logger = Logger.getLogger(GameController.class);
private ConcurrentHashMap<UUID, GameSession> gameSessions = new ConcurrentHashMap<UUID, GameSession>(); private ConcurrentHashMap<UUID, GameSession> gameSessions = new ConcurrentHashMap<UUID, GameSession>();
private ConcurrentHashMap<UUID, GameWatcher> watchers = new ConcurrentHashMap<UUID, GameWatcher>(); private ConcurrentHashMap<UUID, GameWatcher> watchers = new ConcurrentHashMap<UUID, GameWatcher>();

View file

@ -45,8 +45,8 @@ import org.apache.log4j.Logger;
*/ */
public class GameFactory { public class GameFactory {
private final static GameFactory INSTANCE = new GameFactory(); private static final GameFactory INSTANCE = new GameFactory();
private final static Logger logger = Logger.getLogger(GameFactory.class); private static final Logger logger = Logger.getLogger(GameFactory.class);
private Map<String, Class<Match>> games = new HashMap<String, Class<Match>>(); private Map<String, Class<Match>> games = new HashMap<String, Class<Match>>();
private Map<String, MatchType> gameTypes = new HashMap<String, MatchType>(); private Map<String, MatchType> gameTypes = new HashMap<String, MatchType>();

View file

@ -39,7 +39,7 @@ import mage.view.GameView;
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class GameManager { public class GameManager {
private final static GameManager INSTANCE = new GameManager(); private static final GameManager INSTANCE = new GameManager();
public static GameManager getInstance() { public static GameManager getInstance() {
return INSTANCE; return INSTANCE;

View file

@ -46,7 +46,7 @@ import org.apache.log4j.Logger;
*/ */
public class GameReplay { public class GameReplay {
private final static Logger logger = Logger.getLogger(GameReplay.class); private static final Logger logger = Logger.getLogger(GameReplay.class);
private GameStates savedGame; private GameStates savedGame;
private Game game; private Game game;

View file

@ -40,7 +40,7 @@ import java.util.concurrent.Callable;
*/ */
public class GameWorker implements Callable { public class GameWorker implements Callable {
private final static Logger logger = Logger.getLogger(GameWorker.class); private static final Logger logger = Logger.getLogger(GameWorker.class);
private GameCallback result; private GameCallback result;
private Game game; private Game game;

View file

@ -60,7 +60,7 @@ import org.apache.log4j.Logger;
*/ */
public class GamesRoomImpl extends RoomImpl implements GamesRoom, Serializable { public class GamesRoomImpl extends RoomImpl implements GamesRoom, Serializable {
private final static Logger logger = Logger.getLogger(GamesRoomImpl.class); private static final Logger logger = Logger.getLogger(GamesRoomImpl.class);
private static ScheduledExecutorService updateExecutor = Executors.newSingleThreadScheduledExecutor(); private static ScheduledExecutorService updateExecutor = Executors.newSingleThreadScheduledExecutor();
private static List<TableView> tableView = new ArrayList<TableView>(); private static List<TableView> tableView = new ArrayList<TableView>();

View file

@ -37,8 +37,8 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
public class GamesRoomManager { public class GamesRoomManager {
private final static GamesRoomManager INSTANCE = new GamesRoomManager(); private static final GamesRoomManager INSTANCE = new GamesRoomManager();
// private final static Logger logger = Logger.getLogger(GamesRoomManager.class); // private static final Logger logger = Logger.getLogger(GamesRoomManager.class);
private ConcurrentHashMap<UUID, GamesRoom> rooms = new ConcurrentHashMap<UUID, GamesRoom>(); private ConcurrentHashMap<UUID, GamesRoom> rooms = new ConcurrentHashMap<UUID, GamesRoom>();
private UUID mainRoomId; private UUID mainRoomId;

View file

@ -42,8 +42,8 @@ import org.apache.log4j.Logger;
*/ */
public class PlayerFactory { public class PlayerFactory {
private final static PlayerFactory INSTANCE = new PlayerFactory(); private static final PlayerFactory INSTANCE = new PlayerFactory();
private final static Logger logger = Logger.getLogger(PlayerFactory.class); private static final Logger logger = Logger.getLogger(PlayerFactory.class);
private Map<String, Class> playerTypes = new LinkedHashMap<String, Class>(); private Map<String, Class> playerTypes = new LinkedHashMap<String, Class>();

View file

@ -37,7 +37,7 @@ import mage.server.UserManager;
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class ReplayManager { public class ReplayManager {
private final static ReplayManager INSTANCE = new ReplayManager(); private static final ReplayManager INSTANCE = new ReplayManager();
public static ReplayManager getInstance() { public static ReplayManager getInstance() {
return INSTANCE; return INSTANCE;

View file

@ -43,7 +43,7 @@ import org.apache.log4j.Logger;
*/ */
public class ReplaySession implements GameCallback { public class ReplaySession implements GameCallback {
private final static Logger logger = Logger.getLogger(ReplaySession.class); private static final Logger logger = Logger.getLogger(ReplaySession.class);
private GameReplay replay; private GameReplay replay;
protected UUID userId; protected UUID userId;

View file

@ -59,7 +59,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
public class TournamentController { public class TournamentController {
private final static Logger logger = Logger.getLogger(TournamentController.class); private static final Logger logger = Logger.getLogger(TournamentController.class);
private UUID chatId; private UUID chatId;
private UUID tableId; private UUID tableId;

View file

@ -45,8 +45,8 @@ import org.apache.log4j.Logger;
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class TournamentFactory { public class TournamentFactory {
private final static TournamentFactory INSTANCE = new TournamentFactory(); private static final TournamentFactory INSTANCE = new TournamentFactory();
private final static Logger logger = Logger.getLogger(TournamentFactory.class); private static final Logger logger = Logger.getLogger(TournamentFactory.class);
private Map<String, Class<Tournament>> tournaments = new HashMap<String, Class<Tournament>>(); private Map<String, Class<Tournament>> tournaments = new HashMap<String, Class<Tournament>>();
private Map<String, TournamentType> tournamentTypes = new HashMap<String, TournamentType>(); private Map<String, TournamentType> tournamentTypes = new HashMap<String, TournamentType>();

View file

@ -40,7 +40,7 @@ import mage.view.TournamentView;
*/ */
public class TournamentManager { public class TournamentManager {
private final static TournamentManager INSTANCE = new TournamentManager(); private static final TournamentManager INSTANCE = new TournamentManager();
private ConcurrentHashMap<UUID, TournamentController> controllers = new ConcurrentHashMap<UUID, TournamentController>(); private ConcurrentHashMap<UUID, TournamentController> controllers = new ConcurrentHashMap<UUID, TournamentController>();

View file

@ -38,7 +38,7 @@ import org.apache.log4j.Logger;
*/ */
public class Config { public class Config {
private final static Logger logger = Logger.getLogger(Config.class); private static final Logger logger = Logger.getLogger(Config.class);
static { static {
Properties p = new Properties(); Properties p = new Properties();

View file

@ -44,8 +44,8 @@ import org.apache.log4j.Logger;
*/ */
public class ConfigSettings { public class ConfigSettings {
private final static Logger logger = Logger.getLogger(ConfigSettings.class); private static final Logger logger = Logger.getLogger(ConfigSettings.class);
private final static ConfigSettings INSTANCE = new ConfigSettings(); private static final ConfigSettings INSTANCE = new ConfigSettings();
private Config config; private Config config;

View file

@ -49,7 +49,7 @@ public class ThreadExecutor {
((ThreadPoolExecutor)timeoutExecutor).allowCoreThreadTimeOut(true); ((ThreadPoolExecutor)timeoutExecutor).allowCoreThreadTimeOut(true);
} }
private final static ThreadExecutor INSTANCE = new ThreadExecutor(); private static final ThreadExecutor INSTANCE = new ThreadExecutor();
public static ThreadExecutor getInstance() { public static ThreadExecutor getInstance() {
return INSTANCE; return INSTANCE;

View file

@ -50,7 +50,7 @@ import mage.filter.predicate.mageobject.AbilityPredicate;
*/ */
public class BloodfireDwarf extends CardImpl<BloodfireDwarf> { public class BloodfireDwarf extends CardImpl<BloodfireDwarf> {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature without flying"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature without flying");
static { static {
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));

View file

@ -48,7 +48,7 @@ import mage.target.common.TargetCreaturePermanent;
*/ */
public class DiversionaryTactics extends CardImpl<DiversionaryTactics> { public class DiversionaryTactics extends CardImpl<DiversionaryTactics> {
private final static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control");
static { static {
filter.add(Predicates.not(new TappedPredicate())); filter.add(Predicates.not(new TappedPredicate()));

View file

@ -44,7 +44,7 @@ import mage.target.common.TargetControlledPermanent;
*/ */
public class OvergrownEstate extends CardImpl<OvergrownEstate> { public class OvergrownEstate extends CardImpl<OvergrownEstate> {
private final static FilterControlledPermanent filter = new FilterControlledLandPermanent("a land"); private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("a land");
public OvergrownEstate(UUID ownerId) { public OvergrownEstate(UUID ownerId) {
super(ownerId, 113, "Overgrown Estate", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{B}{G}{W}"); super(ownerId, 113, "Overgrown Estate", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{B}{G}{W}");

View file

@ -51,7 +51,7 @@ import mage.target.common.TargetControlledCreaturePermanent;
*/ */
public class QuagmireDruid extends CardImpl<QuagmireDruid> { public class QuagmireDruid extends CardImpl<QuagmireDruid> {
private final static FilterPermanent filter = new FilterPermanent("enchantment"); private static final FilterPermanent filter = new FilterPermanent("enchantment");
static { static {
filter.add(new CardTypePredicate(CardType.ENCHANTMENT)); filter.add(new CardTypePredicate(CardType.ENCHANTMENT));

View file

@ -43,7 +43,7 @@ import mage.target.TargetPermanent;
*/ */
public class Smash extends CardImpl<Smash> { public class Smash extends CardImpl<Smash> {
private final static FilterPermanent filter = new FilterPermanent("artifact"); private static final FilterPermanent filter = new FilterPermanent("artifact");
static { static {
filter.add(new CardTypePredicate(CardType.ARTIFACT)); filter.add(new CardTypePredicate(CardType.ARTIFACT));

View file

@ -69,7 +69,7 @@ public class TranquilPath extends CardImpl<TranquilPath> {
class TranquilPathEffect extends OneShotEffect<TranquilPathEffect> { class TranquilPathEffect extends OneShotEffect<TranquilPathEffect> {
private final static FilterPermanent filter = new FilterPermanent(""); private static final FilterPermanent filter = new FilterPermanent("");
static { static {
filter.add(new CardTypePredicate(CardType.ENCHANTMENT)); filter.add(new CardTypePredicate(CardType.ENCHANTMENT));

View file

@ -51,7 +51,7 @@ import java.util.UUID;
*/ */
public class AngelOfJubilation extends CardImpl<AngelOfJubilation> { public class AngelOfJubilation extends CardImpl<AngelOfJubilation> {
private final static FilterCreaturePermanent filterNonBlack = new FilterCreaturePermanent("nonblack creatures"); private static final FilterCreaturePermanent filterNonBlack = new FilterCreaturePermanent("nonblack creatures");
static { static {
filterNonBlack.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK))); filterNonBlack.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));

View file

@ -61,7 +61,7 @@ public class DevoutChaplain extends CardImpl<DevoutChaplain> {
new CardTypePredicate(CardType.ENCHANTMENT))); new CardTypePredicate(CardType.ENCHANTMENT)));
} }
private final static FilterControlledPermanent humanFilter = new FilterControlledPermanent("untapped Human you control"); private static final FilterControlledPermanent humanFilter = new FilterControlledPermanent("untapped Human you control");
static { static {
humanFilter.add(Predicates.not(new TappedPredicate())); humanFilter.add(Predicates.not(new TappedPredicate()));

View file

@ -56,7 +56,7 @@ import java.util.UUID;
*/ */
public class GallowsAtWillowHill extends CardImpl<GallowsAtWillowHill> { public class GallowsAtWillowHill extends CardImpl<GallowsAtWillowHill> {
private final static FilterControlledPermanent humanFilter = new FilterControlledPermanent("untapped Human you control"); private static final FilterControlledPermanent humanFilter = new FilterControlledPermanent("untapped Human you control");
static { static {
humanFilter.add(Predicates.not(new TappedPredicate())); humanFilter.add(Predicates.not(new TappedPredicate()));

View file

@ -51,7 +51,7 @@ import mage.game.permanent.token.SpiritToken;
*/ */
public class BakuAltar extends CardImpl<BakuAltar> { public class BakuAltar extends CardImpl<BakuAltar> {
private final static FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard(); private static final FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard();
public BakuAltar(UUID ownerId) { public BakuAltar(UUID ownerId) {
super(ownerId, 152, "Baku Altar", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}"); super(ownerId, 152, "Baku Altar", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");

View file

@ -53,7 +53,7 @@ import mage.game.Game;
*/ */
public class BlademaneBaku extends CardImpl<BlademaneBaku> { public class BlademaneBaku extends CardImpl<BlademaneBaku> {
private final static FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard(); private static final FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard();
public BlademaneBaku(UUID ownerId) { public BlademaneBaku(UUID ownerId) {
super(ownerId, 95, "Blademane Baku", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{R}"); super(ownerId, 95, "Blademane Baku", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{R}");

View file

@ -50,7 +50,7 @@ import mage.target.TargetPermanent;
*/ */
public class ChiseiHeartOfOceans extends CardImpl<ChiseiHeartOfOceans> { public class ChiseiHeartOfOceans extends CardImpl<ChiseiHeartOfOceans> {
private final static FilterPermanent filter = new FilterControlledPermanent("remove a counter from a permanent you control"); private static final FilterPermanent filter = new FilterControlledPermanent("remove a counter from a permanent you control");
static { static {
filter.add(new ControllerPredicate(Constants.TargetController.YOU)); filter.add(new ControllerPredicate(Constants.TargetController.YOU));

View file

@ -49,8 +49,8 @@ import mage.target.common.TargetCreaturePermanent;
*/ */
public class ClashOfRealities extends CardImpl<ClashOfRealities> { public class ClashOfRealities extends CardImpl<ClashOfRealities> {
private final static FilterCreaturePermanent filterSpirit = new FilterCreaturePermanent("Spirit creature"); private static final FilterCreaturePermanent filterSpirit = new FilterCreaturePermanent("Spirit creature");
private final static FilterCreaturePermanent filterNotSpirit = new FilterCreaturePermanent("non-Spirit creature"); private static final FilterCreaturePermanent filterNotSpirit = new FilterCreaturePermanent("non-Spirit creature");
static { static {
filterSpirit.add(new SubtypePredicate("Spirit")); filterSpirit.add(new SubtypePredicate("Spirit"));

View file

@ -44,7 +44,7 @@ import mage.filter.predicate.mageobject.SupertypePredicate;
*/ */
public class DayOfDestiny extends CardImpl<DayOfDestiny> { public class DayOfDestiny extends CardImpl<DayOfDestiny> {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("Legendary creatures"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Legendary creatures");
static { static {
filter.add(new SupertypePredicate("Legendary")); filter.add(new SupertypePredicate("Legendary"));

View file

@ -63,7 +63,7 @@ import java.util.UUID;
*/ */
public class FaithfulSquire extends CardImpl<FaithfulSquire> { public class FaithfulSquire extends CardImpl<FaithfulSquire> {
private final static FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard(); private static final FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard();
public FaithfulSquire(UUID ownerId) { public FaithfulSquire(UUID ownerId) {
super(ownerId, 3, "Faithful Squire", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{W}{W}"); super(ownerId, 3, "Faithful Squire", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{W}{W}");

View file

@ -67,7 +67,7 @@ public class FinalJudgment extends CardImpl<FinalJudgment> {
class FinalJudgmentEffect extends OneShotEffect<FinalJudgmentEffect> { class FinalJudgmentEffect extends OneShotEffect<FinalJudgmentEffect> {
private final static FilterPermanent filter = new FilterPermanent(""); private static final FilterPermanent filter = new FilterPermanent("");
static { static {
filter.add(new CardTypePredicate(CardType.CREATURE)); filter.add(new CardTypePredicate(CardType.CREATURE));

View file

@ -50,7 +50,7 @@ import mage.target.common.TargetLandPermanent;
*/ */
public class Floodbringer extends CardImpl<Floodbringer> { public class Floodbringer extends CardImpl<Floodbringer> {
private final static FilterControlledPermanent filter = new FilterControlledLandPermanent("a land you control (return to hand)"); private static final FilterControlledPermanent filter = new FilterControlledLandPermanent("a land you control (return to hand)");
public Floodbringer(UUID ownerId) { public Floodbringer(UUID ownerId) {
super(ownerId, 34, "Floodbringer", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{U}"); super(ownerId, 34, "Floodbringer", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{U}");

View file

@ -55,7 +55,7 @@ import mage.target.common.TargetLandPermanent;
*/ */
public class GenjuOfTheCedars extends CardImpl<GenjuOfTheCedars> { public class GenjuOfTheCedars extends CardImpl<GenjuOfTheCedars> {
private final static FilterLandPermanent filter = new FilterLandPermanent("Forest"); private static final FilterLandPermanent filter = new FilterLandPermanent("Forest");
static { static {
filter.add(new SubtypePredicate("Forest")); filter.add(new SubtypePredicate("Forest"));

View file

@ -56,7 +56,7 @@ import mage.target.common.TargetLandPermanent;
*/ */
public class GenjuOfTheFalls extends CardImpl<GenjuOfTheFalls> { public class GenjuOfTheFalls extends CardImpl<GenjuOfTheFalls> {
private final static FilterLandPermanent filter = new FilterLandPermanent("Island"); private static final FilterLandPermanent filter = new FilterLandPermanent("Island");
static { static {
filter.add(new SubtypePredicate("Island")); filter.add(new SubtypePredicate("Island"));

View file

@ -60,7 +60,7 @@ import mage.target.common.TargetLandPermanent;
*/ */
public class GenjuOfTheFens extends CardImpl<GenjuOfTheFens> { public class GenjuOfTheFens extends CardImpl<GenjuOfTheFens> {
private final static FilterLandPermanent filter = new FilterLandPermanent("Swamp"); private static final FilterLandPermanent filter = new FilterLandPermanent("Swamp");
static { static {
filter.add(new SubtypePredicate("Swamp")); filter.add(new SubtypePredicate("Swamp"));

View file

@ -58,7 +58,7 @@ import mage.target.common.TargetLandPermanent;
*/ */
public class GenjuOfTheFields extends CardImpl<GenjuOfTheFields> { public class GenjuOfTheFields extends CardImpl<GenjuOfTheFields> {
private final static FilterLandPermanent filter = new FilterLandPermanent("Plains"); private static final FilterLandPermanent filter = new FilterLandPermanent("Plains");
static { static {
filter.add(new SubtypePredicate("Plains")); filter.add(new SubtypePredicate("Plains"));

View file

@ -55,7 +55,7 @@ import mage.target.common.TargetLandPermanent;
*/ */
public class GenjuOfTheRealm extends CardImpl<GenjuOfTheRealm> { public class GenjuOfTheRealm extends CardImpl<GenjuOfTheRealm> {
private final static FilterLandPermanent filter = new FilterLandPermanent(); private static final FilterLandPermanent filter = new FilterLandPermanent();
public GenjuOfTheRealm(UUID ownerId) { public GenjuOfTheRealm(UUID ownerId) {
super(ownerId, 151, "Genju of the Realm", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{W}{U}{B}{R}{G}"); super(ownerId, 151, "Genju of the Realm", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{W}{U}{B}{R}{G}");

View file

@ -55,7 +55,7 @@ import mage.target.common.TargetLandPermanent;
*/ */
public class GenjuOfTheSpires extends CardImpl<GenjuOfTheSpires> { public class GenjuOfTheSpires extends CardImpl<GenjuOfTheSpires> {
private final static FilterLandPermanent filter = new FilterLandPermanent("Mountain"); private static final FilterLandPermanent filter = new FilterLandPermanent("Mountain");
static { static {
filter.add(new SubtypePredicate("Mountain")); filter.add(new SubtypePredicate("Mountain"));

View file

@ -42,7 +42,7 @@ import mage.target.common.TargetCreaturePermanent;
*/ */
public class HerosDemise extends CardImpl<HerosDemise> { public class HerosDemise extends CardImpl<HerosDemise> {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("legendary creature"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("legendary creature");
static { static {
filter.add(new SupertypePredicate("Legendary")); filter.add(new SupertypePredicate("Legendary"));

View file

@ -43,7 +43,7 @@ import mage.target.common.TargetCreatureOrPlayer;
*/ */
public class IreOfKaminari extends CardImpl<IreOfKaminari> { public class IreOfKaminari extends CardImpl<IreOfKaminari> {
private final static FilterCard filter = new FilterCard("Arcane"); private static final FilterCard filter = new FilterCard("Arcane");
static { static {
filter.add(new SubtypePredicate("Arcane")); filter.add(new SubtypePredicate("Arcane"));

View file

@ -50,7 +50,7 @@ import mage.target.TargetPermanent;
*/ */
public class IsaoEnlightenedBushi extends CardImpl<IsaoEnlightenedBushi> { public class IsaoEnlightenedBushi extends CardImpl<IsaoEnlightenedBushi> {
private final static FilterPermanent filter = new FilterPermanent("Samurai"); private static final FilterPermanent filter = new FilterPermanent("Samurai");
static { static {
filter.add(new SubtypePredicate("Samurai")); filter.add(new SubtypePredicate("Samurai"));

View file

@ -45,7 +45,7 @@ import mage.filter.common.FilterSpiritOrArcaneCard;
*/ */
public class KamiOfTatteredShoji extends CardImpl<KamiOfTatteredShoji> { public class KamiOfTatteredShoji extends CardImpl<KamiOfTatteredShoji> {
private final static FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard(); private static final FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard();
public KamiOfTatteredShoji(UUID ownerId) { public KamiOfTatteredShoji(UUID ownerId) {
super(ownerId, 11, "Kami of Tattered Shoji", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{W}"); super(ownerId, 11, "Kami of Tattered Shoji", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{W}");

View file

@ -48,7 +48,7 @@ import mage.target.TargetPermanent;
*/ */
public class NezumiShadowWatcher extends CardImpl<NezumiShadowWatcher> { public class NezumiShadowWatcher extends CardImpl<NezumiShadowWatcher> {
private final static FilterPermanent filter = new FilterPermanent("Ninja"); private static final FilterPermanent filter = new FilterPermanent("Ninja");
static { static {
filter.add(new SubtypePredicate("Ninja")); filter.add(new SubtypePredicate("Ninja"));

View file

@ -45,7 +45,7 @@ import mage.game.permanent.token.Token;
*/ */
public class OyobiWhoSplitTheHeavens extends CardImpl<OyobiWhoSplitTheHeavens> { public class OyobiWhoSplitTheHeavens extends CardImpl<OyobiWhoSplitTheHeavens> {
private final static FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard(); private static final FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard();
public OyobiWhoSplitTheHeavens(UUID ownerId) { public OyobiWhoSplitTheHeavens(UUID ownerId) {
super(ownerId, 18, "Oyobi, Who Split the Heavens", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{6}{W}"); super(ownerId, 18, "Oyobi, Who Split the Heavens", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{6}{W}");

View file

@ -53,7 +53,7 @@ import mage.players.Player;
*/ */
public class PetalmaneBaku extends CardImpl<PetalmaneBaku> { public class PetalmaneBaku extends CardImpl<PetalmaneBaku> {
private final static FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard(); private static final FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard();
public PetalmaneBaku(UUID ownerId) { public PetalmaneBaku(UUID ownerId) {
super(ownerId, 139, "Petalmane Baku", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{G}"); super(ownerId, 139, "Petalmane Baku", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{G}");

Some files were not shown because too many files have changed in this diff Show more