MCPcopy Create free account
hub / github.com/boxbeam/RedLib / getCallingPlugin

Method getCallingPlugin

src/redempt/redlib/RedLib.java:94–104  ·  view source on GitHub ↗

Gets the plugin that called the calling method of this method @return The plugin which called the method

()

Source from the content-addressed store, hash-verified

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

Callers 8

syncDelayedMethod · 0.95
syncRepeatingMethod · 0.95
asyncDelayedMethod · 0.95
asyncRepeatingMethod · 0.95
EventListenerMethod · 0.95
ProtectedRegionMethod · 0.95
ProtectionPolicyMethod · 0.95
protectMethod · 0.95

Calls 3

getStackTraceMethod · 0.80
getPluginMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected