Class TurnNotifier

java.lang.Object
games.stendhal.server.core.events.TurnNotifier

public final class TurnNotifier extends Object
Other classes can register here to be notified at some time in the future.
Author:
hendrik, daniel
  • Method Details

    • get

      public static TurnNotifier 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

      public void notifyInTurns(int diff, TurnListener turnListener)
      Notifies the turnListener in diff turns.
      Parameters:
      diff - the number of turns to wait before notifying
      turnListener - the object to notify
    • notifyInSeconds

      public void notifyInSeconds(int sec, TurnListener turnListener)
      Notifies the turnListener in sec seconds.
      Parameters:
      sec - the number of seconds to wait before notifying
      turnListener - the object to notify
    • notifyAtTurn

      public void notifyAtTurn(int turn, TurnListener turnListener)
      Notifies the turnListener at turn number turn.
      Parameters:
      turn - the number of the turn
      turnListener - the object to notify
    • dontNotify

      public void dontNotify(TurnListener turnListener)
      Forgets all registered notification entries for the given TurnListener where the entry's message equals the given one.
      Parameters:
      turnListener -
    • getRemainingTurns

      public int getRemainingTurns(TurnListener turnListener)
      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

      public int getRemainingSeconds(TurnListener turnListener)
      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

      public Map<Integer,​Set<TurnListener>> 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