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 Summary
Modifier and Type Method Description static YAPIONPacketHandlercreateInstance(java.util.function.Consumer<YAPIONPacket> yapionPacketConsumer, boolean runThread, boolean ignoreException)Create aYAPIONPacketHandlerby the different parametersstatic YAPIONPacketHandlercreateInstance(java.util.function.Consumer<YAPIONPacket> yapionPacketConsumer, boolean runThread, boolean daemonThread, boolean ignoreException)Create aYAPIONPacketHandlerby the different parametersdefault booleandaemonThread()Specifies if the Thread should be a Daemon or not.voidhandlePacket(YAPIONPacket yapionPacket)Handle a specificYAPIONPacket.default booleanignoreException()Specifies if exceptions should be ignores and not processes by the '@exception' handler.default booleanrunThread()Specifies if this handler should be run in a Thread.
-
-
-
Method Detail
-
handlePacket
void handlePacket(YAPIONPacket yapionPacket)
Handle a specificYAPIONPacket.- Parameters:
yapionPacket- the packet to handle.
-
runThread
default boolean runThread()
Specifies if this handler should be run in a Thread.- Returns:
trueif it should run in a thread,falseotherwise
-
daemonThread
default boolean daemonThread()
Specifies if the Thread should be a Daemon or not. This only takes effect whenrunThread()returnstrue. If not implemented this method returnstrueby default.- Returns:
trueif it should run as a daemon,falseotherwise.
-
ignoreException
default boolean ignoreException()
Specifies if exceptions should be ignores and not processes by the '@exception' handler.- Returns:
trueif exceptions should be ignored,falseotherwise
-
createInstance
static YAPIONPacketHandler createInstance(java.util.function.Consumer<YAPIONPacket> yapionPacketConsumer, boolean runThread, boolean daemonThread, boolean ignoreException)
Create aYAPIONPacketHandlerby the different parameters- Parameters:
yapionPacketConsumer- theConsumerto handle theYAPIONPacketrunThread-trueif it should run in a thread,falseotherwisedaemonThread-trueif it should run as a daemon,falseotherwise.ignoreException-trueif exceptions should be ignored,falseotherwise- Returns:
YAPIONPacketHandlerinstance
-
createInstance
static YAPIONPacketHandler createInstance(java.util.function.Consumer<YAPIONPacket> yapionPacketConsumer, boolean runThread, boolean ignoreException)
Create aYAPIONPacketHandlerby the different parameters- Parameters:
yapionPacketConsumer- theConsumerto handle theYAPIONPacketrunThread-trueif it should run in a thread,falseotherwiseignoreException-trueif exceptions should be ignored,falseotherwise- Returns:
YAPIONPacketHandlerinstance
-
-