Class ViaFacet<V>

    • Constructor Detail

      • ViaFacet

        public ViaFacet​(@NonNull java.lang.Class<? extends V> viewerClass,
                        @NonNull java.util.function.Function<V,​us.myles.ViaVersion.api.data.UserConnection> connectionFunction,
                        int minProtocol)
    • Method Detail

      • isSupported

        public boolean isSupported()
        Description copied from interface: Facet
        Gets whether this handler is supported by the current runtime.

        If not, this can be discarded since it will fail for all viewers.

        Specified by:
        isSupported in interface Facet<V>
        Overrides:
        isSupported in class FacetBase<V>
        Returns:
        if this handler is supported
      • isApplicable

        public boolean isApplicable​(@NonNull V viewer)
        Description copied from interface: Facet
        Gets whether this handler is applicable to a particular viewer.

        This should only be invoked if Facet.isSupported() is true.

        Specified by:
        isApplicable in interface Facet<V>
        Overrides:
        isApplicable in class FacetBase<V>
        Parameters:
        viewer - a viewer
        Returns:
        if this handler is applicable to a viewer
      • findConnection

        public @Nullable us.myles.ViaVersion.api.data.UserConnection findConnection​(@NonNull V viewer)
      • findProtocol

        public int findProtocol​(@NonNull V viewer)
      • createMessage

        public @NonNull java.lang.String createMessage​(@NonNull V viewer,
                                                       @NonNull net.kyori.adventure.text.Component message)
        Description copied from interface: Facet.Message
        Creates a message.

        Messages should not be translated to a viewer's locale, this is done elsewhere.

        Specified by:
        createMessage in interface Facet.Message<V,​java.lang.String>
        Parameters:
        viewer - a viewer
        message - a message
        Returns:
        a message or null