Teams
Wraps Minecraft teams into an object-oriented API:
The main benefit is that configuration stays grouped by team, which makes lobby setup, role assignment, and PvP rules much easier to read than a long list of raw team modify commands.
Teams can also act as a bridge to other OOP features. Once you have a Team handle, you can reuse its members as an entity selector for scoreboards, boss bars, or any API that already works with Entity.
They also integrate nicely with execute conditions and score tracking helpers, which makes it easy to express checks like “does this team still have this player?” or “how many players are still alive in this team?” without rebuilding selectors by hand.
Reusing a team in other OOP features
This keeps team-centric logic in one place: the same Team wrapper can drive visibility, score updates, and member management without rebuilding selectors manually.
Conditions and counters
This pattern is useful when several OOP systems need to exchange state. A Team can expose conditions for execute, while a ScoreboardEntity can cache the current member count or mirror that count into entity/storage NBT for later reuse by timers, events, or custom game rules.
Team functions
| Function | Description |
|---|---|
ensureExists |
Create the team if it doesn't exist |
delete |
Delete the team |
setDisplayName |
Set the team display name |
setPrefix / setSuffix |
Set name prefix/suffix |
setColor |
Set team color |
setFriendlyFire |
Toggle friendly fire |
setSeeFriendlyInvisibles |
Toggle seeing invisible teammates |
setCollisionRule |
Set collision rule |
setNametagVisibility |
Set nametag visibility |
setDeathMessageVisibility |
Set death message visibility |
addMembers |
Add entities to the team |
hasMembers |
Check if the team still has at least one member |
hasPlayer / hasMember |
Check if a specific player or entity is in the team |
hasScore |
Check a score range directly on the team selector |
members |
Reuse the team as an Entity selector |
clearMembers |
Remove every current team member |
Practical workflow
- Define the team once with its visual identity and gameplay rules.
- Add members when players join a role or side.
- Reuse
members()or higher-level helpers likebossBar.setPlayers(team)andscoreboard.getScore(team)when other features need to target that whole team. - Reuse
player.joinTeam(...)andplayer.leaveAnyTeam()in gameplay functions instead of raw selectors.
