Interface ForwardingAudience.Single
- All Superinterfaces:
Audience
,ForwardingAudience
,Pointered
- Enclosing interface:
- ForwardingAudience
- Since:
- 4.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.kyori.adventure.audience.ForwardingAudience
ForwardingAudience.Single
-
Method Summary
Modifier and TypeMethodDescription@NotNull Audience
audience()
Gets the audience.Deprecated.this audience only supports forwarding to a single audiencedefault void
Clear all server-provided resource packs that have been sent to this user.default void
Clears the title, if one is being displayed.default void
deleteMessage
(@NotNull SignedMessage.Signature signature) Requests deletion of a message with the providedSignedMessage.Signature
.default @NotNull Audience
filterAudience
(@NotNull Predicate<? super Audience> filter) Filters this audience.default void
forEachAudience
(@NotNull Consumer<? super Audience> action) Executes an action against all audiences.default <T> @NotNull Optional<T>
Gets the value ofpointer
.default <T> T
getOrDefault
(@NotNull Pointer<T> pointer, T defaultValue) Gets the value ofpointer
.default <T> @UnknownNullability T
getOrDefaultFrom
(@NotNull Pointer<T> pointer, @NotNull Supplier<? extends T> defaultValue) Gets the value ofpointer
.default void
hideBossBar
(@NotNull BossBar bar) Hides a boss bar.default void
Opens a book.default void
Plays a sound at the location of the recipient of the sound.default void
Plays a sound at a location.default void
playSound
(@NotNull Sound sound, @NotNull Sound.Emitter emitter) Plays a sound from an emitter, usually an entity.default @NotNull Pointers
pointers()
Gets the pointers for this object.default void
removeResourcePacks
(@NotNull Iterable<UUID> ids) Clear resource packs with the provided ids if they are present.default void
removeResourcePacks
(@NotNull UUID id, @NotNull UUID @NotNull ... others) Clear resource packs with the provided ids if they are present.default void
Resets the title and timings back to their default.default void
sendActionBar
(@NotNull Component message) Sends a message on the action bar.default void
sendMessage
(@NotNull SignedMessage signedMessage, @NotNull ChatType.Bound boundChatType) Sends a signed player message to thisAudience
with the providedbound chat type
.default void
sendMessage
(@NotNull Identified source, @NotNull Component message, @NotNull MessageType type) Deprecated.default void
sendMessage
(@NotNull Identity source, @NotNull Component message, @NotNull MessageType type) Deprecated.default void
sendMessage
(@NotNull Component message) Sends a system chat message to thisAudience
.default void
sendMessage
(@NotNull Component message, @NotNull ChatType.Bound boundChatType) Sends a message to thisAudience
with the providedbound chat type
.default void
sendPlayerListFooter
(@NotNull Component footer) Sends the player list footer.default void
sendPlayerListHeader
(@NotNull Component header) Sends the player list header.default void
sendPlayerListHeaderAndFooter
(@NotNull Component header, @NotNull Component footer) Sends the player list header and footer.default void
sendResourcePacks
(@NotNull ResourcePackRequest request) Sends a request to apply resource packs to this audience.default <T> void
sendTitlePart
(@NotNull TitlePart<T> part, T value) Shows a part of a title.default void
showBossBar
(@NotNull BossBar bar) Shows a boss bar.default void
Stops a sound, or many sounds.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
-
Method Details
-
audience
Gets the audience.- Returns:
- the audience
- Since:
- 4.0.0
-
audiences
Deprecated.this audience only supports forwarding to a single audienceGets the audiences.- Specified by:
audiences
in interfaceForwardingAudience
- Returns:
audience()
-
get
Description copied from interface:Pointered
Gets the value ofpointer
. -
getOrDefault
@Contract("_, null -> null; _, !null -> !null") @Nullable default <T> T getOrDefault(@NotNull @NotNull Pointer<T> pointer, @Nullable T defaultValue) Description copied from interface:Pointered
Gets the value ofpointer
.If this
Audience
is unable to provide a value forpointer
,defaultValue
will be returned.- Specified by:
getOrDefault
in interfacePointered
- Type Parameters:
T
- the type- Parameters:
pointer
- the pointerdefaultValue
- the default value- Returns:
- the value
-
getOrDefaultFrom
default <T> @UnknownNullability T getOrDefaultFrom(@NotNull @NotNull Pointer<T> pointer, @NotNull @NotNull Supplier<? extends T> defaultValue) Description copied from interface:Pointered
Gets the value ofpointer
.If this
Audience
is unable to provide a value forpointer
, the value supplied bydefaultValue
will be returned.- Specified by:
getOrDefaultFrom
in interfacePointered
- Type Parameters:
T
- the type- Parameters:
pointer
- the pointerdefaultValue
- the default value supplier- Returns:
- the value
-
filterAudience
@NotNull default @NotNull Audience filterAudience(@NotNull @NotNull Predicate<? super Audience> filter) Description copied from interface:Audience
Filters this audience.The returned
Audience
may be the same, or a completely different one.Container audiences such as
ForwardingAudience
may or may not have their own identity. If they do, they may test themselves against the providedfilter
first, and if the test fails return an empty audience skipping any contained children. If they do not, they must not test themselves against the filter, only testing their children.- Specified by:
filterAudience
in interfaceAudience
- Specified by:
filterAudience
in interfaceForwardingAudience
- Parameters:
filter
- a filter that determines if an audience should be included- Returns:
- an audience providing a snapshot of all audiences that match the predicate when this method is invoked
-
forEachAudience
Description copied from interface:Audience
Executes an action against all audiences.If you implement
Audience
and notForwardingAudience
in your own code, and your audience forwards to other audiences, then you must override this method and provide each audience toaction
.If an implementation of
Audience
has its own identity distinct from its contained children, it may test itself against the providedfilter
first, and if the test fails return an empty audience skipping any contained children. If it does not, it must not test itself against the filter, only testing its children.- Specified by:
forEachAudience
in interfaceAudience
- Specified by:
forEachAudience
in interfaceForwardingAudience
- Parameters:
action
- the action
-
pointers
Description copied from interface:Pointered
Gets the pointers for this object.- Specified by:
pointers
in interfaceForwardingAudience
- Specified by:
pointers
in interfacePointered
- Returns:
- the pointers
-
sendMessage
Description copied from interface:Audience
Sends a system chat message to thisAudience
.- Specified by:
sendMessage
in interfaceAudience
- Specified by:
sendMessage
in interfaceForwardingAudience
- Parameters:
message
- a message- See Also:
-
sendMessage
default void sendMessage(@NotNull @NotNull Component message, @NotNull ChatType.Bound boundChatType) Description copied from interface:Audience
Sends a message to thisAudience
with the providedbound chat type
.- Specified by:
sendMessage
in interfaceAudience
- Specified by:
sendMessage
in interfaceForwardingAudience
- Parameters:
message
- the component contentboundChatType
- the bound chat type
-
sendMessage
default void sendMessage(@NotNull @NotNull SignedMessage signedMessage, @NotNull ChatType.Bound boundChatType) Description copied from interface:Audience
Sends a signed player message to thisAudience
with the providedbound chat type
.- Specified by:
sendMessage
in interfaceAudience
- Specified by:
sendMessage
in interfaceForwardingAudience
- Parameters:
signedMessage
- the signed message databoundChatType
- the bound chat type
-
deleteMessage
Description copied from interface:Audience
Requests deletion of a message with the providedSignedMessage.Signature
.- Specified by:
deleteMessage
in interfaceAudience
- Specified by:
deleteMessage
in interfaceForwardingAudience
- Parameters:
signature
- the signature
-
sendMessage
@Deprecated default void sendMessage(@NotNull @NotNull Identified source, @NotNull @NotNull Component message, @NotNull @NotNull MessageType type) Deprecated.Description copied from interface:Audience
Sends an unsigned player chat message from the givenIdentified
to thisAudience
with theChatType
corresponding to the providedMessageType
.- Specified by:
sendMessage
in interfaceAudience
- Specified by:
sendMessage
in interfaceForwardingAudience
- Parameters:
source
- the source of the messagemessage
- a messagetype
- the type- See Also:
-
sendMessage
@Deprecated default void sendMessage(@NotNull @NotNull Identity source, @NotNull @NotNull Component message, @NotNull @NotNull MessageType type) Deprecated.Description copied from interface:Audience
Sends a player chat message from the entity represented by the givenIdentity
to thisAudience
with theChatType
corresponding to the providedMessageType
.- Specified by:
sendMessage
in interfaceAudience
- Specified by:
sendMessage
in interfaceForwardingAudience
- Parameters:
source
- the identity of the source of the messagemessage
- a messagetype
- the type- See Also:
-
sendActionBar
Description copied from interface:Audience
Sends a message on the action bar.- Specified by:
sendActionBar
in interfaceAudience
- Specified by:
sendActionBar
in interfaceForwardingAudience
- Parameters:
message
- a message- See Also:
-
sendPlayerListHeader
Description copied from interface:Audience
Sends the player list header.Depending on the implementation of this
Audience
, an existing footer may be displayed. If you wish to set both the header and the footer, please useAudience.sendPlayerListHeaderAndFooter(Component, Component)
.- Specified by:
sendPlayerListHeader
in interfaceAudience
- Specified by:
sendPlayerListHeader
in interfaceForwardingAudience
- Parameters:
header
- the header
-
sendTitlePart
Description copied from interface:Audience
Shows a part of a title.- Specified by:
sendTitlePart
in interfaceAudience
- Specified by:
sendTitlePart
in interfaceForwardingAudience
- Type Parameters:
T
- the type of the value of the part- Parameters:
part
- the partvalue
- the value
-
clearTitle
default void clearTitle()Description copied from interface:Audience
Clears the title, if one is being displayed.- Specified by:
clearTitle
in interfaceAudience
- Specified by:
clearTitle
in interfaceForwardingAudience
- See Also:
-
resetTitle
default void resetTitle()Description copied from interface:Audience
Resets the title and timings back to their default.- Specified by:
resetTitle
in interfaceAudience
- Specified by:
resetTitle
in interfaceForwardingAudience
- See Also:
-
showBossBar
Description copied from interface:Audience
Shows a boss bar.- Specified by:
showBossBar
in interfaceAudience
- Specified by:
showBossBar
in interfaceForwardingAudience
- Parameters:
bar
- a boss bar- See Also:
-
hideBossBar
Description copied from interface:Audience
Hides a boss bar.- Specified by:
hideBossBar
in interfaceAudience
- Specified by:
hideBossBar
in interfaceForwardingAudience
- Parameters:
bar
- a boss bar- See Also:
-
playSound
Description copied from interface:Audience
Plays a sound at the location of the recipient of the sound.To play a sound that follows the recipient, use
Audience.playSound(Sound, Sound.Emitter)
withSound.Emitter.self()
.- Specified by:
playSound
in interfaceAudience
- Specified by:
playSound
in interfaceForwardingAudience
- Parameters:
sound
- a sound- See Also:
-
playSound
Description copied from interface:Audience
Plays a sound at a location.- Specified by:
playSound
in interfaceAudience
- Specified by:
playSound
in interfaceForwardingAudience
- Parameters:
sound
- a soundx
- x coordinatey
- y coordinatez
- z coordinate- See Also:
-
playSound
Description copied from interface:Audience
Plays a sound from an emitter, usually an entity.Sounds played using this method will follow the emitter unless the sound is a custom sound. In this case the sound will be played at the location of the emitter and will not follow them.
To play a sound that follows the recipient, use
Sound.Emitter.self()
.Note: Due to MC-138832, the volume and pitch may be ignored when using this method.
- Specified by:
playSound
in interfaceAudience
- Specified by:
playSound
in interfaceForwardingAudience
- Parameters:
sound
- a soundemitter
- an emitter
-
stopSound
Description copied from interface:Audience
Stops a sound, or many sounds.- Specified by:
stopSound
in interfaceAudience
- Specified by:
stopSound
in interfaceForwardingAudience
- Parameters:
stop
- a sound stop- See Also:
-
openBook
Description copied from interface:Audience
Opens a book.When possible, no item should persist after closing the book.
- Specified by:
openBook
in interfaceAudience
- Specified by:
openBook
in interfaceForwardingAudience
- Parameters:
book
- a book- See Also:
-
sendResourcePacks
Description copied from interface:Audience
Sends a request to apply resource packs to this audience.Multiple resource packs are only supported since 1.20.3. On older versions, all requests behave as if
ResourcePackRequest.replace()
is set totrue
.- Specified by:
sendResourcePacks
in interfaceAudience
- Specified by:
sendResourcePacks
in interfaceForwardingAudience
- Parameters:
request
- the resource pack request- See Also:
-
removeResourcePacks
Description copied from interface:Audience
Clear resource packs with the provided ids if they are present.- Specified by:
removeResourcePacks
in interfaceAudience
- Specified by:
removeResourcePacks
in interfaceForwardingAudience
- Parameters:
ids
- the ids of resource packs to remove
-
removeResourcePacks
default void removeResourcePacks(@NotNull @NotNull UUID id, @NotNull @NotNull UUID @NotNull ... others) Description copied from interface:Audience
Clear resource packs with the provided ids if they are present.- Specified by:
removeResourcePacks
in interfaceAudience
- Specified by:
removeResourcePacks
in interfaceForwardingAudience
- Parameters:
id
- the idothers
- the ids of any additional resource packs
-
clearResourcePacks
default void clearResourcePacks()Description copied from interface:Audience
Clear all server-provided resource packs that have been sent to this user.- Specified by:
clearResourcePacks
in interfaceAudience
- Specified by:
clearResourcePacks
in interfaceForwardingAudience
-