Record Class SpecificRoundEndTrigger

java.lang.Object
java.lang.Record
megamek.server.trigger.SpecificRoundEndTrigger
All Implemented Interfaces:
Trigger

public record SpecificRoundEndTrigger(int gameRound) extends Record implements Trigger
This Trigger reacts at the end of the specified game round. This is more or less the same as a RoundStartTrigger of the following round, but this can be used to trigger something without actually entering the following round just yet (e.g. ending the game at the end of round 10 instead of at the beginning of round 11). Note that this Trigger can react multiple times!
  • Constructor Summary

    Constructors
    Constructor
    Description
    SpecificRoundEndTrigger(int gameRound)
    Creates an instance of a SpecificRoundEndTrigger record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the value of the gameRound record component.
    final int
    Returns a hash code value for this object.
    boolean
    Returns true when this Trigger is triggered, i.e.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SpecificRoundEndTrigger

      public SpecificRoundEndTrigger(int gameRound)
      Creates an instance of a SpecificRoundEndTrigger record class.
      Parameters:
      gameRound - the value for the gameRound record component
  • Method Details

    • isTriggered

      public 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
    • toString

      @Nonnull public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • gameRound

      public int gameRound()
      Returns the value of the gameRound record component.
      Returns:
      the value of the gameRound record component