Package yapion.packet

Interface YAPIONPacketHandler

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface YAPIONPacketHandler
    • Method Detail

      • handlePacket

        void handlePacket​(YAPIONPacket yapionPacket)
        Handle a specific YAPIONPacket.
        Parameters:
        yapionPacket - the packet to handle.
      • runThread

        default boolean runThread()
        Specifies if this handler should be run in a Thread.
        Returns:
        true if it should run in a thread, false otherwise
      • daemonThread

        default boolean daemonThread()
        Specifies if the Thread should be a Daemon or not. This only takes effect when runThread() returns true. If not implemented this method returns true by default.
        Returns:
        true if it should run as a daemon, false otherwise.
      • ignoreException

        default boolean ignoreException()
        Specifies if exceptions should be ignores and not processes by the '@exception' handler.
        Returns:
        true if exceptions should be ignored, false otherwise
      • createInstance

        static YAPIONPacketHandler createInstance​(java.util.function.Consumer<YAPIONPacket> yapionPacketConsumer,
                                                  boolean runThread,
                                                  boolean daemonThread,
                                                  boolean ignoreException)
        Create a YAPIONPacketHandler by the different parameters
        Parameters:
        yapionPacketConsumer - the Consumer to handle the YAPIONPacket
        runThread - true if it should run in a thread, false otherwise
        daemonThread - true if it should run as a daemon, false otherwise.
        ignoreException - true if exceptions should be ignored, false otherwise
        Returns:
        YAPIONPacketHandler instance
      • createInstance

        static YAPIONPacketHandler createInstance​(java.util.function.Consumer<YAPIONPacket> yapionPacketConsumer,
                                                  boolean runThread,
                                                  boolean ignoreException)
        Create a YAPIONPacketHandler by the different parameters
        Parameters:
        yapionPacketConsumer - the Consumer to handle the YAPIONPacket
        runThread - true if it should run in a thread, false otherwise
        ignoreException - true if exceptions should be ignored, false otherwise
        Returns:
        YAPIONPacketHandler instance