diff options
author | makamys <makamys@outlook.com> | 2023-12-08 18:22:19 +0100 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2023-12-08 18:26:09 +0100 |
commit | b8b2e173656346f2b82eb629a0797c8bd6b0395d (patch) | |
tree | ef6250be064787301b6af8b8fd094512120a38de /src | |
parent | 6f273f33f60c8512efdd5a390aca94260742f5cc (diff) | |
download | Neodymium-b8b2e173656346f2b82eb629a0797c8bd6b0395d.tar.gz Neodymium-b8b2e173656346f2b82eb629a0797c8bd6b0395d.tar.bz2 Neodymium-b8b2e173656346f2b82eb629a0797c8bd6b0395d.zip |
Un-hardcode package name in VirtualJar
(Makes it easier to drag and drop into other mods.)
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/makamys/neodymium/util/virtualjar/VirtualJar.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/makamys/neodymium/util/virtualjar/VirtualJar.java b/src/main/java/makamys/neodymium/util/virtualjar/VirtualJar.java index d5049b4..21f5f33 100644 --- a/src/main/java/makamys/neodymium/util/virtualjar/VirtualJar.java +++ b/src/main/java/makamys/neodymium/util/virtualjar/VirtualJar.java @@ -30,7 +30,7 @@ public class VirtualJar { LOGGER.debug("Registering URL protocol handler: " + PROTOCOL); // We want the Handler to always be loaded by the same class loader. - Launch.classLoader.addClassLoaderExclusion("makamys." + MODID + ".util.virtualjar.protocol." + PROTOCOL); + Launch.classLoader.addClassLoaderExclusion(getPackage() + ".protocol." + PROTOCOL + "."); // The Handler is loaded by the AppClassLoader, but it needs to access the state of VirtualJar, which is loaded // by the LaunchClassLoader. The solution? Make the Handler just a proxy that delegates the real work to @@ -42,6 +42,11 @@ public class VirtualJar { registered = true; } + private static String getPackage() { + String name = VirtualJar.class.getName(); + return name.substring(0, name.lastIndexOf('.')); + } + public static void add(IVirtualJar jar) { registerHandler(); |