Skip to content

Commit

Permalink
LMB only
Browse files Browse the repository at this point in the history
  • Loading branch information
claypigeon123 committed Feb 13, 2022
1 parent 6c0b0f4 commit 6e7de72
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions l4j/launch4jconfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
<runtimeBits>64/32</runtimeBits>
</jre>
<versionInfo>
<fileVersion>1.0.1.0</fileVersion>
<txtFileVersion>1.0.1</txtFileVersion>
<fileVersion>1.0.3.0</fileVersion>
<txtFileVersion>1.0.3</txtFileVersion>
<fileDescription>Anti-afk for FFXIV</fileDescription>
<copyright>CP Systems</copyright>
<productVersion>1.0.1.0</productVersion>
<txtProductVersion>1.0.1</txtProductVersion>
<productVersion>1.0.3.0</productVersion>
<txtProductVersion>1.0.3</txtProductVersion>
<productName>Anti-afk for FFXIV</productName>
<companyName></companyName>
<internalName>cp-anti-afk</internalName>
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/cp/tools/antiafk/config/Configurer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.cp.tools.antiafk.config.model.KeyboardButton;
import com.cp.tools.antiafk.config.model.MouseButton;
import com.cp.tools.antiafk.util.SystemInputProcessor;
import com.sun.glass.ui.Robot;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
Expand Down Expand Up @@ -33,11 +34,11 @@ private static Configuration setupConfig() throws JAXBException {
int minTime = processor.nextPositiveInt("Enter the MINIMUM amount of time to wait between executions (in seconds): ");
int maxTime = processor.nextPositiveIntLargerThanOrEqualTo("Enter the MAXIMUM amount of time to wait between executions (in seconds): ", minTime);

boolean useMouse = processor.nextYesNoDecision("Use mouse instead of keyboard (yes/no): ");
boolean useMouse = processor.nextYesNoDecision("Use mouse instead of keyboard (yes/no)? ");

Configuration config;
if (useMouse) {
MouseButton key = processor.nextMouseButton("Type out the mouse button to press (valid options are RMB, LMB, MMB): ");
MouseButton key = processor.nextMouseButton("Type out the mouse button to press (valid options are LMB): ");
config = new Configuration(minTime, maxTime, key);
} else {
KeyboardButton key = processor.nextKeyboardButton("Type out the key to press (valid options are SPACE, BACKSPACE, ENTER, I, U): ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import java.awt.event.MouseEvent;

public enum MouseButton {
LMB(MouseEvent.BUTTON1),
RMB(MouseEvent.BUTTON2),
MMB(MouseEvent.BUTTON3);
LMB(MouseEvent.BUTTON1);

private final int keyCode;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/cp/tools/antiafk/logic/AntiAfkProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;

public class AntiAfkProcess {
private static final Logger log = LoggerFactory.getLogger(AntiAfkProcess.class);
Expand All @@ -20,6 +21,7 @@ public class AntiAfkProcess {
private Configuration config;

public AntiAfkProcess() throws JAXBException, AWTException {
log.info("{}", MouseInfo.getNumberOfButtons());
log.info("Starting program");
configure();
this.robot = new Robot();
Expand Down Expand Up @@ -55,7 +57,6 @@ private void press() {
if (config.getMouseButtonToPress() != null) {
MouseButton mb = config.getMouseButtonToPress();
log.info("Pressing [{}] mouse button now", mb);

robot.mousePress(InputEvent.getMaskForButton(mb.getKeyCode()));
robot.delay(faker.number().numberBetween(10, 101));
robot.mouseRelease(InputEvent.getMaskForButton(mb.getKeyCode()));
Expand Down

0 comments on commit 6e7de72

Please sign in to comment.