TeamHelper
com.jsmacrosce.jsmacros.client.api.helper.world.TeamHelper
Exposes a scoreboard team and its display, membership, color, and team-rule settings.
Obtain a team from a player entry or from ScoreboardsHelper.getTeams().
Team colors have distinct representations: getColorFormat() returns formatting,
getColorIndex() its index, getColorValue() its packed value (or -1 when unset), and getColorName() its name.
js
const board = World.getScoreboards();
if (board !== null) {
const teams = board.getTeams();
for (let i = 0; i !== teams.size(); i += 1) {
const team = teams.get(i);
Chat.log(`${team.getName()} is shown as ${team.getDisplayName().getString()}`);
Chat.log(` colour ${team.getColorName()}, value ${team.getColorValue()}`);
Chat.log(` ${team.getPlayerList().size()} members, prefix ${team.getPrefix()}`);
}
}
// and the team a particular player is on, which is null when they are on none
const entry = World.getPlayerEntry("Notch");
if (entry !== null) {
const team = entry.getTeam();
Chat.log(team === null ? "not in a team" : `on ${team.getName()}`);
}Constructors
new TeamHelper
new TeamHelper(PlayerTeam t)#Wraps the supplied raw scoreboard team without changing it.
Parameters:
t: raw scoreboard team to wrap
Methods
deathMessageVisibility
Returns the death-message visibility rule, configured separately from nametagVisibility().
Returns: this team's death message visibility rule.
getCollisionRule
getColorFormat
Returns the team's color formatting. An unset team color is represented by reset formatting; use getColorValue() to distinguish it from a set color.
Returns: the formatting of this team's color.
getColorIndex
Returns the team's color index, distinct from the packed value returned by getColorValue().
Returns: the color index of this team.
getColorName
getColorValue
Returns the packed color value, or
-1 when the team color has no packed value.Returns: the color value for this team or
-1 if it has no color.getDisplayName
Returns the team's display text, which may differ from getName().
Returns: the display name of this team.
getName
getPlayerList
getPrefix
Returns the text prepended to member names; it may be empty and may include formatting.
Returns: the prefix set on this team.
getScoreboard
Returns the scoreboard this team belongs to.
Returns: the scoreboard including this team.
getSuffix
Returns the text appended to member names; it may be empty and may include formatting.
Returns: the suffix set on this team.
isFriendlyFire
Returns the team's friendly-fire setting.
Returns:
true if members of this team can hurt each other.nametagVisibility
showFriendlyInvisibles
Returns whether team members can see other members while they are invisible.
Returns:
true if members of this team can see each other through invisibility.