diff --git a/robocraft-assistant-app/pom.xml b/robocraft-assistant-app/pom.xml
index 1904234..09c3be1 100644
--- a/robocraft-assistant-app/pom.xml
+++ b/robocraft-assistant-app/pom.xml
@@ -12,7 +12,6 @@
jar
robocraft-assistant-app
- http://maven.apache.org
@@ -20,6 +19,17 @@
robocraft-assistant-core
1.0.0
+
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.5
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.5
+
junit
@@ -55,7 +65,7 @@
true
lib
simple
- com.github.hronom.robocraft.assistant.app.App
+ com.github.hronom.robocraft.assistant.app.RobocraftAssistantApp
true
true
@@ -190,7 +200,7 @@
TODO
src/main/icons/1461509409_robot_64.ico
- com.github.hronom.robocraft.assistant.app.App
+ com.github.hronom.robocraft.assistant.app.RobocraftAssistantApp
true
anything
diff --git a/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/App.java b/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/App.java
deleted file mode 100755
index f0c0174..0000000
--- a/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/App.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.github.hronom.robocraft.assistant.app;
-
-import com.github.hronom.robocraft.assistant.core.Shooter;
-import com.tulskiy.keymaster.common.HotKey;
-import com.tulskiy.keymaster.common.HotKeyListener;
-import com.tulskiy.keymaster.common.Provider;
-
-import java.awt.*;
-import java.awt.event.KeyEvent;
-import java.util.concurrent.TimeUnit;
-
-import javax.swing.*;
-
-public class App {
- public static void main(String[] args) throws InterruptedException, AWTException {
- final Shooter shooter = new Shooter();
-
- Provider provider = Provider.getCurrentProvider(true);
- provider.register(KeyStroke.getKeyStroke(KeyEvent.VK_R, 0), new HotKeyListener() {
- public void onHotKey(HotKey hotKey) {
- shooter.toggle();
- }
- });
-
- Thread.sleep(TimeUnit.DAYS.toMillis(1000));
-
- provider.reset();
- provider.stop();
- }
-}
diff --git a/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/RobocraftAssistantApp.java b/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/RobocraftAssistantApp.java
new file mode 100755
index 0000000..9c6f6e0
--- /dev/null
+++ b/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/RobocraftAssistantApp.java
@@ -0,0 +1,209 @@
+package com.github.hronom.robocraft.assistant.app;
+
+import com.github.hronom.robocraft.assistant.app.controllers.ShootController;
+import com.github.hronom.robocraft.assistant.app.models.ShooterModel;
+import com.github.hronom.robocraft.assistant.app.views.AssistantMainView;
+import com.github.hronom.robocraft.assistant.app.views.ShootView;
+import com.github.hronom.robocraft.assistant.core.Shooter;
+import com.tulskiy.keymaster.common.HotKey;
+import com.tulskiy.keymaster.common.HotKeyListener;
+import com.tulskiy.keymaster.common.Provider;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.awt.*;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.util.concurrent.TimeUnit;
+
+import javax.swing.*;
+
+public class RobocraftAssistantApp {
+ private static final Logger logger = LogManager.getLogger();
+
+ public static void main(String[] args) throws InterruptedException, AWTException {
+ logger.info(RobocraftAssistantApp.class.getSimpleName());
+ printSystemInfo();
+
+ ShooterModel shooterModel = new ShooterModel();
+
+ ShootView shootView = new ShootView();
+ new ShootController(shooterModel, shootView);
+ new AssistantMainView(shootView);
+ }
+
+ /*private static final Logger logger = LogManager.getLogger();
+
+ public static void main(String[] args) {
+ logger.info(ScrapeDatRoomsViewApp.class.getSimpleName());
+ printSystemInfo();
+
+ ScrapeView scrapeView = new ScrapeView();
+ new ScrapeButtonController(scrapeView);
+ new WebsiteUrlTypingController(scrapeView);
+ new GrabberSelectionController(scrapeView);
+ new ScrapeMainView(scrapeView);
+
+ // testMotel6();
+ // testRedRoof();
+ // testRedLion();
+ }*/
+
+ private static void printSystemInfo() {
+ logger.info("Java version: " + System.getProperty("java.version"));
+ logger.info("Java vendor: " + System.getProperty("java.vendor"));
+ logger.info("Java vendor url: " + System.getProperty("java.vendor.url"));
+ logger.info("Java home: " + System.getProperty("java.home"));
+ logger.info("Java vm specification version: " +
+ System.getProperty("java.vm.specification.version"));
+ logger.info(
+ "Java vm specification vendor: " + System.getProperty("java.vm.specification.vendor"));
+ logger.info(
+ "Java vm specification name: " + System.getProperty("java.vm.specification.name"));
+ logger.info("Java vm version: " + System.getProperty("java.vm.version"));
+ logger.info("Java vm vendor: " + System.getProperty("java.vm.vendor"));
+ logger.info("Java vm name: " + System.getProperty("java.vm.name"));
+ logger.info(
+ "Java specification version: " + System.getProperty("java.specification.version"));
+ logger
+ .info("Java specification vendor: " + System.getProperty("java.specification.vendor"));
+ logger.info("Java specification name: " + System.getProperty("java.specification.name"));
+ logger.info("Java class.version: " + System.getProperty("java.class.version"));
+ logger.info("Java class.path: " + System.getProperty("java.class.path"));
+ logger.info("Java library.path: " + System.getProperty("java.library.path"));
+ logger.info("Java io.tmpdir: " + System.getProperty("java.io.tmpdir"));
+ logger.info("Java compiler: " + System.getProperty("java.compiler"));
+ logger.info("Java ext.dirs: " + System.getProperty("java.ext.dirs"));
+ logger.info("OS name: " + System.getProperty("os.name"));
+ logger.info("OS arch: " + System.getProperty("os.arch"));
+ logger.info("OS version: " + System.getProperty("os.version"));
+
+ // Total number of processors or cores available to the JVM.
+ logger.info("Available processors (cores): " + Runtime.getRuntime().availableProcessors());
+ // Total amount of free memory available to the JVM.
+ logger.info("Free memory (bytes): " + Runtime.getRuntime().freeMemory());
+ // This will return Long.MAX_VALUE if there is no preset limit.
+ long maxMemory = Runtime.getRuntime().maxMemory();
+ // Maximum amount of memory the JVM will attempt to use.
+ logger.info(
+ "Maximum memory (bytes): " + (maxMemory == Long.MAX_VALUE ? "no limit" : maxMemory));
+ // Total memory currently in use by the JVM.
+ logger.info("Total memory (bytes): " + Runtime.getRuntime().totalMemory());
+ // Get a list of all filesystem roots on this system.
+ File[] roots = File.listRoots();
+ // For each filesystem root, print some info.
+ for (File root : roots) {
+ logger.info("File system root: " + root.getAbsolutePath());
+ logger.info("Total space (bytes): " + root.getTotalSpace());
+ logger.info("Free space (bytes): " + root.getFreeSpace());
+ logger.info("Usable space (bytes): " + root.getUsableSpace());
+ }
+ }
+
+ /*private static void testMotel6() {
+ final Path resultsDir = Paths.get("motel6");
+ final Path resultsPhotosDir = resultsDir.resolve("photos");
+
+ try {
+ PathsUtils.deletePathIfExists(resultsDir);
+ PathsUtils.createDirectoryIfNotExists(resultsDir);
+ PathsUtils.createDirectoryIfNotExists(resultsPhotosDir);
+ } catch (IOException e) {
+ logger.fatal(e);
+ }
+
+ JxBrowserGrabber jxBrowserGrabber = new JxBrowserGrabber();
+ String html = jxBrowserGrabber.grabContent(
+ "https://www.motel6.com/en/motels.nv.las-vegas.8612.html#?propertyId=8612&numGuests=1&checkinDate=2015-11-26&numNights=1&corporatePlusNumber=CP555996&travelAgentNumber=7724054");
+ Motel6HtmlParser dataProvider = new Motel6HtmlParser();
+ ArrayList roomInfos = dataProvider.parse(html, new RoomPhotoDownloader() {
+ @Override
+ public Path download(String url) {
+ try {
+ return NetworkUtils.downloadImage(url, resultsPhotosDir).toAbsolutePath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ });
+
+ save(roomInfos, resultsDir);
+ }
+
+ private static void testRedRoof() {
+ final Path resultsDir = Paths.get("redroof");
+ final Path resultsPhotosDir = resultsDir.resolve("photos");
+
+ try {
+ PathsUtils.deletePathIfExists(resultsDir);
+ PathsUtils.createDirectoryIfNotExists(resultsDir);
+ PathsUtils.createDirectoryIfNotExists(resultsPhotosDir);
+ } catch (IOException e) {
+ logger.fatal(e);
+ }
+
+ JxBrowserGrabber jxBrowserGrabber = new JxBrowserGrabber();
+ String html = jxBrowserGrabber.grabContent(
+ "https://www.redroof.com/search/index.cfm?children=0&adults=1&SearchTerm=RRI570&checkin=11/30/15&checkout=12/31/15&rooms=1");
+ RedRoofHtmlParser parser = new RedRoofHtmlParser();
+ ArrayList roomInfos = parser.parse(html, new RoomPhotoDownloader() {
+ @Override
+ public Path download(String url) {
+ try {
+ return NetworkUtils.downloadImage(url, resultsPhotosDir);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ });
+
+ save(roomInfos, resultsDir);
+ }
+
+ private static void testRedLion() {
+ final Path resultsDir = Paths.get("redlion");
+ final Path resultsPhotosDir = resultsDir.resolve("photos");
+
+ try {
+ PathsUtils.deletePathIfExists(resultsDir);
+ PathsUtils.createDirectoryIfNotExists(resultsDir);
+ PathsUtils.createDirectoryIfNotExists(resultsPhotosDir);
+ } catch (IOException e) {
+ logger.fatal(e);
+ }
+
+ JxBrowserGrabber jxBrowserGrabber = new JxBrowserGrabber();
+ String html = jxBrowserGrabber.grabContent(
+ "https://reservations.redlion.com/ibe/index.aspx?dt1=5367&hgID=280&hotelID=2072&langID=1&checkin=11%2F22%2F2015&checkout=11%2F23%2F2015&adults=1&children=0&destination=Settle%20Inn%20%26%20Suites%20Harlan#ws-rsftr-0");
+ RedLionHtmlParser parser = new RedLionHtmlParser();
+ ArrayList roomInfos = parser.parse(html, new RoomPhotoDownloader() {
+ @Override
+ public Path download(String url) {
+ try {
+ return NetworkUtils.downloadImage(url, resultsPhotosDir).toAbsolutePath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ });
+
+ save(roomInfos, resultsDir);
+ }
+
+ private static void save(ArrayList roomInfos, Path resultsPath) {
+ CsvMapper mapper = new CsvMapper();
+ mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY);
+
+ CsvSchema schema = mapper.schemaFor(RoomInfo.class).withColumnSeparator(',').withHeader();
+
+ try (BufferedWriter bw = Files.newBufferedWriter(resultsPath.resolve("results.csv"))) {
+ mapper.writer(schema).writeValues(bw).writeAll(roomInfos);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }*/
+}
diff --git a/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/controllers/ShootController.java b/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/controllers/ShootController.java
new file mode 100644
index 0000000..009b6a1
--- /dev/null
+++ b/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/controllers/ShootController.java
@@ -0,0 +1,22 @@
+package com.github.hronom.robocraft.assistant.app.controllers;
+
+import com.github.hronom.robocraft.assistant.app.models.ShooterModel;
+import com.github.hronom.robocraft.assistant.app.views.ShootView;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class ShootController {
+ public ShootController(ShooterModel shooterModel, ShootView shootViewArg) {
+ shootViewArg.addApplySettingsButtonActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ shooterModel.set(
+ shootViewArg.key().toUpperCase().charAt(0),
+ Integer.valueOf(shootViewArg.shootDelay()),
+ Integer.valueOf(shootViewArg.shootCount())
+ );
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/models/ShooterModel.java b/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/models/ShooterModel.java
new file mode 100644
index 0000000..99000d6
--- /dev/null
+++ b/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/models/ShooterModel.java
@@ -0,0 +1,29 @@
+package com.github.hronom.robocraft.assistant.app.models;
+
+import com.github.hronom.robocraft.assistant.core.Shooter;
+import com.tulskiy.keymaster.common.HotKey;
+import com.tulskiy.keymaster.common.HotKeyListener;
+import com.tulskiy.keymaster.common.Provider;
+
+import java.awt.*;
+
+import javax.swing.*;
+
+public class ShooterModel {
+ private final Provider provider = Provider.getCurrentProvider(true);
+ private Shooter shooter;
+
+ public ShooterModel() throws AWTException, InterruptedException {
+ shooter = new Shooter();
+ }
+
+ public void set(Character keyChar, int shootDelay, int shootCount) {
+ provider.reset();
+ provider.register(KeyStroke.getKeyStroke(String.valueOf(keyChar)), new HotKeyListener() {
+ public void onHotKey(HotKey hotKey) {
+ shooter.toggle();
+ }
+ });
+ shooter.resetAndStart(shootDelay, shootCount);
+ }
+}
diff --git a/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/views/AssistantMainView.java b/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/views/AssistantMainView.java
new file mode 100755
index 0000000..5718e2b
--- /dev/null
+++ b/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/views/AssistantMainView.java
@@ -0,0 +1,46 @@
+package com.github.hronom.robocraft.assistant.app.views;
+
+import java.awt.*;
+import java.net.URL;
+import java.util.ArrayList;
+
+import javax.swing.*;
+
+public class AssistantMainView {
+ public AssistantMainView(ShootView shootView) {
+ JPanel mainPanel = new JPanel();
+ mainPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
+
+ GridBagLayout layout = new GridBagLayout();
+ mainPanel.setLayout(layout);
+
+ GridBagConstraints constraint = new GridBagConstraints();
+ constraint.insets = new Insets(3, 3, 3, 3);
+ constraint.weightx = 1;
+ constraint.weighty = 1;
+ constraint.gridx = 0;
+ constraint.gridy = 0;
+ constraint.gridwidth = 1;
+ constraint.gridheight = 1;
+ constraint.fill = GridBagConstraints.BOTH;
+ mainPanel.add(shootView, constraint);
+
+ ArrayList images = new ArrayList<>();
+ images.add(getImage("1461511403_robot_64.png"));
+
+ JFrame frame = new JFrame("Robocraft assistant");
+ frame.setIconImages(images);
+ frame.setContentPane(mainPanel);
+ frame.setPreferredSize(new Dimension(500, 150));
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.pack();
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+ }
+
+ private Image getImage(String fileName) {
+ URL url = this.getClass().getResource(fileName);
+ ImageIcon imageIcon = new ImageIcon(url);
+ return imageIcon.getImage();
+ }
+}
diff --git a/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/views/ShootView.java b/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/views/ShootView.java
new file mode 100755
index 0000000..8d4ce79
--- /dev/null
+++ b/robocraft-assistant-app/src/main/java/com/github/hronom/robocraft/assistant/app/views/ShootView.java
@@ -0,0 +1,146 @@
+package com.github.hronom.robocraft.assistant.app.views;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.awt.*;
+import java.awt.event.ActionListener;
+
+import javax.swing.*;
+import javax.swing.event.DocumentListener;
+
+public class ShootView extends JPanel {
+ private static final Logger logger = LogManager.getLogger();
+
+ private final JLabel shootDelayLabel;
+ private final JTextField shootDelayTextField;
+
+ private final JLabel shootCountLabel;
+ private final JTextField shootCountTextField;
+
+ private final JLabel keyLabel;
+ private final JTextField keyTextField;
+
+ private final JButton applySettingsButton;
+
+ public ShootView() {
+ this.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
+
+ GridBagLayout layout = new GridBagLayout();
+ this.setLayout(layout);
+
+ GridBagConstraints constraint = new GridBagConstraints();
+ constraint.insets = new Insets(3, 3, 3, 3);
+ constraint.weightx = 1;
+ constraint.weighty = 0;
+ constraint.gridwidth = 1;
+ constraint.anchor = GridBagConstraints.CENTER;
+
+ {
+ shootDelayLabel = new JLabel("Shoot delay:");
+
+ constraint.weightx = 0;
+ constraint.weighty = 0;
+ constraint.gridx = 0;
+ constraint.gridy = 0;
+ constraint.gridwidth = 1;
+ constraint.gridheight = 1;
+ constraint.fill = GridBagConstraints.BOTH;
+ this.add(shootDelayLabel, constraint);
+ }
+
+ {
+ shootDelayTextField = new JTextField("1000");
+
+ constraint.weightx = 1;
+ constraint.weighty = 0;
+ constraint.gridx = 1;
+ constraint.gridy = 0;
+ constraint.gridwidth = 1;
+ constraint.gridheight = 1;
+ constraint.fill = GridBagConstraints.BOTH;
+ this.add(shootDelayTextField, constraint);
+ }
+
+ {
+ shootCountLabel = new JLabel("Shoot count:");
+
+ constraint.weightx = 0;
+ constraint.weighty = 0;
+ constraint.gridx = 0;
+ constraint.gridy = 1;
+ constraint.gridwidth = 1;
+ constraint.gridheight = 1;
+ constraint.fill = GridBagConstraints.BOTH;
+ this.add(shootCountLabel, constraint);
+ }
+
+ {
+ shootCountTextField = new JTextField("5");
+
+ constraint.weightx = 1;
+ constraint.weighty = 0;
+ constraint.gridx = 1;
+ constraint.gridy = 1;
+ constraint.gridwidth = 1;
+ constraint.gridheight = 1;
+ constraint.fill = GridBagConstraints.BOTH;
+ this.add(shootCountTextField, constraint);
+ }
+
+ {
+ keyLabel = new JLabel("Key:");
+
+ constraint.weightx = 0;
+ constraint.weighty = 0;
+ constraint.gridx = 0;
+ constraint.gridy = 2;
+ constraint.gridwidth = 1;
+ constraint.gridheight = 1;
+ constraint.fill = GridBagConstraints.BOTH;
+ this.add(keyLabel, constraint);
+ }
+
+ {
+ keyTextField = new JTextField("R");
+
+ constraint.weightx = 1;
+ constraint.weighty = 0;
+ constraint.gridx = 1;
+ constraint.gridy = 2;
+ constraint.gridwidth = 1;
+ constraint.gridheight = 1;
+ constraint.fill = GridBagConstraints.BOTH;
+ this.add(keyTextField, constraint);
+ }
+
+ {
+ applySettingsButton = new JButton("Apply settings");
+
+ constraint.weightx = 1;
+ constraint.weighty = 0;
+ constraint.gridx = 0;
+ constraint.gridy = 3;
+ constraint.gridwidth = 2;
+ constraint.gridheight = 1;
+ constraint.fill = GridBagConstraints.BOTH;
+ this.add(applySettingsButton, constraint);
+ }
+ }
+
+ public String shootDelay() {
+ return shootDelayTextField.getText();
+ }
+
+ public String shootCount() {
+ return shootCountTextField.getText();
+ }
+
+ public String key() {
+ return keyTextField.getText();
+ }
+
+ public void addApplySettingsButtonActionListener(ActionListener actionListener) {
+ applySettingsButton.addActionListener(actionListener);
+ }
+}
diff --git a/robocraft-assistant-app/src/main/resources/com/github/hronom/robocraft/assistant/app/views/1461511403_robot_64.png b/robocraft-assistant-app/src/main/resources/com/github/hronom/robocraft/assistant/app/views/1461511403_robot_64.png
new file mode 100644
index 0000000..434f0a2
Binary files /dev/null and b/robocraft-assistant-app/src/main/resources/com/github/hronom/robocraft/assistant/app/views/1461511403_robot_64.png differ
diff --git a/robocraft-assistant-app/src/main/resources/log4j2.xml b/robocraft-assistant-app/src/main/resources/log4j2.xml
new file mode 100755
index 0000000..543f43e
--- /dev/null
+++ b/robocraft-assistant-app/src/main/resources/log4j2.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/robocraft-assistant-core/src/main/java/com/github/hronom/robocraft/assistant/core/Shooter.java b/robocraft-assistant-core/src/main/java/com/github/hronom/robocraft/assistant/core/Shooter.java
index d70627b..a5ee618 100755
--- a/robocraft-assistant-core/src/main/java/com/github/hronom/robocraft/assistant/core/Shooter.java
+++ b/robocraft-assistant-core/src/main/java/com/github/hronom/robocraft/assistant/core/Shooter.java
@@ -9,59 +9,49 @@
import javax.swing.*;
public class Shooter {
+ private final int mask = InputEvent.BUTTON1_DOWN_MASK;
+
private final AtomicBoolean enabled = new AtomicBoolean(false);
+ private int shootCount;
+
private final Robot robot;
+ private final Timer timer;
public Shooter() throws AWTException {
robot = new Robot();
- int delay = 1000; //milliseconds
- ActionListener taskPerformer = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (enabled.get()) {
- int mask = InputEvent.BUTTON1_DOWN_MASK;
-
- robot.mousePress(mask);
- robot.delay(10);
- robot.mouseRelease(mask);
-
- robot.delay(100);
-
- robot.mousePress(mask);
- robot.delay(10);
- robot.mouseRelease(mask);
-
- robot.delay(100);
-
- robot.mousePress(mask);
- robot.delay(10);
- robot.mouseRelease(mask);
-
- robot.delay(100);
-
- robot.mousePress(mask);
- robot.delay(10);
- robot.mouseRelease(mask);
+ ActionListener taskPerformer = createTaskPerformer();
+ timer = new Timer(-1, taskPerformer);
+ timer.setRepeats(true);
+ }
- robot.delay(100);
+ public void resetAndStart(int shootDelayArg, int shootCountArg) {
+ shootCount = shootCountArg;
+ timer.stop();
+ timer.setDelay(shootDelayArg);
+ timer.start();
+ }
- robot.mousePress(mask);
- robot.delay(10);
- robot.mouseRelease(mask);
+ public void toggle() {
+ enabled.set(!enabled.get());
+ }
- /*robot.delay(100);
+ private ActionListener createTaskPerformer() {
+ return new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (enabled.get()) {
+ for (int i = 0; i < shootCount; i++) {
+ robot.mousePress(mask);
+ robot.delay(10);
+ robot.mouseRelease(mask);
- robot.mousePress(mask);
- robot.delay(10);
- robot.mouseRelease(mask);*/
+ if (i + 1 != shootCount) {
+ robot.delay(100);
+ }
+ }
- //System.out.println("Shoot!!!");
+ System.out.println("Shoot!!!");
}
}
};
- new Timer(delay, taskPerformer).start();
- }
-
- public void toggle() {
- enabled.set(!enabled.get());
}
}