Interface ProtocolPipeline

All Superinterfaces:
Protocol<SimpleProtocol.DummyPacketTypes,SimpleProtocol.DummyPacketTypes,SimpleProtocol.DummyPacketTypes,SimpleProtocol.DummyPacketTypes>, SimpleProtocol

public interface ProtocolPipeline extends SimpleProtocol
  • Method Details

    • add

      void add(Protocol protocol)
      Adds a protocol to the current pipeline. This will call the Protocol.init(UserConnection) method.
      Parameters:
      protocol - protocol to add to the end
    • add

      void add(Collection<Protocol> protocols)
      Adds a collection of protocols to the current pipeline. This will call the Protocol.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

      boolean contains(Class<? extends Protocol> protocolClass)
      Returns whether the protocol is in this pipeline.
      Parameters:
      protocolClass - protocol class
      Returns:
      whether the protocol class is in this pipeline
    • getProtocol

      @Deprecated <P extends Protocol> @Nullable P getProtocol(Class<P> pipeClass)
      Returns the protocol from the given class if present in the pipeline.
      Type Parameters:
      P - protocol
      Parameters:
      pipeClass - protocol class
      Returns:
      protocol from class
    • pipes

      List<Protocol> pipes(@Nullable Class<? extends Protocol> protocolClass, boolean skipCurrentPipeline, Direction direction)
    • pipes

      List<Protocol> pipes()
      Returns the list of protocols this pipeline contains, lead by base protocols.
      Returns:
      immutable list of protocols in this pipe
    • reversedPipes

      List<Protocol> 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 by Protocol.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.