diff options
author | Pepich <benedikt.abel@yahoo.de> | 2017-05-29 14:18:08 +0200 |
---|---|---|
committer | Pepich <benedikt.abel@yahoo.de> | 2017-05-29 14:18:08 +0200 |
commit | f6d3537d93e9275ffeca04b963594c488afc743f (patch) | |
tree | 977376ead10b18d4215524fc1e7a1d1fb06b0fc8 /src | |
parent | b218d77d20aad147a1ebbc97d6ec93a54fcab772 (diff) |
Changed getCaller() to no longer abuse Exceptions
Diffstat (limited to 'src')
-rw-r--r-- | src/com/redstoner/misc/Utils.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/com/redstoner/misc/Utils.java b/src/com/redstoner/misc/Utils.java index a06b966..e7975e0 100644 --- a/src/com/redstoner/misc/Utils.java +++ b/src/com/redstoner/misc/Utils.java @@ -16,7 +16,7 @@ import net.md_5.bungee.api.ChatColor; /** The utils class containing utility functions. Those include but are not limited to sending formatted messages, broadcasts and more. * * @author Pepich */ -@Version(major = 1, minor = 3, revision = 5, compatible = 1) +@Version(major = 1, minor = 3, revision = 6, compatible = 1) public final class Utils { /** The SimpleDateFormat used for getting the current date. */ @@ -209,7 +209,7 @@ public final class Utils * @return the Name of the calling class. */ private static final String getCaller() { - StackTraceElement[] stackTrace = (new Exception()).getStackTrace(); + StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); String classname = "Utils"; for (int i = 0; classname.equals("Utils"); i++) { @@ -224,7 +224,7 @@ public final class Utils * @return the name of the calling class. */ public static final String getCaller(String directCaller) { - StackTraceElement[] stackTrace = (new Exception()).getStackTrace(); + StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); String classname = (directCaller == null ? "Utils" : directCaller); for (int i = 0; classname.equals(directCaller) || classname.equals("Utils"); i++) { |