Fixed Via API usage

This commit is contained in:
FlorianMichael 2024-02-14 19:58:55 +01:00
parent 289f5656b8
commit 5754b07583
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
3 changed files with 5 additions and 5 deletions

View File

@ -58,7 +58,7 @@ public abstract class VLLegacyPipeline extends ChannelInboundHandlerAdapter {
ctx.pipeline().addBefore(this.packetDecoderName(), VIA_DECODER_NAME, this.createViaDecoder());
ctx.pipeline().addBefore(this.packetEncoderName(), VIA_ENCODER_NAME, this.createViaEncoder());
if (this.version.olderThanOrEquals(LegacyProtocolVersion.r1_6_4)) {
if (this.version.olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
this.user.getProtocolInfo().getPipeline().add(PreNettyBaseProtocol.INSTANCE);
ctx.pipeline().addBefore(this.lengthSplitterName(), VIALEGACY_PRE_NETTY_LENGTH_PREPENDER_NAME, this.createViaLegacyPreNettyLengthPrepender());
ctx.pipeline().addBefore(this.lengthPrependerName(), VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, this.createViaLegacyPreNettyLengthRemover());

View File

@ -55,7 +55,7 @@ public abstract class VLPipeline extends ChannelInboundHandlerAdapter {
public void handlerAdded(ChannelHandlerContext ctx) {
ctx.pipeline().addBefore(this.packetCodecName(), VIA_CODEC_NAME, this.createViaCodec());
if (this.version.olderThanOrEquals(LegacyProtocolVersion.r1_6_4)) {
if (this.version.olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
this.user.getProtocolInfo().getPipeline().add(PreNettyBaseProtocol.INSTANCE);
ctx.pipeline().addBefore(this.lengthCodecName(), VIALEGACY_PRE_NETTY_LENGTH_CODEC_NAME, this.createViaLegacyPreNettyLengthCodec());
} else if (this.version.equals(BedrockProtocolVersion.bedrockLatest)) {

View File

@ -63,9 +63,9 @@ public class VersionRange {
public boolean contains(final ProtocolVersion version) {
if (this.ranges.stream().anyMatch(range -> range.contains(version))) return true;
if (this.min == null && this.max == null) return true;
else if (this.min == null) return version.olderThanOrEquals(this.max);
else if (this.max == null) return version.newerThanOrEquals(this.min);
return version.newerThanOrEquals(this.min) && version.olderThanOrEquals(this.max);
else if (this.min == null) return version.olderThanOrEqualTo(this.max);
else if (this.max == null) return version.newerThanOrEqualTo(this.min);
return version.newerThanOrEqualTo(this.min) && version.olderThanOrEqualTo(this.max);
}
public ProtocolVersion getMin() {