2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
|
|
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
|
2023-09-10 04:28:03 +02:00
|
|
|
index 39f2db938edad3db6fa83d9f8431a28176d4011a..ed558935e53c3cc5c58e14786cbbd809401ddb81 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
2023-08-06 02:21:59 +02:00
|
|
|
@@ -1600,13 +1600,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
2021-06-11 14:02:28 +02:00
|
|
|
// Spigot start - limit place/interactions
|
|
|
|
private int limitedPackets;
|
|
|
|
private long lastLimitedPacket = -1;
|
2023-06-09 01:44:17 +02:00
|
|
|
+ private static int getSpamThreshold() { return io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.incomingPacketThreshold; } // Paper - Configurable threshold
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
private boolean checkLimit(long timestamp) {
|
2021-06-12 08:02:49 +02:00
|
|
|
- if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < 30 && this.limitedPackets++ >= 4) {
|
2023-06-09 01:44:17 +02:00
|
|
|
+ if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < getSpamThreshold() && this.limitedPackets++ >= 8) { // Paper - Use threshold, raise packet limit to 8
|
2021-06-11 14:02:28 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-06-12 08:02:49 +02:00
|
|
|
- if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= 30) {
|
2023-06-09 01:44:17 +02:00
|
|
|
+ if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= getSpamThreshold()) { // Paper
|
2021-06-12 08:02:49 +02:00
|
|
|
this.lastLimitedPacket = timestamp;
|
|
|
|
this.limitedPackets = 0;
|
2021-06-11 14:02:28 +02:00
|
|
|
return true;
|