Class TurnNotifier
java.lang.Object
games.stendhal.server.core.events.TurnNotifier
Other classes can register here to be notified at some time in the future.
- Author:
- hendrik, daniel
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dontNotify(TurnListener turnListener)
Forgets all registered notification entries for the given TurnListener where the entry's message equals the given one.static TurnNotifier
get()
Return the TurnNotifier instance.int
Returns the current turn.Returns the list of events.int
getRemainingSeconds(TurnListener turnListener)
Finds out how many seconds will pass until the given TurnListener will be notified with the given message.int
getRemainingTurns(TurnListener turnListener)
Finds out how many turns will pass until the given TurnListener will be notified with the given message.void
logic(int currentTurn)
This method is invoked by StendhalRPRuleProcessor.endTurn().void
notifyAtTurn(int turn, TurnListener turnListener)
Notifies the turnListener at turn number turn.void
notifyInSeconds(int sec, TurnListener turnListener)
Notifies the turnListener in sec seconds.void
notifyInTurns(int diff, TurnListener turnListener)
Notifies the turnListener in diff turns.
-
Method Details
-
get
Return the TurnNotifier instance.- Returns:
- TurnNotifier the Singleton instance
-
logic
public void logic(int currentTurn)This method is invoked by StendhalRPRuleProcessor.endTurn().- Parameters:
currentTurn
- currentTurn
-
notifyInTurns
Notifies the turnListener in diff turns.- Parameters:
diff
- the number of turns to wait before notifyingturnListener
- the object to notify
-
notifyInSeconds
Notifies the turnListener in sec seconds.- Parameters:
sec
- the number of seconds to wait before notifyingturnListener
- the object to notify
-
notifyAtTurn
Notifies the turnListener at turn number turn.- Parameters:
turn
- the number of the turnturnListener
- the object to notify
-
dontNotify
Forgets all registered notification entries for the given TurnListener where the entry's message equals the given one.- Parameters:
turnListener
-
-
getRemainingTurns
Finds out how many turns will pass until the given TurnListener will be notified with the given message.- Parameters:
turnListener
-- Returns:
- the number of remaining turns, or -1 if the given TurnListener will not be notified with the given message.
-
getRemainingSeconds
Finds out how many seconds will pass until the given TurnListener will be notified with the given message.- Parameters:
turnListener
-- Returns:
- the number of remaining seconds, or -1 if the given TurnListener will not be notified with the given message.
-
getEventListForDebugging
Returns the list of events. Note this is only for debugging the TurnNotifier- Returns:
- eventList
-
getCurrentTurnForDebugging
public int getCurrentTurnForDebugging()Returns the current turn. Note this is only for debugging TurnNotifier- Returns:
- current turn
-