mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
prepare for update
This commit is contained in:
47
patches/unapplied-server/0232-Max-joins-per-second.patch
Normal file
47
patches/unapplied-server/0232-Max-joins-per-second.patch
Normal file
@@ -0,0 +1,47 @@
|
||||
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 f40420a6841f03983b0837e177ea2ae7c3a37ca1..3b66ecc4f110d0f2dc0ef6c560801296d7e0be64 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -609,11 +609,20 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper - Buffer joins to world
|
||||
private static int joinAttemptsThisTick; // Paper - Buffer joins to world
|
||||
private static int currTick; // Paper - Buffer joins to world
|
||||
+ private static int tickSecond; // Purpur
|
||||
public void tick() {
|
||||
this.flushQueue();
|
||||
// Paper start - Buffer joins to world
|
||||
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 - Buffer joins to world
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 6884aed8d03ee4da14baeaa5d6eaea54ff53afe5..d0e13dce484c9680128061efaef74555c57ca742 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -456,8 +456,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;
|
||||
Reference in New Issue
Block a user