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@e4f5e1c Bump netty Pufferfish Changes: pufferfish-gg/Pufferfish@a8543a4 #33 Fix anti-xray related crash bug pufferfish-gg/Pufferfish@aefcb1a Updated Upstream (Paper)
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 c1e8d8674738eebaaf7bd918eacb5227a1331b67..fd23bb94194b94a203de8aa165096ebce11c2a63 100644
|
|
--- a/src/main/java/net/minecraft/network/Connection.java
|
|
+++ b/src/main/java/net/minecraft/network/Connection.java
|
|
@@ -545,11 +545,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 (currTick != net.minecraft.server.MinecraftServer.currentTick) {
|
|
currTick = net.minecraft.server.MinecraftServer.currentTick;
|
|
+ // Purpur start
|
|
+ if (org.purpurmc.purpur.PurpurConfig.maxJoinsPerSecond) {
|
|
+ if (++tickSecond > 20) {
|
|
+ tickSecond = 0;
|
|
+ joinAttemptsThisTick = 0;
|
|
+ }
|
|
+ } else
|
|
+ // Purpur end
|
|
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 5038d35ccb37a492d6a16242d876d18c02ccc35c..c482f598c79c8ff32fdcdf8cd1ac7920f4050862 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
@@ -424,8 +424,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;
|