forked from konatakun/powerbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScript.java
81 lines (73 loc) · 1.82 KB
/
Script.java
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package org.powerbot.script;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.EventListener;
import java.util.List;
/**
* Script
* The base interface of a script.
*/
public interface Script extends EventListener {
/**
* Returns the execution queue.
*
* @param state the state being invoked
* @return a sequence of {@link java.lang.Runnable} items to process
*/
List<Runnable> getExecQueue(State state);
/**
* State
* All possible runtime states for a script.
*/
enum State {
START, SUSPEND, RESUME, STOP
}
/**
* Controller
* A controller for a {@link Script} which invokes and determines state changes.
*/
interface Controller extends Suspendable, Stoppable {
/**
* Adds a {@link java.lang.Runnable} to the executor.
*
* @param e a runnable to be executed
* @return {@code true} if the runnable was added, otherwise {@code false}
*/
boolean offer(Runnable e);
/**
* Returns the primary {@link org.powerbot.script.AbstractScript} running with this {@link org.powerbot.script.Script.Controller}.
*
* @return the primary {@link org.powerbot.script.AbstractScript}
*/
AbstractScript script();
}
/**
* Manifest
* A {@link Script} descriptor.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@interface Manifest {
/**
* The human-friendly name.
*
* @return the name
*/
String name();
/**
* The description, which should be 140 characters or less.
*
* @return the description
*/
String description();
/**
* A series of key=value pairs separated by semicolons (;) or newlines,
* e.g. {@code "hidden=true;topic=1234"}.
*
* @return the properties
*/
String properties() default "";
}
}