public class ProtocolPipeline extends SimpleProtocol
SimpleProtocol.DummyPacketTypes
Protocol.Packet, Protocol.ProtocolPacket
newClientboundPacketEnum, newServerboundPacketEnum, oldClientboundPacketEnum, oldServerboundPacketEnum
Constructor and Description |
---|
ProtocolPipeline(UserConnection userConnection) |
Modifier and Type | Method and Description |
---|---|
void |
add(Protocol protocol)
Add a protocol to the current pipeline
This will call the
Protocol.init(UserConnection) method. |
void |
cleanPipes()
Cleans the pipe and adds
BaseProtocol
/!\ WARNING - It doesn't add version-specific base Protocol |
boolean |
contains(Class<? extends Protocol> pipeClass)
Check if the pipeline contains a protocol
|
boolean |
filter(Object o,
List list)
Use the pipeline to filter a NMS packet
|
<P extends Protocol> |
getProtocol(Class<P> pipeClass) |
void |
init(UserConnection userConnection)
Initialise a user for this protocol setting up objects.
|
List<Protocol> |
pipes() |
protected void |
registerPackets()
Register the packets for this protocol.
|
void |
transform(Direction direction,
State state,
PacketWrapper packetWrapper)
Transform a packet using this protocol
|
cancelIncoming, cancelIncoming, cancelIncoming, cancelOutgoing, cancelOutgoing, cancelOutgoing, filterPacket, get, getMappingData, hasMappingDataToLoad, hasRegisteredIncoming, hasRegisteredOutgoing, isFiltered, loadMappingData, onMappingDataLoaded, put, register, registerIncoming, registerIncoming, registerIncoming, registerIncoming, registerIncoming, registerIncomingChannelIdChanges, registerOutgoing, registerOutgoing, registerOutgoing, registerOutgoing, registerOutgoing, registerOutgoing, registerOutgoingChannelIdChanges, toString
public ProtocolPipeline(UserConnection userConnection)
protected void registerPackets()
Protocol
public void init(UserConnection userConnection)
Protocol
UserConnection
To be overridden if needed.
init
in class Protocol<SimpleProtocol.DummyPacketTypes,SimpleProtocol.DummyPacketTypes,SimpleProtocol.DummyPacketTypes,SimpleProtocol.DummyPacketTypes>
userConnection
- The user to initialisepublic void add(Protocol protocol)
Protocol.init(UserConnection)
method.protocol
- The protocol to add to the endpublic void transform(Direction direction, State state, PacketWrapper packetWrapper) throws Exception
Protocol
transform
in class Protocol<SimpleProtocol.DummyPacketTypes,SimpleProtocol.DummyPacketTypes,SimpleProtocol.DummyPacketTypes,SimpleProtocol.DummyPacketTypes>
direction
- The direction the packet is going instate
- The current protocol statepacketWrapper
- The packet wrapper to transformException
- Throws exception if it fails to transformpublic boolean contains(Class<? extends Protocol> pipeClass)
pipeClass
- The class to checkpublic boolean filter(Object o, List list) throws Exception
o
- The NMS packet objectlist
- The output list to write toException
- If it failed to convert / packet cancelld.public void cleanPipes()
BaseProtocol
/!\ WARNING - It doesn't add version-specific base ProtocolCopyright © 2016–2021. All rights reserved.