Interface Team

All Superinterfaces:
net.kyori.adventure.audience.Audience, net.kyori.adventure.audience.ForwardingAudience, net.kyori.adventure.pointer.Pointered

public interface Team extends net.kyori.adventure.audience.ForwardingAudience
A team on a scoreboard that has a common display theme and other properties. This team is only relevant to the display of the associated scoreboard.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Represents an option which may be applied to this team.
    static enum 
    How an option may be applied to members of this team.

    Nested classes/interfaces inherited from interface net.kyori.adventure.audience.ForwardingAudience

    net.kyori.adventure.audience.ForwardingAudience.Single
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This puts a collection of entities onto this team for the scoreboard which results in one packet for the updates rather than a packet-per-entity.
    default void
    addEntities(Entity @NotNull ... entities)
    This puts a collection of entities onto this team for the scoreboard which results in one packet for the updates rather than a packet-per-entity.
    void
    addEntity(Entity entity)
    This puts the specified entity onto this team for the scoreboard.
    default void
    addEntries(@NotNull String... entries)
    This puts a collection of entries onto this team for the scoreboard which results in one packet for the updates rather than a packet-per-entry.
    void
    This puts a collection of entries onto this team for the scoreboard which results in one packet for the updates rather than a packet-per-entry.
    void
    addEntry(@NotNull String entry)
    This puts the specified entry onto this team for the scoreboard.
    void
    addPlayer(@NotNull OfflinePlayer player)
    This puts the specified player onto this team for the scoreboard.
    boolean
    Gets the team friendly fire state
    boolean
    Gets the team's ability to see invisible teammates.
    @NotNull net.kyori.adventure.text.format.TextColor
    Gets the color of the team.
    void
    color(@Nullable net.kyori.adventure.text.format.NamedTextColor color)
    Sets the color of the team.
    @NotNull net.kyori.adventure.text.Component
    Gets the display name for this team
    void
    displayName(@Nullable net.kyori.adventure.text.Component displayName)
    Sets the name displayed to entries for this team
    @NotNull ChatColor
    Deprecated.
    in favour of color()
    @NotNull String
    Deprecated.
    in favour of displayName()
    @NotNull Set<String>
    Gets the Set of entries on the team
    @NotNull String
    Gets the name of this Team
    Deprecated.
    getOption(@NotNull Team.Option option)
    Get an option for this team
    @NotNull Set<OfflinePlayer>
    Deprecated.
    Teams can contain entries that aren't players
    @NotNull String
    Deprecated.
    in favour of prefix()
    @Nullable Scoreboard
    Gets the Scoreboard to which this team is attached
    int
    Gets the size of the team
    @NotNull String
    Deprecated.
    in favour of suffix()
    boolean
    Checks if the team has a color specified
    boolean
    hasEntity(Entity entity)
    Checks to see if the specified entity is a member of this team.
    boolean
    hasEntry(@NotNull String entry)
    Checks to see if the specified entry is a member of this team.
    boolean
    hasPlayer(@NotNull OfflinePlayer player)
    Checks to see if the specified player is a member of this team.
    @NotNull net.kyori.adventure.text.Component
    Gets the prefix prepended to the display of entries on this team.
    void
    prefix(@Nullable net.kyori.adventure.text.Component prefix)
    Sets the prefix prepended to the display of entries on this team.
    boolean
    Removes a collection of entities from this team which results in one packet for the updates rather than a packet-per-entity.
    default boolean
    removeEntities(Entity @NotNull ... entities)
    Removes a collection of entities from this team which results in one packet for the updates rather than a packet-per-entity.
    boolean
    Removes the entity from this team.
    default boolean
    removeEntries(@NotNull String... entries)
    Removes a collection of entries from this team which results in one packet for the updates rather than a packet-per-entry.
    boolean
    Removes a collection of entries from this team which results in one packet for the updates rather than a packet-per-entry.
    boolean
    removeEntry(@NotNull String entry)
    Removes the entry from this team.
    boolean
    removePlayer(@NotNull OfflinePlayer player)
    Removes the player from this team.
    void
    setAllowFriendlyFire(boolean enabled)
    Sets the team friendly fire state
    void
    setCanSeeFriendlyInvisibles(boolean enabled)
    Sets the team's ability to see invisible teammates.
    void
    setColor(@NotNull ChatColor color)
    void
    setDisplayName(@NotNull String displayName)
    void
    void
    setOption(@NotNull Team.Option option, @NotNull Team.OptionStatus status)
    Set an option for this team
    void
    setPrefix(@NotNull String prefix)
    void
    setSuffix(@NotNull String suffix)
    @NotNull net.kyori.adventure.text.Component
    Gets the suffix appended to the display of entries on this team.
    void
    suffix(@Nullable net.kyori.adventure.text.Component suffix)
    Sets the suffix appended to the display of entries on this team.
    void
    Unregisters this team from the Scoreboard

    Methods inherited from interface net.kyori.adventure.audience.Audience

    deleteMessage, openBook, removeResourcePacks, removeResourcePacks, removeResourcePacks, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, showTitle, stopSound

    Methods inherited from interface net.kyori.adventure.audience.ForwardingAudience

    audiences, clearResourcePacks, clearTitle, closeDialog, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, playSound, playSound, playSound, pointers, removeResourcePacks, removeResourcePacks, resetTitle, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendResourcePacks, sendTitlePart, showBossBar, showDialog, stopSound

    Methods inherited from interface net.kyori.adventure.pointer.Pointered

    get, getOrDefault, getOrDefaultFrom
  • Method Details

    • getName

      @NotNull @NotNull String getName()
      Gets the name of this Team
      Returns:
      Objective name
      Throws:
      IllegalStateException - if this team has been unregistered
    • displayName

      @NotNull net.kyori.adventure.text.Component displayName()
      Gets the display name for this team
      Returns:
      Team display name
      Throws:
      IllegalStateException - if this team has been unregistered
    • displayName

      void displayName(@Nullable net.kyori.adventure.text.Component displayName)
      Sets the name displayed to entries for this team
      Parameters:
      displayName - New display name
      Throws:
      IllegalStateException - if this team has been unregistered
    • prefix

      @NotNull net.kyori.adventure.text.Component prefix()
      Gets the prefix prepended to the display of entries on this team.
      Returns:
      Team prefix
      Throws:
      IllegalStateException - if this team has been unregistered
    • prefix

      void prefix(@Nullable net.kyori.adventure.text.Component prefix)
      Sets the prefix prepended to the display of entries on this team.
      Parameters:
      prefix - New prefix
      Throws:
      IllegalStateException - if this team has been unregistered
    • suffix

      @NotNull net.kyori.adventure.text.Component suffix()
      Gets the suffix appended to the display of entries on this team.
      Returns:
      the team's current suffix
      Throws:
      IllegalStateException - if this team has been unregistered
    • suffix

      void suffix(@Nullable net.kyori.adventure.text.Component suffix)
      Sets the suffix appended to the display of entries on this team.
      Parameters:
      suffix - the new suffix for this team.
      Throws:
      IllegalStateException - if this team has been unregistered
    • hasColor

      boolean hasColor()
      Checks if the team has a color specified
      Returns:
      true if it has a color
      Throws:
      IllegalStateException - if this team has been unregistered
    • color

      @NotNull net.kyori.adventure.text.format.TextColor color()
      Gets the color of the team.
      This only sets the team outline, other occurrences of colors such as in names are handled by prefixes / suffixes.
      Returns:
      team color
      Throws:
      IllegalStateException - if this team has been unregistered
      IllegalStateException - if the team doesn't have a color
      See Also:
    • color

      void color(@Nullable net.kyori.adventure.text.format.NamedTextColor color)
      Sets the color of the team.
      This only sets the team outline, other occurrences of colors such as in names are handled by prefixes / suffixes.
      Parameters:
      color - new color, null for no color
    • getDisplayName

      @NotNull @Deprecated @NotNull String getDisplayName()
      Deprecated.
      in favour of displayName()
      Gets the name displayed to entries for this team
      Returns:
      Team display name
      Throws:
      IllegalStateException - if this team has been unregistered
    • setDisplayName

      @Deprecated void setDisplayName(@NotNull @NotNull String displayName)
      Sets the name displayed to entries for this team
      Parameters:
      displayName - New display name
      Throws:
      IllegalStateException - if this team has been unregistered
    • getPrefix

      @NotNull @Deprecated @NotNull String getPrefix()
      Deprecated.
      in favour of prefix()
      Gets the prefix prepended to the display of entries on this team.
      Returns:
      Team prefix
      Throws:
      IllegalStateException - if this team has been unregistered
    • setPrefix

      @Deprecated void setPrefix(@NotNull @NotNull String prefix)
      Sets the prefix prepended to the display of entries on this team.
      Parameters:
      prefix - New prefix
      Throws:
      IllegalStateException - if this team has been unregistered
    • getSuffix

      @NotNull @Deprecated @NotNull String getSuffix()
      Deprecated.
      in favour of suffix()
      Gets the suffix appended to the display of entries on this team.
      Returns:
      the team's current suffix
      Throws:
      IllegalStateException - if this team has been unregistered
    • setSuffix

      @Deprecated void setSuffix(@NotNull @NotNull String suffix)
      Sets the suffix appended to the display of entries on this team.
      Parameters:
      suffix - the new suffix for this team.
      Throws:
      IllegalStateException - if this team has been unregistered
    • getColor

      @NotNull @Deprecated @NotNull ChatColor getColor()
      Deprecated.
      in favour of color()
      Gets the color of the team.
      This only sets the team outline, other occurrences of colors such as in names are handled by prefixes / suffixes.
      Returns:
      team color, defaults to ChatColor.RESET
      Throws:
      IllegalStateException - if this team has been unregistered
    • setColor

      @Deprecated void setColor(@NotNull @NotNull ChatColor color)
      Sets the color of the team.
      This only sets the team outline, other occurrences of colors such as in names are handled by prefixes / suffixes.
      Parameters:
      color - new color, must be non-null. Use ChatColor.RESET for no color
    • allowFriendlyFire

      boolean allowFriendlyFire()
      Gets the team friendly fire state
      Returns:
      true if friendly fire is enabled
      Throws:
      IllegalStateException - if this team has been unregistered
    • setAllowFriendlyFire

      void setAllowFriendlyFire(boolean enabled)
      Sets the team friendly fire state
      Parameters:
      enabled - true if friendly fire is to be allowed
      Throws:
      IllegalStateException - if this team has been unregistered
    • canSeeFriendlyInvisibles

      boolean canSeeFriendlyInvisibles()
      Gets the team's ability to see invisible teammates.
      Returns:
      true if team members can see invisible members
      Throws:
      IllegalStateException - if this team has been unregistered
    • setCanSeeFriendlyInvisibles

      void setCanSeeFriendlyInvisibles(boolean enabled)
      Sets the team's ability to see invisible teammates.
      Parameters:
      enabled - true if invisible teammates are to be visible
      Throws:
      IllegalStateException - if this team has been unregistered
    • getNameTagVisibility

      @Deprecated(since="1.9") @NotNull @NotNull NameTagVisibility getNameTagVisibility()
      Deprecated.
      Gets the team's ability to see name tags
      Returns:
      the current name tag visibility for the team
      Throws:
      IllegalArgumentException - if this team has been unregistered
    • setNameTagVisibility

      @Deprecated(since="1.9") void setNameTagVisibility(@NotNull @NotNull NameTagVisibility visibility)
      Set's the team's ability to see name tags
      Parameters:
      visibility - The nameTagVisibility to set
      Throws:
      IllegalArgumentException - if this team has been unregistered
    • getPlayers

      @Deprecated(since="1.8.6") @NotNull @NotNull Set<OfflinePlayer> getPlayers()
      Deprecated.
      Teams can contain entries that aren't players
      Gets the Set of players on the team
      Returns:
      players on the team
      Throws:
      IllegalStateException - if this team has been unregistered
      See Also:
    • getEntries

      @NotNull @NotNull Set<String> getEntries()
      Gets the Set of entries on the team
      Returns:
      entries on the team
      Throws:
      IllegalStateException - if this team has been unregistered
    • getSize

      int getSize()
      Gets the size of the team
      Returns:
      number of entries on the team
      Throws:
      IllegalStateException - if this team has been unregistered
    • getScoreboard

      @Nullable @Nullable Scoreboard getScoreboard()
      Gets the Scoreboard to which this team is attached
      Returns:
      Owning scoreboard, or null if this team has been unregistered
    • addPlayer

      void addPlayer(@NotNull @NotNull OfflinePlayer player)
      This puts the specified player onto this team for the scoreboard.

      This will remove the player from any other team on the scoreboard.

      Parameters:
      player - the player to add
      Throws:
      IllegalStateException - if this team has been unregistered
      See Also:
    • addEntry

      void addEntry(@NotNull @NotNull String entry)
      This puts the specified entry onto this team for the scoreboard.

      This will remove the entry from any other team on the scoreboard.

      Parameters:
      entry - the entry to add
      Throws:
      IllegalStateException - if this team has been unregistered
    • addEntities

      default void addEntities(@NotNull Entity @NotNull ... entities)
      This puts a collection of entities onto this team for the scoreboard which results in one packet for the updates rather than a packet-per-entity.

      Entities on other teams will be removed from their respective teams.

      Parameters:
      entities - the entities to add
      Throws:
      IllegalArgumentException - if entities are null
      IllegalStateException - if this team has been unregistered
    • addEntities

      void addEntities(@NotNull Collection<Entity> entities) throws IllegalStateException, IllegalArgumentException
      This puts a collection of entities onto this team for the scoreboard which results in one packet for the updates rather than a packet-per-entity.

      Entities on other teams will be removed from their respective teams.

      Parameters:
      entities - the entities to add
      Throws:
      IllegalArgumentException - if entities are null
      IllegalStateException - if this team has been unregistered
    • addEntries

      default void addEntries(@NotNull @NotNull String... entries) throws IllegalStateException, IllegalArgumentException
      This puts a collection of entries onto this team for the scoreboard which results in one packet for the updates rather than a packet-per-entry.

      Entries on other teams will be removed from their respective teams.

      Parameters:
      entries - the entries to add
      Throws:
      IllegalArgumentException - if entries are null
      IllegalStateException - if this team has been unregistered
    • addEntries

      void addEntries(@NotNull Collection<String> entries) throws IllegalStateException, IllegalArgumentException
      This puts a collection of entries onto this team for the scoreboard which results in one packet for the updates rather than a packet-per-entry.

      Entries on other teams will be removed from their respective teams.

      Parameters:
      entries - the entries to add
      Throws:
      IllegalArgumentException - if entries are null
      IllegalStateException - if this team has been unregistered
    • removePlayer

      boolean removePlayer(@NotNull @NotNull OfflinePlayer player)
      Removes the player from this team.
      Parameters:
      player - the player to remove
      Returns:
      if the player was on this team
      Throws:
      IllegalStateException - if this team has been unregistered
      See Also:
    • removeEntry

      boolean removeEntry(@NotNull @NotNull String entry)
      Removes the entry from this team.
      Parameters:
      entry - the entry to remove
      Returns:
      if the entry was a part of this team
      Throws:
      IllegalStateException - if this team has been unregistered
    • removeEntities

      default boolean removeEntities(@NotNull Entity @NotNull ... entities) throws IllegalStateException, IllegalArgumentException
      Removes a collection of entities from this team which results in one packet for the updates rather than a packet-per-entity.
      Parameters:
      entities - the entries to remove
      Returns:
      if any of the entities were a part of this team
      Throws:
      IllegalArgumentException - if entities is null
      IllegalStateException - if this team has been unregistered
    • removeEntities

      boolean removeEntities(@NotNull Collection<Entity> entities) throws IllegalStateException, IllegalArgumentException
      Removes a collection of entities from this team which results in one packet for the updates rather than a packet-per-entity.
      Parameters:
      entities - the entries to remove
      Returns:
      if any of the entities were a part of this team
      Throws:
      IllegalArgumentException - if entities is null
      IllegalStateException - if this team has been unregistered
    • removeEntries

      default boolean removeEntries(@NotNull @NotNull String... entries) throws IllegalStateException, IllegalArgumentException
      Removes a collection of entries from this team which results in one packet for the updates rather than a packet-per-entry.
      Parameters:
      entries - the entries to remove
      Returns:
      if any of the entries were a part of this team
      Throws:
      IllegalArgumentException - if entries is null
      IllegalStateException - if this team has been unregistered
    • removeEntries

      boolean removeEntries(@NotNull Collection<String> entries) throws IllegalStateException, IllegalArgumentException
      Removes a collection of entries from this team which results in one packet for the updates rather than a packet-per-entry.
      Parameters:
      entries - the entries to remove
      Returns:
      if any of the entries were a part of this team
      Throws:
      IllegalArgumentException - if entries is null
      IllegalStateException - if this team has been unregistered
    • unregister

      void unregister()
      Unregisters this team from the Scoreboard
      Throws:
      IllegalStateException - if this team has been unregistered
    • hasPlayer

      boolean hasPlayer(@NotNull @NotNull OfflinePlayer player)
      Checks to see if the specified player is a member of this team.
      Parameters:
      player - the player to search for
      Returns:
      true if the player is a member of this team
      Throws:
      IllegalStateException - if this team has been unregistered
      See Also:
    • hasEntry

      boolean hasEntry(@NotNull @NotNull String entry)
      Checks to see if the specified entry is a member of this team.
      Parameters:
      entry - the entry to search for
      Returns:
      true if the entry is a member of this team
      Throws:
      IllegalStateException - if this team has been unregistered
    • getOption

      @NotNull @NotNull Team.OptionStatus getOption(@NotNull @NotNull Team.Option option)
      Get an option for this team
      Parameters:
      option - the option to get
      Returns:
      the option status
      Throws:
      IllegalStateException - if this team has been unregistered
    • setOption

      void setOption(@NotNull @NotNull Team.Option option, @NotNull @NotNull Team.OptionStatus status)
      Set an option for this team
      Parameters:
      option - the option to set
      status - the new option status
      Throws:
      IllegalStateException - if this team has been unregistered
    • addEntity

      void addEntity(@NotNull Entity entity) throws IllegalStateException, IllegalArgumentException
      This puts the specified entity onto this team for the scoreboard.

      This will remove the entity from any other team on the scoreboard.

      Parameters:
      entity - the entity to add
      Throws:
      IllegalArgumentException - if entity is null
      IllegalStateException - if this team has been unregistered
      See Also:
    • removeEntity

      boolean removeEntity(@NotNull Entity entity) throws IllegalStateException, IllegalArgumentException
      Removes the entity from this team.
      Parameters:
      entity - the entity to remove
      Returns:
      if the entity was on this team
      Throws:
      IllegalArgumentException - if entity is null
      IllegalStateException - if this team has been unregistered
      See Also:
    • hasEntity

      boolean hasEntity(@NotNull Entity entity) throws IllegalStateException, IllegalArgumentException
      Checks to see if the specified entity is a member of this team.
      Parameters:
      entity - the entity to search for
      Returns:
      true if the entity is a member of this team
      Throws:
      IllegalArgumentException - if entity is null
      IllegalStateException - if this team has been unregistered
      See Also: