Skip to content

Commit

Permalink
Fixed Via API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Feb 14, 2024
1 parent 289f565 commit 5754b07
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void handlerAdded(ChannelHandlerContext ctx) {
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());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/raphimc/vialoader/netty/VLPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public VLPipeline(final UserConnection user, final ProtocolVersion version) {
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)) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/raphimc/vialoader/util/VersionRange.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public VersionRange add(final VersionRange range) {
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() {
Expand Down

0 comments on commit 5754b07

Please sign in to comment.