Team (Entity Action Type)

Joins, leaves, creates, edits, empties or deletes a scoreboard team — the datapack equivalent of the /team command.

Joins, leaves, creates, edits, empties or deletes a scoreboard team — the datapack equivalent of the /team command.

Type ID: apoli:team

Type aliases: apoli:join_team (implies "operation": "join"), apoli:leave_team ("leave"), apoli:modify_team ("modify")

Fields

FieldTypeDefaultDescription
operationStringjoinWhat to do — see below.
teamTeamoptionalWhich team, and which properties to set. If omitted, the entity’s current team is used.
create_if_missingBooleantrueFor join and create, make the team if it does not exist yet.

Operations

OperationEffect
joinAdds the entity to the team. Any properties on team are applied to it first.
leaveRemoves the entity from whatever team it is on.
createMakes the team (if missing) and applies the properties, without joining it.
modifyApplies the properties to an existing team. Does nothing if the team does not exist.
emptyRemoves every member from the team.
deleteDeletes the team entirely.

Examples

Join a team, creating it with the right settings on first use:

{
  "type": "apoli:team",
  "operation": "join",
  "team": {
    "name": "vampires",
    "friendly_fire": false,
    "see_friendly_invisibles": true,
    "color": "dark_red"
  }
}

Leave on power loss:

{ "type": "apoli:leave_team" }

Turn off friendly fire on the team the holder is already on:

{
  "type": "apoli:modify_team",
  "team": { "friendly_fire": false }
}

!!! caution

Teams are server state shared by everyone. delete and empty affect all members, not just the entity running the action.