Class TeamEliminatedEvent

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

public class TeamEliminatedEvent extends ZentrixGameEvent
Called when a team is eliminated from a Zentrix game.

This event is fired when all members of a team have been eliminated (killed or left the game). At this point:

  • All team members have been eliminated
  • The team is marked as eliminated
  • Remaining teams count has been updated
  • Win condition may be checked next

This event is NOT cancellable.

Example Usage


 @EventHandler
 public void onTeamEliminated(TeamEliminatedEvent event) {
     ZentrixTeam team = event.getTeam();
     ZentrixGame game = event.getGame();

     // Announce team elimination
     game.broadcast("&c" + team.getDisplayName() + " has been eliminated!");

     // Check remaining teams
     int remaining = event.getRemainingTeamCount();
     game.broadcast("&7" + remaining + " teams remain!");

     // Check if this triggers a win
     if (event.triggersWin()) {
         event.getWinningTeam().ifPresent(winner -> {
             game.broadcast("&6" + winner.getDisplayName() + " wins!");
         });
     }

     // Get the player who caused the final elimination
     event.getFinalKiller().ifPresent(killer -> {
         getLogger().info(killer.getName() + " got the final kill on " +
                          team.getDisplayName());
     });
 }
 
Since:
1.0.0
See Also:
  • Constructor Details

    • TeamEliminatedEvent

      public TeamEliminatedEvent(@NotNull @NotNull ZentrixGame game, @NotNull @NotNull ZentrixTeam team, @NotNull @NotNull ZentrixPlayer lastMemberEliminated, @Nullable @Nullable ZentrixPlayer finalKiller, @NotNull @NotNull Collection<ZentrixPlayer> teamMembers, int placement, int remainingTeamCount)
      Constructs a new TeamEliminatedEvent.
      Parameters:
      game - The game where the elimination occurred
      team - The team that was eliminated
      lastMemberEliminated - The last member of the team to be eliminated
      finalKiller - The player who killed the last team member (null if environmental)
      teamMembers - All members who were on this team
      placement - The team's final placement (e.g., 5th place = 5)
      remainingTeamCount - The number of teams still alive after this elimination
  • Method Details

    • getTeam

      @NotNull public @NotNull ZentrixTeam getTeam()
      Gets the team that was eliminated.
      Returns:
      The eliminated team (never null)
    • getTeamDisplayName

      @NotNull public @NotNull String getTeamDisplayName()
      Gets the team's display name.

      Convenience method equivalent to getTeam().getDisplayName().

      Returns:
      The team's display name (never null)
    • getTeamId

      @NotNull public @NotNull String getTeamId()
      Gets the team's ID.

      Convenience method equivalent to getTeam().getTeamId().

      Returns:
      The team ID (never null)
    • getTeamNumber

      public int getTeamNumber()
      Gets the team's number.

      Convenience method equivalent to getTeam().getTeamNumber().

      Returns:
      The team number
    • getLastMemberEliminated

      @NotNull public @NotNull ZentrixPlayer getLastMemberEliminated()
      Gets the last member of the team to be eliminated.

      This is the player whose death triggered the team elimination.

      Returns:
      The last eliminated member (never null)
    • getFinalKiller

      @NotNull public @NotNull Optional<ZentrixPlayer> getFinalKiller()
      Gets the player who killed the last team member.

      Returns empty if the last member died to environmental damage.

      Returns:
      Optional containing the killer, or empty if environmental death
    • hasFinalKiller

      public boolean hasFinalKiller()
      Checks if there was a killer for the final team member.
      Returns:
      true if the last member was killed by another player
    • getTeamMembers

      @NotNull public @NotNull Collection<ZentrixPlayer> getTeamMembers()
      Gets all members who were on this team.

      This includes all players who were assigned to this team during the game, regardless of when they were eliminated.

      Returns:
      An unmodifiable collection of team members (never null)
    • getTeamMemberCount

      public int getTeamMemberCount()
      Gets the number of members that were on this team.
      Returns:
      The team member count
    • getPlacement

      public int getPlacement()
      Gets the team's final placement.

      This is calculated based on when the team was eliminated relative to others. A placement of 1 means the team won, 2 means second place, etc.

      Returns:
      The placement (1-indexed, higher is worse)
    • getPlacementOrdinal

      @NotNull public @NotNull String getPlacementOrdinal()
      Gets the placement as an ordinal string.

      Examples: "1st", "2nd", "3rd", "4th", etc.

      Returns:
      The ordinal placement string (never null)
    • getRemainingTeamCount

      public int getRemainingTeamCount()
      Gets the number of teams still alive after this elimination.
      Returns:
      Remaining team count
    • triggersWin

      public boolean triggersWin()
      Checks if this elimination triggers a win condition.

      Returns true if only one team remains after this elimination.

      Returns:
      true if this elimination results in a winner
    • getWinningTeam

      @NotNull public @NotNull Optional<ZentrixTeam> getWinningTeam()
      Gets the winning team if this elimination triggers a win.

      Returns empty if there is no winner yet (more than one team remains).

      Returns:
      Optional containing the winning team, or empty if no winner yet
    • getTotalTeamKills

      public int getTotalTeamKills()
      Gets the total kills achieved by this team during the game.
      Returns:
      Total team kills
    • getTopKiller

      @NotNull public @NotNull Optional<ZentrixPlayer> getTopKiller()
      Gets the member with the most kills on this team.
      Returns:
      Optional containing the top killer, or empty if no kills
    • wasRunnerUp

      public boolean wasRunnerUp()
      Checks if this was the last team to be eliminated before the winner.

      Returns true if this team got second place (placement == 2).

      Returns:
      true if this team got second place
    • 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