-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLog.java
More file actions
48 lines (36 loc) · 1.16 KB
/
Log.java
File metadata and controls
48 lines (36 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.awt.Point;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.input.Mouse;
import org.parabot.environment.scripts.framework.SleepCondition;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.SceneObjects;
public class Log implements Strategy {
public boolean activate() {
if (isLoggedIn()) {
System.out.println("Log check passed...");
return false;
}
System.out.println("Logging In....");
return true;
}
/***************************************************************************************************************************************/
public void execute() {
Point login = new Point(452,280);
Mouse.getInstance().click(login);
Time.sleep(new SleepCondition() {
@Override
public boolean isValid() {
return isLoggedIn();
}
}, 2000);
}
/***************************************************************************************************************************************/
public static boolean isLoggedIn() {
try {
return SceneObjects.getNearest().length > 0;
} catch(IllegalArgumentException e) {
// catch
}
return false;
}
}