Skip to content

Commit

Permalink
Adds check that plugin class is accessible from mod class
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte committed Nov 3, 2024
1 parent aa5cac4 commit df9784f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 15 additions & 0 deletions testproject/jijtest/src/main/java/jijtest/AccessPluginClass.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package jijtest;

import cpw.mods.modlauncher.TransformingClassLoader;
import jijtestplugin.Plugin;
import net.neoforged.fml.common.Mod;

@Mod("jijtest")
public class AccessPluginClass {
public AccessPluginClass() {
// Validate that Plugin.class is not loaded via the transforming classloader
if (Plugin.class.getClassLoader() instanceof TransformingClassLoader) {
throw new IllegalStateException("Expected Plugin to be loaded as a plugin!");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package jijtestplugin;

public class Plugin {

}

0 comments on commit df9784f

Please sign in to comment.