Package yapion.packet
Class YAPIONPacketReceiver
- java.lang.Object
- 
- yapion.packet.YAPIONPacketReceiver
 
- 
 public class YAPIONPacketReceiver extends java.lang.Object
- 
- 
Constructor SummaryConstructors Constructor Description YAPIONPacketReceiver()Creates an YAPIONPacketReceiver
 - 
Method SummaryModifier and Type Method Description YAPIONPacketReceiveradd(java.lang.Class<? extends YAPIONPacket>[] packetTypes, YAPIONPacketHandler yapionPacketHandler)Add an YAPIONPacketHandler for the specified packetTypes to handle.YAPIONPacketReceiveradd(java.lang.Class<? extends YAPIONPacket> packetType, YAPIONPacketHandler yapionPacketHandler)Add an YAPIONPacketHandler for a specified packetType to handle.YAPIONPacketReceiveradd(YAPIONPacketHandler yapionPacketHandler, java.lang.Class<? extends YAPIONPacket> packetType)A wrapper function toadd(Class, YAPIONPacketHandler)YAPIONPacketReceiveradd(YAPIONPacketHandler yapionPacketHandler, java.lang.Class<? extends YAPIONPacket>... packetTypes)A wrapper function toadd(Class[], YAPIONPacketHandler)voidhandle(YAPIONPacket yapionPacket)Handles an YAPIONPacket by calling the specified yapionPacketHandler for the type of the packet.YAPIONPacketReceiversetDeserializationExceptionHandler(YAPIONPacketHandler yapionPacketHandler)Set the Deserialization ExceptionYAPIONPacketHandlerto do something when a deserialization exception occurred.YAPIONPacketReceiversetDropHandler(YAPIONPacketHandler yapionPacketHandler)Set the DropYAPIONPacketHandlerto do something when a data drop occurred.YAPIONPacketReceiversetErrorHandler(YAPIONPacketHandler yapionPacketHandler)Set the ErrorYAPIONPacketHandlerto do something when an error occurred.YAPIONPacketReceiversetExceptionHandler(YAPIONPacketHandler yapionPacketHandler)Set the ExceptionYAPIONPacketHandlerto do something when an exception gets thrown.YAPIONPacketReceiversetHandleFailedHandler(YAPIONPacketHandler yapionPacketHandler)Set the HandleFailedYAPIONPacketHandlerto do something when the internalYAPIONInputStream.handle() failed.YAPIONPacketReceiversetUnknownHandler(YAPIONPacketHandler yapionPacketHandler)Set the UnknownYAPIONPacketHandlerto do something when an unknown packet was handled occurred.
 
- 
- 
- 
Method Detail- 
addpublic YAPIONPacketReceiver add(java.lang.Class<? extends YAPIONPacket> packetType, YAPIONPacketHandler yapionPacketHandler) Add an YAPIONPacketHandler for a specified packetType to handle. If either the packetType or yapionPacketHandler isnullthis method throws an YAPIONPacketException.- Parameters:
- packetType- the packet to handle
- yapionPacketHandler- the handler which handles the specified packet
 
 - 
addpublic YAPIONPacketReceiver add(java.lang.Class<? extends YAPIONPacket>[] packetTypes, YAPIONPacketHandler yapionPacketHandler) Add an YAPIONPacketHandler for the specified packetTypes to handle. If either the yapionPacketHandler or the packetTypes itself isnullthis method throws an YAPIONPacketException. If any value in the packetTypes array isnullit will just be skipped over.- Parameters:
- packetTypes- the packets to handle
- yapionPacketHandler- the handler which handles the specified packets
 
 - 
addpublic YAPIONPacketReceiver add(YAPIONPacketHandler yapionPacketHandler, java.lang.Class<? extends YAPIONPacket> packetType) A wrapper function toadd(Class, YAPIONPacketHandler)
 - 
addpublic YAPIONPacketReceiver add(YAPIONPacketHandler yapionPacketHandler, java.lang.Class<? extends YAPIONPacket>... packetTypes) A wrapper function toadd(Class[], YAPIONPacketHandler)
 - 
setExceptionHandlerpublic YAPIONPacketReceiver setExceptionHandler(YAPIONPacketHandler yapionPacketHandler) Set the ExceptionYAPIONPacketHandlerto do something when an exception gets thrown.- Parameters:
- yapionPacketHandler- the- YAPIONPacketHandlerto set
 
 - 
setUnknownHandlerpublic YAPIONPacketReceiver setUnknownHandler(YAPIONPacketHandler yapionPacketHandler) Set the UnknownYAPIONPacketHandlerto do something when an unknown packet was handled occurred.- Parameters:
- yapionPacketHandler-
 
 - 
setDropHandlerpublic YAPIONPacketReceiver setDropHandler(YAPIONPacketHandler yapionPacketHandler) Set the DropYAPIONPacketHandlerto do something when a data drop occurred.- Parameters:
- yapionPacketHandler-
 
 - 
setDeserializationExceptionHandlerpublic YAPIONPacketReceiver setDeserializationExceptionHandler(YAPIONPacketHandler yapionPacketHandler) Set the Deserialization ExceptionYAPIONPacketHandlerto do something when a deserialization exception occurred.- Parameters:
- yapionPacketHandler-
 
 - 
setHandleFailedHandlerpublic YAPIONPacketReceiver setHandleFailedHandler(YAPIONPacketHandler yapionPacketHandler) Set the HandleFailedYAPIONPacketHandlerto do something when the internalYAPIONInputStream.handle() failed.- Parameters:
- yapionPacketHandler-
 
 - 
setErrorHandlerpublic YAPIONPacketReceiver setErrorHandler(YAPIONPacketHandler yapionPacketHandler) Set the ErrorYAPIONPacketHandlerto do something when an error occurred.- Parameters:
- yapionPacketHandler- the- YAPIONPacketHandlerto set
 
 - 
handlepublic void handle(YAPIONPacket yapionPacket) Handles an YAPIONPacket by calling the specified yapionPacketHandler for the type of the packet. If the packet type is not found the "@error" handler gets called. If any exception gets thrown the special "@exception" handler is called. If this also throws an exception this method will log the exception as a warning.- Parameters:
- yapionPacket- to handle
 
 
- 
 
-