-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds check that plugin class is accessible from mod class
- Loading branch information
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
testproject/jijtest/src/main/java/jijtest/AccessPluginClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
package jijtestplugin; | ||
|
||
public class Plugin { | ||
|
||
} |