summaryrefslogtreecommitdiffstats
path: root/nms-patches/CommandDebug.patch
blob: d982a4834afec8003fcf5def1847d6db90ad95b1 (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
--- a/net/minecraft/server/CommandDebug.java
+++ b/net/minecraft/server/CommandDebug.java
@@ -35,6 +35,14 @@
     }
 
     private static int a(CommandListenerWrapper commandlistenerwrapper) throws CommandSyntaxException {
+        // CraftBukkit start - only allow use when enabled (so that no blank profile results occur)
+        if (!commandlistenerwrapper.getServer().methodProfiler.ENABLED) {
+            commandlistenerwrapper.sendFailureMessage(new ChatComponentText("Vanilla debug profiling is disabled."));
+            commandlistenerwrapper.sendFailureMessage(new ChatComponentText("To enable, restart the server with `-DenableDebugMethodProfiler=true' before `-jar'."));
+            commandlistenerwrapper.sendFailureMessage(new ChatComponentText("Use `/timings' for plugin timings."));
+            return 0;
+        }
+        // CraftBukkit end
         MinecraftServer minecraftserver = commandlistenerwrapper.getServer();
         MethodProfiler methodprofiler = minecraftserver.methodProfiler;
 
@@ -48,6 +56,14 @@
     }
 
     private static int b(CommandListenerWrapper commandlistenerwrapper) throws CommandSyntaxException {
+        // CraftBukkit start - only allow use when enabled (so that no blank profile results occur)
+        if (!commandlistenerwrapper.getServer().methodProfiler.ENABLED) {
+            commandlistenerwrapper.sendFailureMessage(new ChatComponentText("Vanilla debug profiling is disabled."));
+            commandlistenerwrapper.sendFailureMessage(new ChatComponentText("To enable, restart the server with `-DenableDebugMethodProfiler=true' before `-jar'."));
+            commandlistenerwrapper.sendFailureMessage(new ChatComponentText("Use `/timings' for plugin timings."));
+            return 0;
+        }
+        // CraftBukkit end
         MinecraftServer minecraftserver = commandlistenerwrapper.getServer();
         MethodProfiler methodprofiler = minecraftserver.methodProfiler;