diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/handlers/BukkitChannelInitializer.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/handlers/BukkitChannelInitializer.java index c873d4466..0dff937eb 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/handlers/BukkitChannelInitializer.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/handlers/BukkitChannelInitializer.java @@ -34,13 +34,13 @@ public final class BukkitChannelInitializer extends ChannelInitializer public static final String VIA_DECODER = "via-decoder"; public static final String MINECRAFT_ENCODER = "encoder"; public static final String MINECRAFT_DECODER = "decoder"; + public static final String MINECRAFT_OUTBOUND_CONFIG = "outbound_config"; public static final String MINECRAFT_COMPRESSOR = "compress"; public static final String MINECRAFT_DECOMPRESSOR = "decompress"; public static final Object COMPRESSION_ENABLED_EVENT = paperCompressionEnabledEvent(); private static final Method INIT_CHANNEL_METHOD; private final ChannelInitializer original; - static { try { INIT_CHANNEL_METHOD = ChannelInitializer.class.getDeclaredMethod("initChannel", Channel.class); @@ -80,7 +80,8 @@ public final class BukkitChannelInitializer extends ChannelInitializer // Add our transformers final ChannelPipeline pipeline = channel.pipeline(); - pipeline.addBefore(MINECRAFT_ENCODER, VIA_ENCODER, new BukkitEncodeHandler(connection)); + final String encoderName = pipeline.get(MINECRAFT_OUTBOUND_CONFIG) != null ? MINECRAFT_OUTBOUND_CONFIG : MINECRAFT_ENCODER; + pipeline.addBefore(encoderName, VIA_ENCODER, new BukkitEncodeHandler(connection)); pipeline.addBefore(MINECRAFT_DECODER, VIA_DECODER, new BukkitDecodeHandler(connection)); }