Skip to content

A good piece of code that allow plugin loading, really simple to use and really powerful.

License

Notifications You must be signed in to change notification settings

hugo4715/PluginLoader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PluginLoader

This software is under Creative commons (The complete license is here)

It can load plugins packaged in .jar by looking in the manifest file to find information. You can take a look to the PluginLoader testplugin repository to find how plugins are made.

Loading Plugin

The PluginManager object is a singleton, so you can access it using

PluginManager.getInstance();

You can set if you want to use logs using this line. It will create a log folder and save logs as zip files.

PluginManager.getInstance().setUseLogFile(true);

You can then load plugins using

PluginManager.getInstance().loadPlugins(new File("plugins/"));

It will load all plugins in the specified folder and call their onLoad() method. If you just want to load one plugin, you can also use

PluginManager.getInstance().loadPlugin(new File("plugins/myPlugin.jar"));

At the end you must use this static method

PluginManager.close();

It will call the onUnload() then unload the plugins and destroy the PluginManager instance.

So, in your plugin main you should have

PluginManager.getInstance().setUseLogFile(true);
PluginManager.getInstance().loadPlugins(new File("plugins/"));
PluginManager.close();

About

A good piece of code that allow plugin loading, really simple to use and really powerful.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages