mirror of
https://github.com/lucko/LuckPerms.git
synced 2025-08-31 10:01:45 +02:00
Preload dependencies in Docker image
This commit is contained in:
@@ -51,7 +51,8 @@ public class StandaloneLoader implements ShutdownCallback {
|
||||
public static final Logger LOGGER = LogManager.getLogger(StandaloneLoader.class);
|
||||
|
||||
private static final String JAR_NAME = "luckperms-standalone.jarinjar";
|
||||
private static final String BOOTSTRAP_CLASS = "me.lucko.luckperms.standalone.LPStandaloneBootstrap";
|
||||
private static final String BOOTSTRAP_PLUGIN_CLASS = "me.lucko.luckperms.standalone.LPStandaloneBootstrap";
|
||||
private static final String BOOTSTRAP_DEPENDENCY_PRELOADER_CLASS = "me.lucko.luckperms.standalone.StandaloneDependencyPreloader";
|
||||
|
||||
private LuckPermsApplication app;
|
||||
private JarInJarClassLoader loader;
|
||||
@@ -72,7 +73,19 @@ public class StandaloneLoader implements ShutdownCallback {
|
||||
// create a jar-in-jar classloader for the standalone plugin, then enable it
|
||||
// the application is passes to the plugin constructor, to allow it to pass hooks back
|
||||
this.loader = new JarInJarClassLoader(getClass().getClassLoader(), JAR_NAME);
|
||||
this.plugin = this.loader.instantiatePlugin(BOOTSTRAP_CLASS, LuckPermsApplication.class, this.app);
|
||||
|
||||
// special case for dependency preload command
|
||||
if (args.length == 1 && args[0].equals("preloadDependencies")) {
|
||||
try {
|
||||
Class<?> clazz = this.loader.loadClass(BOOTSTRAP_DEPENDENCY_PRELOADER_CLASS);
|
||||
clazz.getMethod("main").invoke(null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this.plugin = this.loader.instantiatePlugin(BOOTSTRAP_PLUGIN_CLASS, LuckPermsApplication.class, this.app);
|
||||
this.plugin.onLoad();
|
||||
this.plugin.onEnable();
|
||||
|
||||
|
Reference in New Issue
Block a user