Class FacetAudience<V>
- java.lang.Object
-
- net.kyori.adventure.platform.facet.FacetAudience<V>
-
- Type Parameters:
V
- a viewer type
@Internal public class FacetAudience<V> extends java.lang.Object implements Audience, java.io.Closeable
AnAudience
that is implemented byFacet
s.This audience must support multiple viewers, although platforms do not use this feature yet.
This is not supported API. Subject to change at any time.
- Since:
- 4.0.0
- See Also:
Facet
-
-
Field Summary
Fields Modifier and Type Field Description protected @NotNull FacetAudienceProvider<V,FacetAudience<V>>
provider
-
Constructor Summary
Constructors Constructor Description FacetAudience(@NotNull FacetAudienceProvider provider, @NotNull java.util.Collection<? extends V> viewers, @Nullable java.util.Collection<? extends Facet.Chat> chat, @Nullable java.util.Collection<? extends Facet.ActionBar> actionBar, @Nullable java.util.Collection<? extends Facet.Title> title, @Nullable java.util.Collection<? extends Facet.Sound> sound, @Nullable java.util.Collection<? extends Facet.EntitySound> entitySound, @Nullable java.util.Collection<? extends Facet.Book> book, @Nullable java.util.Collection<? extends Facet.BossBar.Builder> bossBar, @Nullable java.util.Collection<? extends Facet.TabList> tabList, @Nullable java.util.Collection<? extends Facet.Pointers> pointerProviders)
Create a new facet-based audience.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addViewer(V viewer)
Add a member to this audience.void
clearTitle()
void
close()
protected void
contributePointers(Pointers.Builder builder)
void
hideBossBar(@NotNull BossBar bar)
void
openBook(@NotNull Book original)
void
playSound(@NotNull Sound original)
void
playSound(@NotNull Sound original, double x, double y, double z)
void
playSound(@NotNull Sound sound, @NotNull Sound.Emitter emitter)
@NotNull Pointers
pointers()
void
refresh()
Refresh the audience.void
removeViewer(V viewer)
Remove a viewer from this audience.void
resetTitle()
void
sendActionBar(@NotNull Component original)
void
sendMessage(@NotNull SignedMessage signedMessage, @NotNull ChatType.Bound boundChatType)
void
sendMessage(@NotNull Identity source, @NotNull Component original, @NotNull MessageType type)
void
sendMessage(@NotNull Component original, @NotNull ChatType.Bound boundChatType)
void
sendPlayerListFooter(@NotNull Component footer)
void
sendPlayerListHeader(@NotNull Component header)
void
sendPlayerListHeaderAndFooter(@NotNull Component header, @NotNull Component footer)
<T> void
sendTitlePart(@NotNull TitlePart<T> part, T value)
void
showBossBar(@NotNull BossBar bar)
void
showTitle(@NotNull Title original)
void
stopSound(@NotNull SoundStop original)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.kyori.adventure.audience.Audience
deleteMessage, deleteMessage, filterAudience, forEachAudience, openBook, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, stopSound
-
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom
-
-
-
-
Field Detail
-
provider
@NotNull protected final @NotNull FacetAudienceProvider<V,FacetAudience<V>> provider
-
-
Constructor Detail
-
FacetAudience
public FacetAudience(@NotNull @NotNull FacetAudienceProvider provider, @NotNull @NotNull java.util.Collection<? extends V> viewers, @Nullable @Nullable java.util.Collection<? extends Facet.Chat> chat, @Nullable @Nullable java.util.Collection<? extends Facet.ActionBar> actionBar, @Nullable @Nullable java.util.Collection<? extends Facet.Title> title, @Nullable @Nullable java.util.Collection<? extends Facet.Sound> sound, @Nullable @Nullable java.util.Collection<? extends Facet.EntitySound> entitySound, @Nullable @Nullable java.util.Collection<? extends Facet.Book> book, @Nullable @Nullable java.util.Collection<? extends Facet.BossBar.Builder> bossBar, @Nullable @Nullable java.util.Collection<? extends Facet.TabList> tabList, @Nullable @Nullable java.util.Collection<? extends Facet.Pointers> pointerProviders)
Create a new facet-based audience.- Parameters:
provider
- for this audienceviewers
- the viewers receiving content sent to this audiencechat
- chat facet candidatesactionBar
- action bar facet candidatestitle
- title facet candidatessound
- sound facet candidatesentitySound
- entity sound facet candidatesbook
- book facet candidatesbossBar
- boss bar facet candidatestabList
- tab list facet candidatespointerProviders
- facets that provide pointers to this audience- Since:
- 4.0.0
-
-
Method Detail
-
addViewer
public void addViewer(@NotNull V viewer)
Add a member to this audience.- Parameters:
viewer
- the viewer- Since:
- 4.0.0
-
removeViewer
public void removeViewer(@NotNull V viewer)
Remove a viewer from this audience.- Parameters:
viewer
- the viewer to remove- Since:
- 4.0.0
-
refresh
public void refresh()
Refresh the audience.- Since:
- 4.0.0
-
sendMessage
public void sendMessage(@NotNull @NotNull Identity source, @NotNull @NotNull Component original, @NotNull @NotNull MessageType type)
- Specified by:
sendMessage
in interfaceAudience
-
sendMessage
public void sendMessage(@NotNull @NotNull Component original, @NotNull ChatType.Bound boundChatType)
- Specified by:
sendMessage
in interfaceAudience
-
sendMessage
public void sendMessage(@NotNull @NotNull SignedMessage signedMessage, @NotNull ChatType.Bound boundChatType)
- Specified by:
sendMessage
in interfaceAudience
-
sendActionBar
public void sendActionBar(@NotNull @NotNull Component original)
- Specified by:
sendActionBar
in interfaceAudience
-
playSound
public void playSound(@NotNull Sound original)
-
playSound
public void playSound(@NotNull @NotNull Sound sound, @NotNull Sound.Emitter emitter)
-
playSound
public void playSound(@NotNull Sound original, double x, double y, double z)
-
stopSound
public void stopSound(@NotNull @NotNull SoundStop original)
-
showTitle
public void showTitle(@NotNull Title original)
-
sendTitlePart
public <T> void sendTitlePart(@NotNull @NotNull TitlePart<T> part, @NotNull T value)
- Specified by:
sendTitlePart
in interfaceAudience
-
clearTitle
public void clearTitle()
- Specified by:
clearTitle
in interfaceAudience
-
resetTitle
public void resetTitle()
- Specified by:
resetTitle
in interfaceAudience
-
showBossBar
public void showBossBar(@NotNull @NotNull BossBar bar)
- Specified by:
showBossBar
in interfaceAudience
-
hideBossBar
public void hideBossBar(@NotNull @NotNull BossBar bar)
- Specified by:
hideBossBar
in interfaceAudience
-
sendPlayerListHeader
public void sendPlayerListHeader(@NotNull @NotNull Component header)
- Specified by:
sendPlayerListHeader
in interfaceAudience
-
sendPlayerListFooter
public void sendPlayerListFooter(@NotNull @NotNull Component footer)
- Specified by:
sendPlayerListFooter
in interfaceAudience
-
sendPlayerListHeaderAndFooter
public void sendPlayerListHeaderAndFooter(@NotNull @NotNull Component header, @NotNull @NotNull Component footer)
- Specified by:
sendPlayerListHeaderAndFooter
in interfaceAudience
-
contributePointers
@OverrideOnly protected void contributePointers(Pointers.Builder builder)
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-