Package net.minestom.server.scoreboard
Class Team
java.lang.Object
net.minestom.server.scoreboard.Team
- All Implemented Interfaces:
Audience
,ForwardingAudience
,Pointered
,PacketGroupingAudience
This object represents a team on a scoreboard that has a common display theme and other properties.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.kyori.adventure.audience.ForwardingAudience
ForwardingAudience.Single
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a member to theTeam
.void
addMembers
(@NotNull Collection<@NotNull String> toAdd) Adds a members to theTeam
.@NotNull TeamsPacket
Creates an destruction packet to remove the team.@NotNull TeamsPacket
Creates the creation packet to add a team.@NotNull TeamsPacket.CollisionRule
Gets the collision rule of the team.byte
Gets the friendly flags of the team.Obtains an unmodifiableSet
of registered players who are on the team.@NotNull TeamsPacket.NameTagVisibility
Gets the tag visibility of the team.@NotNull Collection
<Player> Gets an iterable of the players this audience contains.Gets the prefix of the team.Gets the suffix of the team.@NotNull NamedTextColor
Gets the color of the team.Gets the display name of the team.Gets the registry name of the team.boolean
boolean
@NotNull Pointers
pointers()
void
removeMember
(@NotNull String member) Removes a member from theTeam
.void
removeMembers
(@NotNull Collection<@NotNull String> toRemove) Removes members from theTeam
.void
Sends anTeamsPacket.UpdateTeamAction
action packet.void
setAllowFriendlyFire
(boolean value) void
setCollisionRule
(@NotNull TeamsPacket.CollisionRule rule) Changes theTeamsPacket.CollisionRule
of the team.void
setFriendlyFlags
(byte flag) Changes the friendly flags of the team.void
setNameTagVisibility
(@NotNull TeamsPacket.NameTagVisibility visibility) Changes theTeamsPacket.NameTagVisibility
of the team.void
Changes the prefix of the team.void
setSeeInvisiblePlayers
(boolean value) void
Changes the suffix of the team.void
setTeamColor
(@NotNull NamedTextColor color) Changes the color of the team.void
setTeamDisplayName
(Component teamDisplayName) Changes the display name of the team.void
updateAllowFriendlyFire
(boolean value) void
updateCollisionRule
(@NotNull 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
(@NotNull TeamsPacket.NameTagVisibility nameTagVisibility) Changes theTeamsPacket.NameTagVisibility
of the team and sends an update packet.void
updatePrefix
(Component prefix) Changes the prefix of the team and sends an update packet.void
updateSeeInvisiblePlayers
(boolean value) void
updateSuffix
(Component suffix) Changes the suffix of the team and sends an update packet.void
updateTeamColor
(@NotNull NamedTextColor color) Changes the color of the team and sends an update packet.void
updateTeamDisplayName
(Component teamDisplayName) Changes the display name of the team and sends an update packet.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
clearResourcePacks, deleteMessage, filterAudience, forEachAudience, openBook, playSound, removeResourcePacks, removeResourcePacks, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendResourcePacks
Methods inherited from interface net.minestom.server.adventure.audience.PacketGroupingAudience
audiences, clearTitle, hideBossBar, playSound, playSound, playSound, resetTitle, sendActionBar, sendGroupedPacket, sendMessage, sendNotification, sendPlayerListHeaderAndFooter, sendTitlePart, showBossBar, stopSound
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom
-
Constructor Details
-
Team
Default constructor to creates a team.- Parameters:
teamName
- The registry name for the team
-
-
Method Details
-
addMember
Adds a member to theTeam
.
This member collection can containPlayer
orLivingEntity
. For players use their username, for entities use their UUID- Parameters:
member
- The member to be added
-
addMembers
Adds a members to theTeam
.
This member collection can containPlayer
orLivingEntity
. For players use their username, for entities use their UUID- Parameters:
toAdd
- The members to be added
-
removeMember
Removes a member from theTeam
.
This member collection can containPlayer
orLivingEntity
. For players use their username, for entities use their UUID- Parameters:
member
- The member to be removed
-
removeMembers
Removes members from theTeam
.
This member collection can containPlayer
orLivingEntity
. For players use their username, for entities use their UUID- Parameters:
toRemove
- The members to be removed
-
setTeamDisplayName
Changes the display name of the team.
Warning: This is only changed 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- See Also:
-
updateNameTagVisibility
public void updateNameTagVisibility(@NotNull @NotNull TeamsPacket.NameTagVisibility nameTagVisibility) 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- See Also:
-
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- See Also:
-
updateTeamColor
Changes the color of the team and sends an update packet.- Parameters:
color
- 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
-
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
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
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
-
sendUpdatePacket
public void sendUpdatePacket()Sends anTeamsPacket.UpdateTeamAction
action packet. -
getPlayers
Description copied from interface:PacketGroupingAudience
Gets an iterable of the players this audience contains.- Specified by:
getPlayers
in interfacePacketGroupingAudience
- Returns:
- the connections
-
pointers
- Specified by:
pointers
in interfaceForwardingAudience
- Specified by:
pointers
in interfacePointered
-