Add jarfile property to Plugin
This commit is contained in:
parent
e540626a28
commit
18a5534499
@ -17,7 +17,9 @@ public class Plugin
|
|||||||
private PluginDescription description;
|
private PluginDescription description;
|
||||||
@Getter
|
@Getter
|
||||||
private ProxyServer proxy;
|
private ProxyServer proxy;
|
||||||
|
@Getter
|
||||||
|
private File jarfile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the plugin has just been loaded. Most of the proxy will not
|
* Called when the plugin has just been loaded. Most of the proxy will not
|
||||||
* be initialized, so only use it for registering
|
* 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.
|
* Called by the loader to initialize the fields in this plugin.
|
||||||
*
|
*
|
||||||
* @param description the description that describes 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.proxy = proxy;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
|
this.jarfile = jarfile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ public class PluginManager
|
|||||||
Class<?> main = loader.loadClass( desc.getMain() );
|
Class<?> main = loader.loadClass( desc.getMain() );
|
||||||
Plugin plugin = (Plugin) main.getDeclaredConstructor().newInstance();
|
Plugin plugin = (Plugin) main.getDeclaredConstructor().newInstance();
|
||||||
|
|
||||||
plugin.init( proxy, desc );
|
plugin.init( proxy, desc, file );
|
||||||
plugins.put( desc.getName(), plugin );
|
plugins.put( desc.getName(), plugin );
|
||||||
plugin.onLoad();
|
plugin.onLoad();
|
||||||
ProxyServer.getInstance().getLogger().log( Level.INFO, "Loaded plugin {0} version {1} by {2}", new Object[]
|
ProxyServer.getInstance().getLogger().log( Level.INFO, "Loaded plugin {0} version {1} by {2}", new Object[]
|
||||||
|
Loading…
Reference in New Issue
Block a user