Attempt to fix FastLogin maybe

This commit is contained in:
Aikar 2020-05-03 02:20:56 -04:00
parent 932e97f345
commit 3e9fc24b66
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
2 changed files with 26 additions and 24 deletions

View File

@ -1,4 +1,4 @@
From 5e98ffe924abde6c9985464127a99fc2506fba12 Mon Sep 17 00:00:00 2001
From 57f98e2c510b576b4d3c94b12384b1bc4b6b5e33 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 2 Mar 2019 14:55:01 -0500
Subject: [PATCH] Handle Excessive Signs in Chunks creating large packets
@ -14,30 +14,32 @@ With further contributions from
Co-Authored-by: Spottedleaf <spottedleaf@spottedleaf.dev>
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index b1dededc15..ddc12364e7 100644
index b1dededc15..e966b6edcc 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -158,19 +158,53 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -158,19 +158,55 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
NetworkManager.LOGGER.debug("Set listener of {} to {}", this, packetlistener);
this.packetListener = packetlistener;
}
+ // Paper start
+ private static java.util.List<Packet> buildExtraPackets(Packet packet) {
+ java.util.List<Packet> extra = packet.getExtraPackets();
+ if (extra == null || extra.isEmpty()) {
+ return null;
+ private static class InnerUtil { // Attempt to hide these methods from ProtocolLib so it doesn't accidently pick them up.
+ private static java.util.List<Packet> buildExtraPackets(Packet packet) {
+ java.util.List<Packet> extra = packet.getExtraPackets();
+ if (extra == null || extra.isEmpty()) {
+ return null;
+ }
+ java.util.List<Packet> ret = new java.util.ArrayList<>(1 + extra.size());
+ buildExtraPackets0(extra, ret);
+ return ret;
+ }
+ java.util.List<Packet> ret = new java.util.ArrayList<>(1 + extra.size());
+ buildExtraPackets0(extra, ret);
+ return ret;
+ }
+
+ private static void buildExtraPackets0(java.util.List<Packet> extraPackets, java.util.List<Packet> into) {
+ for (Packet extra : extraPackets) {
+ into.add(extra);
+ java.util.List<Packet> extraExtra = extra.getExtraPackets();
+ if (extraExtra != null && !extraExtra.isEmpty()) {
+ buildExtraPackets0(extraExtra, into);
+ private static void buildExtraPackets0(java.util.List<Packet> extraPackets, java.util.List<Packet> into) {
+ for (Packet extra : extraPackets) {
+ into.add(extra);
+ java.util.List<Packet> extraExtra = extra.getExtraPackets();
+ if (extraExtra != null && !extraExtra.isEmpty()) {
+ buildExtraPackets0(extraExtra, into);
+ }
+ }
+ }
+ }
@ -52,9 +54,9 @@ index b1dededc15..ddc12364e7 100644
- this.o();
- this.b(packet, genericfuturelistener);
- } else {
+ // Paper start start - handle oversized packets better
+ // Paper start - handle oversized packets better
+ // write the packets to the queue, then flush - antixray hooks there already
+ java.util.List<Packet> extraPackets = buildExtraPackets(packet);
+ java.util.List<Packet> extraPackets = InnerUtil.buildExtraPackets(packet);
+ boolean hasExtraPackets = extraPackets != null && !extraPackets.isEmpty();
+ if (!hasExtraPackets) {
this.packetQueue.add(new NetworkManager.QueuedPacket(packet, genericfuturelistener));

View File

@ -1,4 +1,4 @@
From f6be2f7be9bb53cabe1258d71f9dbc4ab92bcce6 Mon Sep 17 00:00:00 2001
From 320c3f9937a0e870f32f6b1dc3cf5480004a7692 Mon Sep 17 00:00:00 2001
From: stonar96 <minecraft.stonar96@gmail.com>
Date: Mon, 20 Aug 2018 03:03:58 +0200
Subject: [PATCH] Anti-Xray
@ -1377,10 +1377,10 @@ index 2c1d1b1a55..44aed67274 100644
if (this.h == this.b) {
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index ddc12364e7..0b6dce35e6 100644
index e966b6edcc..682434ec07 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -186,6 +186,11 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -188,6 +188,11 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
public void sendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) {
// Paper start start - handle oversized packets better
@ -1390,9 +1390,9 @@ index ddc12364e7..0b6dce35e6 100644
+ return;
+ }
// write the packets to the queue, then flush - antixray hooks there already
java.util.List<Packet> extraPackets = buildExtraPackets(packet);
java.util.List<Packet> extraPackets = InnerUtil.buildExtraPackets(packet);
boolean hasExtraPackets = extraPackets != null && !extraPackets.isEmpty();
@@ -248,21 +253,32 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -250,21 +255,32 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}