From d607149097bbf363c0557e5a195c210ab49a7710 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 28 Feb 2020 17:39:32 +0100 Subject: [PATCH] Remove useless dependencies --- .../ynerant/leveleditor/frame/MainFrame.java | 24 +++----------- .../ynerant/leveleditor/game/GameFrame.java | 18 +++++----- .../leveleditor/game/towers/Tower.java | 2 +- .../java/fr/ynerant/leveleditor/AppTest.java | 33 ------------------- 4 files changed, 15 insertions(+), 62 deletions(-) delete mode 100644 src/test/java/fr/ynerant/leveleditor/AppTest.java diff --git a/src/main/java/fr/ynerant/leveleditor/frame/MainFrame.java b/src/main/java/fr/ynerant/leveleditor/frame/MainFrame.java index b1e26a5..8464484 100644 --- a/src/main/java/fr/ynerant/leveleditor/frame/MainFrame.java +++ b/src/main/java/fr/ynerant/leveleditor/frame/MainFrame.java @@ -1,18 +1,12 @@ package fr.ynerant.leveleditor.frame; -import fr.ynerant.leveleditor.api.editor.EditorAPI; import fr.ynerant.leveleditor.client.main.Main; -import fr.ynerant.leveleditor.editor.EditorFrame; import fr.ynerant.leveleditor.frame.listeners.ChangeLAFListener; import fr.ynerant.leveleditor.frame.listeners.CreateMapListener; import fr.ynerant.leveleditor.frame.listeners.OpenMapListener; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.core.Logger; import javax.swing.*; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.KeyEvent; /** @@ -34,13 +28,6 @@ public class MainFrame extends JFrame { */ private static MainFrame INSTANCE; - /** - * Logger de la classe - * - * @see LogManager#getLogger(String) - */ - private static final Logger LOGGER = (Logger) LogManager.getLogger("MainFrame"); - /** * Constructeur * @@ -49,7 +36,7 @@ public class MainFrame extends JFrame { @SuppressWarnings("JavadocReference") private MainFrame() { super(); - LOGGER.info("Initialisation de la fen\u00eatre"); + System.out.println("Initialisation de la fen\u00eatre"); this.setTitle("Level Editor"); this.setPreferredSize(new Dimension(1000, 800)); this.setSize(800, 700); @@ -92,12 +79,9 @@ public class MainFrame extends JFrame { this.setJMenuBar(menuBar); JButton start = new JButton("Commencer la partie !"); - start.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent actionEvent) { - if (Main.launchGameMode()) - getInstance().dispose(); - } + start.addActionListener(actionEvent -> { + if (Main.launchGameMode()) + getInstance().dispose(); }); this.setContentPane(start); } diff --git a/src/main/java/fr/ynerant/leveleditor/game/GameFrame.java b/src/main/java/fr/ynerant/leveleditor/game/GameFrame.java index c4efaea..a4ed1ee 100644 --- a/src/main/java/fr/ynerant/leveleditor/game/GameFrame.java +++ b/src/main/java/fr/ynerant/leveleditor/game/GameFrame.java @@ -27,15 +27,17 @@ public class GameFrame extends JFrame { private int round = 0; private int hp = 5; private int reward = 20; - private List mobs = new ArrayList<>(); - private List towers = new ArrayList<>(); + private final List mobs = new ArrayList<>(); + private final List towers = new ArrayList<>(); - private JRadioButton basicTower, nullTower, autoTower; - private JLabel waveLabel; - private JLabel nbMobsLabel; - private JLabel hpLabel; - private JLabel rewardLabel; - private JLabel winLabel; + private final JRadioButton basicTower; + private final JRadioButton nullTower; + private final JRadioButton autoTower; + private final JLabel waveLabel; + private final JLabel nbMobsLabel; + private final JLabel hpLabel; + private final JLabel rewardLabel; + private final JLabel winLabel; public GameFrame(RawMap map) { super("Jeu"); diff --git a/src/main/java/fr/ynerant/leveleditor/game/towers/Tower.java b/src/main/java/fr/ynerant/leveleditor/game/towers/Tower.java index 985e23d..619bf5d 100644 --- a/src/main/java/fr/ynerant/leveleditor/game/towers/Tower.java +++ b/src/main/java/fr/ynerant/leveleditor/game/towers/Tower.java @@ -9,7 +9,7 @@ import java.util.Collection; import java.util.Random; public abstract class Tower { - private Sprite sprite; + private final Sprite sprite; private final int x; private final int y; private long remainingTicks; diff --git a/src/test/java/fr/ynerant/leveleditor/AppTest.java b/src/test/java/fr/ynerant/leveleditor/AppTest.java deleted file mode 100644 index 6af0af5..0000000 --- a/src/test/java/fr/ynerant/leveleditor/AppTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package fr.ynerant.leveleditor; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest extends TestCase { - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest(String testName) { - super(testName); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() { - return new TestSuite(AppTest.class); - } - - /** - * Rigourous Test :-) - */ - public void testApp() { - assertTrue(true); - } -}