aboutsummaryrefslogtreecommitdiffhomepage
path: root/CraftBukkit-Patches/0020-Toggle-for-player-interact-limiter.patch
blob: b21e7654bc9e74ac9e37d4359db53c8e89310b53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 89d24e2d915b377efa206cdbca29a7e7d6c23c6f 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