From 56a0a83ddb1b7472dbc9762e2aca396605c62085 Mon Sep 17 00:00:00 2001 From: File Date: Sun, 20 Apr 1997 05:37:42 -0800 Subject: [PATCH] purpur File Patches diff --git a/net/minecraft/network/Connection.java b/net/minecraft/network/Connection.java index 19ec939529eb638bdc4d7fd9260f161fae118314..21e891ecdb90a1828428441aef9c2593253751f8 100644 --- a/net/minecraft/network/Connection.java +++ b/net/minecraft/network/Connection.java @@ -554,11 +554,20 @@ public class Connection extends SimpleChannelInboundHandler> { 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 - Max joins per second 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 - Max joins per second + if (org.purpurmc.purpur.PurpurConfig.maxJoinsPerSecond) { + if (++Connection.tickSecond > 20) { + Connection.tickSecond = 0; + Connection.joinAttemptsThisTick = 0; + } + } else + // Purpur end - Max joins per second Connection.joinAttemptsThisTick = 0; } // Paper end - Buffer joins to world