mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-18 16:25:14 +01:00
61 lines
2.4 KiB
Diff
61 lines
2.4 KiB
Diff
From 9356c9e66746a50197da675505bc256290c0832b Mon Sep 17 00:00:00 2001
|
|
From: LinsaFTW <25271111+linsaftw@users.noreply.github.com>
|
|
Date: Wed, 28 Dec 2022 14:23:54 -0300
|
|
Subject: [PATCH] Optimize Decoder/Encoder Getter
|
|
|
|
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java b/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java
|
|
index 606866a52..497ca8559 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java
|
|
@@ -31,26 +31,42 @@ public class ChannelWrapper
|
|
@Getter
|
|
private volatile boolean closing;
|
|
|
|
+ // FlameCord start - Optimize Decoder/Encoder Getter
|
|
+ MinecraftDecoder decoder;
|
|
+ MinecraftEncoder encoder;
|
|
+ // FlameCord end - Optimize Decoder/Encoder Getter
|
|
+
|
|
public ChannelWrapper(ChannelHandlerContext ctx)
|
|
{
|
|
this.ch = ctx.channel();
|
|
this.remoteAddress = ( this.ch.remoteAddress() == null ) ? this.ch.parent().localAddress() : this.ch.remoteAddress();
|
|
+
|
|
+ // FlameCord start - Optimize Decoder/Encoder Getter
|
|
+ this.decoder = (MinecraftDecoder) ch.pipeline().get( PipelineUtils.PACKET_DECODER );
|
|
+ this.encoder = (MinecraftEncoder) ch.pipeline().get( PipelineUtils.PACKET_ENCODER );
|
|
+ // FlameCord end - Optimize Decoder/Encoder Getter
|
|
}
|
|
|
|
public void setProtocol(Protocol protocol)
|
|
{
|
|
// FlameCord - Use pipeline to reduce redundancy
|
|
final ChannelPipeline pipeline = ch.pipeline();
|
|
- pipeline.get( MinecraftDecoder.class ).setProtocol( protocol );
|
|
- pipeline.get( MinecraftEncoder.class ).setProtocol( protocol );
|
|
+
|
|
+ // FlameCord start - Optimize Decoder/Encoder Getter
|
|
+ decoder.setProtocol( protocol );
|
|
+ encoder.setProtocol( protocol );
|
|
+ // FlameCord end - Optimize Decoder/Encoder Getter
|
|
}
|
|
|
|
public void setVersion(int protocol)
|
|
{
|
|
// FlameCord - Use pipeline to reduce redundancy
|
|
final ChannelPipeline pipeline = ch.pipeline();
|
|
- pipeline.get( MinecraftDecoder.class ).setProtocolVersion( protocol );
|
|
- pipeline.get( MinecraftEncoder.class ).setProtocolVersion( protocol );
|
|
+
|
|
+ // FlameCord start - Optimize Decoder/Encoder Getter
|
|
+ decoder.setProtocolVersion( protocol );
|
|
+ encoder.setProtocolVersion( protocol );
|
|
+ // FlameCord end - Optimize Decoder/Encoder Getter
|
|
}
|
|
|
|
public void write(Object packet)
|
|
--
|
|
2.37.3.windows.1
|
|
|