Skip to content

Plugin loader to load classes dynamically into the project

Notifications You must be signed in to change notification settings

LabyStudio/pluginloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plugin Loader

Load and unload classes dynamically in your project

Example core

package de.labystudio.pluginloader;

import de.labystudio.pluginloader.plugin.Plugin;

import java.io.File;

public class DemoProject implements Core {

    public DemoProject() {
        // Create plugin loader
        PluginLoader pluginLoader = new PluginLoader(this, new File("plugins"),
                ClassLoader.getSystemClassLoader(), System.out::println);
        
        // Load all plugins in directory
        pluginLoader.loadPluginsInDirectory();

        // Unload a plugin
        Plugin testPlugin = pluginLoader.getPlugin("TestPlugin");
        pluginLoader.unloadPlugin(testPlugin);

        // Load single jar file
        pluginLoader.loadPlugin(testPlugin.getJarFile());
    }

}

Example plugin

package de.labystudio.pluginloader;

import de.labystudio.pluginloader.plugin.Plugin;

public class TestPlugin extends Plugin {

    @Override
    public void onEnable() {
        // Enable your plugin...
    }

    @Override
    public void onDisable() {
        // Disable your plugin...
    }
    
}

Add to gradle

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    compile 'com.github.LabyStudio:pluginloader:1.0.3'
}

About

Plugin loader to load classes dynamically into the project

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages