Add jarfile property to Plugin

This commit is contained in:
Robin Lambertz 2013-04-23 17:47:05 +01:00 committed by md_5
parent e540626a28
commit 18a5534499
2 changed files with 7 additions and 3 deletions

View File

@ -17,6 +17,8 @@ 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
@ -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;
}
}

View File

@ -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[]