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-23 14:55:09 +01:00
|
|
|
index 48223b78dd7ea2f065a259ad071f101398f40cfd..30fae97d5fed9de036cc4131a09d404468c69dd4 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-03-23 14:55:09 +01:00
|
|
|
index e49e9cc31a9e05422fd1f48616c5a452011d66e1..132e1e055a8898beb4683dbec821b1f6e4dbf1a2 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);
|
|
|
|
}
|