diff options
author | Pepich <benedikt.abel@yahoo.de> | 2017-05-05 09:21:19 +0200 |
---|---|---|
committer | Pepich <benedikt.abel@yahoo.de> | 2017-05-05 09:21:19 +0200 |
commit | 1ee4a123d24fc85b494ed64b863f1658cc1cfbda (patch) | |
tree | 77c13e9a2bb2839b40ad3f97e454f31a7a41e709 /src | |
parent | 205cdb2d8635ddcfd56f5b359309f7e9f241a0a5 (diff) |
Updated API to version 3.2
Diffstat (limited to 'src')
-rw-r--r-- | src/com/redstoner/misc/Main.java | 2 | ||||
-rw-r--r-- | src/com/redstoner/misc/Utils.java | 19 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/com/redstoner/misc/Main.java b/src/com/redstoner/misc/Main.java index ad684a9..e6ef372 100644 --- a/src/com/redstoner/misc/Main.java +++ b/src/com/redstoner/misc/Main.java @@ -10,7 +10,7 @@ import com.redstoner.misc.mysql.MysqlHandler; /** Main class. Duh. * * @author Pepich */ -@Version(major = 3, minor = 1, revision = 1, compatible = -1) +@Version(major = 3, minor = 2, revision = 0, compatible = -1) public class Main extends JavaPlugin { public static JavaPlugin plugin; diff --git a/src/com/redstoner/misc/Utils.java b/src/com/redstoner/misc/Utils.java index 3bd02c2..3a51344 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 = 2, revision = 13, compatible = 1) +@Version(major = 1, minor = 3, revision = 0, compatible = 1) public final class Utils { /** The SimpleDateFormat used for getting the current date. */ @@ -202,7 +202,7 @@ public final class Utils /** This method will find the next parent caller and return their class name, omitting package names. * - * @return */ + * @return the Name of the calling class. */ private static final String getCaller() { StackTraceElement[] stackTrace = (new Exception()).getStackTrace(); @@ -214,6 +214,21 @@ public final class Utils return classname; } + /** This method will find the next parent caller and return their class name, omitting package names. + * + * @param directCaller used to prevent this method from returning the caller itself. Null if supposed to be ignored. + * @return the name of the calling class. */ + public static final String getCaller(Class<? extends Object> directCaller) + { + StackTraceElement[] stackTrace = (new Exception()).getStackTrace(); + String classname = (directCaller == null ? "Utils" : directCaller.getName()); + for (int i = 0; classname.equals(directCaller.getName()); i++) + { + classname = stackTrace[i].getClassName().replaceAll(".*\\.", ""); + } + return classname; + } + /** Displays the module header to the recipient.</br> * Format: &2--=[ %MODULE% ]=-- * |