Interface ForwardingAudience
-
- All Known Subinterfaces:
ForwardingAudience.Single
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ForwardingAudience extends Audience
A receiver that wraps one or more receivers.ForwardingAudienceis designed to easily allow users or implementations wrap an existing (collection of)Audience(s).- Since:
- 4.0.0
- See Also:
Audience
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceForwardingAudience.SingleAn audience that forwards everything to a single other audience.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description @NotNull Iterable<? extends Audience>audiences()Gets the audiences.default voidclearTitle()Clears the title, if one is being displayed.default @NotNull AudiencefilterAudience(@NotNull Predicate<? super Audience> filter)Filters this audience.default voidforEachAudience(@NotNull Consumer<? super Audience> action)Executes an action against all audiences.default voidhideBossBar(@NotNull BossBar bar)Hides a boss bar.default voidopenBook(@NotNull Book book)Opens a book.default voidplaySound(@NotNull Sound sound)Plays a sound at the location of the recipient of the sound.default voidplaySound(@NotNull Sound sound, double x, double y, double z)Plays a sound at a location.default voidplaySound(@NotNull Sound sound, @NotNull Sound.Emitter emitter)Plays a sound from an emitter, usually an entity.default @NotNull Pointerspointers()Gets the pointers for this object.default voidresetTitle()Resets the title and timings back to their default.default voidsendActionBar(@NotNull Component message)Sends a message on the action bar.default voidsendMessage(@NotNull Identified source, @NotNull Component message, @NotNull MessageType type)Sends a chat message.default voidsendMessage(@NotNull Identity source, @NotNull Component message, @NotNull MessageType type)Sends a chat message.default voidsendPlayerListFooter(@NotNull Component footer)Sends the player list footer.default voidsendPlayerListHeader(@NotNull Component header)Sends the player list header.default voidsendPlayerListHeaderAndFooter(@NotNull Component header, @NotNull Component footer)Sends the player list header and footer.default <T> voidsendTitlePart(@NotNull TitlePart<T> part, T value)Shows a part of a title.default voidshowBossBar(@NotNull BossBar bar)Shows a boss bar.default voidstopSound(@NotNull SoundStop stop)Stops a sound, or many sounds.-
Methods inherited from interface net.kyori.adventure.audience.Audience
openBook, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, showTitle, stopSound
-
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom
-
-
-
-
Method Detail
-
audiences
@OverrideOnly @NotNull @NotNull Iterable<? extends Audience> audiences()
Gets the audiences.- Returns:
- the audiences
- Since:
- 4.0.0
-
pointers
@NotNull default @NotNull Pointers pointers()
Description copied from interface:PointeredGets the pointers for this object.
-
filterAudience
@NotNull default @NotNull Audience filterAudience(@NotNull @NotNull Predicate<? super Audience> filter)
Description copied from interface:AudienceFilters this audience.The returned
Audiencemay be the same, or a completely different one.Container audiences such as
ForwardingAudiencemay or may not have their own identity. If they do, they may test themselves against the providedfilterfirst, 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:
filterAudiencein interfaceAudience- 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
default void forEachAudience(@NotNull @NotNull Consumer<? super Audience> action)Description copied from interface:AudienceExecutes an action against all audiences.If you implement
Audienceand notForwardingAudiencein 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
Audiencehas its own identity distinct from its contained children, it may test itself against the providedfilterfirst, 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:
forEachAudiencein interfaceAudience- Parameters:
action- the action
-
sendMessage
default void sendMessage(@NotNull @NotNull Identified source, @NotNull @NotNull Component message, @NotNull @NotNull MessageType type)Description copied from interface:AudienceSends a chat message.- Specified by:
sendMessagein interfaceAudience- Parameters:
source- the source of the messagemessage- a messagetype- the type- See Also:
Component
-
sendMessage
default void sendMessage(@NotNull @NotNull Identity source, @NotNull @NotNull Component message, @NotNull @NotNull MessageType type)Description copied from interface:AudienceSends a chat message.- Specified by:
sendMessagein interfaceAudience- Parameters:
source- the identity of the source of the messagemessage- a messagetype- the type- See Also:
Component
-
sendActionBar
default void sendActionBar(@NotNull @NotNull Component message)Description copied from interface:AudienceSends a message on the action bar.- Specified by:
sendActionBarin interfaceAudience- Parameters:
message- a message- See Also:
Component
-
sendPlayerListHeader
default void sendPlayerListHeader(@NotNull @NotNull Component header)Description copied from interface:AudienceSends 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:
sendPlayerListHeaderin interfaceAudience- Parameters:
header- the header
-
sendPlayerListFooter
default void sendPlayerListFooter(@NotNull @NotNull Component footer)Description copied from interface:AudienceSends the player list footer.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:
sendPlayerListFooterin interfaceAudience- Parameters:
footer- the footer
-
sendPlayerListHeaderAndFooter
default void sendPlayerListHeaderAndFooter(@NotNull @NotNull Component header, @NotNull @NotNull Component footer)Description copied from interface:AudienceSends the player list header and footer.- Specified by:
sendPlayerListHeaderAndFooterin interfaceAudience- Parameters:
header- the headerfooter- the footer
-
sendTitlePart
default <T> void sendTitlePart(@NotNull @NotNull TitlePart<T> part, @NotNull T value)Description copied from interface:AudienceShows a part of a title.- Specified by:
sendTitlePartin interfaceAudience- 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:AudienceClears the title, if one is being displayed.- Specified by:
clearTitlein interfaceAudience- See Also:
Title
-
resetTitle
default void resetTitle()
Description copied from interface:AudienceResets the title and timings back to their default.- Specified by:
resetTitlein interfaceAudience- See Also:
Title
-
showBossBar
default void showBossBar(@NotNull @NotNull BossBar bar)Description copied from interface:AudienceShows a boss bar.- Specified by:
showBossBarin interfaceAudience- Parameters:
bar- a boss bar- See Also:
BossBar
-
hideBossBar
default void hideBossBar(@NotNull @NotNull BossBar bar)Description copied from interface:AudienceHides a boss bar.- Specified by:
hideBossBarin interfaceAudience- Parameters:
bar- a boss bar- See Also:
BossBar
-
playSound
default void playSound(@NotNull @NotNull Sound sound)Description copied from interface:AudiencePlays 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().
-
playSound
default void playSound(@NotNull @NotNull Sound sound, double x, double y, double z)Description copied from interface:AudiencePlays a sound at a location.
-
playSound
default void playSound(@NotNull @NotNull Sound sound, @NotNull Sound.Emitter emitter)Description copied from interface:AudiencePlays 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.
-
stopSound
default void stopSound(@NotNull @NotNull SoundStop stop)Description copied from interface:AudienceStops a sound, or many sounds.
-
-