diff --git a/src/main/java/fr/ynerant/leveleditor/api/editor/EditorAPI.java b/src/main/java/fr/ynerant/leveleditor/api/editor/EditorAPI.java index 62f7628..d50c72b 100644 --- a/src/main/java/fr/ynerant/leveleditor/api/editor/EditorAPI.java +++ b/src/main/java/fr/ynerant/leveleditor/api/editor/EditorAPI.java @@ -19,7 +19,7 @@ public class EditorAPI { private static File LAST_FILE; public static RawMap toRawMap(int width, int height) { - List cases = new ArrayList(); + List cases = new ArrayList<>(); for (int y = 1; y < height; y += 16) { for (int x = 1; x < width; x += 16) { @@ -48,7 +48,7 @@ public class EditorAPI { jfc.setFileHidingEnabled(true); jfc.setFileSelectionMode(JFileChooser.FILES_ONLY); File dir = new File("maps"); - dir.mkdirs(); + assert dir.mkdirs(); jfc.setCurrentDirectory(dir); return jfc; @@ -56,7 +56,7 @@ public class EditorAPI { public static void saveAs(RawMap map) { JFileChooser jfc = createJFC(); - File file = null; + File file; jfc.showSaveDialog(null); file = jfc.getSelectedFile(); @@ -83,7 +83,7 @@ public class EditorAPI { String json = createGson().toJson(map); try { - file.createNewFile(); + assert file.createNewFile(); BufferedOutputStream bos = new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(file))); bos.write(json.getBytes(StandardCharsets.UTF_8)); @@ -96,7 +96,7 @@ public class EditorAPI { public static Map open() { JFileChooser jfc = createJFC(); - File file = null; + File file; jfc.showOpenDialog(null); file = jfc.getSelectedFile(); @@ -114,15 +114,14 @@ public class EditorAPI { try { GZIPInputStream gis = new GZIPInputStream(new BufferedInputStream(new FileInputStream(f))); byte[] bytes = new byte[512 * 1024]; - int count = 0; - String text = ""; + int count; + StringBuilder text = new StringBuilder(); while ((count = gis.read(bytes)) != -1) { - text += new String(bytes, 0, count, StandardCharsets.UTF_8); + text.append(new String(bytes, 0, count, StandardCharsets.UTF_8)); } gis.close(); - bytes = null; - json = text; + json = text.toString(); } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/java/fr/ynerant/leveleditor/api/editor/RawMap.java b/src/main/java/fr/ynerant/leveleditor/api/editor/RawMap.java index 6bef1c7..6f42a0f 100644 --- a/src/main/java/fr/ynerant/leveleditor/api/editor/RawMap.java +++ b/src/main/java/fr/ynerant/leveleditor/api/editor/RawMap.java @@ -24,7 +24,7 @@ public class RawMap { RawMap raw = new RawMap(); raw.width = map.getWidth(); raw.height = map.getHeight(); - raw.cases = new ArrayList(); + raw.cases = new ArrayList<>(); for (Case c : map.getAllCases()) { RawCase rc = RawCase.create(c); raw.cases.add(rc); diff --git a/src/main/java/fr/ynerant/leveleditor/api/editor/sprites/Category.java b/src/main/java/fr/ynerant/leveleditor/api/editor/sprites/Category.java index b08bacd..5f336fe 100644 --- a/src/main/java/fr/ynerant/leveleditor/api/editor/sprites/Category.java +++ b/src/main/java/fr/ynerant/leveleditor/api/editor/sprites/Category.java @@ -5,16 +5,14 @@ import java.util.List; public class Category { private List sprites; private String name; - private int index; private Category() { } - public static Category create(String name, int index, List sprites) { + public static Category create(String name, List sprites) { Category c = new Category(); c.name = name; - c.index = index; c.sprites = sprites; return c; @@ -28,7 +26,4 @@ public class Category { return sprites; } - public int getIndex() { - return index; - } } diff --git a/src/main/java/fr/ynerant/leveleditor/api/editor/sprites/Sprite.java b/src/main/java/fr/ynerant/leveleditor/api/editor/sprites/Sprite.java index 4deffdd..f019baa 100644 --- a/src/main/java/fr/ynerant/leveleditor/api/editor/sprites/Sprite.java +++ b/src/main/java/fr/ynerant/leveleditor/api/editor/sprites/Sprite.java @@ -5,7 +5,7 @@ import java.awt.image.BufferedImage; import java.util.ArrayList; public class Sprite { - public static final Sprite BLANK = new Sprite(new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB), Category.create("blank", 0, new ArrayList()), 0); + public static final Sprite BLANK = new Sprite(new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB), Category.create("blank", new ArrayList<>()), 0); static { Graphics2D g = BLANK.getImage().createGraphics(); diff --git a/src/main/java/fr/ynerant/leveleditor/api/editor/sprites/SpriteRegister.java b/src/main/java/fr/ynerant/leveleditor/api/editor/sprites/SpriteRegister.java index e3bbc61..d75f759 100644 --- a/src/main/java/fr/ynerant/leveleditor/api/editor/sprites/SpriteRegister.java +++ b/src/main/java/fr/ynerant/leveleditor/api/editor/sprites/SpriteRegister.java @@ -17,7 +17,7 @@ import java.util.jar.JarFile; public class SpriteRegister { private static Map>> nameToCoords; - private static Map sprites = new HashMap(); + private static final Map sprites = new HashMap<>(); public static void unpack() throws IOException, URISyntaxException { if (Main.isInDevelopmentMode()) { @@ -38,7 +38,7 @@ public class SpriteRegister { if (name.startsWith("assets/")) { File f = new File(name); if (name.endsWith("/")) - f.mkdirs(); + assert f.mkdirs(); else if (!f.isFile()) Files.copy(jar.getInputStream(je), Paths.get(f.toURI())); } @@ -49,7 +49,7 @@ public class SpriteRegister { } private static void unpackDir(File dir) throws IOException { - for (File f : dir.listFiles()) { + for (File f : Objects.requireNonNull(dir.listFiles())) { if (f.isDirectory()) { unpackDir(f); continue; @@ -57,9 +57,8 @@ public class SpriteRegister { String path = f.getAbsolutePath().substring(f.getAbsolutePath().indexOf(File.separatorChar + "assets") + 1); File local = new File(path); - local.getParentFile().mkdirs(); - if (local.exists()) - local.delete(); + assert local.getParentFile().mkdirs(); + assert !local.exists() || local.delete(); Files.copy(Paths.get(f.toURI()), Paths.get(local.toURI())); } } @@ -71,16 +70,16 @@ public class SpriteRegister { } File assetsDir = new File("assets"); - List assets = new ArrayList(); + List assets = new ArrayList<>(); - for (File dir : assetsDir.listFiles()) { + for (File dir : Objects.requireNonNull(assetsDir.listFiles())) { assets.add(dir.getName()); } for (String asset : assets) { try { File f = new File(assetsDir.getAbsolutePath() + "/" + asset + "/textures/sprites"); - f.mkdirs(); + assert f.mkdirs(); BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(f, "sprites.json")))); nameToCoords = new Gson().fromJson(br, Map.class); br.close(); @@ -90,7 +89,7 @@ public class SpriteRegister { BufferedInputStream is = new BufferedInputStream(new FileInputStream(new File(f, key + ".png"))); BufferedImage img = ImageIO.read(is); - Category cat = Category.create(key, new ArrayList(nameToCoords.keySet()).indexOf(key), new ArrayList()); + Category cat = Category.create(key, new ArrayList<>()); for (List list : nameToCoords.get(key)) { int x = list.get(0).intValue(); @@ -102,7 +101,6 @@ public class SpriteRegister { sprites.put(key, cat); } catch (Throwable t) { LogManager.getLogger("SpriteRegister").fatal("Erreur lors de la lecture du sprite '" + key + "'", t); - continue; } } } catch (IOException e) { @@ -115,21 +113,8 @@ public class SpriteRegister { return sprites.get(name); } - public static Category getCategory(int index) { - return getCategory(new ArrayList(sprites.keySet()).get(index)); - } - public static List getAllCategories() { - return new ArrayList(sprites.values()); + return new ArrayList<>(sprites.values()); } - public static List getAllSprites() { - List list = new ArrayList(); - - for (Category c : sprites.values()) { - list.addAll(c.getSprites()); - } - - return list; - } } diff --git a/src/main/java/fr/ynerant/leveleditor/client/main/Main.java b/src/main/java/fr/ynerant/leveleditor/client/main/Main.java index 9772ba3..f9d3960 100644 --- a/src/main/java/fr/ynerant/leveleditor/client/main/Main.java +++ b/src/main/java/fr/ynerant/leveleditor/client/main/Main.java @@ -1,6 +1,3 @@ -/** - * @author ÿnérant - */ package fr.ynerant.leveleditor.client.main; import fr.ynerant.leveleditor.api.editor.EditorAPI; @@ -33,15 +30,6 @@ import java.util.Map; * @see #main(String...) */ public class Main { - /** - * Variable disant si le jeu est en débogage ou non. S'active en insérant l'argument --debug dans le lancement. - * - * @see #isInDebugMode() - * @see #main(String...) - * @since 0.1-aplha - */ - private static boolean DEBUG; - /** * Variable disant si le jeu est lancé en développement ou non. * @@ -87,7 +75,6 @@ public class Main { OptionParser parser = new OptionParser(); OptionSpec edit = parser.accepts("edit", "Lancer l'\u00e9diteur de monde").withOptionalArg(); - OptionSpec debug = parser.accepts("debug").withOptionalArg().ofType(Boolean.class).defaultsTo(true); OptionSpec help = parser.accepts("help", "Affiche ce menu d'aide").withOptionalArg().forHelp(); OptionSet set = parser.parse(args); @@ -102,14 +89,6 @@ public class Main { } } - if (set.has(debug)) { - DEBUG = set.valueOf(debug); - - if (DEBUG) { - LOGGER.setLevel(Level.ALL); - } - } - try { SpriteRegister.unpack(); } catch (IOException | URISyntaxException e) { @@ -165,7 +144,6 @@ public class Main { /** * Permet de lancer l'éditeur de carte * - * @return * @see #main(String...) * @see #launchFrame() * @since 0.1-aplha @@ -187,8 +165,7 @@ public class Main { if (baseWidth == 0) return false; break; - } catch (NumberFormatException ex) { - continue; + } catch (NumberFormatException ignored) { } } @@ -203,8 +180,7 @@ public class Main { if (baseHeight == 0) return false; break; - } catch (NumberFormatException ex) { - continue; + } catch (NumberFormatException ignored) { } } @@ -234,17 +210,6 @@ public class Main { return true; } - /** - * Accesseur disant si le jeu est en débogage ou non. S'active en insérant l'argument --debug dans le lancement. - * - * @see #DEBUG - * @since 0.1-aplha - */ - public static boolean isInDebugMode() { - return DEBUG; - } - - /** * Accesseur disant si le jeu est lancé en développement ou non. * diff --git a/src/main/java/fr/ynerant/leveleditor/client/main/package-info.java b/src/main/java/fr/ynerant/leveleditor/client/main/package-info.java index 25bb92c..e5f506f 100644 --- a/src/main/java/fr/ynerant/leveleditor/client/main/package-info.java +++ b/src/main/java/fr/ynerant/leveleditor/client/main/package-info.java @@ -3,7 +3,4 @@ * * @author ÿnérant */ -/** - * @author ÿnérant - */ package fr.ynerant.leveleditor.client.main; \ No newline at end of file diff --git a/src/main/java/fr/ynerant/leveleditor/editor/CollidPanel.java b/src/main/java/fr/ynerant/leveleditor/editor/CollidPanel.java index 9ab4cbc..b8ef8c5 100644 --- a/src/main/java/fr/ynerant/leveleditor/editor/CollidPanel.java +++ b/src/main/java/fr/ynerant/leveleditor/editor/CollidPanel.java @@ -17,10 +17,6 @@ public class CollidPanel extends JPanel { this.frame = frame; } - public EditorFrame getFrame() { - return frame; - } - public Map getMap() { return frame.getMap(); } diff --git a/src/main/java/fr/ynerant/leveleditor/editor/EditorFrame.java b/src/main/java/fr/ynerant/leveleditor/editor/EditorFrame.java index a26facc..fabc479 100644 --- a/src/main/java/fr/ynerant/leveleditor/editor/EditorFrame.java +++ b/src/main/java/fr/ynerant/leveleditor/editor/EditorFrame.java @@ -20,32 +20,23 @@ public class EditorFrame extends JFrame implements ChangeListener, ActionListene private final Map map; - private final JPanel content = new JPanel(); - - private final JMenuBar menuBar = new JMenuBar(); - private final JMenu fichier = new JMenu("Fichier"); - private final JMenu tools = new JMenu("Outils"); - private final JMenuItem nouveau = new JMenuItem("Nouveau"); - private final JMenuItem open = new JMenuItem("Ouvrir"); private final JMenuItem save = new JMenuItem("Sauvegarder"); private final JMenuItem saveAs = new JMenuItem("Sauvegarder sous ..."); private final JMenuItem exit = new JMenuItem("Quitter"); - private final JMenu selectionMode = new JMenu("Mode de s\u00e9lection"); private final JRadioButtonMenuItem pen = new JRadioButtonMenuItem("Pinceau"); private final JRadioButtonMenuItem pot = new JRadioButtonMenuItem("Pot de peinture"); private final JTabbedPane tabs = new JTabbedPane(); - private final JPanel tabEvents = new JPanel(); private final CollidPanel tabColl; private final MapPanel mapPanel; private final JTabbedPane resources = new JTabbedPane(); private final JPanel couche1 = new JPanel(); private final JPanel couche2 = new JPanel(); private final JPanel couche3 = new JPanel(); - ButtonGroup group = new ButtonGroup(); + final ButtonGroup group = new ButtonGroup(); private SpriteComp selectedSprite; public EditorFrame(Map map) { - super("Alice Game Engine"); + super("Level Editor"); this.map = map; this.setSize(600, 600); this.setPreferredSize(getSize()); @@ -53,17 +44,21 @@ public class EditorFrame extends JFrame implements ChangeListener, ActionListene this.setExtendedState(JFrame.MAXIMIZED_BOTH); this.setLocationRelativeTo(null); this.addWindowListener(this); + JPanel content = new JPanel(); content.setLayout(new BorderLayout()); this.setContentPane(content); this.setVisible(true); this.setVisible(false); + JMenu fichier = new JMenu("Fichier"); fichier.setMnemonic(KeyEvent.VK_F + KeyEvent.ALT_DOWN_MASK); + JMenuItem nouveau = new JMenuItem("Nouveau"); nouveau.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK, true)); nouveau.addActionListener(new CreateMapListener()); fichier.add(nouveau); + JMenuItem open = new JMenuItem("Ouvrir"); open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_DOWN_MASK, true)); open.addActionListener(new OpenMapListener()); fichier.add(open); @@ -84,6 +79,7 @@ public class EditorFrame extends JFrame implements ChangeListener, ActionListene exit.addActionListener(this); fichier.add(exit); + JMenuBar menuBar = new JMenuBar(); menuBar.add(fichier); pen.setSelected(true); @@ -91,9 +87,11 @@ public class EditorFrame extends JFrame implements ChangeListener, ActionListene pot.addActionListener(this); group.add(pen); group.add(pot); + JMenu selectionMode = new JMenu("Mode de s\u00e9lection"); selectionMode.add(pen); selectionMode.add(pot); + JMenu tools = new JMenu("Outils"); tools.setMnemonic(KeyEvent.VK_O + KeyEvent.ALT_DOWN_MASK); tools.add(selectionMode); @@ -118,6 +116,7 @@ public class EditorFrame extends JFrame implements ChangeListener, ActionListene scrollCollidMap.getVerticalScrollBar().setUnitIncrement(34); tabs.addTab("Carte", scrollMap); + JPanel tabEvents = new JPanel(); tabs.addTab("\u00c9vennments", new JScrollPane(tabEvents)); tabs.addTab("Collisions", scrollCollidMap); tabs.addChangeListener(this); diff --git a/src/main/java/fr/ynerant/leveleditor/editor/Map.java b/src/main/java/fr/ynerant/leveleditor/editor/Map.java index 9738292..83d7ea4 100644 --- a/src/main/java/fr/ynerant/leveleditor/editor/Map.java +++ b/src/main/java/fr/ynerant/leveleditor/editor/Map.java @@ -14,13 +14,13 @@ public class Map { @Deprecated private static List cases; private final EditorFrame frame; - private int width; - private int height; - private java.util.Map> casesMap = new HashMap>(); - private transient BufferedImage font; + private final int width; + private final int height; + private final java.util.Map> casesMap = new HashMap<>(); + private final transient BufferedImage font; public Map(RawMap raw) { - cases = new ArrayList(); + cases = new ArrayList<>(); this.width = raw.getWidth(); this.height = raw.getHeight(); this.font = raw.getFont(); @@ -49,7 +49,7 @@ public class Map { } public Case getCase(int x, int y) { - return casesMap.getOrDefault(x, new HashMap()).get(y); + return casesMap.getOrDefault(x, new HashMap<>()).get(y); } public void setCase(int x, int y, Case c) { @@ -60,13 +60,9 @@ public class Map { return font; } - public void setFont(BufferedImage font) { - this.font = font; - } - private void reorganizeMap() { for (int i = 0; i < width; ++i) { - casesMap.put(i, new HashMap()); + casesMap.put(i, new HashMap<>()); } for (Case c : cases) { @@ -75,7 +71,7 @@ public class Map { } public List getAllCases() { - List list = new ArrayList(); + List list = new ArrayList<>(); for (java.util.Map l : casesMap.values()) { list.addAll(l.values()); diff --git a/src/main/java/fr/ynerant/leveleditor/editor/MapPanel.java b/src/main/java/fr/ynerant/leveleditor/editor/MapPanel.java index f16ed01..dbe9316 100644 --- a/src/main/java/fr/ynerant/leveleditor/editor/MapPanel.java +++ b/src/main/java/fr/ynerant/leveleditor/editor/MapPanel.java @@ -16,10 +16,6 @@ public class MapPanel extends JPanel { this.frame = frame; } - public EditorFrame getFrame() { - return frame; - } - public Map getMap() { return frame.getMap(); } @@ -66,6 +62,7 @@ public class MapPanel extends JPanel { } } + @SuppressWarnings("BooleanMethodIsAlwaysInverted") private boolean isEmpty(BufferedImage image) { int allrgba = 0; diff --git a/src/main/java/fr/ynerant/leveleditor/editor/SpriteComp.java b/src/main/java/fr/ynerant/leveleditor/editor/SpriteComp.java index 4900088..63186db 100644 --- a/src/main/java/fr/ynerant/leveleditor/editor/SpriteComp.java +++ b/src/main/java/fr/ynerant/leveleditor/editor/SpriteComp.java @@ -8,8 +8,8 @@ import java.awt.*; public class SpriteComp extends JComponent { private static final long serialVersionUID = -6512257366877053285L; - private Sprite sprite; - private int couche; + private final Sprite sprite; + private final int couche; private boolean selected; public SpriteComp(Sprite sprite, int couche) { @@ -28,18 +28,10 @@ public class SpriteComp extends JComponent { return sprite; } - public void setSprite(Sprite s) { - this.sprite = s; - } - public int getCouche() { return couche; } - public void setCouche(int couche) { - this.couche = couche; - } - public boolean isSelected() { return selected; } diff --git a/src/main/java/fr/ynerant/leveleditor/editor/WrapLayout.java b/src/main/java/fr/ynerant/leveleditor/editor/WrapLayout.java index 4f4e4c1..36d402f 100644 --- a/src/main/java/fr/ynerant/leveleditor/editor/WrapLayout.java +++ b/src/main/java/fr/ynerant/leveleditor/editor/WrapLayout.java @@ -6,18 +6,10 @@ import java.awt.*; public class WrapLayout extends FlowLayout { private static final long serialVersionUID = 8777237960365591646L; - public WrapLayout() { - super(); - } - public WrapLayout(int align) { super(align); } - public WrapLayout(int align, int hgap, int vgap) { - super(align, hgap, vgap); - } - @Override public Dimension preferredLayoutSize(Container target) { return layoutSize(target, true); diff --git a/src/main/java/fr/ynerant/leveleditor/frame/MainFrame.java b/src/main/java/fr/ynerant/leveleditor/frame/MainFrame.java index 2ad7b9e..1e1ec4e 100644 --- a/src/main/java/fr/ynerant/leveleditor/frame/MainFrame.java +++ b/src/main/java/fr/ynerant/leveleditor/frame/MainFrame.java @@ -1,6 +1,3 @@ -/** - * @author ÿnérant - */ package fr.ynerant.leveleditor.frame; import fr.ynerant.leveleditor.client.main.Main; @@ -22,8 +19,6 @@ import java.awt.event.KeyEvent; public class MainFrame extends JFrame { /** * ID de série - * - * @see {@link JFrame} */ private static final long serialVersionUID = -3168760121879418534L; @@ -40,18 +35,7 @@ public class MainFrame extends JFrame { * * @see LogManager#getLogger(String) */ - private static Logger LOGGER = (Logger) LogManager.getLogger("MainFrame"); - - private JMenuBar menuBar = new JMenuBar(); - private JMenu fichier = new JMenu("Fichier"); - private JMenu display = new JMenu("Affichage"); - private JMenu editMaps = new JMenu("Cartes"); - private JMenu changeLAF = new JMenu("Modfier l'apparence"); - private JMenuItem createMap = new JMenuItem("Cr\u00e9er"); - private JMenuItem openMap = new JMenuItem("Ouvrir"); - private JMenuItem systemLAF = new JMenuItem("Apparence syst\u00e8me"); - private JMenuItem javaLAF = new JMenuItem("Apparence Java"); - private JMenuItem darkLAF = new JMenuItem("Apparence sombre"); + private static final Logger LOGGER = (Logger) LogManager.getLogger("MainFrame"); /** * Constructeur @@ -69,25 +53,35 @@ public class MainFrame extends JFrame { this.setExtendedState(JFrame.MAXIMIZED_BOTH); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JMenu fichier = new JMenu("Fichier"); fichier.setMnemonic(KeyEvent.VK_F + KeyEvent.ALT_DOWN_MASK); + JMenu display = new JMenu("Affichage"); display.setMnemonic(KeyEvent.VK_A + KeyEvent.ALT_DOWN_MASK); + JMenuItem createMap = new JMenuItem("Cr\u00e9er"); createMap.addActionListener(new CreateMapListener()); + JMenu editMaps = new JMenu("Cartes"); editMaps.add(createMap); + JMenuItem openMap = new JMenuItem("Ouvrir"); openMap.addActionListener(new OpenMapListener()); editMaps.add(openMap); fichier.add(editMaps); + JMenuItem systemLAF = new JMenuItem("Apparence syst\u00e8me"); systemLAF.addActionListener(new ChangeLAFListener(systemLAF, this)); + JMenu changeLAF = new JMenu("Modfier l'apparence"); changeLAF.add(systemLAF); + JMenuItem javaLAF = new JMenuItem("Apparence Java"); javaLAF.addActionListener(new ChangeLAFListener(javaLAF, this)); changeLAF.add(javaLAF); + JMenuItem darkLAF = new JMenuItem("Apparence sombre"); darkLAF.addActionListener(new ChangeLAFListener(darkLAF, this)); changeLAF.add(darkLAF); display.add(changeLAF); + JMenuBar menuBar = new JMenuBar(); menuBar.add(fichier); menuBar.add(display); diff --git a/src/main/java/fr/ynerant/leveleditor/frame/listeners/CollidMapMouseListener.java b/src/main/java/fr/ynerant/leveleditor/frame/listeners/CollidMapMouseListener.java index d9f3486..bd229ef 100644 --- a/src/main/java/fr/ynerant/leveleditor/frame/listeners/CollidMapMouseListener.java +++ b/src/main/java/fr/ynerant/leveleditor/frame/listeners/CollidMapMouseListener.java @@ -28,7 +28,7 @@ public class CollidMapMouseListener extends MouseAdapter { int x = panel.getWidth() / 2 - map.getFont().getWidth(); int y = panel.getHeight() / 2 - map.getFont().getHeight(); - Case c = null; + Case c; if ((c = map.getCase((event.getX() - x + 2) / 34, (event.getY() - y + 2) / 34)) != null && event.getX() - x >= 2 && event.getY() - y >= 2) { int colIndex = c.getCollision().ordinal(); diff --git a/src/main/java/fr/ynerant/leveleditor/frame/listeners/CreateMapListener.java b/src/main/java/fr/ynerant/leveleditor/frame/listeners/CreateMapListener.java index 0068526..1403be4 100644 --- a/src/main/java/fr/ynerant/leveleditor/frame/listeners/CreateMapListener.java +++ b/src/main/java/fr/ynerant/leveleditor/frame/listeners/CreateMapListener.java @@ -1,6 +1,3 @@ -/** - * @author ÿnérant - */ package fr.ynerant.leveleditor.frame.listeners; import fr.ynerant.leveleditor.client.main.Main; diff --git a/src/main/java/fr/ynerant/leveleditor/frame/listeners/MapMouseListener.java b/src/main/java/fr/ynerant/leveleditor/frame/listeners/MapMouseListener.java index d9313fe..705e83f 100644 --- a/src/main/java/fr/ynerant/leveleditor/frame/listeners/MapMouseListener.java +++ b/src/main/java/fr/ynerant/leveleditor/frame/listeners/MapMouseListener.java @@ -28,7 +28,7 @@ public class MapMouseListener extends MouseAdapter { int x = panel.getWidth() / 2 - map.getFont().getWidth(); int y = panel.getHeight() / 2 - map.getFont().getHeight(); - Case c = null; + Case c; if ((c = map.getCase((event.getX() - x + 2) / 34, (event.getY() - y + 2) / 34)) != null && event.getX() - x >= 2 && event.getY() - y >= 2) { if (getFrame().getSelectedSprite() != null) {