C
- clientbound packet typeS
- serverbound packet typepublic interface VersionedPacketTransformer<C extends ClientboundPacketType,S extends ServerboundPacketType>
Modifier and Type | Method and Description |
---|---|
boolean |
scheduleSend(PacketWrapper packet)
Sends a packet to the user or server, depending on the packet type given by
PacketWrapper.getPacketType() , submitted to the netty event loop. |
boolean |
scheduleSend(UserConnection connection,
C packetType,
java.util.function.Consumer<PacketWrapper> packetWriter) |
boolean |
scheduleSend(UserConnection connection,
S packetType,
java.util.function.Consumer<PacketWrapper> packetWriter) |
boolean |
send(PacketWrapper packet)
Sends a packet to the user or server, depending on the packet type given by
PacketWrapper.getPacketType() . |
boolean |
send(UserConnection connection,
C packetType,
java.util.function.Consumer<PacketWrapper> packetWriter) |
boolean |
send(UserConnection connection,
S packetType,
java.util.function.Consumer<PacketWrapper> packetWriter) |
@Nullable PacketWrapper |
transform(PacketWrapper packet)
Transforms a packet to the protocol version of the given connection or server, or null if cancelled at some point.
|
@Nullable PacketWrapper |
transform(UserConnection connection,
C packetType,
java.util.function.Consumer<PacketWrapper> packetWriter) |
@Nullable PacketWrapper |
transform(UserConnection connection,
S packetType,
java.util.function.Consumer<PacketWrapper> packetWriter) |
boolean send(PacketWrapper packet) throws java.lang.Exception
PacketWrapper.getPacketType()
.
Returns false if the packet has been cancelled at some point, but does not indicate whether a replacement has been constructed.java.lang.IllegalArgumentException
- if the packet type is not of the expected clientbound or serverbound packets classjava.lang.IllegalArgumentException
- if PacketWrapper.user()
returns nulljava.lang.RuntimeException
- if no path from the input version to the required client version existsjava.lang.Exception
- if an error occurred while transforming or sending the packetboolean send(UserConnection connection, C packetType, java.util.function.Consumer<PacketWrapper> packetWriter) throws java.lang.Exception
java.lang.Exception
send(PacketWrapper)
boolean send(UserConnection connection, S packetType, java.util.function.Consumer<PacketWrapper> packetWriter) throws java.lang.Exception
java.lang.Exception
send(PacketWrapper)
boolean scheduleSend(PacketWrapper packet) throws java.lang.Exception
PacketWrapper.getPacketType()
, submitted to the netty event loop.
Returns false if the packet has been cancelled at some point, but does not indicate whether a replacement has been constructed.packet
- packet wrapperjava.lang.IllegalArgumentException
- if the packet type is not of the expected clientbound or serverbound packets classjava.lang.IllegalArgumentException
- if PacketWrapper.user()
returns nulljava.lang.RuntimeException
- if no path from the input version to the required client version existsjava.lang.Exception
- if an error occurred while transforming or sending the packetboolean scheduleSend(UserConnection connection, C packetType, java.util.function.Consumer<PacketWrapper> packetWriter) throws java.lang.Exception
java.lang.Exception
scheduleSend(PacketWrapper)
boolean scheduleSend(UserConnection connection, S packetType, java.util.function.Consumer<PacketWrapper> packetWriter) throws java.lang.Exception
java.lang.Exception
scheduleSend(PacketWrapper)
@Nullable PacketWrapper transform(PacketWrapper packet) throws java.lang.Exception
ProtocolInfo.getProtocolVersion()
or ProtocolInfo.getServerProtocolVersion()
.packet
- packet wrapperjava.lang.IllegalArgumentException
- if the packet type is not of the expected clientbound or serverbound packets classjava.lang.IllegalArgumentException
- if PacketWrapper.user()
returns nulljava.lang.RuntimeException
- if no path from the input version to the required client version existsjava.lang.Exception
- if an error occurred while transforming the packet@Nullable PacketWrapper transform(UserConnection connection, C packetType, java.util.function.Consumer<PacketWrapper> packetWriter) throws java.lang.Exception
java.lang.Exception
transform(PacketWrapper)
@Nullable PacketWrapper transform(UserConnection connection, S packetType, java.util.function.Consumer<PacketWrapper> packetWriter) throws java.lang.Exception
java.lang.Exception
transform(PacketWrapper)