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
ForwardingAudience
is 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 interface
ForwardingAudience.Single
An audience that forwards everything to a single other audience. -
Method Summary
Modifier and Type Method Description @NotNull Iterable<? extends Audience>
audiences()
Gets the audiences.default void
clearTitle()
Clears the title, if one is being displayed.default <T> @NotNull Optional<T>
get(@NotNull Pointer<T> pointer)
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
openBook(@NotNull Book book)
Opens a book.default void
playSound(@NotNull Sound sound)
Plays a sound at the location of the recipient of the sound.default void
playSound(@NotNull Sound sound, double x, double y, double z)
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 void
resetTitle()
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 Identified source, @NotNull Component message, @NotNull MessageType type)
Sends a chat message.default void
sendMessage(@NotNull Identity source, @NotNull Component message, @NotNull MessageType type)
Sends a chat message.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
showBossBar(@NotNull BossBar bar)
Shows a boss bar.default void
showTitle(@NotNull Title title)
Shows a title.default void
stopSound(@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, stopSound
-
Method Details
-
audiences
Gets the audiences.- Returns:
- the audiences
- Since:
- 4.0.0
-
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
-
sendMessage
default void sendMessage(@NotNull @NotNull Identified source, @NotNull @NotNull Component message, @NotNull @NotNull MessageType type)Description copied from interface:Audience
Sends a chat message.- Specified by:
sendMessage
in 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:Audience
Sends a chat message.- Specified by:
sendMessage
in interfaceAudience
- Parameters:
source
- the identity of the source of the messagemessage
- a messagetype
- the type- See Also:
Component
-
sendActionBar
Description copied from interface:Audience
Sends a message on the action bar.- Specified by:
sendActionBar
in interfaceAudience
- Parameters:
message
- a message- See Also:
Component
-
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
- Parameters:
header
- the header
-
showTitle
Description copied from interface:Audience
Shows a title. -
clearTitle
default void clearTitle()Description copied from interface:Audience
Clears the title, if one is being displayed.- Specified by:
clearTitle
in interfaceAudience
- See Also:
Title
-
resetTitle
default void resetTitle()Description copied from interface:Audience
Resets the title and timings back to their default.- Specified by:
resetTitle
in interfaceAudience
- See Also:
Title
-
showBossBar
Description copied from interface:Audience
Shows a boss bar.- Specified by:
showBossBar
in interfaceAudience
- Parameters:
bar
- a boss bar- See Also:
BossBar
-
hideBossBar
Description copied from interface:Audience
Hides a boss bar.- Specified by:
hideBossBar
in interfaceAudience
- Parameters:
bar
- a boss bar- See Also:
BossBar
-
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()
. -
playSound
Description copied from interface:Audience
Plays a sound at a location. -
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.
-
stopSound
Description copied from interface:Audience
Stops a sound, or many sounds. -
openBook
Description copied from interface:Audience
Opens a book.When possible, no item should persist after closing the book.
-