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
|
2024-04-23 19:02:08 +02:00
|
|
|
index 19ff229f90d07447947afa8b4794b683feceb574..6a0e6697331732555f9e4e63e95dce0a2bfc1a85 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
|
2024-01-24 13:07:40 +01:00
|
|
|
@@ -1529,13 +1529,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
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) {
|
2024-01-22 19:01:10 +01:00
|
|
|
+ if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < getSpamThreshold() && this.limitedPackets++ >= 8) { // Paper - Configurable 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) {
|
2024-01-22 19:01:10 +01:00
|
|
|
+ if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= getSpamThreshold()) { // Paper - Configurable threshold
|
2021-06-12 08:02:49 +02:00
|
|
|
this.lastLimitedPacket = timestamp;
|
|
|
|
this.limitedPackets = 0;
|
2021-06-11 14:02:28 +02:00
|
|
|
return true;
|