From a8df4c493e828547cf4d119135469082d91ebb5e Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Thu, 26 Jul 2018 14:02:23 -0400 Subject: [PATCH] Housekeeping. --- build.gradle | 8 +++++--- .../proxy/connection/MinecraftConnection.java | 12 ++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index e02567778..d39aeaa59 100644 --- a/build.gradle +++ b/build.gradle @@ -15,11 +15,13 @@ repositories { } dependencies { + def nettyVersion = '4.1.27.Final' + compile 'com.google.code.gson:gson:2.8.5' compile 'com.google.guava:guava:25.1-jre' - compile 'io.netty:netty-codec:4.1.27.Final' - compile 'io.netty:netty-codec-http:4.1.27.Final' - compile 'io.netty:netty-handler:4.1.27.Final' + compile "io.netty:netty-codec:${nettyVersion}" + compile "io.netty:netty-codec-http:${nettyVersion}" + compile "io.netty:netty-handler:${nettyVersion}" compile 'net.kyori:text:1.12-1.5.0' testCompile 'org.junit.jupiter:junit-jupiter-api:5.3.0-M1' testCompile 'org.junit.jupiter:junit-jupiter-engine:5.3.0-M1' diff --git a/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java b/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java index 3af95373e..5bc3e8f7d 100644 --- a/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java +++ b/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java @@ -4,10 +4,7 @@ import com.google.common.base.Preconditions; import com.velocitypowered.proxy.protocol.PacketWrapper; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.compression.JavaVelocityCompressor; -import com.velocitypowered.proxy.protocol.netty.MinecraftCompressDecoder; -import com.velocitypowered.proxy.protocol.netty.MinecraftCompressEncoder; -import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; -import com.velocitypowered.proxy.protocol.netty.MinecraftEncoder; +import com.velocitypowered.proxy.protocol.netty.*; import com.velocitypowered.proxy.protocol.packets.SetCompression; import io.netty.channel.Channel; import io.netty.channel.ChannelFutureListener; @@ -15,6 +12,9 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.util.ReferenceCountUtil; +import static com.velocitypowered.proxy.protocol.netty.MinecraftPipelineUtils.MINECRAFT_DECODER; +import static com.velocitypowered.proxy.protocol.netty.MinecraftPipelineUtils.MINECRAFT_ENCODER; + /** * A utility class to make working with the pipeline a little less painful and transparently handles certain Minecraft * protocol mechanics. @@ -152,7 +152,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { MinecraftCompressEncoder encoder = new MinecraftCompressEncoder(threshold, compressor); MinecraftCompressDecoder decoder = new MinecraftCompressDecoder(threshold, compressor); - channel.pipeline().addBefore("minecraft-decoder", "compress-decoder", decoder); - channel.pipeline().addBefore("minecraft-encoder", "compress-encoder", encoder); + channel.pipeline().addBefore(MINECRAFT_DECODER, "compress-decoder", decoder); + channel.pipeline().addBefore(MINECRAFT_ENCODER, "compress-encoder", encoder); } }