blob: d7539782a87c14fdb560a02d58b6c3554ca33f68 (
plain)
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
|
package events.implementations;
import core.VSProcess;
import events.*;
import protocols.VSProtocol;
public class ProtocolEvent extends VSEvent {
private String protocolClassname;
private boolean isClientProtocol; /* true = client, false = server */
private boolean isProtocolActivation; /* true = activate, false = deactivate */
protected void onInit() {
setClassname(getClass().toString());
}
public void isClientProtocol(boolean isClientProtocol) {
this.isClientProtocol = isClientProtocol;
}
public boolean isClientProtocol() {
return isClientProtocol;
}
public void isProtocolActivation(boolean isProtocolActivation) {
this.isProtocolActivation = isProtocolActivation;
}
public boolean isProtocolActivation() {
return isProtocolActivation;
}
public void setProtocolClassname(String protocolClassname) {
this.protocolClassname = protocolClassname;
}
public void onStart() {
//String type = isClientProtocol ? " Client!" : " Server!";
//process.setBoolean(protocolClassname + type, isProtocolActivation);
VSProtocol protocol;
if (!process.objectExists(protocolClassname)) {
protocol = (VSProtocol) VSRegisteredEvents.createEventInstanceByClassname(protocolClassname, process);
process.setObject(protocolClassname, protocol);
} else {
protocol = (VSProtocol) process.getObject(protocolClassname);
}
if (isClientProtocol)
protocol.isClient(isProtocolActivation);
else
protocol.isServer(isProtocolActivation);
StringBuffer buffer = new StringBuffer();
buffer.append(VSRegisteredEvents.getShortname(protocolClassname));
buffer.append(" ");
buffer.append(isClientProtocol
? prefs.getString("lang.client") : prefs.getString("lang.server"));
buffer.append(" ");
buffer.append(isProtocolActivation
? prefs.getString("lang.activated") : prefs.getString("lang.deactivated"));
logg(buffer.toString());
}
}
|