diff --git a/src/main/java/wtf/beatrice/autosqueal/Main.java b/src/main/java/wtf/beatrice/autosqueal/Main.java index e55fc6b..816182a 100644 --- a/src/main/java/wtf/beatrice/autosqueal/Main.java +++ b/src/main/java/wtf/beatrice/autosqueal/Main.java @@ -9,8 +9,6 @@ import wtf.beatrice.autosqueal.ui.MainWindow; public class Main { - private static boolean running = true; - private static final Logger LOGGER = LogManager.getLogger(Main.class); private static final MainWindow mainWindow = new MainWindow(); diff --git a/src/main/java/wtf/beatrice/autosqueal/controls/CursorMover.java b/src/main/java/wtf/beatrice/autosqueal/controls/CursorMover.java index 7043429..8654d8f 100644 --- a/src/main/java/wtf/beatrice/autosqueal/controls/CursorMover.java +++ b/src/main/java/wtf/beatrice/autosqueal/controls/CursorMover.java @@ -14,14 +14,14 @@ public class CursorMover extends TimerTask { private static final Logger LOGGER = LogManager.getLogger(CursorMover.class); - private final Random RANDOM; + private final Random random; private static final int LOOPS_BEFORE_CLICK = 5; private int iteration = 0; public CursorMover() { - RANDOM = new SecureRandom(); + random = new SecureRandom(); } @Override @@ -45,8 +45,8 @@ public class CursorMover extends TimerTask iteration = 0; } else { - destX = RANDOM.nextInt(RunnerUtil.SCREEN_WIDTH); - destY = RANDOM.nextInt(RunnerUtil.SCREEN_HEIGHT); + destX = random.nextInt(RunnerUtil.SCREEN_WIDTH); + destY = random.nextInt(RunnerUtil.SCREEN_HEIGHT); singleStepMovementTask = new SingleStepMovementTask(destX, destY, false); diff --git a/src/main/java/wtf/beatrice/autosqueal/controls/SingleStepMovementTask.java b/src/main/java/wtf/beatrice/autosqueal/controls/SingleStepMovementTask.java index c860f35..6c0b478 100644 --- a/src/main/java/wtf/beatrice/autosqueal/controls/SingleStepMovementTask.java +++ b/src/main/java/wtf/beatrice/autosqueal/controls/SingleStepMovementTask.java @@ -55,7 +55,7 @@ public class SingleStepMovementTask extends TimerTask { try { robot = new Robot(); } catch (AWTException e) { - throw new RuntimeException(e); + LOGGER.error(e); } } diff --git a/src/main/java/wtf/beatrice/autosqueal/listener/CursorMoveListener.java b/src/main/java/wtf/beatrice/autosqueal/listener/CursorMoveListener.java index af8b599..fde5f4a 100644 --- a/src/main/java/wtf/beatrice/autosqueal/listener/CursorMoveListener.java +++ b/src/main/java/wtf/beatrice/autosqueal/listener/CursorMoveListener.java @@ -11,9 +11,6 @@ public class CursorMoveListener extends TimerTask { private int oldX; private int oldY; - private int newX; - private int newY; - private int loops; private boolean isUserAway; @@ -28,8 +25,8 @@ public class CursorMoveListener extends TimerTask { @Override public void run() { - newX = MouseInfo.getPointerInfo().getLocation().x; - newY = MouseInfo.getPointerInfo().getLocation().y; + int newX = MouseInfo.getPointerInfo().getLocation().x; + int newY = MouseInfo.getPointerInfo().getLocation().y; if(newX != oldX || newY != oldY) { // cursor has been moved diff --git a/src/main/java/wtf/beatrice/autosqueal/ui/MainWindow.java b/src/main/java/wtf/beatrice/autosqueal/ui/MainWindow.java index 38aeda8..acfdfa9 100644 --- a/src/main/java/wtf/beatrice/autosqueal/ui/MainWindow.java +++ b/src/main/java/wtf/beatrice/autosqueal/ui/MainWindow.java @@ -23,11 +23,6 @@ public class MainWindow private CursorMover cursorMover = new CursorMover(); private Button toggleButton; - - public MainWindow() { - - } - public void init() { JFrame frame = new JFrame();