summaryrefslogtreecommitdiffhomepage
path: root/patches/server/0108-Configurable-packet-in-spam-threshold.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2023-09-10 12:28:03 +1000
committerNassim Jahnke <[email protected]>2023-09-10 12:28:03 +1000
commit72e87abc2db813ecd74a323c33a7b9c79b0c67b9 (patch)
tree37012a296b6095897a3f364fa85beec7502283c7 /patches/server/0108-Configurable-packet-in-spam-threshold.patch
parent33bec7f20a5d3e20d9a8c0a16a1e5276add5d4fb (diff)
downloadPaper-72e87abc2db813ecd74a323c33a7b9c79b0c67b9.tar.gz
Paper-72e87abc2db813ecd74a323c33a7b9c79b0c67b9.zip
Strip raytracing for EntityLiving#hasLineOfSight
Co-authored-by: Paul Sauve <[email protected]>
Diffstat (limited to 'patches/server/0108-Configurable-packet-in-spam-threshold.patch')
-rw-r--r--patches/server/0108-Configurable-packet-in-spam-threshold.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/patches/server/0108-Configurable-packet-in-spam-threshold.patch b/patches/server/0108-Configurable-packet-in-spam-threshold.patch
new file mode 100644
index 0000000000..7c36138c34
--- /dev/null
+++ b/patches/server/0108-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 39f2db938edad3db6fa83d9f8431a28176d4011a..ed558935e53c3cc5c58e14786cbbd809401ddb81 100644
+--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+@@ -1600,13 +1600,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
+ // 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;