Package com.ohacd.matchbox.api.events
Class PhaseChangeEvent
java.lang.Object
com.ohacd.matchbox.api.MatchboxEvent
com.ohacd.matchbox.api.events.PhaseChangeEvent
Event fired when the game phase changes.
- Since:
- 0.9.5
-
Constructor Summary
ConstructorsConstructorDescriptionPhaseChangeEvent(@NotNull String sessionName, @NotNull com.ohacd.matchbox.game.utils.GamePhase fromPhase, @NotNull com.ohacd.matchbox.game.utils.GamePhase toPhase, int currentRound) Creates a new phase change event. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispatch(@NotNull MatchboxEventListener listener) Dispatches this event to the appropriate listener method.intGets the current round number.@NotNull com.ohacd.matchbox.game.utils.GamePhaseGets the previous game phase.@NotNull StringGets the name of the session where the phase changed.@NotNull com.ohacd.matchbox.game.utils.GamePhaseGets the new game phase.Methods inherited from class com.ohacd.matchbox.api.MatchboxEvent
getTimestamp, toString
-
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 namefromPhase- the previous phasetoPhase- the new phasecurrentRound- the current round number
-
-
Method Details
-
dispatch
Description copied from class:MatchboxEventDispatches 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:
dispatchin classMatchboxEvent- Parameters:
listener- the listener to dispatch to
-
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
-