PaperSpigot-Parent/Spigot-Server-Patches/0020-Toggle-for-player-interact-limiter.patch
Zach Brown 7b0c576798 Restructure PaperSpigot as a new set of modules
Allows us much greater control over the Spigot portion of the code
and makes us more "proper"
Credit to @Dmck2b for originally passing the idea along a while back
2014-07-21 15:46:54 -05:00

47 lines
1.9 KiB
Diff

From 9e7a82050008d416ebe798741ad303dcc11b86e8 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Wed, 16 Jul 2014 14:11:08 -0500
Subject: [PATCH] Toggle for player interact limiter
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 9a7b256..dd63b9f 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -59,6 +59,8 @@ import org.bukkit.inventory.InventoryView;
import org.bukkit.util.NumberConversions;
// CraftBukkit end
+import org.github.paperspigot.PaperSpigotConfig; // PaperSpigot
+
public class PlayerConnection implements PacketPlayInListener {
private static final Logger c = LogManager.getLogger();
@@ -578,7 +580,7 @@ public class PlayerConnection implements PacketPlayInListener {
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
boolean throttled = false;
- if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 5) {
+ if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 5 && PaperSpigotConfig.interactLimitEnabled) {
throttled = true;
} else
{
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
index f7dc787..ec800c3 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -140,4 +140,10 @@ public class PaperSpigotConfig
Bukkit.getLogger().log( Level.INFO, "Disabling async plugin bad ju-ju catcher, this might be bad depending on your plugins" );
}
}
+
+ public static boolean interactLimitEnabled;
+ private static void interactLimitEnabled()
+ {
+ interactLimitEnabled = getBoolean( "settings.limit-player-interactions", true );
+ }
}
--
1.9.1