Updated Via* API usage
This commit is contained in:
parent
65b9a0bd64
commit
e5138149b8
|
@ -58,11 +58,11 @@ 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.lowerThanOrEquals(LegacyProtocolVersion.r1_6_4)) {
|
||||
if (this.version.olderThanOrEquals(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());
|
||||
} else if (this.version.equals(BedrockProtocolVersion.bedrockLatest)) {
|
||||
} else if (this.version.equalTo(BedrockProtocolVersion.bedrockLatest)) {
|
||||
this.user.getProtocolInfo().getPipeline().add(BedrockBaseProtocol.INSTANCE);
|
||||
ctx.pipeline().addBefore(this.lengthSplitterName(), VIABEDROCK_DISCONNECT_HANDLER_NAME, this.createViaBedrockDisconnectHandler());
|
||||
ctx.pipeline().addBefore(this.lengthSplitterName(), VIABEDROCK_FRAME_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockFrameEncapsulationHandler());
|
||||
|
|
|
@ -55,10 +55,10 @@ public abstract class VLPipeline extends ChannelInboundHandlerAdapter {
|
|||
public void handlerAdded(ChannelHandlerContext ctx) {
|
||||
ctx.pipeline().addBefore(this.packetCodecName(), VIA_CODEC_NAME, this.createViaCodec());
|
||||
|
||||
if (this.version.lowerThanOrEquals(LegacyProtocolVersion.r1_6_4)) {
|
||||
if (this.version.olderThanOrEquals(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)) {
|
||||
} else if (this.version.equalTo(BedrockProtocolVersion.bedrockLatest)) {
|
||||
this.user.getProtocolInfo().getPipeline().add(BedrockBaseProtocol.INSTANCE);
|
||||
ctx.pipeline().addBefore(this.lengthCodecName(), VIABEDROCK_DISCONNECT_HANDLER_NAME, this.createViaBedrockDisconnectHandler());
|
||||
ctx.pipeline().addBefore(this.lengthCodecName(), VIABEDROCK_FRAME_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockFrameEncapsulationHandler());
|
||||
|
|
|
@ -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.lowerThanOrEquals(this.max);
|
||||
else if (this.max == null) return version.higherThanOrEquals(this.min);
|
||||
return version.higherThanOrEquals(this.min) && version.lowerThanOrEquals(this.max);
|
||||
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);
|
||||
}
|
||||
|
||||
public ProtocolVersion getMin() {
|
||||
|
|
Loading…
Reference in New Issue