Gets the plugin that called the calling method of this method @return The plugin which called the method
()
| 92 | * @return The plugin which called the method |
| 93 | */ |
| 94 | public static Plugin getCallingPlugin() { |
| 95 | Exception ex = new Exception(); |
| 96 | try { |
| 97 | Class<?> clazz = Class.forName(ex.getStackTrace()[2].getClassName()); |
| 98 | Plugin plugin = JavaPlugin.getProvidingPlugin(clazz); |
| 99 | return plugin.isEnabled() ? plugin : Bukkit.getPluginManager().getPlugin(plugin.getName()); |
| 100 | } catch (ClassNotFoundException e) { |
| 101 | e.printStackTrace(); |
| 102 | return null; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Gets all non-abstract, non-interface classes which extend a certain class within a plugin |
no test coverage detected