Skip to content

Commit 06cf6a7

Browse files
committed
Adds check that plugin class is accessible from mod class
1 parent 0940b12 commit 06cf6a7

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package jijtest;
2+
3+
import cpw.mods.modlauncher.TransformingClassLoader;
4+
import jijtestplugin.Plugin;
5+
import net.neoforged.fml.common.Mod;
6+
7+
@Mod("jijtest")
8+
public class AccessPluginClass {
9+
public AccessPluginClass() {
10+
// Validate that Plugin.class is not loaded via the transforming classloader
11+
if (Plugin.class.getClassLoader() instanceof TransformingClassLoader) {
12+
throw new IllegalStateException("Expected Plugin to be loaded as a plugin!");
13+
}
14+
}
15+
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
package jijtestplugin;
22

33
public class Plugin {
4-
54
}

0 commit comments

Comments
 (0)