Interface ProtocolPipeline
- All Superinterfaces:
Protocol<SimpleProtocol.DummyPacketTypes,
,SimpleProtocol.DummyPacketTypes, SimpleProtocol.DummyPacketTypes, SimpleProtocol.DummyPacketTypes> SimpleProtocol
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.viaversion.viaversion.api.protocol.SimpleProtocol
SimpleProtocol.DummyPacketTypes
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a protocol to the current pipeline.void
add
(Collection<Protocol> protocols) Adds a collection of protocols to the current pipeline.int
Returns the number of base protocols in this pipeline.void
Cleans the pipe and adds the base protocol.boolean
Returns whether the protocol is in this pipeline.<P extends Protocol>
@Nullable PgetProtocol
(Class<P> pipeClass) Deprecated.boolean
Returns 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.Methods inherited from interface com.viaversion.viaversion.api.protocol.Protocol
appendClientbound, appendServerbound, cancelClientbound, cancelClientbound, cancelServerbound, cancelServerbound, get, getComponentRewriter, getEntityRewriter, getItemRewriter, getLogger, getMappingData, getPacketTypesProvider, getTagRewriter, hasMappingDataToLoad, hasRegisteredClientbound, hasRegisteredClientbound, hasRegisteredServerbound, hasRegisteredServerbound, init, initialize, isBaseProtocol, loadMappingData, put, register, registerClientbound, registerClientbound, registerClientbound, registerClientbound, registerClientbound, registerClientbound, registerClientbound, registerServerbound, registerServerbound, registerServerbound, registerServerbound, registerServerbound, registerServerbound, registerServerbound, transform
-
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
-
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)