-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Describe the bug
When a module uses an object from another module (such as the NPCShops module getting an instance of ParallelCharms), a ClassCastException occurs due to the classloaders simply loading their own instances of all classes instead of using a proper dependency tree.
To Reproduce
- Load ParallelUtils with the Charms and NPCShops modules from commit af11d5e
- Observe Console
Expected behavior
Load modules without error and retain proper dependency linking and classloader separation.
Screenshots
[17:12:36 ERROR]: [ParallelUtils] [ParallelUtils] Error while enabling module NPCShops
[17:12:36 WARN]: java.lang.ClassCastException: class parallelmc.parallelutils.modules.charms.ParallelCharms cannot be cast to class parallelmc.parallelutils.modules.charms.ParallelCharms (parallelmc.parallelutils.modules.charms.ParallelCharms is in unnamed module of loader parallelmc.parallelutils.ParallelClassLoader @6f8f6ad; parallelmc.parallelutils.modules.charms.ParallelCharms is in unnamed module of loader parallelmc.parallelutils.ParallelClassLoader @20d3fdfb)
[17:12:36 WARN]: at parallelmc.parallelutils.modules.npcshops.maggieshop.MaggieShop.loadShopCharms(MaggieShop.java:36)
[17:12:36 WARN]: at parallelmc.parallelutils.modules.npcshops.maggieshop.MaggieShop.<init>(MaggieShop.java:31)
[17:12:36 WARN]: at parallelmc.parallelutils.modules.npcshops.NPCShops.onEnable(NPCShops.java:49)
[17:12:36 WARN]: at ParallelUtils-4.2.0.jar//parallelmc.parallelutils.ParallelUtils.onEnable(ParallelUtils.java:190)
[17:12:36 WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281)
[17:12:36 WARN]: at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189)
[17:12:36 WARN]: at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104)
[17:12:36 WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507)
[17:12:36 WARN]: at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:653)
[17:12:36 WARN]: at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:564)
[17:12:36 WARN]: at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:641)
[17:12:36 WARN]: at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:440)
[17:12:36 WARN]: at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:345)
[17:12:36 WARN]: at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1117)
[17:12:36 WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323)
[17:12:36 WARN]: at java.base/java.lang.Thread.run(Thread.java:833)
Additional context
Check out how Paper loads plugins. Might even be able to use their dependency graph.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo