PowerMiner/src/DropperThread.java

45 lines
1.1 KiB
Java
Raw Permalink Normal View History

import java.awt.Point;
import java.io.IOException;
public class DropperThread implements Runnable {
Thread dropperThread;
Point clickLocation;
Cursor cursor;
2018-03-21 04:56:48 -04:00
CursorTask cursorTask;
2018-03-21 04:56:48 -04:00
public DropperThread(Point clickLocation, Cursor cursor, CursorTask cursorTask) {
this.clickLocation = clickLocation;
this.cursor = cursor;
2018-03-21 04:56:48 -04:00
this.cursorTask = cursorTask;
}
@Override
public void run() {
try {
2018-03-21 04:56:48 -04:00
cursor.moveAndRightlickAtCoordinatesWithRandomness(clickLocation, 15, 8);
Thread.sleep(Randomizer.nextGaussianWithinRange(30, 70));
cursorTask.hoverOverDropOption(cursor, clickLocation, 0);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//System.out.println("~~~~~~~~~~~~~ dropperThread finished!");
}
public void start() {
//System.out.println("dropperThread started");
if (dropperThread == null) {
dropperThread = new Thread(this, "dropperThread");
dropperThread.start();
}
}
public void waitTillDone() throws InterruptedException {
dropperThread.join();
}
}