summaryrefslogtreecommitdiffstats
path: root/nms-patches/MethodProfiler.patch
blob: b608e64a86a015a1d0d2dac169577c34e55b48fd (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
--- a/net/minecraft/server/MethodProfiler.java
+++ b/net/minecraft/server/MethodProfiler.java
@@ -13,6 +13,7 @@
 
 public class MethodProfiler {
 
+    public static final boolean ENABLED = Boolean.getBoolean("enableDebugMethodProfiler"); // CraftBukkit - disable unless specified in JVM arguments
     private static final Logger b = LogManager.getLogger();
     private final List<String> c = Lists.newArrayList();
     private final List<Long> d = Lists.newArrayList();
@@ -23,12 +24,14 @@
     public MethodProfiler() {}
 
     public void a() {
+        if (!ENABLED) return;  // CraftBukkit
         this.f.clear();
         this.e = "";
         this.c.clear();
     }
 
     public void a(String s) {
+        if (!ENABLED) return;  // CraftBukkit
         if (this.a) {
             if (!this.e.isEmpty()) {
                 this.e = this.e + ".";
@@ -41,12 +44,14 @@
     }
 
     public void a(Supplier<String> supplier) {
+        if (!ENABLED) return;  // CraftBukkit
         if (this.a) {
             this.a((String) supplier.get());
         }
     }
 
     public void b() {
+        if (!ENABLED) return;  // CraftBukkit
         if (this.a) {
             long i = System.nanoTime();
             long j = ((Long) this.d.remove(this.d.size() - 1)).longValue();
@@ -69,7 +74,7 @@
     }
 
     public List<MethodProfiler.ProfilerInfo> b(String s) {
-        if (!this.a) {
+        if (!ENABLED || !this.a) {  // CraftBukkit
             return Collections.emptyList();
         } else {
             long i = this.f.containsKey("root") ? ((Long) this.f.get("root")).longValue() : 0L;
@@ -135,11 +140,13 @@
     }
 
     public void c(String s) {
+        if (!ENABLED) return;  // CraftBukkit
         this.b();
         this.a(s);
     }
 
     public String c() {
+        if (!ENABLED) return "[DISABLED]";  // CraftBukkit
         return this.c.isEmpty() ? "[UNKNOWN]" : (String) this.c.get(this.c.size() - 1);
     }
 
@@ -159,7 +166,7 @@
             return methodprofiler_profilerinfo.a < this.a ? -1 : (methodprofiler_profilerinfo.a > this.a ? 1 : methodprofiler_profilerinfo.c.compareTo(this.c));
         }
 
-        public int compareTo(Object object) {
+        public int compareTo(MethodProfiler.ProfilerInfo object) { // CraftBukkit: decompile error
             return this.a((MethodProfiler.ProfilerInfo) object);
         }
     }