> ## Documentation Index
> Fetch the complete documentation index at: https://velas.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating and Configuring Teams in VelaBoard

> Teams group players and entities under shared colors, prefixes, and gameplay rules. Learn how to create, configure, and manage them with the Team API.

Teams group players and entities under shared visual properties. By assigning players or entities to a team, you can control how their names appear in chat, whether they can damage each other, how their name tags display to other players, and what collision rules apply between them. Teams are managed through your `Scoreboard` instance.

## Creating and retrieving teams

Use `scoreboard.team(String name)` to create a team or retrieve an existing one by the same name. This is the primary way to work with teams — it is safe to call repeatedly with the same name.

```java theme={null}
Team redTeam = scoreboard.team("red");
```

If you only want to retrieve a team that already exists without creating one, use `getTeam(String name)`. It returns `null` if no team with that name exists:

```java theme={null}
Team existing = scoreboard.getTeam("red"); // null if not found
```

To check whether a team exists before acting on it:

```java theme={null}
if (scoreboard.hasTeam("red")) {
    // team exists
}
```

To find which team a player belongs to:

```java theme={null}
Team playerTeam = scoreboard.getTeamOf(player); // null if not on a team
```

## Team properties

Once you have a `Team` reference, you can configure its visual and gameplay properties. All setter methods return the `Team` instance, so you can chain them.

| Property                | Method                                        | Description                                                                                     |
| ----------------------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| Color                   | `setColor(TeamColor)`                         | Sets the team color used for name display. Choose from 16 `TeamColor` values.                   |
| Prefix                  | `setPrefix(String)`                           | Text prepended to each member's name in chat and above their head.                              |
| Suffix                  | `setSuffix(String)`                           | Text appended to each member's name in chat and above their head.                               |
| Friendly fire           | `setFriendlyFire(boolean)`                    | Controls whether teammates can damage each other.                                               |
| Friendly invisibilities | `setCanSeeFriendlyInvisibilities(boolean)`    | Controls whether invisible teammates are visible to other team members.                         |
| Collision rule          | `setTeamCollisionRule(TeamCollisionRule)`     | Sets entity collision behavior: `NEVER`, `FOR_OWN_TEAM`, `FOR_OTHER_TEAMS`, or `ALWAYS`.        |
| Name tag visibility     | `setNameTagVisibility(TeamNameTagVisibility)` | Controls who can see member name tags: `NEVER`, `FOR_OWN_TEAM`, `FOR_OTHER_TEAMS`, or `ALWAYS`. |

**`TeamColor` values:** `BLACK`, `DARK_BLUE`, `DARK_GREEN`, `DARK_AQUA`, `DARK_RED`, `DARK_PURPLE`, `GOLD`, `GRAY`, `DARK_GRAY`, `BLUE`, `GREEN`, `AQUA`, `RED`, `LIGHT_PURPLE`, `YELLOW`, `WHITE`

**`TeamCollisionRule` values:** `NEVER`, `FOR_OWN_TEAM`, `FOR_OTHER_TEAMS`, `ALWAYS`

**`TeamNameTagVisibility` values:** `NEVER`, `FOR_OWN_TEAM`, `FOR_OTHER_TEAMS`, `ALWAYS`

## Members

Add or remove players and entities from a team using the following methods:

| Method                 | Description                                   |
| ---------------------- | --------------------------------------------- |
| `addPlayer(Player)`    | Adds a player to the team.                    |
| `addEntity(Entity)`    | Adds a non-player entity to the team.         |
| `removePlayer(Player)` | Removes a player from the team.               |
| `removeEntity(Entity)` | Removes an entity from the team.              |
| `hasPlayer(Player)`    | Returns `true` if the player is on this team. |
| `hasEntity(Entity)`    | Returns `true` if the entity is on this team. |

## Fluent API

All `Team` setter methods return the `Team` instance, so you can chain configuration into a single expression. This is the recommended way to set up a team.

```java theme={null}
Team redTeam = scoreboard.team("red")
    .setColor(TeamColor.RED)
    .setPrefix("§c[Red] ")
    .setFriendlyFire(false)
    .setTeamCollisionRule(TeamCollisionRule.FOR_OWN_TEAM)
    .setNameTagVisibility(TeamNameTagVisibility.ALWAYS)
    .addPlayer(player);
```

You can continue to call setter methods on the team later — for example, to update the prefix when a player's rank changes:

```java theme={null}
scoreboard.getTeam("red").setPrefix("§c[Captain] ");
```

To remove a team entirely, call `removeTeam(String name)` on the scoreboard. To remove all teams at once, use `clearTeams()`:

```java theme={null}
scoreboard.removeTeam("red");
scoreboard.clearTeams();
```
