2023-03-10 05:56:39 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
|
|
Date: Thu, 9 Mar 2023 20:50:15 -0800
|
|
|
|
Subject: [PATCH] Max pending logins
|
|
|
|
|
|
|
|
Should help the floodgates on launch
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
2023-03-25 00:22:47 +01:00
|
|
|
index 2e96377d628b3a07fb565020074d665f594f32e8..75b1877f8c3e4da3183437f327ef3376fd0a3c21 100644
|
2023-03-10 05:56:39 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
|
|
@@ -85,7 +85,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
|
|
|
UUID uniqueId = UUIDUtil.getOrCreatePlayerUUID(this.gameProfile);
|
|
|
|
if (this.server.getPlayerList().pushPendingJoin(name, uniqueId, this.connection)) {
|
|
|
|
this.handleAcceptedLogin();
|
|
|
|
- }
|
2023-03-19 22:58:52 +01:00
|
|
|
+ } else { --this.tick; } // Folia - max concurrent logins
|
2023-03-10 05:56:39 +01:00
|
|
|
// Folia end - region threading - rewrite login process
|
|
|
|
} // Folia - region threading - remove delayed accept
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
2023-04-04 03:41:09 +02:00
|
|
|
index b9bd88fa6536e17cccec8a4f482b9b272be9568f..5f13a2f03d7a448d86550d90f105edc5dcde1194 100644
|
2023-03-10 05:56:39 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
2023-03-23 14:55:09 +01:00
|
|
|
@@ -177,6 +177,17 @@ public abstract class PlayerList {
|
2023-03-10 05:56:39 +01:00
|
|
|
conflictingId = this.connectionById.get(byId);
|
|
|
|
|
|
|
|
if (conflictingName == null && conflictingId == null) {
|
2023-03-19 22:58:52 +01:00
|
|
|
+ // Folia start - max concurrent login
|
2023-03-10 05:56:39 +01:00
|
|
|
+ int loggedInCount = 0;
|
|
|
|
+ for (Connection value : this.connectionById.values()) {
|
|
|
|
+ if (value.isPlayerConnected()) {
|
|
|
|
+ ++loggedInCount;
|
|
|
|
+ }
|
|
|
|
+ }
|
2023-03-19 22:58:52 +01:00
|
|
|
+ if ((this.connectionById.size() - loggedInCount) >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick) {
|
2023-03-10 05:56:39 +01:00
|
|
|
+ return false;
|
|
|
|
+ }
|
2023-03-19 22:58:52 +01:00
|
|
|
+ // Folia end - max concurrent login
|
2023-03-10 05:56:39 +01:00
|
|
|
this.connectionByName.put(userName, conn);
|
|
|
|
this.connectionById.put(byId, conn);
|
|
|
|
}
|