fix config option in last commit

This commit is contained in:
Shane Freeder 2020-08-25 13:23:58 +01:00
parent 74d2746308
commit 4d7ea42991
No known key found for this signature in database
GPG key ID: A3F61EA5A085289C

View file

@ -8,7 +8,7 @@ the world per tick, this attempts to reduce the impact that join floods
has on the server
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 9fc12595a566f216620a7fb296d2d30e22332689..83a2363adef4a29547b81be61e260bbdc59b9fd5 100644
index 9fc12595a566f216620a7fb296d2d30e22332689..f65d3545039a2c471819ab5950c171ef6193cdb4 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -452,4 +452,9 @@ public class PaperConfig {
@ -18,14 +18,14 @@ index 9fc12595a566f216620a7fb296d2d30e22332689..83a2363adef4a29547b81be61e260bbd
+
+ public static int maxJoinsPerTick;
+ private static void maxJoinsPerTick() {
+ getInt("settings.max-joins-per-tick", 3);
+ maxJoinsPerTick = getInt("settings.max-joins-per-tick", 3);
+ }
}
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 48fc9f40050685ea08af8da54ae8a00cf3d8ee36..c9b36e6040f03e6cee46989bab8415d829f8eef4 100644
index 48fc9f40050685ea08af8da54ae8a00cf3d8ee36..ac8d642f26b0ad99068638fe539d84786d86042e 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -363,10 +363,22 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -363,10 +363,23 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
// Paper end
@ -43,6 +43,7 @@ index 48fc9f40050685ea08af8da54ae8a00cf3d8ee36..c9b36e6040f03e6cee46989bab8415d8
if (this.packetListener instanceof LoginListener) {
+ if ( ((LoginListener) this.packetListener).getLoginState() != LoginListener.EnumProtocolState.READY_TO_ACCEPT // Paper
+ || (joinAttemptsThisTick++ < MAX_PER_TICK)) { // Paper - limit the number of joins which can be processed each tick
+ System.out.println("tick " + joinAttemptsThisTick + "/" + MAX_PER_TICK);
((LoginListener) this.packetListener).tick();
+ } // Paper
}