|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface EventHandler<P extends AbstractPlayer,S extends AbstractSession>
Implementors of the EventHandler
interface are responsible
for handling game events that are caused by the session itself and by
clients connected to the session. This interface extends the
Runnable
interface, and should contain a loop that runs
continously thoughout a game, generating events.
In addition, whenever external game events occur, these should be handled in
the implementation of this interface.
Method Summary | |
---|---|
void |
checkSettings()
A method that should be called by the thread itself continuously. |
void |
fireEventOccured(P player,
Event event,
java.lang.Object[] values)
Method that should be called whenever an external game event occurs. |
boolean |
isReady()
Method that ensures that the thread can perform pre-game calculations before the game is initiated. |
void |
setSession(S session)
Sets the session to which this thread is assigned. |
void |
stop()
Called when a game is over, and the thread should be stopped. |
Methods inherited from interface java.lang.Runnable |
---|
run |
Method Detail |
---|
void setSession(S session)
session
- The owner of this thread.void fireEventOccured(P player, Event event, java.lang.Object[] values)
player
- The player that caused the event.event
- The event.values
- The values related to the event.void checkSettings()
void stop()
boolean isReady()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |