aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0107-Configurable-packet-in-spam-threshold.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0107-Configurable-packet-in-spam-threshold.patch')
-rw-r--r--patches/server/0107-Configurable-packet-in-spam-threshold.patch8
1 files changed, 4 insertions, 4 deletions
diff --git a/patches/server/0107-Configurable-packet-in-spam-threshold.patch b/patches/server/0107-Configurable-packet-in-spam-threshold.patch
index fe5b74c81b..fd7d119231 100644
--- a/patches/server/0107-Configurable-packet-in-spam-threshold.patch
+++ b/patches/server/0107-Configurable-packet-in-spam-threshold.patch
@@ -5,23 +5,23 @@ Subject: [PATCH] Configurable packet in spam threshold
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 2b1311185bb08592038e256d860a722fbd4d9ffc..28ec3530a5c3df8e0c629228f80c0130cb65cc27 100644
+index 2b1311185bb08592038e256d860a722fbd4d9ffc..3ac549815895e6cbb43cbfc04377337f8b7ebd43 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1595,13 +1595,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Spigot start - limit place/interactions
private int limitedPackets;
private long lastLimitedPacket = -1;
-+ private static final int THRESHOLD = io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.incomingPacketThreshold; // Paper - Configurable threshold
++ private static int getSpamThreshold() { return io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.incomingPacketThreshold; } // Paper - Configurable threshold
private boolean checkLimit(long timestamp) {
- if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < 30 && this.limitedPackets++ >= 4) {
-+ if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < THRESHOLD && this.limitedPackets++ >= 8) { // Paper - Use threshold, raise packet limit to 8
++ if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < getSpamThreshold() && this.limitedPackets++ >= 8) { // Paper - Use threshold, raise packet limit to 8
return false;
}
- if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= 30) {
-+ if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= THRESHOLD) { // Paper
++ if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= getSpamThreshold()) { // Paper
this.lastLimitedPacket = timestamp;
this.limitedPackets = 0;
return true;