From 18a5534499b2c73a11682360d54da9a77b14a535 Mon Sep 17 00:00:00 2001 From: Robin Lambertz Date: Tue, 23 Apr 2013 17:47:05 +0100 Subject: [PATCH] Add jarfile property to Plugin --- api/src/main/java/net/md_5/bungee/api/plugin/Plugin.java | 8 ++++++-- .../java/net/md_5/bungee/api/plugin/PluginManager.java | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/net/md_5/bungee/api/plugin/Plugin.java b/api/src/main/java/net/md_5/bungee/api/plugin/Plugin.java index 38fe3f6f..7380bbb0 100644 --- a/api/src/main/java/net/md_5/bungee/api/plugin/Plugin.java +++ b/api/src/main/java/net/md_5/bungee/api/plugin/Plugin.java @@ -17,7 +17,9 @@ public class Plugin private PluginDescription description; @Getter private ProxyServer proxy; - + @Getter + private File jarfile; + /** * Called when the plugin has just been loaded. Most of the proxy will not * be initialized, so only use it for registering @@ -69,10 +71,12 @@ public class Plugin * Called by the loader to initialize the fields in this plugin. * * @param description the description that describes this plugin + * @param jarfile this plugins jar or container */ - final void init(ProxyServer proxy, PluginDescription description) + final void init(ProxyServer proxy, PluginDescription description, File jarfile) { this.proxy = proxy; this.description = description; + this.jarfile = jarfile; } } diff --git a/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java b/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java index c2e76f7e..82b152b0 100644 --- a/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java +++ b/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java @@ -248,7 +248,7 @@ public class PluginManager Class main = loader.loadClass( desc.getMain() ); Plugin plugin = (Plugin) main.getDeclaredConstructor().newInstance(); - plugin.init( proxy, desc ); + plugin.init( proxy, desc, file ); plugins.put( desc.getName(), plugin ); plugin.onLoad(); ProxyServer.getInstance().getLogger().log( Level.INFO, "Loaded plugin {0} version {1} by {2}", new Object[]