GameStateChangeEvent
GameStateChangeEvent fires before Whack Me assigns a new game state.
Methods
Section titled “Methods”| Method | Return type | Description |
|---|---|---|
getOldState() | GameState | State still assigned during event dispatch. |
getNewState() | GameState | Requested destination. |
isCancelled() | boolean | Whether the transition will be prevented. |
setCancelled(boolean) | void | Retain the old state when true. |
getGame() | Game | Related live game. |
getArena() | Arena | Related arena. |
States are INACTIVE, WAITING, IN_GAME, ENDING, and RESTARTING.
Cancelling prevents the assignment and the destination state’s first tick.
@EventHandlerpublic void onStateChange(GameStateChangeEvent event) { if (event.getNewState() == GameState.IN_GAME && maintenanceArenas.contains(event.getArena().getId())) { event.setCancelled(true); }}