Skip to content

Commit

Permalink
Reset reader index only if system property is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Exceptionflug committed Mar 3, 2024
1 parent 67e002a commit fab64d0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.ProtocolConstants;

import java.util.Objects;

/**
* Date: 21.08.2021
*
Expand Down Expand Up @@ -58,7 +60,9 @@ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protoco
DebugUtil.writeDump(buf, new CorruptedFrameException("Protocolize is unable to read packet " + obtainProtocolizePacketClass().getName()
+ " at protocol version " + protocolVersion + " in direction " + direction.name()));
}
buf.resetReaderIndex();
if (Objects.equals(System.getProperty("protocolize.reset.readerindex"), "true")) {
buf.resetReaderIndex();
}
} catch (Throwable throwable) {
BadPacketException badPacketException = new BadPacketException("Protocolize is unable to read packet " + obtainProtocolizePacketClass().getName()
+ " at protocol version " + protocolVersion + " in direction " + direction.name(), throwable);
Expand Down

0 comments on commit fab64d0

Please sign in to comment.