3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +01:00

Check for new outbound_config pipeline handler

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-04-06 23:10:58 +02:00
Ursprung c2489c7a4c
Commit 35a00d0b95
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F

Datei anzeigen

@ -34,13 +34,13 @@ public final class BukkitChannelInitializer extends ChannelInitializer<Channel>
public static final String VIA_DECODER = "via-decoder"; public static final String VIA_DECODER = "via-decoder";
public static final String MINECRAFT_ENCODER = "encoder"; public static final String MINECRAFT_ENCODER = "encoder";
public static final String MINECRAFT_DECODER = "decoder"; 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_COMPRESSOR = "compress";
public static final String MINECRAFT_DECOMPRESSOR = "decompress"; public static final String MINECRAFT_DECOMPRESSOR = "decompress";
public static final Object COMPRESSION_ENABLED_EVENT = paperCompressionEnabledEvent(); public static final Object COMPRESSION_ENABLED_EVENT = paperCompressionEnabledEvent();
private static final Method INIT_CHANNEL_METHOD; private static final Method INIT_CHANNEL_METHOD;
private final ChannelInitializer<Channel> original; private final ChannelInitializer<Channel> original;
static { static {
try { try {
INIT_CHANNEL_METHOD = ChannelInitializer.class.getDeclaredMethod("initChannel", Channel.class); INIT_CHANNEL_METHOD = ChannelInitializer.class.getDeclaredMethod("initChannel", Channel.class);
@ -80,7 +80,8 @@ public final class BukkitChannelInitializer extends ChannelInitializer<Channel>
// Add our transformers // Add our transformers
final ChannelPipeline pipeline = channel.pipeline(); 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)); pipeline.addBefore(MINECRAFT_DECODER, VIA_DECODER, new BukkitDecodeHandler(connection));
} }