PaperMC/Spigot-Server-Patches/0012-Toggle-for-player-interact-limiter.patch
Aikar 9ff01b16ab Add MCUtils helper
This will be used by my next commit. But trying to get the build going
since CI blew up
2016-03-28 21:01:42 -04:00

40 lines
1.9 KiB
Diff

From 6a41507aeb1e0942a0d347bbdb8500d3b38356df Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 13:31:05 -0600
Subject: [PATCH] Toggle for player interact limiter
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 7cfe3b9..f0ed051 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -156,4 +156,12 @@ public class PaperConfig {
}
return time;
}
+
+ public static boolean useInteractLimiter;
+ private static void useInteractLimiter() {
+ useInteractLimiter = getBoolean("settings.limit-player-interactions", true);
+ if (!useInteractLimiter) {
+ Bukkit.getLogger().log(Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users");
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index cd19408..b351f2b 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -913,7 +913,8 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
this.player.resetIdleTimer();
// Spigot start
boolean throttled = false;
- if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) {
+ // Paper - Allow disabling interact limiter
+ if (com.destroystokyo.paper.PaperConfig.useInteractLimiter && lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) {
throttled = true;
} else if ( packetplayinblockplace.timestamp - lastPlace >= 30 || lastPlace == -1 )
{
--
2.7.4