Class GameStartEvent

java.lang.Object
org.bukkit.event.Event

public class GameStartEvent extends ZentrixGameEvent
Called when a Zentrix game starts (transitions to PLAYING state).

This event is fired after all players have been teleported to the arena and the game officially begins. At this point:

  • All players are in the game world
  • Teams have been assigned
  • The first phase is about to start
  • Players are in survival mode

This event is NOT cancellable.

Example Usage


 @EventHandler
 public void onGameStart(GameStartEvent event) {
     ZentrixGame game = event.getGame();
     int players = event.getStartingPlayerCount();
     int teams = event.getStartingTeamCount();

     getLogger().info("Game started in " + event.getArenaName() +
                      " with " + players + " players in " + teams + " teams!");

     // Give all players a starting bonus
     for (ZentrixPlayer player : game.getPlayers()) {
         player.getBukkitPlayer().ifPresent(p -> {
             p.sendMessage("Good luck!");
         });
     }
 }
 
Since:
1.0.0
See Also:
  • Constructor Details

    • GameStartEvent

      public GameStartEvent(@NotNull @NotNull ZentrixGame game)
      Constructs a new GameStartEvent.
      Parameters:
      game - The game that is starting
  • Method Details

    • getStartingPlayerCount

      public int getStartingPlayerCount()
      Gets the number of players when the game started.

      This is the initial player count at game start, which may be different from the current count if players leave during the event.

      Returns:
      The starting player count
    • getStartingTeamCount

      public int getStartingTeamCount()
      Gets the number of teams when the game started.

      For solo games, this will equal the player count. For team games, this will be the number of formed teams.

      Returns:
      The starting team count
    • getTeams

      @NotNull public @NotNull Collection<ZentrixTeam> getTeams()
      Gets all teams in the game at start.

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

      Returns:
      An unmodifiable collection of teams
    • getMaxPlayers

      public int getMaxPlayers()
      Gets the maximum players allowed in this game.
      Returns:
      The maximum player count
    • getTeamSize

      public int getTeamSize()
      Gets the team size for this game type.
      Returns:
      The team size (1 for solo games)
    • isSoloGame

      public boolean isSoloGame()
      Checks if this is a solo game (team size of 1).
      Returns:
      true if this is a solo game
    • isTeamGame

      public boolean isTeamGame()
      Checks if this is a team game (team size greater than 1).
      Returns:
      true if this is a team game
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Gets the handler list for this event.
      Overrides:
      getHandlers in class ZentrixGameEvent
      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