PaperMC/nms-patches/CommandDebug.patch

33 lines
1.9 KiB
Diff
Raw Normal View History

--- a/net/minecraft/server/CommandDebug.java
+++ b/net/minecraft/server/CommandDebug.java
2018-07-15 02:00:00 +02:00
@@ -35,6 +35,14 @@
}
2018-07-15 02:00:00 +02:00
private static int a(CommandListenerWrapper commandlistenerwrapper) throws CommandSyntaxException {
+ // CraftBukkit start - only allow use when enabled (so that no blank profile results occur)
2018-07-15 02:00:00 +02:00
+ 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
2018-07-15 02:00:00 +02:00
MinecraftServer minecraftserver = commandlistenerwrapper.getServer();
MethodProfiler methodprofiler = minecraftserver.methodProfiler;
2018-07-15 02:00:00 +02:00
@@ -48,6 +56,14 @@
}
2018-07-15 02:00:00 +02:00
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;