mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 09:27:43 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@5436d44 Deprecate several Keyed#getKey methods (#10357) PaperMC/Paper@a7f1dc6 Change online mode default for Velocity configuration (#10413) PaperMC/Paper@37db2d7 [ci skip] Update book page/char limit for book meta doc (#10415) PaperMC/Paper@526795b Update patches to handle vineflower decompiler (#10406) PaperMC/Paper@8fe90de [ci skip] Referenced InventoryDragEvent in documentation of InventoryClickEvent (#10395) PaperMC/Paper@46d462b Fix StackOverflowException thrown on shutdown (Fixes #10404) (#10408) PaperMC/Paper@f061e76 Fix hit criteria advancement triggered before changing state (#10409) PaperMC/Paper@3263470 Add color transition and clone functions to ParticleBuilder (#10342) PaperMC/Paper@4445d23 Deprecate ItemStack#setType & add ItemStack#withType (#10290)
This commit is contained in:
47
patches/server/0237-Max-joins-per-second.patch
Normal file
47
patches/server/0237-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 a536ebcf29d8ef0ed32863bd8d5e70f7a0636e8d..9e31954212b1d6162dca2fbc91d373e908560335 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -570,11 +570,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 ce3ab604e6ed6669f38abf83d40b500148277b9d..a05da9ff158c6e7d55abb23e4b28f3703e9e5b3d 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