Make all classes final
This commit is contained in:
parent
68ee8a51ab
commit
903866c8e5
@ -10,7 +10,7 @@ import java.awt.Graphics;
|
|||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class Background {
|
public final class Background {
|
||||||
|
|
||||||
private static final int STARS_COUNT = (int) Math.sqrt(WIDTH * HEIGHT);
|
private static final int STARS_COUNT = (int) Math.sqrt(WIDTH * HEIGHT);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import java.io.IOException;
|
|||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class GameCanvas extends DoubleBufferedCanvas implements Runnable, NetworkListener {
|
public final class GameCanvas extends DoubleBufferedCanvas implements Runnable, NetworkListener {
|
||||||
|
|
||||||
private static final String WAIT_MESSAGE = "Please, wait...";
|
private static final String WAIT_MESSAGE = "Please, wait...";
|
||||||
private static final int WIN = 1, LOOSE = -1, NOTHING = 0;
|
private static final int WIN = 1, LOOSE = -1, NOTHING = 0;
|
||||||
|
@ -5,13 +5,12 @@ import com.annimon.turrets.util.GuiUtil;
|
|||||||
import com.annimon.turrets.util.Prefs;
|
import com.annimon.turrets.util.Prefs;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JLayer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class Main extends JFrame {
|
public final class Main extends JFrame {
|
||||||
|
|
||||||
private static Main instance;
|
private static Main instance;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import javax.swing.event.ListSelectionListener;
|
|||||||
* Main menu
|
* Main menu
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class MenuPanel extends JPanel {
|
public final class MenuPanel extends JPanel {
|
||||||
|
|
||||||
private static final String[] MENU_ITEMS = {
|
private static final String[] MENU_ITEMS = {
|
||||||
"Create Game", "Join", "Options", "Help", "Exit"
|
"Create Game", "Join", "Options", "Help", "Exit"
|
||||||
|
@ -25,7 +25,7 @@ import javax.swing.text.MaskFormatter;
|
|||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class OptionsPanel extends JPanel {
|
public final class OptionsPanel extends JPanel {
|
||||||
|
|
||||||
private static final Font FONT = new Font("Stencil", 1, 30);
|
private static final Font FONT = new Font("Stencil", 1, 30);
|
||||||
private static final int VERT_INSET = 80, HOR_INSET = 50;
|
private static final int VERT_INSET = 80, HOR_INSET = 50;
|
||||||
|
@ -11,7 +11,7 @@ import java.awt.Graphics2D;
|
|||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class ShootInfo {
|
public final class ShootInfo {
|
||||||
|
|
||||||
double x, y, speedX;
|
double x, y, speedX;
|
||||||
double windSpeed, vsin, t;
|
double windSpeed, vsin, t;
|
||||||
|
@ -12,7 +12,7 @@ import java.awt.LinearGradientPaint;
|
|||||||
* Destructible terrain.
|
* Destructible terrain.
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class Terrain {
|
public final class Terrain {
|
||||||
|
|
||||||
private static final Color[] TERRAIN_COLOR = {
|
private static final Color[] TERRAIN_COLOR = {
|
||||||
new Color(0xFF33CE2B), new Color(0xFF1C7317)
|
new Color(0xFF33CE2B), new Color(0xFF1C7317)
|
||||||
|
@ -12,7 +12,7 @@ import java.awt.Graphics2D;
|
|||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class Turret {
|
public final class Turret {
|
||||||
|
|
||||||
public static final boolean SERVER = true, CLIENT = false;
|
public static final boolean SERVER = true, CLIENT = false;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import java.awt.Graphics2D;
|
|||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class Wind {
|
public final class Wind {
|
||||||
|
|
||||||
private double speed;
|
private double speed;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import java.net.Socket;
|
|||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class GameClient {
|
public final class GameClient {
|
||||||
|
|
||||||
private final SocketHelper helper;
|
private final SocketHelper helper;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import java.net.UnknownHostException;
|
|||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class GameServer {
|
public final class GameServer {
|
||||||
|
|
||||||
private final ServerSocket serverSocket;
|
private final ServerSocket serverSocket;
|
||||||
private final SocketHelper helper;
|
private final SocketHelper helper;
|
||||||
|
@ -11,7 +11,7 @@ import java.net.Socket;
|
|||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class SocketHelper extends Thread {
|
public final class SocketHelper extends Thread {
|
||||||
|
|
||||||
private final Socket socket;
|
private final Socket socket;
|
||||||
private final DataInputStream dis;
|
private final DataInputStream dis;
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
package com.annimon.turrets.util;
|
package com.annimon.turrets.util;
|
||||||
|
|
||||||
import com.annimon.turrets.Constants;
|
import com.annimon.turrets.Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle exceptions.
|
* Handle exceptions.
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class ExceptionHandler {
|
public final class ExceptionHandler {
|
||||||
|
|
||||||
private static final boolean DEBUG_MODE = Constants.DEBUG_MODE;
|
private static final boolean DEBUG_MODE = Constants.DEBUG_MODE;
|
||||||
|
|
||||||
public static void handle(Throwable throwable) {
|
public static void handle(Throwable throwable) {
|
||||||
if (DEBUG_MODE) {
|
if (DEBUG_MODE) {
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handle(Throwable throwable, String comment) {
|
public static void handle(Throwable throwable, String comment) {
|
||||||
if (DEBUG_MODE) {
|
if (DEBUG_MODE) {
|
||||||
System.out.println(comment);
|
System.out.println(comment);
|
||||||
handle(throwable);
|
handle(throwable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import javax.swing.plaf.LayerUI;
|
|||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class GuiUtil {
|
public final class GuiUtil {
|
||||||
|
|
||||||
public static <T extends JComponent> JLayer<T> createPlanetLayer(T component) {
|
public static <T extends JComponent> JLayer<T> createPlanetLayer(T component) {
|
||||||
return new JLayer<>(component, (LayerUI<T>) new PlanetBackground());
|
return new JLayer<>(component, (LayerUI<T>) new PlanetBackground());
|
||||||
|
@ -6,7 +6,7 @@ import java.util.Random;
|
|||||||
* Extended random
|
* Extended random
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class RandomExt extends Random {
|
public final class RandomExt extends Random {
|
||||||
|
|
||||||
public RandomExt() {
|
public RandomExt() {
|
||||||
super();
|
super();
|
||||||
|
@ -4,7 +4,7 @@ package com.annimon.turrets.util;
|
|||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class Util {
|
public final class Util {
|
||||||
|
|
||||||
private static final RandomExt random = new RandomExt();
|
private static final RandomExt random = new RandomExt();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user