From 4ddc55a5b79705d3d0764cdf91b153d0185a54e8 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 12 Apr 2020 17:20:38 -0400 Subject: [PATCH] No need to register multiple times --- .../proxy/connection/MinecraftConnection.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java index 53c83310a..d3214787c 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java @@ -162,11 +162,15 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { } private void installDiscardHandler(ChannelHandlerContext ctx) { - ctx.pipeline().addBefore(MINECRAFT_DECODER, "discard", DiscardHandler.HANDLER); + if (ctx.pipeline().get("discard") == null) { + ctx.pipeline().addBefore(MINECRAFT_DECODER, "discard", DiscardHandler.HANDLER); + } } private void installDiscardHandler() { - channel.pipeline().addBefore(MINECRAFT_DECODER, "discard", DiscardHandler.HANDLER); + if (channel.pipeline().get("discard") == null) { + channel.pipeline().addBefore(MINECRAFT_DECODER, "discard", DiscardHandler.HANDLER); + } } public EventLoop eventLoop() {