mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 09:26:08 +03:00
79 lines
2.9 KiB
Diff
79 lines
2.9 KiB
Diff
--- ../src-base/minecraft/net/minecraft/network/NetworkManager.java
|
|
+++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java
|
|
@@ -78,8 +78,13 @@
|
|
private final EnumPacketDirection direction;
|
|
private final Queue<NetworkManager.InboundHandlerTuplePacketListener> outboundPacketsQueue = Queues.<NetworkManager.InboundHandlerTuplePacketListener>newConcurrentLinkedQueue();
|
|
private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();
|
|
- private Channel channel;
|
|
- private SocketAddress socketAddress;
|
|
+ public Channel channel; // CatServer - private -> public
|
|
+ public SocketAddress socketAddress;
|
|
+ // Spigot Start // PAIL
|
|
+ public java.util.UUID spoofedUUID;
|
|
+ public com.mojang.authlib.properties.Property[] spoofedProfile;
|
|
+ public boolean preparing = true;
|
|
+ // Spigot End
|
|
private INetHandler packetListener;
|
|
private ITextComponent terminationReason;
|
|
private boolean isEncrypted;
|
|
@@ -100,6 +105,7 @@
|
|
super.channelActive(p_channelActive_1_);
|
|
this.channel = p_channelActive_1_.channel();
|
|
this.socketAddress = this.channel.remoteAddress();
|
|
+ this.preparing = false; // Spigot
|
|
|
|
try
|
|
{
|
|
@@ -157,13 +163,14 @@
|
|
|
|
public void setNetHandler(INetHandler handler)
|
|
{
|
|
- Validate.notNull(handler, "packetListener", new Object[0]);
|
|
+ Validate.notNull(handler, "packetListener");
|
|
LOGGER.debug("Set listener of {} to {}", new Object[] {this, handler});
|
|
this.packetListener = handler;
|
|
}
|
|
|
|
public void sendPacket(Packet<?> packetIn)
|
|
{
|
|
+ if(packetIn == null) return;
|
|
if (this.isChannelOpen())
|
|
{
|
|
this.flushOutboundQueue();
|
|
@@ -186,6 +193,7 @@
|
|
|
|
public void sendPacket(Packet<?> packetIn, GenericFutureListener <? extends Future <? super Void >> listener, GenericFutureListener <? extends Future <? super Void >> ... listeners)
|
|
{
|
|
+ if(packetIn == null) return;
|
|
if (this.isChannelOpen())
|
|
{
|
|
this.flushOutboundQueue();
|
|
@@ -297,6 +305,7 @@
|
|
|
|
public void closeChannel(ITextComponent message)
|
|
{
|
|
+ this.preparing = false; // Spigot
|
|
if (this.channel.isOpen())
|
|
{
|
|
this.channel.close().awaitUninterruptibly();
|
|
@@ -408,7 +417,7 @@
|
|
}
|
|
else
|
|
{
|
|
- this.channel.pipeline().addBefore("decoder", "decompress", new NettyCompressionDecoder(threshold));
|
|
+ this.channel.pipeline().addAfter("splitter", "decompress", new NettyCompressionDecoder(threshold)); // CatServer
|
|
}
|
|
|
|
if (this.channel.pipeline().get("compress") instanceof NettyCompressionEncoder)
|
|
@@ -463,6 +472,10 @@
|
|
return channel;
|
|
}
|
|
|
|
+ public SocketAddress getRawAddress(){
|
|
+ return this.channel.remoteAddress(); // Spigot
|
|
+ }
|
|
+
|
|
static class InboundHandlerTuplePacketListener
|
|
{
|
|
private final Packet<?> packet;
|