Added scarpet team functions (#569)

* Added team functions

* Docs for team functions

* Added team functions to editor keywords

* Added static method getPlayerNameByValue to EntityValue (also works with non existing players

Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
This commit is contained in:
replaceitemandgnembon authored and GitHub committed 2020-11-26 02:59:23 -04:00
1 parent 1fb4209a15
commit 210b0fc8ea
6 files changed
+357 -1

No files matched your search

+76 -1
View File
@@ -27,5 +27,80 @@ for the objective.
### `scoreboard_display(place, objective)`
sets display location for a specified `objective`. If `objective` is `null`, then display is cleared. If objective is invalid,
Sets display location for a specified `objective`. If `objective` is `null`, then display is cleared. If objective is invalid,
returns `null`.
# Team
### `team_list()`, `team_list(team)`
Returns all available teams as a list with no arguments.
When a `team` is specified, it returns all the players inside that team. If the `team` is invalid, returns `null`.
### `team_add(team)`, `team_add(team,player)`
With one argument, creates a new `team` and returns its name if successful, or `null` if team already exists.
`team_add('admin')` -> Create a team with the name 'admin'
`team_add('admin','Steve')` -> Joing the player 'Steve' into the team 'admin'
If a `player` is specified, the player will join the given `team`. Returns `true` if player joined the team, or `false` if nothing changed since the player was already in this team. If the team is invalid, returns `null`
### `team_remove(team)`
Removes a `team`. Returns `true` if the team was deleted, or `null` if the team is invalid.
### `team_leave(player)`
Removes the `player` from the team he is in. Returns `true` if the player left a team, otherwise `false`.
`team_leave('Steve')` -> Removes Steve from the team he is currently in
`for(team_list('admin'), team_leave('admin', _))` -> Remove all players from team 'admin'
### `team_property(team,property,value?)`
Reads the `property` of the `team` if no `value` is specified. If a `value` is added as a third argument, it sets the `property` to that `value`.
* `collisionRule`
* Type: String
* Options: always, never, pushOtherTeams, pushOwnTeam
* `color`
* Type: String
* Options: See [team command](https://minecraft.gamepedia.com/Commands/team#Arguments) (same strings as `'teamcolor'` [command argument](https://github.com/gnembon/fabric-carpet/blob/master/docs/scarpet/Full.md#command-argument-types] options))
* `displayName`
* Type: String or FormattedText, when querying returns FormattedText
* `prefix`
* Type: String or FormattedText, when querying returns FormattedText
* `suffix`
* Type: String or FormattedText, when querying returns FormattedText
* `friendlyFire`
* Type: boolean
* `seeFriendlyInvisibles`
* Type: boolean
* `nametagVisibility`
* Type: String
* Options: always, never, hideForOtherTeams, hideForOwnTeam
* `deathMessageVisibility`
* Type: String
* Options: always, never, hideForOtherTeams, hideForOwnTeam
Examples:
```
team_property('admin','color','dark_red') Make the team color for team 'admin' dark red
team_property('admin','prefix',format('r Admin | ')) Set prefix of all players in 'admin'
team_property('admin','display_name','Administrators') Set display name for team 'admin'
team_property('admin','seeFriendlyInvisibles',true) Make all players in 'admin' see other admins even when invisible
team_property('admin','deathMessageVisibility','hideForOtherTeams') Make all players in 'admin' see other admins even when invisible
```