mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 08:20:51 +01:00
3c0d6aaed9
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 0c7aedbc SPIGOT-7554, PR-954: Add DecoratedPotInventory CraftBukkit Changes: 53ebb05e3 SPIGOT-7554, PR-1323: Add DecoratedPotInventory 33a2d8773 Ensure that PlayerMoveEvent is always fired where applicable 7df18510f SPIGOT-7555: Don't cast ItemFlags to byte 19aec59ea Use provided case for non-existent OfflinePlayers Spigot Changes: e7ce55a3 Remove obsolete PlayerMoveEvent improvements 3e5e22c0 Remove obsolete lowercasing of non existent OfflinePlayer names
28 lines
1.7 KiB
Diff
28 lines
1.7 KiB
Diff
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
|
|
index fe6a995331ba489911886047130861496d75979a..4300fd30f782a2fe32519f7e27edff292ca46ef6 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -1536,13 +1536,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
// Spigot start - limit place/interactions
|
|
private int limitedPackets;
|
|
private long lastLimitedPacket = -1;
|
|
+ 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 < 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 >= getSpamThreshold()) { // Paper
|
|
this.lastLimitedPacket = timestamp;
|
|
this.limitedPackets = 0;
|
|
return true;
|