Interface ForwardingAudience.Single
- All Superinterfaces:
Audience, ForwardingAudience, Pointered
- Enclosing interface:
ForwardingAudience
- Since:
- 4.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface ForwardingAudience
ForwardingAudience.Single -
Method Summary
Modifier and TypeMethodDescriptionaudience()Gets the audience.Gets the audiences.default voidClear all server-provided resource packs that have been sent to this user.default voidClears the title, if one is being displayed.default voidCloses the dialog that is currently being shown to this audience, if any.default voiddeleteMessage(SignedMessage.Signature signature) Requests deletion of a message with the providedSignedMessage.Signature.default AudiencefilterAudience(Predicate<? super Audience> filter) Filters this audience.default voidforEachAudience(Consumer<? super Audience> action) Executes an action against all audiences.default <T> Optional<T> Gets the value ofpointer.default <T> @Nullable TgetOrDefault(Pointer<T> pointer, @Nullable T defaultValue) Gets the value ofpointer.default <T> @UnknownNullability TgetOrDefaultFrom(Pointer<T> pointer, Supplier<? extends T> defaultValue) Gets the value ofpointer.default voidhideBossBar(BossBar bar) Hides a boss bar.default voidOpens a book.default voidPlays a sound at the location of the recipient of the sound.default voidPlays a sound at a location.default voidplaySound(Sound sound, Sound.Emitter emitter) Plays a sound from an emitter, usually an entity.default Pointerspointers()Gets the pointers for this object.default voidremoveResourcePacks(Iterable<UUID> ids) Clear resource packs with the provided ids if they are present.default voidremoveResourcePacks(UUID id, UUID... others) Clear resource packs with the provided ids if they are present.default voidResets the title and timings back to their default.default voidsendActionBar(Component message) Sends a message on the action bar.default voidsendMessage(SignedMessage signedMessage, ChatType.Bound boundChatType) Sends a signed player message to thisAudiencewith the providedbound chat type.default voidsendMessage(Component message) Sends a system chat message to thisAudience.default voidsendMessage(Component message, ChatType.Bound boundChatType) Sends a message to thisAudiencewith the providedbound chat type.default voidsendPlayerListFooter(Component footer) Sends the player list footer.default voidsendPlayerListHeader(Component header) Sends the player list header.default voidsendPlayerListHeaderAndFooter(Component header, Component footer) Sends the player list header and footer.default voidsendResourcePacks(ResourcePackRequest request) Sends a request to apply resource packs to this audience.default <T> voidsendTitlePart(TitlePart<T> part, T value) Shows a part of a title.default voidshowBossBar(BossBar bar) Shows a boss bar.default voidshowDialog(DialogLike dialog) Shows a dialog to this audience.default voidStops a sound, or many sounds.Methods inherited from interface Audience
deleteMessage, openBook, openBook, removeResourcePacks, removeResourcePacks, removeResourcePacks, sendActionBar, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, showTitle, stopSound
-
Method Details
-
audience
-
audiences
Description copied from interface:ForwardingAudienceGets the audiences.- Specified by:
audiencesin interfaceForwardingAudience- Returns:
- the audiences
-
get
-
getOrDefault
@Contract("_, null -> null; _, !null -> !null") default <T> @Nullable T getOrDefault(Pointer<T> pointer, @Nullable T defaultValue) Description copied from interface:PointeredGets the value ofpointer.If this
Audienceis unable to provide a value forpointer,defaultValuewill be returned.- Specified by:
getOrDefaultin interfacePointered- Type Parameters:
T- the type- Parameters:
pointer- the pointerdefaultValue- the default value- Returns:
- the value
-
getOrDefaultFrom
default <T> @UnknownNullability T getOrDefaultFrom(Pointer<T> pointer, Supplier<? extends T> defaultValue) Description copied from interface:PointeredGets the value ofpointer.If this
Audienceis unable to provide a value forpointer, the value supplied bydefaultValuewill be returned.- Specified by:
getOrDefaultFromin interfacePointered- Type Parameters:
T- the type- Parameters:
pointer- the pointerdefaultValue- the default value supplier- Returns:
- the value
-
filterAudience
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- Specified by:
filterAudiencein 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: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- Specified by:
forEachAudiencein interfaceForwardingAudience- Parameters:
action- the action
-
pointers
-
sendMessage
Description copied from interface:AudienceSends a system chat message to thisAudience.- Specified by:
sendMessagein interfaceAudience- Specified by:
sendMessagein interfaceForwardingAudience- Parameters:
message- a message- See Also:
-
sendMessage
Description copied from interface:AudienceSends a message to thisAudiencewith the providedbound chat type.- Specified by:
sendMessagein interfaceAudience- Specified by:
sendMessagein interfaceForwardingAudience- Parameters:
message- the component contentboundChatType- the bound chat type
-
sendMessage
Description copied from interface:AudienceSends a signed player message to thisAudiencewith the providedbound chat type.- Specified by:
sendMessagein interfaceAudience- Specified by:
sendMessagein interfaceForwardingAudience- Parameters:
signedMessage- the signed message databoundChatType- the bound chat type
-
deleteMessage
Description copied from interface:AudienceRequests deletion of a message with the providedSignedMessage.Signature.- Specified by:
deleteMessagein interfaceAudience- Specified by:
deleteMessagein interfaceForwardingAudience- Parameters:
signature- the signature
-
sendActionBar
Description copied from interface:AudienceSends a message on the action bar.- Specified by:
sendActionBarin interfaceAudience- Specified by:
sendActionBarin interfaceForwardingAudience- Parameters:
message- a message- See Also:
-
sendPlayerListHeader
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- Specified by:
sendPlayerListHeaderin interfaceForwardingAudience- Parameters:
header- the header
-
sendTitlePart
Description copied from interface:AudienceShows a part of a title.- Specified by:
sendTitlePartin interfaceAudience- Specified by:
sendTitlePartin 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:AudienceClears the title, if one is being displayed.- Specified by:
clearTitlein interfaceAudience- Specified by:
clearTitlein interfaceForwardingAudience- See Also:
-
resetTitle
default void resetTitle()Description copied from interface:AudienceResets the title and timings back to their default.- Specified by:
resetTitlein interfaceAudience- Specified by:
resetTitlein interfaceForwardingAudience- See Also:
-
showBossBar
Description copied from interface:AudienceShows a boss bar.- Specified by:
showBossBarin interfaceAudience- Specified by:
showBossBarin interfaceForwardingAudience- Parameters:
bar- a boss bar- See Also:
-
hideBossBar
Description copied from interface:AudienceHides a boss bar.- Specified by:
hideBossBarin interfaceAudience- Specified by:
hideBossBarin interfaceForwardingAudience- Parameters:
bar- a boss bar- See Also:
-
playSound
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().- Specified by:
playSoundin interfaceAudience- Specified by:
playSoundin interfaceForwardingAudience- Parameters:
sound- a sound- See Also:
-
playSound
Description copied from interface:AudiencePlays a sound at a location.- Specified by:
playSoundin interfaceAudience- Specified by:
playSoundin interfaceForwardingAudience- Parameters:
sound- a soundx- x coordinatey- y coordinatez- z coordinate- See Also:
-
playSound
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().- Specified by:
playSoundin interfaceAudience- Specified by:
playSoundin interfaceForwardingAudience- Parameters:
sound- a soundemitter- an emitter
-
stopSound
-
openBook
-
sendResourcePacks
Description copied from interface:AudienceSends 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:
sendResourcePacksin interfaceAudience- Specified by:
sendResourcePacksin interfaceForwardingAudience- Parameters:
request- the resource pack request- See Also:
-
removeResourcePacks
Description copied from interface:AudienceClear resource packs with the provided ids if they are present.- Specified by:
removeResourcePacksin interfaceAudience- Specified by:
removeResourcePacksin interfaceForwardingAudience- Parameters:
ids- the ids of resource packs to remove
-
removeResourcePacks
Description copied from interface:AudienceClear resource packs with the provided ids if they are present.- Specified by:
removeResourcePacksin interfaceAudience- Specified by:
removeResourcePacksin interfaceForwardingAudience- Parameters:
id- the idothers- the ids of any additional resource packs
-
clearResourcePacks
default void clearResourcePacks()Description copied from interface:AudienceClear all server-provided resource packs that have been sent to this user.- Specified by:
clearResourcePacksin interfaceAudience- Specified by:
clearResourcePacksin interfaceForwardingAudience
-
showDialog
Description copied from interface:AudienceShows a dialog to this audience.This method exists to allow initial native support for dialogs until Adventure has full API to support building and sending dialogs.
- Specified by:
showDialogin interfaceAudience- Specified by:
showDialogin interfaceForwardingAudience- Parameters:
dialog- the dialog
-
closeDialog
default void closeDialog()Description copied from interface:AudienceCloses the dialog that is currently being shown to this audience, if any.This will return the user to the previous dialog if one was opened from the current dialog.
- Specified by:
closeDialogin interfaceAudience- Specified by:
closeDialogin interfaceForwardingAudience
-