geforkt von Mirrors/Paper
bc127ea819
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: eec4aab0 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent 205213c6 SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron CraftBukkit Changes: b8c522d5 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent f04a77dc SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron d1dbcebc SPIGOT-6653: Canceling snow bucket placement removes snow from bucket 4f34a67b #891: Fix scheduler task ID overflow and duplication issues Spigot Changes: d03d7f12 BUILDTOOLS-604: Rebuild patches
59 Zeilen
2.9 KiB
Diff
59 Zeilen
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
Date: Wed, 19 Aug 2020 05:05:54 +0100
|
|
Subject: [PATCH] Buffer joins to world
|
|
|
|
This patch buffers the number of logins which will attempt to join
|
|
the world per tick, this attempts to reduce the impact that join floods
|
|
has on the server
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
index 2678e4517570cbeafca7a9a4e54d4518cba75e69..8f702f1e80776259015a48cc4649b995198c7bfb 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
@@ -457,4 +457,9 @@ public class PaperConfig {
|
|
maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
|
|
}
|
|
}
|
|
+
|
|
+ public static int maxJoinsPerTick;
|
|
+ private static void maxJoinsPerTick() {
|
|
+ maxJoinsPerTick = getInt("settings.max-joins-per-tick", 3);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
|
index 3faf9bc694016f3f46576a549814ff8e6070598a..7f6405ac44fef423dc8b21f3dbeaae26a1005077 100644
|
|
--- a/src/main/java/net/minecraft/network/Connection.java
|
|
+++ b/src/main/java/net/minecraft/network/Connection.java
|
|
@@ -37,6 +37,7 @@ import net.minecraft.network.protocol.Packet;
|
|
import net.minecraft.network.protocol.PacketFlow;
|
|
import net.minecraft.network.protocol.game.ClientboundDisconnectPacket;
|
|
import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket;
|
|
+import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.server.RunningOnDifferentThreadException;
|
|
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
|
import net.minecraft.server.network.ServerLoginPacketListenerImpl;
|
|
@@ -373,10 +374,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
|
}
|
|
// Paper end
|
|
|
|
+ private static final int MAX_PER_TICK = com.destroystokyo.paper.PaperConfig.maxJoinsPerTick; // Paper
|
|
+ private static int joinAttemptsThisTick; // Paper
|
|
+ private static int currTick; // Paper
|
|
public void tick() {
|
|
this.flushQueue();
|
|
+ // Paper start
|
|
+ if (currTick != MinecraftServer.currentTick) {
|
|
+ currTick = MinecraftServer.currentTick;
|
|
+ joinAttemptsThisTick = 0;
|
|
+ }
|
|
+ // Paper end
|
|
if (this.packetListener instanceof ServerLoginPacketListenerImpl) {
|
|
+ if ( ((ServerLoginPacketListenerImpl) this.packetListener).state != ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper
|
|
+ || (joinAttemptsThisTick++ < MAX_PER_TICK)) { // Paper - limit the number of joins which can be processed each tick
|
|
((ServerLoginPacketListenerImpl) this.packetListener).tick();
|
|
+ } // Paper
|
|
}
|
|
|
|
if (this.packetListener instanceof ServerGamePacketListenerImpl) {
|