Class AbstractOneTimeTrigger

java.lang.Object
megamek.server.trigger.AbstractOneTimeTrigger
All Implemented Interfaces:
Trigger
Direct Known Subclasses:
GameStartTrigger

public abstract class AbstractOneTimeTrigger extends Object implements Trigger
This is a base class for Triggers that should only ever react once, regardless of how often its prerequisites are satisfied.
  • Constructor Details

    • AbstractOneTimeTrigger

      public AbstractOneTimeTrigger()
  • Method Details

    • isTriggered

      public final boolean isTriggered(IGame game, TriggerSituation event)
      Description copied from interface: Trigger
      Returns true when this Trigger is triggered, i.e. if the prerequisites for its associated event are deemed to be satisfied. Note that the event is itself responsible for making sure that it only returns true once, if it should only trigger once. If it returns true on multiple occasions, the triggered event may happen multiple times. The given TriggerEvent specifies when at what moment of the game this method is called.
      Specified by:
      isTriggered in interface Trigger
      Parameters:
      game - The game
      event - The type of event that caused the trigger to be called
      Returns:
      True when this Trigger considers itself triggered, false otherwise
    • isTriggeredImpl

      protected abstract boolean isTriggeredImpl(IGame game, TriggerSituation event)
      Override this to define the trigger conditions as for Trigger.isTriggered(IGame, TriggerSituation). Regardless of how these are defined, this trigger will remember if it ever returned true before. If it did, it will not return true a second time, and it will not even call this method again.
      Parameters:
      event - The type of event that caused the trigger to be called
      Returns:
      True when this Trigger considers itself triggered, false otherwise
      See Also: