mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-11-14 19:34:58 -05:00
Use a constructor parameter to determine clientsideness in packet encoder
This commit is contained in:
parent
2a8d18a3f8
commit
a61bcb97f7
3 changed files with 4 additions and 4 deletions
|
@ -114,7 +114,7 @@ public class TcpClientSession extends TcpSession {
|
||||||
|
|
||||||
pipeline.addLast("encryption", new TcpPacketEncryptor(TcpClientSession.this));
|
pipeline.addLast("encryption", new TcpPacketEncryptor(TcpClientSession.this));
|
||||||
pipeline.addLast("sizer", new TcpPacketSizer(TcpClientSession.this));
|
pipeline.addLast("sizer", new TcpPacketSizer(TcpClientSession.this));
|
||||||
pipeline.addLast("codec", new TcpPacketCodec(TcpClientSession.this));
|
pipeline.addLast("codec", new TcpPacketCodec(TcpClientSession.this, true));
|
||||||
pipeline.addLast("manager", TcpClientSession.this);
|
pipeline.addLast("manager", TcpClientSession.this);
|
||||||
|
|
||||||
addHAProxySupport(pipeline);
|
addHAProxySupport(pipeline);
|
||||||
|
|
|
@ -18,9 +18,9 @@ public class TcpPacketCodec extends ByteToMessageCodec<Packet> {
|
||||||
private final Session session;
|
private final Session session;
|
||||||
private final boolean client;
|
private final boolean client;
|
||||||
|
|
||||||
public TcpPacketCodec(Session session) {
|
public TcpPacketCodec(Session session, boolean client) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
this.client = session instanceof TcpClientSession;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class TcpServer extends AbstractServer {
|
||||||
|
|
||||||
pipeline.addLast("encryption", new TcpPacketEncryptor(session));
|
pipeline.addLast("encryption", new TcpPacketEncryptor(session));
|
||||||
pipeline.addLast("sizer", new TcpPacketSizer(session));
|
pipeline.addLast("sizer", new TcpPacketSizer(session));
|
||||||
pipeline.addLast("codec", new TcpPacketCodec(session));
|
pipeline.addLast("codec", new TcpPacketCodec(session, false));
|
||||||
pipeline.addLast("manager", session);
|
pipeline.addLast("manager", session);
|
||||||
}
|
}
|
||||||
}).group(this.group).localAddress(this.getHost(), this.getPort()).bind();
|
}).group(this.group).localAddress(this.getHost(), this.getPort()).bind();
|
||||||
|
|
Loading…
Reference in a new issue