Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3861e41
commit ae51c16
Showing
3 changed files
with
77 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.16.1--d3a6e66f8d7bf9ae7937b7b6dad700d97cde34b8 | ||
1.16.1--6874b340330971b9934941a70410d110383d7e76 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Shane Freeder <theboyetronic@gmail.com> | ||
Date: Sun, 2 Aug 2020 18:27:13 +0100 | ||
Subject: [PATCH] PaperMC - Buffer joins | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java | ||
index 54e374cc94..8bcba67e6b 100644 | ||
--- a/src/main/java/net/minecraft/server/NetworkManager.java | ||
+++ b/src/main/java/net/minecraft/server/NetworkManager.java | ||
@@ -412,10 +412,24 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { | ||
} | ||
// Paper end | ||
|
||
+ private static final int MAX_PER_TICK = 3; // max joins per tick | ||
+ private static int lastHit = 0; // unused for now | ||
+ public static int thisTick; // current tick counter | ||
+ private static int loginsThisTick = 0; | ||
+ private static int currTick; | ||
public void a() { | ||
+ if (currTick != thisTick) { | ||
+ currTick = thisTick; | ||
+ loginsThisTick = 0; | ||
+ } | ||
+ | ||
this.o(); | ||
if (this.packetListener instanceof LoginListener) { | ||
- ((LoginListener) this.packetListener).tick(); | ||
+ if ( ((LoginListener) this.packetListener).getLoginState() != LoginListener.EnumProtocolState.READY_TO_ACCEPT | ||
+ || (thisTick > lastHit + 10 || loginsThisTick++ < MAX_PER_TICK) | ||
+ ) { | ||
+ ((LoginListener) this.packetListener).tick(); | ||
+ } | ||
} | ||
|
||
if (this.packetListener instanceof PlayerConnection) { | ||
diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java | ||
index 0438126662..bb69477c41 100644 | ||
--- a/src/main/java/net/minecraft/server/ServerConnection.java | ||
+++ b/src/main/java/net/minecraft/server/ServerConnection.java | ||
@@ -121,7 +121,7 @@ public class ServerConnection { | ||
|
||
public void c() { | ||
List list = this.connectedChannels; | ||
- | ||
+ NetworkManager.thisTick++; //Paper | ||
synchronized (this.connectedChannels) { | ||
// Spigot Start | ||
this.addPending(); // Paper |