Skript event executor classes do not have an enclosing method

This commit is contained in:
Zach Brown 2016-01-09 18:43:35 -06:00
parent 9172103531
commit 414a748893

View File

@ -1,4 +1,4 @@
From 3957d5f9f79ab7212bfcbc2204e4edd89c3c7600 Mon Sep 17 00:00:00 2001
From a9ddd6b7178106c99145a5c7e955a782aa24d657 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 8 Jan 2016 23:12:28 -0600
Subject: [PATCH] Timings v2
@ -824,10 +824,10 @@ index 0000000..2993971
+}
diff --git a/src/main/java/org/spigotmc/timings/TimedEventExecutor.java b/src/main/java/org/spigotmc/timings/TimedEventExecutor.java
new file mode 100644
index 0000000..a704015
index 0000000..0674238
--- /dev/null
+++ b/src/main/java/org/spigotmc/timings/TimedEventExecutor.java
@@ -0,0 +1,73 @@
@@ -0,0 +1,81 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -880,9 +880,17 @@ index 0000000..a704015
+ String id;
+
+ if (method == null) {
+ method = executor.getClass().getEnclosingMethod();
+ if (executor.getClass().getEnclosingClass() != null) { // Oh Skript, how we love you
+ method = executor.getClass().getEnclosingMethod();
+ }
+ }
+ id = method.getDeclaringClass().getName();
+
+ if (method != null) {
+ id = method.getDeclaringClass().getName();
+ } else {
+ id = "null";
+ }
+
+
+ final String eventName = eventClass.getSimpleName();
+ boolean verbose = "BlockPhysicsEvent".equals(eventName) || "Drain".equals(eventName) || "Fill".equals(eventName);