public class ExampleDaemon1 extends UserDefinedDaemon
Constructor and Description |
---|
ExampleDaemon1() |
Modifier and Type | Method and Description |
---|---|
void |
endDaemon()
Called by the framework when the daemon is shut down.
You can override this method to clean up after the daemon if needed. |
java.lang.String |
getName()
Called by the framework to get the name of the daemon.
You should override this method. |
boolean |
initDaemon()
Called by the framework to initialise the daemon.
You should override this method to make your own initialisation. |
void |
onEvent(EventIfc event)
This method is called for each posted event.
You can override this method to handle events. |
void |
onText(java.lang.String buffer,
java.lang.String text)
This method is called when new text has arrived from the game server.
You can override this method to handle incoming text. You must call setIncomingTextMode to enable this callback method.The current text buffer contains both the previous text and the new text that just arrived. |
void |
onTimer(java.util.Date time)
This method is called when the timer is triggered.
|
enableEvents, enableIncomingText, getClassName, getResource, postEvent, printTrace, printTrace, setBufferText, setTimer, setTimer, skipBufferText
public java.lang.String getName()
UserDefinedDaemon
getName
in class UserDefinedDaemon
public boolean initDaemon() throws java.lang.Exception
UserDefinedDaemon
initDaemon
in class UserDefinedDaemon
true
if the initialisation was successful,
otherwise false
.java.lang.Exception
UserDefinedDaemon.enableEvents()
,
UserDefinedDaemon.enableIncomingText()
,
UserDefinedDaemon.postEvent(com.swath.UserDefinedEvent)
,
UserDefinedDaemon.setTimer(java.util.Date)
,
UserDefinedDaemon.printTrace(java.lang.String)
,
UserDefinedDaemon.onTimer(java.util.Date)
,
UserDefinedDaemon.onText(java.lang.String, java.lang.String)
,
UserDefinedDaemon.onEvent(com.swath.EventIfc)
public void endDaemon() throws java.lang.Exception
UserDefinedDaemon
endDaemon
in class UserDefinedDaemon
java.lang.Exception
public void onEvent(EventIfc event) throws java.lang.Exception
UserDefinedDaemon
onEvent
in class UserDefinedDaemon
event
- The event.java.lang.Exception
UserDefinedDaemon.enableEvents()
,
UserDefinedDaemon.postEvent(com.swath.UserDefinedEvent)
,
UserDefinedDaemon.setTimer(java.util.Date)
,
UserDefinedDaemon.printTrace(java.lang.String)
public void onTimer(java.util.Date time) throws java.lang.Exception
UserDefinedDaemon
onTimer
in class UserDefinedDaemon
time
- The current time.java.lang.Exception
UserDefinedDaemon.postEvent(com.swath.UserDefinedEvent)
,
UserDefinedDaemon.setTimer(java.util.Date)
,
UserDefinedDaemon.printTrace(java.lang.String)
public void onText(java.lang.String buffer, java.lang.String text) throws java.lang.Exception
UserDefinedDaemon
setIncomingTextMode
to enable this callback method.skipBufferText
and setBufferText
methods.onText
in class UserDefinedDaemon
buffer
- The current text buffer.text
- The new incoming text.java.lang.Exception
UserDefinedDaemon.enableIncomingText()
,
UserDefinedDaemon.skipBufferText(int)
,
UserDefinedDaemon.setBufferText(java.lang.String)
,
UserDefinedDaemon.postEvent(com.swath.UserDefinedEvent)
,
UserDefinedDaemon.setTimer(java.util.Date)
,
UserDefinedDaemon.printTrace(java.lang.String)