Package me.totalfreedom.audience
Class MutableAudienceForwarder
java.lang.Object
me.totalfreedom.audience.MutableAudienceForwarder
- All Implemented Interfaces:
net.kyori.adventure.audience.Audience,net.kyori.adventure.pointer.Pointered
public class MutableAudienceForwarder
extends Object
implements net.kyori.adventure.audience.Audience
A replacement for
ForwardingAudience that allows for audiences to be removed and
added at will. Not thread safe.
This is intended for use in toggleable logging systems, for example, potion spy.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAudience(net.kyori.adventure.audience.Audience audience) Adds an audience to this forwarder.voidvoiddeleteMessage(@NotNull net.kyori.adventure.chat.SignedMessage signedMessage) Deletes a signed message from the audiences chat.voiddeleteMessage(@NotNull net.kyori.adventure.chat.SignedMessage.Signature signature) Deletes a signed message from the audiences chat using the provided chat signature.@NotNull net.kyori.adventure.audience.AudiencefilterAudience(@NotNull Predicate<? super net.kyori.adventure.audience.Audience> filter) Filters the audiences in the stream by the given predicate.voidforEachAudience(@NotNull Consumer<? super net.kyori.adventure.audience.Audience> action) Applies a consumer to each audience in the stream.static MutableAudienceForwarderfrom(net.kyori.adventure.audience.Audience... audiences) Creates a newMutableAudienceForwarderwith the given audiences.voidhideBossBar(@NotNull net.kyori.adventure.bossbar.BossBar bar) voidopenBook(@NotNull net.kyori.adventure.inventory.Book book) voidopenBook(@NotNull net.kyori.adventure.inventory.Book.Builder book) voidplaySound(@NotNull net.kyori.adventure.sound.Sound sound) voidplaySound(@NotNull net.kyori.adventure.sound.Sound sound, double x, double y, double z) voidplaySound(@NotNull net.kyori.adventure.sound.Sound sound, @NotNull net.kyori.adventure.sound.Sound.Emitter emitter) booleanremoveAudience(net.kyori.adventure.audience.Audience audience) Removes an audience from this forwarder.voidvoidsendActionBar(@NotNull net.kyori.adventure.text.Component message) voidsendActionBar(@NotNull net.kyori.adventure.text.ComponentLike message) voidsendMessage(@NotNull net.kyori.adventure.chat.SignedMessage signedMessage, @NotNull net.kyori.adventure.chat.ChatType.Bound boundChatType) Sends aSignedMessageto every audience within the stream.voidsendMessage(@NotNull net.kyori.adventure.text.Component message) Sends aComponentto every audience within the stream.voidsendMessage(@NotNull net.kyori.adventure.text.ComponentLike message) Sends aComponentLiketo every audience within the stream.voidsendMessage(@NotNull net.kyori.adventure.text.ComponentLike message, @NotNull net.kyori.adventure.chat.ChatType.Bound boundChatType) Sends aSignedMessageto every audience within the stream.voidsendMessage(@NotNull net.kyori.adventure.text.Component message, @NotNull net.kyori.adventure.chat.ChatType.Bound boundChatType) Sends aSignedMessageto every audience within the stream.voidsendPlayerListFooter(@NotNull net.kyori.adventure.text.Component footer) voidsendPlayerListFooter(@NotNull net.kyori.adventure.text.ComponentLike footer) voidsendPlayerListHeader(@NotNull net.kyori.adventure.text.Component header) voidsendPlayerListHeader(@NotNull net.kyori.adventure.text.ComponentLike header) voidsendPlayerListHeaderAndFooter(@NotNull net.kyori.adventure.text.ComponentLike header, @NotNull net.kyori.adventure.text.ComponentLike footer) voidsendPlayerListHeaderAndFooter(@NotNull net.kyori.adventure.text.Component header, @NotNull net.kyori.adventure.text.Component footer) <T> voidsendTitlePart(@NotNull net.kyori.adventure.title.TitlePart<T> part, T value) voidshowBossBar(@NotNull net.kyori.adventure.bossbar.BossBar bar) voidshowTitle(@NotNull net.kyori.adventure.title.Title title) voidstopSound(@NotNull net.kyori.adventure.sound.Sound sound) voidstopSound(@NotNull net.kyori.adventure.sound.SoundStop stop) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.kyori.adventure.audience.Audience
sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessageMethods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom, pointers
-
Constructor Details
-
MutableAudienceForwarder
public MutableAudienceForwarder()
-
-
Method Details
-
from
Creates a newMutableAudienceForwarderwith the given audiences.- Parameters:
audiences- The audiences to forward to.- Returns:
- The new
MutableAudienceForwarder.
-
addAudience
public void addAudience(net.kyori.adventure.audience.Audience audience) Adds an audience to this forwarder.- Parameters:
audience- The audience to add.
-
removeAudience
public boolean removeAudience(net.kyori.adventure.audience.Audience audience) Removes an audience from this forwarder.- Parameters:
audience- The audience to remove.- Returns:
- Whether the audience was removed.
-
filterAudience
@NotNull public @NotNull net.kyori.adventure.audience.Audience filterAudience(@NotNull @NotNull Predicate<? super net.kyori.adventure.audience.Audience> filter) Filters the audiences in the stream by the given predicate.- Specified by:
filterAudiencein interfacenet.kyori.adventure.audience.Audience- Parameters:
filter- a filter that determines if an audience should be included- Returns:
- The first Audience found that matches the filter.
-
forEachAudience
public void forEachAudience(@NotNull @NotNull Consumer<? super net.kyori.adventure.audience.Audience> action) Applies a consumer to each audience in the stream.- Specified by:
forEachAudiencein interfacenet.kyori.adventure.audience.Audience- Parameters:
action- the action to apply.
-
sendMessage
public void sendMessage(@NotNull @NotNull net.kyori.adventure.text.ComponentLike message) Sends aComponentLiketo every audience within the stream.- Specified by:
sendMessagein interfacenet.kyori.adventure.audience.Audience- Parameters:
message- The message to send.- See Also:
-
Audience.sendMessage(ComponentLike)forEachAudience(Consumer)
-
sendMessage
public void sendMessage(@NotNull @NotNull net.kyori.adventure.text.Component message) Sends aComponentto every audience within the stream.- Specified by:
sendMessagein interfacenet.kyori.adventure.audience.Audience- Parameters:
message- The message to send- See Also:
-
Audience.sendMessage(Component)forEachAudience(Consumer)
-
sendMessage
public void sendMessage(@NotNull @NotNull net.kyori.adventure.text.Component message, @NotNull net.kyori.adventure.chat.ChatType.Bound boundChatType) Sends aSignedMessageto every audience within the stream.- Specified by:
sendMessagein interfacenet.kyori.adventure.audience.Audience- Parameters:
message- the component content of the messageboundChatType- the bound chat type of the message- See Also:
-
Audience.sendMessage(Component, ChatType.Bound)forEachAudience(Consumer)
-
sendMessage
public void sendMessage(@NotNull @NotNull net.kyori.adventure.text.ComponentLike message, @NotNull net.kyori.adventure.chat.ChatType.Bound boundChatType) Sends aSignedMessageto every audience within the stream.- Specified by:
sendMessagein interfacenet.kyori.adventure.audience.Audience- Parameters:
message- the component content of the messageboundChatType- the bound chat type of the message- See Also:
-
Audience.sendMessage(ComponentLike, ChatType.Bound)forEachAudience(Consumer)
-
sendMessage
public void sendMessage(@NotNull @NotNull net.kyori.adventure.chat.SignedMessage signedMessage, @NotNull net.kyori.adventure.chat.ChatType.Bound boundChatType) Sends aSignedMessageto every audience within the stream.- Specified by:
sendMessagein interfacenet.kyori.adventure.audience.Audience- Parameters:
signedMessage- the signed message data to sendboundChatType- the bound chat type of the message
-
deleteMessage
public void deleteMessage(@NotNull @NotNull net.kyori.adventure.chat.SignedMessage signedMessage) Deletes a signed message from the audiences chat.- Specified by:
deleteMessagein interfacenet.kyori.adventure.audience.Audience- Parameters:
signedMessage- the message to delete
-
deleteMessage
public void deleteMessage(@NotNull net.kyori.adventure.chat.SignedMessage.Signature signature) Deletes a signed message from the audiences chat using the provided chat signature.- Specified by:
deleteMessagein interfacenet.kyori.adventure.audience.Audience- Parameters:
signature- the signature associated with the message to delete.
-
sendActionBar
public void sendActionBar(@NotNull @NotNull net.kyori.adventure.text.ComponentLike message) - Specified by:
sendActionBarin interfacenet.kyori.adventure.audience.Audience
-
sendActionBar
public void sendActionBar(@NotNull @NotNull net.kyori.adventure.text.Component message) - Specified by:
sendActionBarin interfacenet.kyori.adventure.audience.Audience
-
sendPlayerListHeader
public void sendPlayerListHeader(@NotNull @NotNull net.kyori.adventure.text.ComponentLike header) - Specified by:
sendPlayerListHeaderin interfacenet.kyori.adventure.audience.Audience
-
sendPlayerListHeader
public void sendPlayerListHeader(@NotNull @NotNull net.kyori.adventure.text.Component header) - Specified by:
sendPlayerListHeaderin interfacenet.kyori.adventure.audience.Audience
-
showTitle
public void showTitle(@NotNull @NotNull net.kyori.adventure.title.Title title) - Specified by:
showTitlein interfacenet.kyori.adventure.audience.Audience
-
sendTitlePart
public <T> void sendTitlePart(@NotNull @NotNull net.kyori.adventure.title.TitlePart<T> part, @NotNull T value) - Specified by:
sendTitlePartin interfacenet.kyori.adventure.audience.Audience
-
clearTitle
public void clearTitle()- Specified by:
clearTitlein interfacenet.kyori.adventure.audience.Audience
-
resetTitle
public void resetTitle()- Specified by:
resetTitlein interfacenet.kyori.adventure.audience.Audience
-
showBossBar
public void showBossBar(@NotNull @NotNull net.kyori.adventure.bossbar.BossBar bar) - Specified by:
showBossBarin interfacenet.kyori.adventure.audience.Audience
-
hideBossBar
public void hideBossBar(@NotNull @NotNull net.kyori.adventure.bossbar.BossBar bar) - Specified by:
hideBossBarin interfacenet.kyori.adventure.audience.Audience
-
playSound
public void playSound(@NotNull @NotNull net.kyori.adventure.sound.Sound sound) - Specified by:
playSoundin interfacenet.kyori.adventure.audience.Audience
-
playSound
public void playSound(@NotNull @NotNull net.kyori.adventure.sound.Sound sound, double x, double y, double z) - Specified by:
playSoundin interfacenet.kyori.adventure.audience.Audience
-
playSound
public void playSound(@NotNull @NotNull net.kyori.adventure.sound.Sound sound, @NotNull net.kyori.adventure.sound.Sound.Emitter emitter) - Specified by:
playSoundin interfacenet.kyori.adventure.audience.Audience
-
stopSound
public void stopSound(@NotNull @NotNull net.kyori.adventure.sound.Sound sound) - Specified by:
stopSoundin interfacenet.kyori.adventure.audience.Audience
-
stopSound
public void stopSound(@NotNull @NotNull net.kyori.adventure.sound.SoundStop stop) - Specified by:
stopSoundin interfacenet.kyori.adventure.audience.Audience
-
openBook
public void openBook(@NotNull net.kyori.adventure.inventory.Book.Builder book) - Specified by:
openBookin interfacenet.kyori.adventure.audience.Audience
-
openBook
public void openBook(@NotNull @NotNull net.kyori.adventure.inventory.Book book) - Specified by:
openBookin interfacenet.kyori.adventure.audience.Audience
-