# ILeadAPI > Main API interface for interacting with the Lead team system. `gg.lode.leadapi.ILeadAPI` --- ## Signature ```java public interface ILeadAPI ``` --- ## Methods ### save ```java void save() ``` Saves all team data to persistent storage. --- ### getTeam (by UUID) ```java @Nullable ITeam getTeam(UUID member) ``` Retrieves the team that a player belongs to. | Parameter | Type | Description | |---|---|---| | `member` | `UUID` | The player's unique ID. | **Returns:** `ITeam` — The player's team, or `null` if the player is not on any team. --- ### getTeam (by name) ```java @Nullable ITeam getTeam(String name) ``` Retrieves a team by its name/ID string. | Parameter | Type | Description | |---|---|---| | `name` | `String` | The team's name or ID. | **Returns:** `ITeam` — The matching team, or `null` if not found. --- ### getTeams ```java List<ITeam> getTeams() ``` Retrieves all currently registered teams. **Returns:** `List<ITeam>` — All teams. --- ### hasTeam ```java boolean hasTeam(UUID member) ``` Checks whether a player is currently on a team. | Parameter | Type | Description | |---|---|---| | `member` | `UUID` | The player's unique ID. | **Returns:** `boolean` — `true` if the player is on a team. --- ### update ```java void update() ``` Updates internal state (scoreboards, TAB integration, etc.). --- ### createTeamWithUniqueColor ```java ITeam createTeamWithUniqueColor(Player player, String id, String name) throws MaxTeamLimitException, TeamAlreadyExistsException ``` Creates a team with an automatically assigned unique color. The player becomes the leader. | Parameter | Type | Description | |---|---|---| | `player` | `Player` | The player who will lead the team. | | `id` | `String` | The team's string ID. | | `name` | `String` | The team's display name. | **Returns:** `ITeam` — The newly created team. **Throws:** - [[MaxTeamLimitException]] — When the maximum team limit has been reached. - [[TeamAlreadyExistsException]] — When a team with the given ID already exists. --- ### createTeamByType (with name) ```java ITeam createTeamByType(Player player, String name, GeneratorType generatorType) throws MaxTeamLimitException, TeamAlreadyExistsException ``` Creates a team using a specific generator type to determine the team's identity. The player becomes the leader. | Parameter | Type | Description | |---|---|---| | `player` | `Player` | The player who will lead the team. | | `name` | `String` | The team's display name. | | `generatorType` | `GeneratorType` | The strategy for generating the team's identifier. | **Returns:** `ITeam` — The newly created team. **Throws:** - [[MaxTeamLimitException]] — When the maximum team limit has been reached. - [[TeamAlreadyExistsException]] — When a team with the generated ID already exists. --- ### createTeamByType (auto-named) ```java ITeam createTeamByType(Player player, GeneratorType teamType) throws MaxTeamLimitException, TeamAlreadyExistsException ``` Creates a team using a specific generator type. The team name/ID is auto-generated. The player becomes the leader. | Parameter | Type | Description | |---|---|---| | `player` | `Player` | The player who will lead the team. | | `teamType` | `GeneratorType` | The strategy for generating the team's identifier. | **Returns:** `ITeam` — The newly created team. **Throws:** - [[MaxTeamLimitException]] — When the maximum team limit has been reached. - [[TeamAlreadyExistsException]] — When a team with the generated ID already exists. --- ### createTeamByColor ```java ITeam createTeamByColor(String id, UUID leader, String color) throws TeamAlreadyExistsException ``` Creates a team with a specific ID, leader, and hex color. | Parameter | Type | Description | |---|---|---| | `id` | `String` | The team's string ID. | | `leader` | `UUID` | The leader's unique ID. | | `color` | `String` | The team's hex color (e.g., `"#FF0000"`). | **Returns:** `ITeam` — The newly created team. **Throws:** [[TeamAlreadyExistsException]] — When a team with the given ID already exists. --- ### createTeamById ```java ITeam createTeamById(String id) throws TeamAlreadyExistsException ``` Creates a team with only an ID (no leader assigned). | Parameter | Type | Description | |---|---|---| | `id` | `String` | The team's string ID. | **Returns:** `ITeam` — The newly created team. **Throws:** [[TeamAlreadyExistsException]] — When a team with the given ID already exists. --- ### createTeamWithLeader ```java ITeam createTeamWithLeader(String id, UUID leader) throws TeamAlreadyExistsException ``` Creates a team with a specific ID and leader. | Parameter | Type | Description | |---|---|---| | `id` | `String` | The team's string ID. | | `leader` | `UUID` | The leader's unique ID. | **Returns:** `ITeam` — The newly created team. **Throws:** [[TeamAlreadyExistsException]] — When a team with the given ID already exists. --- ### deleteTeam (by ITeam) ```java ITeam deleteTeam(ITeam team) ``` Deletes the given team. | Parameter | Type | Description | |---|---|---| | `team` | `ITeam` | The team to delete. | **Returns:** `ITeam` — The deleted team. --- ### deleteTeam (by ID) ```java ITeam deleteTeam(String id) throws TeamNotFoundException ``` Deletes a team by its ID string. | Parameter | Type | Description | |---|---|---| | `id` | `String` | The team's string ID. | **Returns:** `ITeam` — The deleted team. **Throws:** [[TeamNotFoundException]] — When no team with the given ID exists. --- ### removePlayerFromTeam ```java void removePlayerFromTeam(ITeam team, UUID player) ``` Removes a specific player from the given team. | Parameter | Type | Description | |---|---|---| | `team` | `ITeam` | The team to remove the player from. | | `player` | `UUID` | The player's unique ID. | --- ### getAvailableTeamNumber ```java String getAvailableTeamNumber() ``` Returns the next available team number as a string (for auto-numbering teams). **Returns:** `String` — The next available number. --- ## Related Pages - [[LeadAPI]] — Static accessor for the `ILeadAPI` instance - [[ITeam]] — Team interface returned by most methods - [[GeneratorType]] — Generator strategies used in `createTeamByType` - [[MaxTeamLimitException]] — Thrown when team limit is reached - [[TeamAlreadyExistsException]] — Thrown when a duplicate team ID is used - [[TeamNotFoundException]] — Thrown when a team ID is not found