Package megamek.server.trigger
Class AbstractOneTimeTrigger
java.lang.Object
megamek.server.trigger.AbstractOneTimeTrigger
- All Implemented Interfaces:
Trigger
- Direct Known Subclasses:
GameStartTrigger
This is a base class for Triggers that should only ever react once, regardless of how often its prerequisites are
satisfied.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanisTriggered(IGame game, TriggerSituation event) Returns true when this Trigger is triggered, i.e.protected abstract booleanisTriggeredImpl(IGame game, TriggerSituation event) Override this to define the trigger conditions as forTrigger.isTriggered(IGame, TriggerSituation).
-
Constructor Details
-
AbstractOneTimeTrigger
public AbstractOneTimeTrigger()
-
-
Method Details
-
isTriggered
Description copied from interface:TriggerReturns 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:
isTriggeredin interfaceTrigger- Parameters:
game- The gameevent- The type of event that caused the trigger to be called- Returns:
- True when this Trigger considers itself triggered, false otherwise
-
isTriggeredImpl
Override this to define the trigger conditions as forTrigger.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:
-