diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-18 21:44:09 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-18 21:44:09 +0000 |
| commit | 34b16d2ffc7b40df933ba85ddb8e414121116ca5 (patch) | |
| tree | b7ba976bb34f9ec51acd10dca935b9a33d9e01f8 /sources/events/implementations/ProtocolEvent.java | |
| parent | ace76b508e2f6c1bc420112306ebee52f478de13 (diff) | |
new Task Manager works :-)
Diffstat (limited to 'sources/events/implementations/ProtocolEvent.java')
| -rw-r--r-- | sources/events/implementations/ProtocolEvent.java | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/sources/events/implementations/ProtocolEvent.java b/sources/events/implementations/ProtocolEvent.java index 096e9b6..d753978 100644 --- a/sources/events/implementations/ProtocolEvent.java +++ b/sources/events/implementations/ProtocolEvent.java @@ -2,9 +2,10 @@ package events.implementations; import core.VSProcess; import events.*; +import protocols.VSProtocol; public class ProtocolEvent extends VSEvent { - private String eventClassname; + private String protocolClassname; private boolean isClientProtocol; /* true = client, false = server */ private boolean isProtocolActivation; /* true = activate, false = deactivate */ @@ -28,24 +29,38 @@ public class ProtocolEvent extends VSEvent { return isProtocolActivation; } - public void setEventClassname(String eventClassname) { - this.eventClassname = eventClassname; + public void setProtocolClassname(String protocolClassname) { + this.protocolClassname = protocolClassname; } public void onStart() { - String type = isClientProtocol ? "client" : "server"; - String name = VSRegisteredEvents.getName(eventClassname); - process.setBoolean("sim."+name.toLowerCase()+"."+type+".enabled!", isProtocolActivation); + //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(eventClassname)); + 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()); } } |
