java.lang.Object
net.minestom.server.scoreboard.Team
All Implemented Interfaces:
Audience, ForwardingAudience, Pointered, PacketGroupingAudience

public class Team extends Object implements PacketGroupingAudience
This object represents a team on a scoreboard that has a common display theme and other properties.
  • Field Details

  • Constructor Details

    • Team

      protected Team(String teamName)
      Default constructor to creates a team.
      Parameters:
      teamName - The registry name for the team
  • Method Details

    • addMember

      public void addMember(String member)
      Adds a member to the Team.
      This member collection can contain Player or LivingEntity. For players use their username, for entities use their UUID
      Parameters:
      member - The member to be added
    • addMembers

      public void addMembers(Collection<String> toAdd)
      Adds a members to the Team.
      This member collection can contain Player or LivingEntity. For players use their username, for entities use their UUID
      Parameters:
      toAdd - The members to be added
    • removeMember

      public void removeMember(String member)
      Removes a member from the Team.
      This member collection can contain Player or LivingEntity. For players use their username, for entities use their UUID
      Parameters:
      member - The member to be removed
    • removeMembers

      public void removeMembers(Collection<String> toRemove)
      Removes members from the Team.
      This member collection can contain Player or LivingEntity. For players use their username, for entities use their UUID
      Parameters:
      toRemove - The members to be removed
    • setTeamDisplayName

      public void setTeamDisplayName(Component teamDisplayName)
      Changes the display name of the team.

      Warning: This is only changed server side.
      Parameters:
      teamDisplayName - The new display name
    • updateTeamDisplayName

      public void updateTeamDisplayName(Component teamDisplayName)
      Changes the display name of the team and sends an update packet.
      Parameters:
      teamDisplayName - The new display name
    • setNameTagVisibility

      public void setNameTagVisibility(TeamsPacket.NameTagVisibility visibility)
      Changes the TeamsPacket.NameTagVisibility of the team.

      Warning: This is only changed on the server side.
      Parameters:
      visibility - The new tag visibility
      See Also:
    • updateNameTagVisibility

      public void updateNameTagVisibility(TeamsPacket.NameTagVisibility nameTagVisibility)
      Changes the TeamsPacket.NameTagVisibility of the team and sends an update packet.
      Parameters:
      nameTagVisibility - The new tag visibility
    • setCollisionRule

      public void setCollisionRule(TeamsPacket.CollisionRule rule)
      Changes the TeamsPacket.CollisionRule of the team.

      Warning: This is only changed on the server side.
      Parameters:
      rule - The new rule
      See Also:
    • updateCollisionRule

      public void updateCollisionRule(TeamsPacket.CollisionRule collisionRule)
      Changes the collision rule of the team and sends an update packet.
      Parameters:
      collisionRule - The new collision rule
    • setTeamColor

      public void setTeamColor(NamedTextColor color)
      Changes the color of the team.

      Warning: This is only changed on the server side.
      Parameters:
      color - The new team color
      See Also:
    • updateTeamColor

      public void updateTeamColor(NamedTextColor color)
      Changes the color of the team and sends an update packet.
      Parameters:
      color - The new team color
    • setPrefix

      public void setPrefix(Component prefix)
      Changes the prefix of the team.

      Warning: This is only changed on the server side.
      Parameters:
      prefix - The new prefix
    • updatePrefix

      public void updatePrefix(Component prefix)
      Changes the prefix of the team and sends an update packet.
      Parameters:
      prefix - The new prefix
    • setSuffix

      public void setSuffix(Component suffix)
      Changes the suffix of the team.

      Warning: This is only changed on the server side.
      Parameters:
      suffix - The new suffix
    • updateSuffix

      public void updateSuffix(Component suffix)
      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
    • setAllowFriendlyFire

      public void setAllowFriendlyFire(boolean value)
    • updateAllowFriendlyFire

      public void updateAllowFriendlyFire(boolean value)
    • isAllowFriendlyFire

      public boolean isAllowFriendlyFire()
    • setSeeInvisiblePlayers

      public void setSeeInvisiblePlayers(boolean value)
    • updateSeeInvisiblePlayers

      public void updateSeeInvisiblePlayers(boolean value)
    • isSeeInvisiblePlayers

      public boolean isSeeInvisiblePlayers()
    • getTeamName

      public String getTeamName()
      Gets the registry name of the team.
      Returns:
      the registry name
    • createTeamsCreationPacket

      public TeamsPacket createTeamsCreationPacket()
      Creates the creation packet to add a team.
      Returns:
      the packet to add the team
    • createTeamDestructionPacket

      public TeamsPacket createTeamDestructionPacket()
      Creates an destruction packet to remove the team.
      Returns:
      the packet to remove the team
    • getMembers

      public Set<String> getMembers()
      Obtains an unmodifiable Set of registered players who are on the team.
      Returns:
      an unmodifiable Set of registered players
    • getTeamDisplayName

      public Component 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

      public TeamsPacket.NameTagVisibility getNameTagVisibility()
      Gets the tag visibility of the team.
      Returns:
      the tag visibility
    • getCollisionRule

      public TeamsPacket.CollisionRule getCollisionRule()
      Gets the collision rule of the team.
      Returns:
      the collision rule
    • getTeamColor

      public NamedTextColor getTeamColor()
      Gets the color of the team.
      Returns:
      the team color
    • getPrefix

      public Component getPrefix()
      Gets the prefix of the team.
      Returns:
      the team prefix
    • getSuffix

      public Component getSuffix()
      Gets the suffix of the team.
      Returns:
      the suffix team
    • sendUpdatePacket

      public void sendUpdatePacket()
      Sends an TeamsPacket.UpdateTeamAction action packet.
    • getPlayers

      public Collection<Player> getPlayers()
      Description copied from interface: PacketGroupingAudience
      Gets an iterable of the players this audience contains.
      Specified by:
      getPlayers in interface PacketGroupingAudience
      Returns:
      the connections
    • pointers

      @Contract(pure=true) public Pointers pointers()
      Specified by:
      pointers in interface ForwardingAudience
      Specified by:
      pointers in interface Pointered