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
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
ConstructorsModifierConstructorDescriptionprotectedZentrixGameEvent(@NotNull ZentrixGame game) Constructs a new synchronous game event.protectedZentrixGameEvent(@NotNull ZentrixGame game, boolean isAsync) Constructs a new game event. -
Method Summary
Modifier and TypeMethodDescription@NotNull StringGets the arena name this game is running on.@NotNull ZentrixGamegetGame()Gets the game this event is associated with.@NotNull StringGets the unique identifier of the game.Gets the current game state.@NotNull StringGets the game type name (e.g., "solo", "duo", "squad").static @NotNull org.bukkit.event.HandlerListGets the static handler list for this event type.@NotNull org.bukkit.event.HandlerListGets the handler list for this event.intGets the current number of alive players in the game.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
ZentrixGameEvent
Constructs a new synchronous game event.- Parameters:
game- The game this event is associated with- Throws:
IllegalArgumentException- if game is null
-
ZentrixGameEvent
Constructs a new game event.- Parameters:
game- The game this event is associated withisAsync-trueif the event is fired asynchronously- Throws:
IllegalArgumentException- if game is null
-
-
Method Details
-
getGame
Gets the game this event is associated with.- Returns:
- The game instance (never null)
-
getGameId
Gets the unique identifier of the game.Convenience method equivalent to
getGame().getGameId().- Returns:
- The game ID (never null)
-
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
Gets the current game state.Convenience method equivalent to
getGame().getState().- Returns:
- The game state (never null)
-
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:
getHandlersin classZentrixEvent- 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
-