Improve linting
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bea 2024-08-05 19:18:44 +02:00
parent d841288db7
commit 46265e99b1
4 changed files with 22 additions and 12 deletions

View File

@ -8,8 +8,12 @@ import java.util.TimerTask;
public class CursorMoveListener extends TimerTask { public class CursorMoveListener extends TimerTask {
private int oldX, oldY; private int oldX;
private int newX, newY; private int oldY;
private int newX;
private int newY;
private int loops; private int loops;
private boolean isUserAway; private boolean isUserAway;

View File

@ -10,11 +10,15 @@ public class CursorMover extends TimerTask {
private static final Logger LOGGER = LogManager.getLogger(CursorMover.class); private static final Logger LOGGER = LogManager.getLogger(CursorMover.class);
final int destX, destY; final int destX;
final int destY;
final Robot robot; final Robot robot;
float currentX, currentY; float currentX;
float stepX = 1, stepY = 1; float currentY;
float stepX = 1;
float stepY = 1;
boolean isRunning = true; boolean isRunning = true;
@ -26,7 +30,8 @@ public class CursorMover extends TimerTask {
destX = destinationX; destX = destinationX;
destY = destinationY; destY = destinationY;
int lengthX, lengthY; int lengthX;
int lengthY;
lengthX = Math.round(Math.abs(currentX - destX)); lengthX = Math.round(Math.abs(currentX - destX));
lengthY = Math.round(Math.abs(currentY - destY)); lengthY = Math.round(Math.abs(currentY - destY));

View File

@ -13,8 +13,9 @@ import java.util.List;
public class KeyPressListener implements NativeKeyListener public class KeyPressListener implements NativeKeyListener
{ {
private static final Logger LOGGER = LogManager.getLogger(KeyPressListener.class); private static final Logger LOGGER = LogManager.getLogger(KeyPressListener.class);
private final static List<Integer> pressedKeysIds = new ArrayList<>(); private static final List<Integer> pressedKeysIds = new ArrayList<>();
@Override
public void nativeKeyPressed(NativeKeyEvent e) { public void nativeKeyPressed(NativeKeyEvent e) {
LOGGER.info("Key Pressed: {}", NativeKeyEvent.getKeyText(e.getKeyCode())); LOGGER.info("Key Pressed: {}", NativeKeyEvent.getKeyText(e.getKeyCode()));
@ -31,6 +32,7 @@ public class KeyPressListener implements NativeKeyListener
handlePressedKeys(); handlePressedKeys();
} }
@Override
public void nativeKeyReleased(NativeKeyEvent e) { public void nativeKeyReleased(NativeKeyEvent e) {
LOGGER.info("Key Released: {}", NativeKeyEvent.getKeyText(e.getKeyCode())); LOGGER.info("Key Released: {}", NativeKeyEvent.getKeyText(e.getKeyCode()));
@ -44,9 +46,7 @@ public class KeyPressListener implements NativeKeyListener
pressedKeysIds.contains(NativeKeyEvent.VC_CONTROL)) { pressedKeysIds.contains(NativeKeyEvent.VC_CONTROL)) {
StringBuilder keys = new StringBuilder(); StringBuilder keys = new StringBuilder();
pressedKeysIds.forEach(keyCode -> { pressedKeysIds.forEach(keyCode -> keys.append("[").append(NativeKeyEvent.getKeyText(keyCode)).append("]"));
keys.append("[").append(NativeKeyEvent.getKeyText(keyCode)).append("]");
});
LOGGER.warn("Received shutdown keystroke: {}", keys); LOGGER.warn("Received shutdown keystroke: {}", keys);

View File

@ -41,7 +41,8 @@ public class Main {
LOGGER.info("Starting coordinates: {}, {}", currentX, currentY); LOGGER.info("Starting coordinates: {}, {}", currentX, currentY);
int randomX, randomY; int randomX;
int randomY;
randomX = random.nextInt(width); randomX = random.nextInt(width);
randomY = random.nextInt(height); randomY = random.nextInt(height);
@ -90,6 +91,6 @@ public class Main {
timer.cancel(); timer.cancel();
Thread.sleep(TIME_BETWEEN_MOVES * 1000); Thread.sleep(TIME_BETWEEN_MOVES * 1000L);
} }
} }