org.bstats
diff --git a/Common/loader-utils/src/main/java/dev/brighten/antivpn/loader/JarInJarClassLoader.java b/Common/loader-utils/src/main/java/dev/brighten/antivpn/loader/JarInJarClassLoader.java
index 6488c0e..4d8a4c3 100644
--- a/Common/loader-utils/src/main/java/dev/brighten/antivpn/loader/JarInJarClassLoader.java
+++ b/Common/loader-utils/src/main/java/dev/brighten/antivpn/loader/JarInJarClassLoader.java
@@ -35,14 +35,15 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
+import java.util.Arrays;
/**
* Classloader that can load a jar from within another jar file.
*
- * The "loader" jar contains the loading code & public API classes,
+ *
The "loader" jar contains the loading code & public API classes
* and is class-loaded by the platform.
*
- * The inner "plugin" jar contains the plugin itself, and is class-loaded
+ *
The inner "plugin" jar contains the plugin itself and is class-loaded
* by the loading code & this classloader.
*/
public class JarInJarClassLoader extends URLClassLoader {
@@ -57,8 +58,10 @@ public class JarInJarClassLoader extends URLClassLoader {
* @param jarResourcePath the path to the jar-in-jar resource within the loader jar
* @throws LoadingException if something unexpectedly bad happens
*/
- public JarInJarClassLoader(ClassLoader loaderClassLoader, String jarResourcePath) throws LoadingException {
- super(new URL[]{extractJar(loaderClassLoader, jarResourcePath)}, loaderClassLoader);
+ public JarInJarClassLoader(ClassLoader loaderClassLoader, String... jarResourcePath) throws LoadingException {
+ super(Arrays.stream(jarResourcePath)
+ .map(path -> extractJar(loaderClassLoader, path))
+ .toArray(URL[]::new), loaderClassLoader);
}
public void addJarToClasspath(URL url) {
@@ -127,10 +130,10 @@ public class JarInJarClassLoader extends URLClassLoader {
}
// create a temporary file
- // on posix systems by default this is only read/writable by the process owner
+ // on posix systems; by default, this is only read/writable by the process owner
Path path;
try {
- path = Files.createTempFile("luckperms-jarinjar", ".jar.tmp");
+ path = Files.createTempFile(jarResourcePath, ".jar.tmp");
} catch (IOException e) {
throw new LoadingException("Unable to create a temporary file", e);
}
diff --git a/Velocity/VelocityLoader/pom.xml b/Velocity/VelocityLoader/pom.xml
index 1a52d54..5eaa4e1 100644
--- a/Velocity/VelocityLoader/pom.xml
+++ b/Velocity/VelocityLoader/pom.xml
@@ -81,6 +81,10 @@
antivpn-velocity.jarinjar
${project.parent.basedir}/VelocityPlugin/target/VelocityPlugin-${project.version}.jar
+
+ antivpn-source.jarinjar
+ ${project.parent.parent.basedir}/Common/Source/target/Source-${project.version}.jar
+
diff --git a/Velocity/VelocityLoader/src/main/java/dev/brighten/antivpn/velocity/VelocityPluginLoader.java b/Velocity/VelocityLoader/src/main/java/dev/brighten/antivpn/velocity/VelocityPluginLoader.java
index 8de032d..9c7add0 100644
--- a/Velocity/VelocityLoader/src/main/java/dev/brighten/antivpn/velocity/VelocityPluginLoader.java
+++ b/Velocity/VelocityLoader/src/main/java/dev/brighten/antivpn/velocity/VelocityPluginLoader.java
@@ -20,6 +20,7 @@ import java.util.logging.Logger;
public class VelocityPluginLoader {
private static final String JAR_NAME = "antivpn-velocity.jarinjar";
+ private static final String SOURCE_NAME = "antivpn-source.jarinjar";
private static final String BOOTSTRAP_CLASS = "dev.brighten.antivpn.velocity.VelocityPlugin";
private final LoaderBootstrap plugin;
@@ -32,7 +33,7 @@ public class VelocityPluginLoader {
instances.put(Path.class, path);
instances.put(String.class, metricsFactory);
instances.put(LoaderBootstrap.class, this);
- JarInJarClassLoader loader = new JarInJarClassLoader(getClass().getClassLoader(), JAR_NAME);
+ JarInJarClassLoader loader = new JarInJarClassLoader(getClass().getClassLoader(), JAR_NAME, SOURCE_NAME);
this.plugin = loader.instantiatePlugin(BOOTSTRAP_CLASS, Map.class, instances);
plugin.onLoad(path.toFile());
}
diff --git a/Velocity/VelocityPlugin/pom.xml b/Velocity/VelocityPlugin/pom.xml
index 8ccae20..2f794f5 100644
--- a/Velocity/VelocityPlugin/pom.xml
+++ b/Velocity/VelocityPlugin/pom.xml
@@ -36,7 +36,7 @@
dev.brighten.antivpn
Source
1.9.4
- compile
+ provided