Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class MinecraftDecoder extends ChannelInboundHandlerAdapter {
private static final QuietRuntimeException DECODE_FAILED =
new QuietRuntimeException("A packet did not decode successfully (invalid data). For more "
+ "information, launch Velocity with -Dvelocity.packet-decode-logging=true to see more.");
private static final boolean DIRECTION_VALIDATION = Boolean.getBoolean("velocity.packet-direction-validation");
Comment thread
pop4959 marked this conversation as resolved.
Outdated

private final ProtocolUtils.Direction direction;
private StateRegistry state;
Expand Down Expand Up @@ -74,7 +75,7 @@ private void tryDecode(ChannelHandlerContext ctx, ByteBuf buf) throws Exception
MinecraftPacket packet = this.registry.createPacket(packetId);
if (packet == null) {
buf.readerIndex(originalReaderIndex);
if (this.direction == ProtocolUtils.Direction.SERVERBOUND && this.state != StateRegistry.PLAY) {
if (DIRECTION_VALIDATION && this.direction == ProtocolUtils.Direction.SERVERBOUND && this.state != StateRegistry.PLAY) {
buf.release();
throw this.handleInvalidPacketId(packetId);
}
Expand Down