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.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/patches/server/0107-Configurable-packet-in-spam-threshold.patch b/patches/server/0107-Configurable-packet-in-spam-threshold.patch
new file mode 100644
index 0000000000..7059a874f8
--- /dev/null
+++ b/patches/server/0107-Configurable-packet-in-spam-threshold.patch
@@ -0,0 +1,27 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Zach Brown <[email protected]>
+Date: Sun, 11 Sep 2016 14:30:57 -0500
+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 b86f742c4a7500f0bb241d5c07a077aa1be1c7e5..c94a736dbf02c2ba34e74e73b6cc3780238f0ede 100644
+--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+@@ -1611,13 +1611,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 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
+ return false;
+ }
+
+- if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= 30) {
++ if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= THRESHOLD) { // Paper
+ this.lastLimitedPacket = timestamp;
+ this.limitedPackets = 0;
+ return true;