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 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.
* Format: &2--=[ %MODULE% ]=-- *