Interface Facet<V>
-
- Type Parameters:
V- a viewer type
- All Known Subinterfaces:
Facet.ActionBar<V,M>,Facet.Book<V,M,B>,Facet.BossBar.Builder<V,B>,Facet.BossBarEntity<V,P>,Facet.Chat<V,M>,Facet.ChatPacket<V,M>,Facet.FakeEntity<V,P>,Facet.Message<V,M>,Facet.Position<V,P>,Facet.Sound<V,P>,Facet.Title<V,M,T>,Facet.TitlePacket<V,M,T>
- All Known Implementing Classes:
FacetBase,ViaFacet,ViaFacet.ActionBar,ViaFacet.ActionBarTitle,ViaFacet.BossBar,ViaFacet.BossBar.Builder,ViaFacet.BossBar.Builder1_9_To_1_15,ViaFacet.Chat,ViaFacet.ProtocolBased,ViaFacet.Title
public interface Facet<V>A unit of functionality for a viewer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceFacet.ActionBar<V,M>A facet that sends action bars.static interfaceFacet.Book<V,M,B>A facet that opens a book.static interfaceFacet.BossBar<V>A facet that listens to boss bar changes.static interfaceFacet.BossBarEntity<V,P>A facet that listens to boss bar changes, using fake entities.static interfaceFacet.BossBarPacket<V>A facet that listens to boss bar changes, using packets.static interfaceFacet.Chat<V,M>A facet that sends chat messages.static interfaceFacet.ChatPacket<V,M>A facet that sends chat messages, using packets.static interfaceFacet.FakeEntity<V,P>A facet for spawning client-side entities.static interfaceFacet.Message<V,M>A facet that converts components between formats.static interfaceFacet.Position<V,P>A facet that requires a 3D vector.static interfaceFacet.Sound<V,P>A facet that plays and stops sounds.static interfaceFacet.Title<V,M,T>A facet that shows, clears, and resets titles.static interfaceFacet.TitlePacket<V,M,T>A facet that sends titles, using packets.
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default booleanisApplicable(@NonNull V viewer)Gets whether this handler is applicable to a particular viewer.default booleanisSupported()Gets whether this handler is supported by the current runtime.static <V,F extends Facet<? extends V>>
@NonNull java.util.Collection<F>of(@NonNull java.util.function.Supplier<F>... suppliers)Creates a collection of supported facets.static <V,F extends Facet<V>>
@Nullable Fof(@Nullable java.util.Collection<F> facets, @Nullable V viewer)Gets the first applicable facet for a viewer.
-
-
-
Method Detail
-
of
@SafeVarargs static <V,F extends Facet<? extends V>> @NonNull java.util.Collection<F> of(@NonNull java.util.function.Supplier<F>... suppliers)
Creates a collection of supported facets.- Type Parameters:
V- a viewer typeF- a facet type- Parameters:
suppliers- an array of facet suppliers- Returns:
- a collection of facets
-
of
static <V,F extends Facet<V>> @Nullable F of(@Nullable java.util.Collection<F> facets, @Nullable V viewer)
Gets the first applicable facet for a viewer.- Type Parameters:
V- a viewer typeF- a facet type- Parameters:
facets- a collection of supported facetsviewer- a viewer- Returns:
- a facet or
nullif none are applicable
-
isSupported
default boolean isSupported()
Gets whether this handler is supported by the current runtime.If not, this can be discarded since it will fail for all viewers.
- Returns:
- if this handler is supported
-
isApplicable
default boolean isApplicable(@NonNull V viewer)
Gets whether this handler is applicable to a particular viewer.This should only be invoked if
isSupported()istrue.- Parameters:
viewer- a viewer- Returns:
- if this handler is applicable to a viewer
-
-