Class ZentrixGameEvent

java.lang.Object
org.bukkit.event.Event
dev.itsharshxd.zentrix.api.events.ZentrixEvent
dev.itsharshxd.zentrix.api.events.ZentrixGameEvent
Direct Known Subclasses:
GameEndEvent, GamePhaseChangeEvent, GameStartEvent, PlayerDeathGameEvent, PlayerJoinGameEvent, PlayerKillEvent, PlayerLeaveGameEvent, TeamEliminatedEvent

public abstract class ZentrixGameEvent extends ZentrixEvent
Base class for all Zentrix events that are associated with a specific game.

This class provides common functionality for events that occur within the context of a Zentrix game, such as game lifecycle events, player events within games, and team events.

Example Usage


 @EventHandler
 public void onAnyGameEvent(ZentrixGameEvent event) {
     ZentrixGame game = event.getGame();
     String arenaName = event.getArenaName();
     int playerCount = event.getPlayerCount();

     getLogger().info("Event in arena " + arenaName + " with " + playerCount + " players");
 }
 
Since:
1.0.0
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructs a new synchronous game event.
    protected
    ZentrixGameEvent(@NotNull ZentrixGame game, boolean isAsync)
    Constructs a new game event.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull String
    Gets the arena name this game is running on.
    @NotNull ZentrixGame
    Gets the game this event is associated with.
    @NotNull String
    Gets the unique identifier of the game.
    Gets the current game state.
    @NotNull String
    Gets the game type name (e.g., "solo", "duo", "squad").
    static @NotNull org.bukkit.event.HandlerList
    Gets the static handler list for this event type.
    @NotNull org.bukkit.event.HandlerList
    Gets the handler list for this event.
    int
    Gets the current number of alive players in the game.

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ZentrixGameEvent

      protected ZentrixGameEvent(@NotNull @NotNull ZentrixGame game)
      Constructs a new synchronous game event.
      Parameters:
      game - The game this event is associated with
      Throws:
      IllegalArgumentException - if game is null
    • ZentrixGameEvent

      protected ZentrixGameEvent(@NotNull @NotNull ZentrixGame game, boolean isAsync)
      Constructs a new game event.
      Parameters:
      game - The game this event is associated with
      isAsync - true if the event is fired asynchronously
      Throws:
      IllegalArgumentException - if game is null
  • Method Details

    • getGame

      @NotNull public @NotNull ZentrixGame getGame()
      Gets the game this event is associated with.
      Returns:
      The game instance (never null)
    • getGameId

      @NotNull public @NotNull String getGameId()
      Gets the unique identifier of the game.

      Convenience method equivalent to getGame().getGameId().

      Returns:
      The game ID (never null)
    • getArenaName

      @NotNull public @NotNull String getArenaName()
      Gets the arena name this game is running on.

      Convenience method equivalent to getGame().getArenaName().

      Returns:
      The arena name (never null)
    • getPlayerCount

      public int getPlayerCount()
      Gets the current number of alive players in the game.

      Convenience method equivalent to getGame().getPlayerCount().

      Returns:
      The player count
    • getGameState

      @NotNull public ZentrixGame.GameState getGameState()
      Gets the current game state.

      Convenience method equivalent to getGame().getState().

      Returns:
      The game state (never null)
    • getGameTypeName

      @NotNull public @NotNull String getGameTypeName()
      Gets the game type name (e.g., "solo", "duo", "squad").

      Convenience method equivalent to getGame().getGameTypeName().

      Returns:
      The game type name (never null)
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Gets the handler list for this event.
      Overrides:
      getHandlers in class ZentrixEvent
      Returns:
      The handler list
    • getHandlerList

      @NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()
      Gets the static handler list for this event type.
      Returns:
      The handler list