Interface TeamService


public interface TeamService
Service for team-related queries within Zentrix games.

This service provides access to team information, membership, and team status queries.

Example Usage


 TeamService teamService = ZentrixProvider.get().getTeamService();

 // Check if two players are teammates
 if (teamService.areTeammates(player1, player2)) {
     // Don't allow friendly fire, etc.
 }

 // Get a player's team
 Optional<ZentrixTeam> team = teamService.getPlayerTeam(player);
 team.ifPresent(t -> {
     String teamName = t.getDisplayName();
     int aliveMembers = t.getAliveMemberCount();
 });
 
Since:
1.0.0
  • Method Details

    • getTeams

      @NotNull @NotNull Collection<ZentrixTeam> getTeams(@NotNull @NotNull ZentrixGame game)
      Gets all teams in a specific game.
      Parameters:
      game - The game
      Returns:
      An unmodifiable collection of teams (never null, may be empty)
    • getTeam

      @NotNull @NotNull Optional<ZentrixTeam> getTeam(@NotNull @NotNull ZentrixGame game, @NotNull @NotNull String teamId)
      Gets a team by its ID within a game.
      Parameters:
      game - The game
      teamId - The team ID (e.g., "team-1")
      Returns:
      Optional containing the team, or empty if not found
    • getPlayerTeam

      @NotNull @NotNull Optional<ZentrixTeam> getPlayerTeam(@NotNull @NotNull org.bukkit.entity.Player player)
      Gets the team a player belongs to.
      Parameters:
      player - The player
      Returns:
      Optional containing the team, or empty if not in a team
    • getPlayerTeam

      @NotNull @NotNull Optional<ZentrixTeam> getPlayerTeam(@NotNull @NotNull UUID playerId)
      Gets the team a player belongs to by UUID.
      Parameters:
      playerId - The player's UUID
      Returns:
      Optional containing the team, or empty if not in a team
    • getPlayerTeam

      @NotNull @NotNull Optional<ZentrixTeam> getPlayerTeam(@NotNull @NotNull ZentrixGame game, @NotNull @NotNull UUID playerId)
      Gets the team a player belongs to within a specific game.
      Parameters:
      game - The game
      playerId - The player's UUID
      Returns:
      Optional containing the team, or empty if not found
    • areTeammates

      boolean areTeammates(@NotNull @NotNull org.bukkit.entity.Player player1, @NotNull @NotNull org.bukkit.entity.Player player2)
      Checks if two players are on the same team.
      Parameters:
      player1 - First player
      player2 - Second player
      Returns:
      true if both players are on the same team
    • areTeammates

      boolean areTeammates(@NotNull @NotNull UUID playerId1, @NotNull @NotNull UUID playerId2)
      Checks if two players are on the same team by UUID.
      Parameters:
      playerId1 - First player's UUID
      playerId2 - Second player's UUID
      Returns:
      true if both players are on the same team
    • getAliveTeams

      @NotNull @NotNull Collection<ZentrixTeam> getAliveTeams(@NotNull @NotNull ZentrixGame game)
      Gets all alive teams in a game.

      A team is considered alive if it has at least one member who is still playing (not eliminated).

      Parameters:
      game - The game
      Returns:
      An unmodifiable collection of alive teams (never null)
    • getAliveTeamCount

      int getAliveTeamCount(@NotNull @NotNull ZentrixGame game)
      Gets the number of alive teams in a game.
      Parameters:
      game - The game
      Returns:
      The count of teams with at least one alive member
    • isTeamEliminated

      boolean isTeamEliminated(@NotNull @NotNull ZentrixGame game, @NotNull @NotNull ZentrixTeam team)
      Checks if a team is eliminated.

      A team is eliminated when all its members have been killed or left.

      Parameters:
      game - The game
      team - The team to check
      Returns:
      true if the team has no alive members
    • getTeammates

      @NotNull @NotNull Set<UUID> getTeammates(@NotNull @NotNull org.bukkit.entity.Player player)
      Gets the teammates of a player (excluding the player themselves).
      Parameters:
      player - The player
      Returns:
      Set of teammate UUIDs (never null, may be empty)
    • getTeammates

      @NotNull @NotNull Set<UUID> getTeammates(@NotNull @NotNull UUID playerId)
      Gets the teammates of a player by UUID.
      Parameters:
      playerId - The player's UUID
      Returns:
      Set of teammate UUIDs (never null, may be empty)
    • getAliveTeammates

      @NotNull @NotNull Set<UUID> getAliveTeammates(@NotNull @NotNull org.bukkit.entity.Player player)
      Gets alive teammates of a player (still in the game).
      Parameters:
      player - The player
      Returns:
      Set of alive teammate UUIDs (never null, may be empty)
    • getAliveTeammates

      @NotNull @NotNull Set<UUID> getAliveTeammates(@NotNull @NotNull UUID playerId)
      Gets alive teammates of a player by UUID.
      Parameters:
      playerId - The player's UUID
      Returns:
      Set of alive teammate UUIDs (never null, may be empty)
    • getWinningTeam

      @NotNull @NotNull Optional<ZentrixTeam> getWinningTeam(@NotNull @NotNull ZentrixGame game)
      Gets the winning team for a game.

      Returns the team if only one team remains alive.

      Parameters:
      game - The game
      Returns:
      Optional containing the winning team, or empty if no winner yet
    • getTeamMembers

      @NotNull @NotNull Collection<ZentrixPlayer> getTeamMembers(@NotNull @NotNull ZentrixTeam team)
      Gets all ZentrixPlayer members of a team.
      Parameters:
      team - The team
      Returns:
      An unmodifiable collection of team members (never null)
    • getAliveTeamMembers

      @NotNull @NotNull Collection<ZentrixPlayer> getAliveTeamMembers(@NotNull @NotNull ZentrixGame game, @NotNull @NotNull ZentrixTeam team)
      Gets alive ZentrixPlayer members of a team.
      Parameters:
      game - The game
      team - The team
      Returns:
      An unmodifiable collection of alive team members (never null)