mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-19 09:05:43 +01:00
7141632abf
While Velocity supports BungeeCord-style IP forwarding, it is not secure. Users have a lot of problems setting up firewalls or setting up plugins like IPWhitelist. Further, the BungeeCord IP forwarding protocol still retains essentially its original form, when there is brand new support for custom login plugin messages in 1.13. Velocity's modern IP forwarding uses an HMAC-SHA256 code to ensure authenticity of messages, is packed into a binary format that is smaller than BungeeCord's forwarding, and is integrated into the Minecraft login process by using the 1.13 login plugin message packet.
49 lines
2.3 KiB
Diff
49 lines
2.3 KiB
Diff
From d84e0a561e044f2e4ad8586dca7ee49908015c80 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/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
index 1c1ef2dc2..4c0a9f18c 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
@@ -253,4 +253,13 @@ public class PaperConfig {
|
|
public static boolean isProxyOnlineMode() {
|
|
return Bukkit.getOnlineMode() || (SpigotConfig.bungee && bungeeOnlineMode);
|
|
}
|
|
+
|
|
+ public static int packetInSpamThreshold = 300;
|
|
+ private static void packetInSpamThreshold() {
|
|
+ if (version < 11) {
|
|
+ int oldValue = getInt("settings.play-in-use-item-spam-threshold", 300);
|
|
+ set("settings.incoming-packet-spam-threshold", oldValue);
|
|
+ }
|
|
+ packetInSpamThreshold = getInt("settings.incoming-packet-spam-threshold", 300);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
index aad33272f..598b747ec 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -1201,13 +1201,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
|
// Spigot start - limit place/interactions
|
|
private int limitedPackets;
|
|
private long lastLimitedPacket = -1;
|
|
+ private static final int THRESHOLD = com.destroystokyo.paper.PaperConfig.packetInSpamThreshold; // Paper - Configurable threshold
|
|
|
|
private boolean checkLimit(long timestamp) {
|
|
- if (lastLimitedPacket != -1 && timestamp - lastLimitedPacket < 30 && limitedPackets++ >= 4) {
|
|
+ if (lastLimitedPacket != -1 && timestamp - lastLimitedPacket < THRESHOLD && limitedPackets++ >= 8) { // Paper - Use threshold, raise packet limit to 8
|
|
return false;
|
|
}
|
|
|
|
- if (lastLimitedPacket == -1 || timestamp - lastLimitedPacket >= 30) {
|
|
+ if (lastLimitedPacket == -1 || timestamp - lastLimitedPacket >= THRESHOLD) { // Paper
|
|
lastLimitedPacket = timestamp;
|
|
limitedPackets = 0;
|
|
return true;
|
|
--
|
|
2.19.1
|
|
|