aboutsummaryrefslogtreecommitdiffhomepage
path: root/CraftBukkit-Patches/0033-Allow-Disabling-of-Command-TabComplete.patch
blob: db14abeec0472c8c5ea98140b6ba39a5f08ce3cd (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
47
48
49
50
51
52
53
From 514f81e6239b77fa8bba578144d14ac72b2bcacc Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 18:05:54 +1000
Subject: [PATCH] Allow Disabling of Command TabComplete


diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6dc4157..fdac2f6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1698,6 +1698,13 @@ public final class CraftServer implements Server {
     }
 
     public List<String> tabCompleteCommand(Player player, String message) {
+        // Spigot Start
+		if ( (org.spigotmc.SpigotConfig.tabComplete < 0 || message.length() <= org.spigotmc.SpigotConfig.tabComplete) && !message.contains( " " ) )
+        {
+            return ImmutableList.of();
+        }
+        // Spigot End
+
         List<String> completions = null;
         try {
             completions = getCommandMap().tabComplete(player, message.substring(1));
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index a83ee05..f8427ed 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -148,4 +148,21 @@ public class SpigotConfig
     {
         logCommands = getBoolean( "commands.log", true );
     }
+
+    public static int tabComplete;
+    private static void tabComplete()
+    {
+        if ( version < 6 )
+        {
+            boolean oldValue = getBoolean( "commands.tab-complete", true );
+            if ( oldValue )
+            {
+                set( "commands.tab-complete", 0 );
+            } else
+            {
+                set( "commands.tab-complete", -1 );
+            }
+        }
+        tabComplete = getInt( "commands.tab-complete", 0 );
+    }
 }
-- 
1.9.1