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-28 03:00:01 +02:00
|
|
|
index 0d0bc67bd019c6a203cdb46a778d2963359e43f7..5af3e01efd4176c828043ffaba341ae21fad3a73 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-04-25 23:21:18 +02:00
|
|
|
@@ -1522,13 +1522,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;
|