Package net.minestom.server.scoreboard
Class Team
java.lang.Object
net.minestom.server.scoreboard.Team
public class Team
extends java.lang.Object
This object represents a team on a scoreboard that has a common display theme and other properties.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Team(java.lang.String teamName)
Default constructor to creates a team. -
Method Summary
Modifier and Type Method Description void
addMember(java.lang.String member)
Adds a member to theTeam
.TeamsPacket
createTeamDestructionPacket()
Creates an destruction packet to remove the team.TeamsPacket
createTeamsCreationPacket()
Creates the creation packet to add a team.TeamsPacket.CollisionRule
getCollisionRule()
Gets the collision rule of the team.java.lang.String[]
getEntities()
byte
getFriendlyFlags()
Gets the friendly flags of the team.java.util.Set<java.lang.String>
getMembers()
Obtains an unmodifiableSet
of registered players who are on the team.TeamsPacket.NameTagVisibility
getNameTagVisibility()
Gets the tag visibility of the team.ColoredText
getPrefix()
Gets the prefix of the team.ColoredText
getSuffix()
Gets the suffix of the team.ChatColor
getTeamColor()
Gets the color of the team.ColoredText
getTeamDisplayName()
Gets the display name of the team.java.lang.String
getTeamName()
Gets the registry name of the team.void
removeMember(java.lang.String member)
Removes a member from theTeam
.void
sendUpdatePacket()
Sends anTeamsPacket.Action.UPDATE_TEAM_INFO
packet.void
setCollisionRule(TeamsPacket.CollisionRule rule)
Changes theTeamsPacket.CollisionRule
of the team.void
setFriendlyFlags(byte flag)
Changes the friendly flags of the team.void
setNameTagVisibility(TeamsPacket.NameTagVisibility visibility)
Changes theTeamsPacket.NameTagVisibility
of the team.void
setPrefix(ColoredText prefix)
Changes the prefix of the team.void
setSuffix(ColoredText suffix)
Changes the suffix of the team.void
setTeamColor(ChatColor color)
Changes the color of the team.void
setTeamDisplayName(ColoredText teamDisplayName)
Changes the display name of the team.void
updateCollisionRule(TeamsPacket.CollisionRule collisionRule)
Changes the collision rule of the team and sends an update packet.void
updateFriendlyFlags(byte flag)
Changes the friendly flags of the team and sends an update packet.void
updateNameTagVisibility(TeamsPacket.NameTagVisibility nameTagVisibility)
Changes theTeamsPacket.NameTagVisibility
of the team and sends an update packet.void
updatePrefix(ColoredText prefix)
Changes the prefix of the team and sends an update packet.void
updateSuffix(ColoredText suffix)
Changes the suffix of the team and sends an update packet.void
updateTeamColor(ChatColor teamColor)
Changes the color of the team and sends an update packet.void
updateTeamDisplayName(ColoredText teamDisplayName)
Changes the display name of the team and sends an update packet.
-
Constructor Details
-
Team
protected Team(java.lang.String teamName)Default constructor to creates a team.- Parameters:
teamName
- The registry name for the team
-
-
Method Details
-
addMember
public void addMember(java.lang.String member)- Parameters:
member
- The member to be added
-
removeMember
public void removeMember(java.lang.String member)Removes a member from theTeam
.- Parameters:
member
- The member to be removed
-
setTeamDisplayName
Changes the display name of the team.
Warning: This is only changed on the server side.- Parameters:
teamDisplayName
- The new display name
-
updateTeamDisplayName
Changes the display name of the team and sends an update packet.- Parameters:
teamDisplayName
- The new display name
-
setNameTagVisibility
Changes theTeamsPacket.NameTagVisibility
of the team.
Warning: This is only changed on the server side.- Parameters:
visibility
- The new tag visibility
-
updateNameTagVisibility
Changes theTeamsPacket.NameTagVisibility
of the team and sends an update packet.- Parameters:
nameTagVisibility
- The new tag visibility
-
setCollisionRule
Changes theTeamsPacket.CollisionRule
of the team.
Warning: This is only changed on the server side.- Parameters:
rule
- The new rule
-
updateCollisionRule
Changes the collision rule of the team and sends an update packet.- Parameters:
collisionRule
- The new collision rule
-
setTeamColor
Changes the color of the team.
Warning: This is only changed on the server side.- Parameters:
color
- The new team color
-
updateTeamColor
Changes the color of the team and sends an update packet.- Parameters:
teamColor
- The new team color
-
setPrefix
Changes the prefix of the team.
Warning: This is only changed on the server side.- Parameters:
prefix
- The new prefix
-
updatePrefix
Changes the prefix of the team and sends an update packet.- Parameters:
prefix
- The new prefix
-
setSuffix
Changes the suffix of the team.
Warning: This is only changed on the server side.- Parameters:
suffix
- The new suffix
-
updateSuffix
Changes the suffix of the team and sends an update packet.- Parameters:
suffix
- The new suffix
-
setFriendlyFlags
public void setFriendlyFlags(byte flag)Changes the friendly flags of the team.
Warning: This is only changed on the server side.- Parameters:
flag
- The new friendly flag
-
updateFriendlyFlags
public void updateFriendlyFlags(byte flag)Changes the friendly flags of the team and sends an update packet.- Parameters:
flag
- The new friendly flag
-
getTeamName
public java.lang.String getTeamName()Gets the registry name of the team.- Returns:
- the registry name
-
createTeamsCreationPacket
Creates the creation packet to add a team.- Returns:
- the packet to add the team
-
createTeamDestructionPacket
Creates an destruction packet to remove the team.- Returns:
- the packet to remove the team
-
getMembers
public java.util.Set<java.lang.String> getMembers()Obtains an unmodifiableSet
of registered players who are on the team.- Returns:
- an unmodifiable
Set
of registered players
-
getTeamDisplayName
Gets the display name of the team.- Returns:
- the display name
-
getFriendlyFlags
public byte getFriendlyFlags()Gets the friendly flags of the team.- Returns:
- the friendly flags
-
getNameTagVisibility
Gets the tag visibility of the team.- Returns:
- the tag visibility
-
getCollisionRule
Gets the collision rule of the team.- Returns:
- the collision rule
-
getTeamColor
Gets the color of the team.- Returns:
- the team color
-
getPrefix
Gets the prefix of the team.- Returns:
- the team prefix
-
getSuffix
Gets the suffix of the team.- Returns:
- the suffix team
-
getEntities
public java.lang.String[] getEntities() -
sendUpdatePacket
public void sendUpdatePacket()Sends anTeamsPacket.Action.UPDATE_TEAM_INFO
packet.
-