Compare commits

...

1 Commits

Author SHA1 Message Date
LenaGmbh
01ce57cd6e Fixed bug of the autoclicker not being able to click (ironic I know) 2025-09-16 23:20:11 +02:00

View File

@@ -14,13 +14,12 @@ public class AutoClicker implements NativeKeyListener {
try {
GlobalScreen.registerNativeHook();
GlobalScreen.addNativeKeyListener(new AutoClicker());
Clicker();
} catch (NativeHookException ex) {
ex.printStackTrace();
}
}
public static void Clicker() {
public static void clicker() {
int mask = InputEvent.BUTTON1_DOWN_MASK;
clickThread = new Thread(() -> {
try {
@@ -30,8 +29,10 @@ public class AutoClicker implements NativeKeyListener {
bot.mouseRelease(mask);
Thread.sleep(10);
}
} catch (AWTException | InterruptedException ex) {
} catch (AWTException ex) {
ex.printStackTrace();
} catch (InterruptedException ex) {
// Thread got close
}
});
clickThread.start();
@@ -41,7 +42,9 @@ public class AutoClicker implements NativeKeyListener {
if(e.getKeyCode() == NativeKeyEvent.VC_F6) {
hotKeyPressed = !hotKeyPressed;
System.out.println("Autoclicker: " + hotKeyPressed);
if(!hotKeyPressed && clickThread != null) {
if(hotKeyPressed) {
clicker();
} else if(clickThread != null) {
clickThread.interrupt();
try {
clickThread.join();