mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@990be16 Iterate over entity array copy for entity scheduler PaperMC/Paper@3f6c4b0 Add event for player editing sign (#9300) PaperMC/Paper@7103f81 Only tick item frames if players can see it (#9377) PaperMC/Paper@cf0f013 Avoid duplicate death event call for armorstands (#9223) PaperMC/Paper@8582999 Deprecate duplicate chat completion methods (#9401) PaperMC/Paper@e4b40dd Fix entity selectors while spectating (#9402) PaperMC/Paper@82cd69f [ci skip] Update Repo style and change project url in README (#9407) PaperMC/Paper@2c9c5e4 Fix replenishable container entities save/load existing contents (#9417) PaperMC/Paper@437e8da Improve command function perm level checks (#9411) PaperMC/Paper@225c950 Hotfix double entity removal making entity scheduler retire call PaperMC/Paper@fead63e Add option to disable NoteBlock and Tripwire updates (#9368) Pufferfish Changes: pufferfish-gg/Pufferfish@50f3124 Updated Upstream (Paper) pufferfish-gg/Pufferfish@5673490 Add option to suppress null ID disconnections in logs pufferfish-gg/Pufferfish@1e911fb Fix issue with that last patch
48 lines
2.4 KiB
Diff
48 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
|
Date: Tue, 18 Jan 2022 06:35:54 -0600
|
|
Subject: [PATCH] Max joins per second
|
|
|
|
When this option is set to true the `max-joins-per-tick` setting in paper.yml will be used per second instead of per tick
|
|
|
|
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
|
index cf20f0983fc25b26cf92b9d3a28746b1909fc56b..89c1b69ddeb420c2fbda5f588e7c9a467a76089d 100644
|
|
--- a/src/main/java/net/minecraft/network/Connection.java
|
|
+++ b/src/main/java/net/minecraft/network/Connection.java
|
|
@@ -579,11 +579,20 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
|
private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper
|
|
private static int joinAttemptsThisTick; // Paper
|
|
private static int currTick; // Paper
|
|
+ private static int tickSecond; // Purpur
|
|
public void tick() {
|
|
this.flushQueue();
|
|
// Paper start
|
|
if (Connection.currTick != net.minecraft.server.MinecraftServer.currentTick) {
|
|
Connection.currTick = net.minecraft.server.MinecraftServer.currentTick;
|
|
+ // Purpur start
|
|
+ if (org.purpurmc.purpur.PurpurConfig.maxJoinsPerSecond) {
|
|
+ if (++Connection.tickSecond > 20) {
|
|
+ Connection.tickSecond = 0;
|
|
+ Connection.joinAttemptsThisTick = 0;
|
|
+ }
|
|
+ } else
|
|
+ // Purpur end
|
|
Connection.joinAttemptsThisTick = 0;
|
|
}
|
|
// Paper end
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
index 81d672b7f3cdae0f887fb978327573285f326e8e..97e9621b52a6620b1768807c3352d2ef0d2f29a8 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
@@ -454,8 +454,10 @@ public class PurpurConfig {
|
|
}
|
|
|
|
public static boolean useUPnP = false;
|
|
+ public static boolean maxJoinsPerSecond = false;
|
|
private static void networkSettings() {
|
|
useUPnP = getBoolean("settings.network.upnp-port-forwarding", useUPnP);
|
|
+ maxJoinsPerSecond = getBoolean("settings.network.max-joins-per-second", maxJoinsPerSecond);
|
|
}
|
|
|
|
public static java.util.regex.Pattern usernameValidCharactersPattern;
|