Class FacetAudience<V>

  • Type Parameters:
    V - a viewer type
    All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, net.kyori.adventure.audience.Audience, net.kyori.adventure.pointer.Pointered

    @Internal
    public class FacetAudience<V>
    extends java.lang.Object
    implements net.kyori.adventure.audience.Audience, java.io.Closeable
    An Audience that is implemented by Facets.

    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
    • 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​(net.kyori.adventure.pointer.Pointers.Builder builder)  
      void hideBossBar​(@NotNull net.kyori.adventure.bossbar.BossBar bar)  
      void openBook​(@NotNull net.kyori.adventure.inventory.Book original)  
      void playSound​(@NotNull net.kyori.adventure.sound.Sound original)  
      void playSound​(@NotNull net.kyori.adventure.sound.Sound original, double x, double y, double z)  
      void playSound​(@NotNull net.kyori.adventure.sound.Sound sound, @NotNull net.kyori.adventure.sound.Sound.Emitter emitter)  
      @NotNull net.kyori.adventure.pointer.Pointers pointers()  
      void refresh()
      Refresh the audience.
      void removeViewer​(V viewer)
      Remove a viewer from this audience.
      void resetTitle()  
      void sendActionBar​(@NotNull net.kyori.adventure.text.Component original)  
      void sendMessage​(@NotNull net.kyori.adventure.chat.SignedMessage signedMessage, @NotNull net.kyori.adventure.chat.ChatType.Bound boundChatType)  
      void sendMessage​(@NotNull net.kyori.adventure.identity.Identity source, @NotNull net.kyori.adventure.text.Component original, @NotNull net.kyori.adventure.audience.MessageType type)  
      void sendMessage​(@NotNull net.kyori.adventure.text.Component original, @NotNull net.kyori.adventure.chat.ChatType.Bound boundChatType)  
      void sendPlayerListFooter​(@NotNull net.kyori.adventure.text.Component footer)  
      void sendPlayerListHeader​(@NotNull net.kyori.adventure.text.Component header)  
      void sendPlayerListHeaderAndFooter​(@NotNull net.kyori.adventure.text.Component header, @NotNull net.kyori.adventure.text.Component footer)  
      <T> void sendTitlePart​(@NotNull net.kyori.adventure.title.TitlePart<T> part, T value)  
      void showBossBar​(@NotNull net.kyori.adventure.bossbar.BossBar bar)  
      void showTitle​(@NotNull net.kyori.adventure.title.Title original)  
      void stopSound​(@NotNull net.kyori.adventure.sound.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

        clearResourcePacks, deleteMessage, deleteMessage, filterAudience, forEachAudience, openBook, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, sendResourcePacks, stopSound
      • Methods inherited from interface net.kyori.adventure.pointer.Pointered

        get, getOrDefault, getOrDefaultFrom
    • 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 audience
        viewers - the viewers receiving content sent to this audience
        chat - chat facet candidates
        actionBar - action bar facet candidates
        title - title facet candidates
        sound - sound facet candidates
        entitySound - entity sound facet candidates
        book - book facet candidates
        bossBar - boss bar facet candidates
        tabList - tab list facet candidates
        pointerProviders - 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 net.kyori.adventure.identity.Identity source,
                                @NotNull
                                @NotNull net.kyori.adventure.text.Component original,
                                @NotNull
                                @NotNull net.kyori.adventure.audience.MessageType type)
        Specified by:
        sendMessage in interface net.kyori.adventure.audience.Audience
      • sendMessage

        public void sendMessage​(@NotNull
                                @NotNull net.kyori.adventure.text.Component original,
                                @NotNull net.kyori.adventure.chat.ChatType.Bound boundChatType)
        Specified by:
        sendMessage in interface net.kyori.adventure.audience.Audience
      • sendMessage

        public void sendMessage​(@NotNull
                                @NotNull net.kyori.adventure.chat.SignedMessage signedMessage,
                                @NotNull net.kyori.adventure.chat.ChatType.Bound boundChatType)
        Specified by:
        sendMessage in interface net.kyori.adventure.audience.Audience
      • sendActionBar

        public void sendActionBar​(@NotNull
                                  @NotNull net.kyori.adventure.text.Component original)
        Specified by:
        sendActionBar in interface net.kyori.adventure.audience.Audience
      • playSound

        public void playSound​(@NotNull net.kyori.adventure.sound.Sound original)
        Specified by:
        playSound in interface net.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:
        playSound in interface net.kyori.adventure.audience.Audience
      • playSound

        public void playSound​(@NotNull net.kyori.adventure.sound.Sound original,
                              double x,
                              double y,
                              double z)
        Specified by:
        playSound in interface net.kyori.adventure.audience.Audience
      • stopSound

        public void stopSound​(@NotNull
                              @NotNull net.kyori.adventure.sound.SoundStop original)
        Specified by:
        stopSound in interface net.kyori.adventure.audience.Audience
      • openBook

        public void openBook​(@NotNull net.kyori.adventure.inventory.Book original)
        Specified by:
        openBook in interface net.kyori.adventure.audience.Audience
      • showTitle

        public void showTitle​(@NotNull net.kyori.adventure.title.Title original)
        Specified by:
        showTitle in interface net.kyori.adventure.audience.Audience
      • sendTitlePart

        public <T> void sendTitlePart​(@NotNull
                                      @NotNull net.kyori.adventure.title.TitlePart<T> part,
                                      @NotNull
                                      T value)
        Specified by:
        sendTitlePart in interface net.kyori.adventure.audience.Audience
      • clearTitle

        public void clearTitle()
        Specified by:
        clearTitle in interface net.kyori.adventure.audience.Audience
      • resetTitle

        public void resetTitle()
        Specified by:
        resetTitle in interface net.kyori.adventure.audience.Audience
      • showBossBar

        public void showBossBar​(@NotNull
                                @NotNull net.kyori.adventure.bossbar.BossBar bar)
        Specified by:
        showBossBar in interface net.kyori.adventure.audience.Audience
      • hideBossBar

        public void hideBossBar​(@NotNull
                                @NotNull net.kyori.adventure.bossbar.BossBar bar)
        Specified by:
        hideBossBar in interface net.kyori.adventure.audience.Audience
      • sendPlayerListHeader

        public void sendPlayerListHeader​(@NotNull
                                         @NotNull net.kyori.adventure.text.Component header)
        Specified by:
        sendPlayerListHeader in interface net.kyori.adventure.audience.Audience
      • sendPlayerListFooter

        public void sendPlayerListFooter​(@NotNull
                                         @NotNull net.kyori.adventure.text.Component footer)
        Specified by:
        sendPlayerListFooter in interface net.kyori.adventure.audience.Audience
      • sendPlayerListHeaderAndFooter

        public void sendPlayerListHeaderAndFooter​(@NotNull
                                                  @NotNull net.kyori.adventure.text.Component header,
                                                  @NotNull
                                                  @NotNull net.kyori.adventure.text.Component footer)
        Specified by:
        sendPlayerListHeaderAndFooter in interface net.kyori.adventure.audience.Audience
      • pointers

        @NotNull
        public @NotNull net.kyori.adventure.pointer.Pointers pointers()
        Specified by:
        pointers in interface net.kyori.adventure.pointer.Pointered
      • contributePointers

        @OverrideOnly
        protected void contributePointers​(net.kyori.adventure.pointer.Pointers.Builder builder)
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable