Class FacetAudience<V>

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

    @Internal
    public class FacetAudience<V>
    extends java.lang.Object
    implements 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 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
      • playSound

        public void playSound​(@NotNull Sound original)
        Specified by:
        playSound in interface Audience
      • playSound

        public void playSound​(@NotNull Sound original,
                              double x,
                              double y,
                              double z)
        Specified by:
        playSound in interface Audience
      • openBook

        public void openBook​(@NotNull Book original)
        Specified by:
        openBook in interface Audience
      • showTitle

        public void showTitle​(@NotNull Title original)
        Specified by:
        showTitle in interface Audience
      • sendTitlePart

        public <T> void sendTitlePart​(@NotNull
                                      @NotNull TitlePart<T> part,
                                      @NotNull
                                      T value)
        Specified by:
        sendTitlePart in interface Audience
      • contributePointers

        @OverrideOnly
        protected void contributePointers​(Pointers.Builder builder)
      • close

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