Class PhaseChangeEvent

java.lang.Object
com.ohacd.matchbox.api.MatchboxEvent
com.ohacd.matchbox.api.events.PhaseChangeEvent

public class PhaseChangeEvent extends MatchboxEvent
Event fired when the game phase changes.
Since:
0.9.5
  • Constructor Details

    • PhaseChangeEvent

      public PhaseChangeEvent(@NotNull @NotNull String sessionName, @NotNull @NotNull com.ohacd.matchbox.game.utils.GamePhase fromPhase, @NotNull @NotNull com.ohacd.matchbox.game.utils.GamePhase toPhase, int currentRound)
      Creates a new phase change event.
      Parameters:
      sessionName - the session name
      fromPhase - the previous phase
      toPhase - the new phase
      currentRound - the current round number
  • Method Details

    • dispatch

      public void dispatch(@NotNull @NotNull MatchboxEventListener listener)
      Description copied from class: MatchboxEvent
      Dispatches this event to the appropriate listener method.

      This method uses the visitor pattern to call the correct handler method based on the concrete event type. Implementing classes should call super.dispatch(listener) as the first line.

      Specified by:
      dispatch in class MatchboxEvent
      Parameters:
      listener - the listener to dispatch to
    • getSessionName

      @NotNull public @NotNull String getSessionName()
      Gets the name of the session where the phase changed.
      Returns:
      the session name
    • getFromPhase

      @NotNull public @NotNull com.ohacd.matchbox.game.utils.GamePhase getFromPhase()
      Gets the previous game phase.
      Returns:
      the previous phase
    • getToPhase

      @NotNull public @NotNull com.ohacd.matchbox.game.utils.GamePhase getToPhase()
      Gets the new game phase.
      Returns:
      the new phase
    • getCurrentRound

      public int getCurrentRound()
      Gets the current round number.
      Returns:
      the current round