Improve code quality
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Bea 2024-08-05 21:36:44 +02:00
parent 9ad074bb51
commit c3c1b99f1b
5 changed files with 7 additions and 17 deletions

View File

@ -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();

View File

@ -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);

View File

@ -55,7 +55,7 @@ public class SingleStepMovementTask extends TimerTask {
try {
robot = new Robot();
} catch (AWTException e) {
throw new RuntimeException(e);
LOGGER.error(e);
}
}

View File

@ -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

View File

@ -23,11 +23,6 @@ public class MainWindow
private CursorMover cursorMover = new CursorMover();
private Button toggleButton;
public MainWindow() {
}
public void init() {
JFrame frame = new JFrame();