1 package cz.cuni.amis.pogamut.ut2004.teamcomm.bot;
2
3 import cz.cuni.amis.pogamut.base.communication.worldview.IWorldView;
4 import cz.cuni.amis.pogamut.base.communication.worldview.event.IWorldEventListener;
5 import cz.cuni.amis.pogamut.ut2004.teamcomm.server.protocol.messages.TCControlMessage;
6 import cz.cuni.amis.pogamut.ut2004.teamcomm.server.protocol.messages.TCControlServerAlive;
7
8
9
10
11
12
13
14
15
16
17
18 public class TCEvents {
19
20 protected boolean enabled = false;
21
22 protected IWorldView worldView;
23
24 protected IWorldEventListener<TCControlServerAlive> tcControlServerAliveListener = new IWorldEventListener<TCControlServerAlive>() {
25
26 @Override
27 public void notify(TCControlServerAlive event) {
28 tcControlServerAlive(event);
29 }
30
31 };
32
33 public TCEvents(IWorldView worldView) {
34 this.worldView = worldView;
35 }
36
37 public void enableTCEvents() {
38 if (enabled) return;
39 enabled = true;
40
41 worldView.addEventListener(TCControlServerAlive.class, tcControlServerAliveListener);
42 }
43
44 public void disableTCEvents() {
45 if (!enabled) return;
46 enabled = false;
47
48 worldView.removeEventListener(TCControlServerAlive.class, tcControlServerAliveListener);
49 }
50
51
52
53
54
55 public void tcControlServerAlive(TCControlServerAlive event) {
56 }
57
58 }