blob: 8a94f02df525dd1b2acf78a35a4e9bd2f9b6ea2f (
plain) (
blame)
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
|
package NET.worlds.scape;
import NET.worlds.console.Main;
import NET.worlds.console.MainCallback;
class WObjectHighlighter implements MainCallback {
private WObject target;
private Room room;
private boolean newState;
private boolean registered;
public WObjectHighlighter(WObject target) {
this.target = target;
this.start();
}
@Override
public synchronized void mainCallback() {
if (this.newState != this.target.getHighlit()) {
this.target.setHighlit(this.newState);
if (this.newState) {
this.room = this.target.getRoom();
if (this.room != null) {
this.room.highlightTarget = this.target;
}
} else if (this.room != null) {
this.room.highlightTarget = null;
this.room = null;
}
}
Main.unregister(this);
this.registered = false;
}
public synchronized void start() {
this.newState = true;
this.registerMe();
}
public synchronized void stop() {
this.newState = false;
this.registerMe();
}
private synchronized void registerMe() {
if (!this.registered) {
Main.register(this);
this.registered = true;
}
}
}
|