Interface ProtocolPipeline
public interface ProtocolPipeline
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a protocol to the current pipeline.voidadd(Collection<Protocol> protocols) Adds a collection of protocols to the current pipeline.intReturns the number of base protocols in this pipeline.voidCleans the pipe and adds the base protocol.booleanReturns whether the protocol is in this pipeline.<P extends Protocol>
@Nullable PgetProtocol(Class<P> pipeClass) Deprecated.booleanReturns whether this pipe has protocols that are not base protocols, as given byProtocol.isBaseProtocol().pipes()Returns the list of protocols this pipeline contains, lead by base protocols.pipes(@Nullable Class<? extends Protocol> protocolClass, boolean skipCurrentPipeline, Direction direction) Returns the list of protocols this pipeline contains in reversed order, although still lead by base protocols.voidtransform(Direction direction, State state, PacketWrapper packetWrapper) Transform a packet using the protocols in this pipeline.
-
Method Details
-
add
Adds a protocol to the current pipeline. This will call theProtocol.init(UserConnection)method.- Parameters:
protocol- protocol to add to the end
-
add
Adds a collection of protocols to the current pipeline. This will call theProtocol.init(UserConnection)method.Callers of this method should make sure the collection is correctly sorted.
- Parameters:
protocols- correctly sorted protocols to add to the end
-
contains
Returns whether the protocol is in this pipeline.- Parameters:
protocolClass- protocol class- Returns:
- whether the protocol class is in this pipeline
-
getProtocol
Deprecated.Returns the protocol from the given class if present in the pipeline.- Type Parameters:
P- protocol- Parameters:
pipeClass- protocol class- Returns:
- protocol from class
-
transform
void transform(Direction direction, State state, PacketWrapper packetWrapper) throws InformativeException, CancelException Transform a packet using the protocols in this pipeline.- Parameters:
direction- The direction the packet is going instate- The current protocol statepacketWrapper- The packet wrapper to transform- Throws:
InformativeExceptionCancelException
-
pipes
-
pipes
Returns the list of protocols this pipeline contains, lead by base protocols.- Returns:
- immutable list of protocols in this pipe
-
reversedPipes
Returns the list of protocols this pipeline contains in reversed order, although still lead by base protocols.- Returns:
- immutable list of protocols in reversed direction
-
baseProtocolCount
int baseProtocolCount()Returns the number of base protocols in this pipeline.- Returns:
- the number of base protocols in this pipeline
-
hasNonBaseProtocols
boolean hasNonBaseProtocols()Returns whether this pipe has protocols that are not base protocols, as given byProtocol.isBaseProtocol().- Returns:
- whether this pipe has protocols that are not base protocols
-
cleanPipes
void cleanPipes()Cleans the pipe and adds the base protocol. /!\ WARNING - It doesn't add version-specific base Protocol.
-
ProtocolManager.getProtocol(Class)and/orcontains(Class)