Sponge Forge not recognizing my plugin

Hi o/

I’ve just started learning how to code plugins with sponge (Also if you guys have recommendations of how to learn to do this it’d be much appreciated!) and made a plugin that logs that it was activated.

Not sure why, but when running the server it doesn’t log the message I put and when doing /sponge plugins it doesn’t show it in the list (I put it in the mods folder)

Thanks in advance :smiley:

Hey. So take a look at the SpongeDocs. It tells you mostly everything you need to know about building Sponge plugins. The stuff it doesn’t teach you is normally vwry specific so looking at the javadocs/github is what to do. Or ask on the forums (someone will know).

As for the issue you have. Got your boot code? It seems that your plugin isnt being regonised. And just to make sure. What API are you building towards? (API-8 is very different to 7 when booting)

Thanks for responding! I’ll look at the SpongeDocs in a bit!

I’m using Sponge API 7.3.0, not sure what boot code means but this is my current code:

import org.spongepowered.api.Game;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
import org.spongepowered.api.plugin.Plugin;

import javax.inject.Inject;
import java.util.logging.Level;
import java.util.logging.Logger;

@Plugin(id = “Tutorial”, name = “Tutorial”, version = “1.1”)
public class tutorial{

@Inject
Game game;

@Inject
Logger logger;

@Listener
public void onServerStart(GameStartedServerEvent e) {
    logger.log(Level.INFO, "Tutorial plugin has loaded.");
}

}

Thats what i meant by boot code.

That all looks good. Perhaps there is a issue with compiling or something like that? How are you compiling the plugin? Maven? Gradle? Build artifact/export jar?

Also got a console log?

Well I set the plugin up with Gradle but if compiling it means converting it into a jar file I used the Build artifact method. I did not get a console log, unless I missed it.

I mean server console log :wink:

As for build artifact. Mind taking a print screen of the artifact build screen? (You can take a window print screen with alt+printscreen on Windows)

If server log means that it logs it when the server boots up, it did not.

This is the artifact build screen:

No i mean the text of the server when the server boots up. You can find this in the following.

/<Your server location>/logs/latest.txt

As for the building. That looks ok. However you seem to have two modules (on the left) what does the first module give you as options if you expand it?

Yeah, as I said, when the server boots up I get no log.

Not sure where you mean on the left? What should I expand?

Sorry i meant right XD.

Thats strange that you don’t get a log with your server, yet the server boots up. Is it just blank on your command line when the server is running?

I don’t get a blank command line, but I think it doesn’t log because it doesn’t recognize the plugin so it doesn’t run it.

This is what I see what I open it on the right:

Expand main please.

Your server should still log stuff. Even without any mods or plugins, your server should still log information such as the world generation, that its still booting and the ready to join state (also known as “Done!”)

I didn’t say it doesn’t log anything, it just doesn’t log the message I told it to log (“Tutorial plugin has loaded.”) it logs everything else, from the world generation to join messages, ect.


That’s main expanded.

When i asked for the log, i meant the server log, as in everything the server logs. All the messages. The file latest.txt. Typically when a plugin isnt loaded Sponge/forge will give a indication on why, however sometimes its just a generic “not a sponge/forge file” hence why i wanted the log.

As for the expanded contents, that looks like the module your code is in. Im not seeing “compile out” however i guess thats the one you already have inside your project. So the next thing is to check the server log and also check inside your .jar file to make sure the class file is there. You can open the .jar file with any zip extractor (if you are using the default windows one, rename the file to end with .zip and then Windows will let you extract it)

I know what server logs are. As I said above, it logs everything, just doesn’t log the message I told it to.

From what it looks like, the class file is inside.

Right so it seems to be compiling. Which means that the server should regonise it. If I could see your server log to find out why Sponge isn’t booting it that would be great

[23:25:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[23:25:32] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[23:25:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLServerTweaker
[23:25:32] [main/INFO] [FML]: Forge Mod Loader version 14.23.5.2838 for Minecraft 1.12.2 loading
[23:25:32] [main/INFO] [FML]: Java is Java HotSpot™ 64-Bit Server VM, version 1.8.0_261, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jre1.8.0_261
[23:25:32] [main/INFO] [FML]: Searching C:\Users\user\Desktop\Tutorial Server.\mods for mods
[23:25:32] [main/INFO] [FML]: Loading tweaker org.spongepowered.asm.launch.MixinTweaker from aaaaaaspongeforge-1.12.2-2838-7.3.0.jar
[23:25:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[23:25:32] [main/INFO] [LaunchWrapper]: Loading tweak class name org.spongepowered.asm.launch.MixinTweaker
[23:25:32] [main/INFO] [mixin]: SpongePowered MIXIN Subsystem Version=0.8 Source=file:/C:/Users/user/Desktop/Tutorial%20Server/./mods/aaaaaaspongeforge-1.12.2-2838-7.3.0.jar Service=LaunchWrapper Env=SERVER
[23:25:32] [main/WARN] [FML]: The coremod SpongeCoremod (org.spongepowered.mod.SpongeCoremod) is not signed!
[23:25:32] [main/INFO] [mixin]: Compatibility level set to JAVA_8
[23:25:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[23:25:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[23:25:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[23:25:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[23:25:33] [main/INFO] [FML]: Found valid fingerprint for Minecraft Forge. Certificate fingerprint e3c3d50c7c986df74c645c0ac54639741c90a557
[23:25:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[23:25:33] [main/INFO] [LaunchWrapper]: Calling tweak class org.spongepowered.asm.launch.MixinTweaker
[23:25:33] [main/INFO] [mixin]: Initialised Mixin FML Remapper Adapter with net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper@6dcd5639
[23:25:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[23:25:34] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[23:25:34] [main/INFO] [LaunchWrapper]: Loading tweak class name org.spongepowered.asm.mixin.EnvironmentStateTweaker
[23:25:34] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[23:25:34] [main/INFO] [LaunchWrapper]: Calling tweak class org.spongepowered.asm.mixin.EnvironmentStateTweaker
[23:25:34] [main/WARN] [mixin]: @Mixin target net/minecraft/block/state/BlockStateContainer$StateImplementation is public in mixins.common.api.json:mcp.block.state.StateImplementationMixin_API and should be specified in value
[23:25:37] [main/WARN] [mixin]: Static binding violation: PRIVATE @Overwrite method func_189509_E in mixins.common.core.json:world.WorldMixin cannot reduce visibiliy of PUBLIC target method, visibility will be upgraded.
[23:25:38] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.server.MinecraftServer}
[23:25:42] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Starting minecraft server version 1.12.2
[23:25:42] [Server thread/INFO] [FML]: MinecraftForge v14.23.5.2838 Initialized
[23:25:42] [Server thread/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
[23:25:42] [Server thread/INFO] [FML]: Invalid recipe found with multiple oredict ingredients in the same ingredient…
[23:25:42] [Server thread/INFO] [FML]: Replaced 1227 ore ingredients
[23:25:42] [Server thread/INFO] [Sponge]: Found mcmod.info at jar:file:/C:/Users/user/Desktop/Tutorial%20Server/./mods/aaaaaaspongeforge-1.12.2-2838-7.3.0.jar!/mcmod.info
[23:25:42] [Server thread/INFO] [Sponge]: Creating injector in stage ‘PRODUCTION’
[23:25:46] [Server thread/INFO] [FML]: Searching C:\Users\user\Desktop\Tutorial Server.\mods for mods
[23:25:46] [Server thread/ERROR] [FML]: Unable to read a class file correctly
java.lang.IllegalArgumentException: null
at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-all-5.2.jar:5.2]
at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-all-5.2.jar:5.2]
at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-all-5.2.jar:5.2]
at net.minecraftforge.fml.common.discovery.asm.ASMModParser.(ASMModParser.java:57) [ASMModParser.class:?]
at net.minecraftforge.fml.common.discovery.JarDiscoverer.findClassesASM(JarDiscoverer.java:102) [JarDiscoverer.class:?]
at net.minecraftforge.fml.common.discovery.JarDiscoverer.discover(JarDiscoverer.java:77) [JarDiscoverer.class:?]
at net.minecraftforge.fml.common.discovery.ContainerType.findMods(ContainerType.java:47) [ContainerType.class:?]
at net.minecraftforge.fml.common.discovery.ModCandidate.explore(ModCandidate.java:74) [ModCandidate.class:?]
at net.minecraftforge.fml.common.discovery.ModDiscoverer.identifyMods(ModDiscoverer.java:93) [ModDiscoverer.class:?]
at net.minecraftforge.fml.common.Loader.identifyMods(Loader.java:425) [Loader.class:?]
at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:566) [Loader.class:?]
at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98) [FMLServerHandler.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:333) [FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125) [nz.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_261]
[23:25:46] [Server thread/ERROR] [FML]: There was a problem reading the entry tutorial.class in the jar .\mods\Tutorial.jar - probably a corrupt zip
net.minecraftforge.fml.common.LoaderException: java.lang.IllegalArgumentException

at net.minecraftforge.fml.common.discovery.asm.ASMModParser.<init>(ASMModParser.java:63) ~[ASMModParser.class:?]
at net.minecraftforge.fml.common.discovery.JarDiscoverer.findClassesASM(JarDiscoverer.java:102) [JarDiscoverer.class:?]
at net.minecraftforge.fml.common.discovery.JarDiscoverer.discover(JarDiscoverer.java:77) [JarDiscoverer.class:?]
at net.minecraftforge.fml.common.discovery.ContainerType.findMods(ContainerType.java:47) [ContainerType.class:?]
at net.minecraftforge.fml.common.discovery.ModCandidate.explore(ModCandidate.java:74) [ModCandidate.class:?]
at net.minecraftforge.fml.common.discovery.ModDiscoverer.identifyMods(ModDiscoverer.java:93) [ModDiscoverer.class:?]
at net.minecraftforge.fml.common.Loader.identifyMods(Loader.java:425) [Loader.class:?]
at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:566) [Loader.class:?]
at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98) [FMLServerHandler.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:333) [FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125) [nz.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_261]

Caused by: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-all-5.2.jar:5.2]
at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-all-5.2.jar:5.2]
at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-all-5.2.jar:5.2]
at net.minecraftforge.fml.common.discovery.asm.ASMModParser.(ASMModParser.java:57) ~[ASMModParser.class:?]
… 12 more
[23:25:46] [Server thread/WARN] [FML]: Zip file Tutorial.jar failed to read properly, it will be ignored
net.minecraftforge.fml.common.LoaderException: java.lang.IllegalArgumentException

at net.minecraftforge.fml.common.discovery.asm.ASMModParser.<init>(ASMModParser.java:63) ~[ASMModParser.class:?]
at net.minecraftforge.fml.common.discovery.JarDiscoverer.findClassesASM(JarDiscoverer.java:102) ~[JarDiscoverer.class:?]
at net.minecraftforge.fml.common.discovery.JarDiscoverer.discover(JarDiscoverer.java:77) [JarDiscoverer.class:?]
at net.minecraftforge.fml.common.discovery.ContainerType.findMods(ContainerType.java:47) [ContainerType.class:?]
at net.minecraftforge.fml.common.discovery.ModCandidate.explore(ModCandidate.java:74) [ModCandidate.class:?]
at net.minecraftforge.fml.common.discovery.ModDiscoverer.identifyMods(ModDiscoverer.java:93) [ModDiscoverer.class:?]
at net.minecraftforge.fml.common.Loader.identifyMods(Loader.java:425) [Loader.class:?]
at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:566) [Loader.class:?]
at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98) [FMLServerHandler.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:333) [FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125) [nz.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_261]

Caused by: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-all-5.2.jar:5.2]
at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-all-5.2.jar:5.2]
at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-all-5.2.jar:5.2]
at net.minecraftforge.fml.common.discovery.asm.ASMModParser.(ASMModParser.java:57) ~[ASMModParser.class:?]
… 12 more
[23:25:46] [Server thread/INFO] [FML]: Forge Mod Loader has identified 7 mods to load
[23:25:46] [Server thread/WARN] [FML]: Missing English translation for FML: assets/fml/lang/en_us.lang
[23:25:46] [Server thread/WARN] [FML]: Missing English translation for spongeapi: assets/spongeapi/lang/en_us.lang
[23:25:46] [Server thread/WARN] [FML]: Missing English translation for spongeforge: assets/spongeforge/lang/en_us.lang
[23:25:46] [Server thread/INFO] [FML]: FML has found a non-mod file Tutorial.jar in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.
[23:25:47] [Server thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, spongeapi, sponge, spongeforge] at CLIENT
[23:25:47] [Server thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, spongeapi, sponge, spongeforge] at SERVER
[23:25:47] [Server thread/WARN] [Sponge]: There’s no certificate fingerprint available
[23:25:47] [Server thread/INFO] [FML]: Processing ObjectHolder annotations
[23:25:47] [Server thread/INFO] [FML]: Found 1169 ObjectHolder annotations
[23:25:47] [Server thread/INFO] [FML]: Identifying ItemStackHolder annotations
[23:25:47] [Server thread/INFO] [FML]: Found 0 ItemStackHolder annotations
[23:25:47] [Server thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[23:25:47] [Forge Version Check/INFO] [forge.VersionCheck]: [spongeforge] Starting version check at https://files.minecraftforge.net/maven/org/spongepowered/spongeforge/promotions_slim.json
[23:25:48] [Server thread/INFO] [FML]: Applying holder lookups
[23:25:48] [Server thread/INFO] [FML]: Holder lookups applied
[23:25:48] [Server thread/INFO] [FML]: Applying holder lookups
[23:25:48] [Server thread/INFO] [FML]: Holder lookups applied
[23:25:48] [Server thread/WARN] [FML]: Potentially Dangerous alternative prefix sponge for name human, expected spongeforge. This could be a intended override, but in most cases indicates a broken mod.
[23:25:48] [Server thread/INFO] [FML]: Applying holder lookups
[23:25:48] [Server thread/INFO] [FML]: Holder lookups applied
[23:25:48] [Server thread/INFO] [FML]: Applying holder lookups
[23:25:48] [Server thread/INFO] [FML]: Holder lookups applied
[23:25:48] [Server thread/INFO] [FML]: Injecting itemstacks
[23:25:48] [Server thread/INFO] [FML]: Itemstack injection complete
[23:25:48] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Loading properties
[23:25:48] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Default game type: SURVIVAL
[23:25:48] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Generating keypair
[23:25:48] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Starting Minecraft server on *:25565
[23:25:48] [Server thread/INFO] [net.minecraft.network.NetworkSystem]: Using default channel type
[23:25:48] [Forge Version Check/INFO] [forge.VersionCheck]: [spongeforge] Found status: OUTDATED Target: 7.1.2
[23:25:48] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[23:25:48] [Server thread/INFO] [FML]: Applying holder lookups
[23:25:48] [Server thread/INFO] [FML]: Holder lookups applied
[23:25:48] [Server thread/INFO] [FML]: Injecting itemstacks
[23:25:48] [Server thread/INFO] [FML]: Itemstack injection complete
[23:25:48] [Server thread/INFO] [FML]: Forge Mod Loader has successfully loaded 7 mods
[23:25:48] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Preparing level “world”
[23:25:48] [Server thread/INFO] [Sponge]: Checking for worlds that need to be migrated…
[23:25:48] [Server thread/INFO] [Sponge]: No worlds were found in need of migration.
[23:25:48] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: OUTDATED Target: 14.23.5.2854
[23:25:48] [Server thread/INFO] [FML]: Injecting existing registry data into this server instance
[23:25:49] [Server thread/INFO] [FML]: Applying holder lookups
[23:25:49] [Server thread/INFO] [FML]: Holder lookups applied
[23:25:49] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 488 advancements
[23:25:49] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 6 advancement trees
[23:25:49] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing start region for world world (minecraft:overworld/0)
[23:25:50] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 66%
[23:25:51] [Server thread/INFO] [Sponge]: Loading world [world] (minecraft:overworld/0)
[23:25:51] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 488 advancements
[23:25:51] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 6 advancement trees
[23:25:51] [Server thread/INFO] [Sponge]: Loading world [DIM-1] (minecraft:nether/-1)
[23:25:51] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 488 advancements
[23:25:51] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 6 advancement trees
[23:25:51] [Server thread/INFO] [Sponge]: Loading world [DIM1] (minecraft:the_end/1)
[23:25:51] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Done (2.720s)! For help, type “help” or “?”
[23:26:50] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Stopping the server
[23:26:50] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Stopping server
[23:26:50] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving players
[23:26:50] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving worlds
[23:26:50] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving chunks for level ‘world’/0
[23:26:50] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving chunks for level ‘DIM-1’/-1
[23:26:51] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving chunks for level ‘DIM1’/1
[23:26:51] [Server thread/INFO] [Sponge]: Unloading world [world] (minecraft:overworld/0)
[23:26:51] [Server thread/INFO] [Sponge]: Unloading world [DIM-1] (minecraft:nether/-1)
[23:26:51] [Server thread/INFO] [Sponge]: Unloading world [DIM1] (minecraft:the_end/1)

Should have mentioned. When sending logs, normally we use a site such as pastebin so formatting isnt wrecked. However found the problem. Sponge is seeing it but it looks like the class file inside is corrupt. If you compile it again it should be ok.

Just double check that your compiling at Java 8 (and not newer)

[23:25:46] [Server thread/ERROR] [FML]: Unable to read a class file correctly

java.lang.IllegalArgumentException: null
at org.objectweb.asm.ClassReader.(Unknown Source) ~[asm-all-5.2.jar:5.2]

[23:25:46] [Server thread/ERROR] [FML]: There was a problem reading the entry tutorial.class in the jar .\mods\Tutorial.jar - probably a corrupt zip

How do I check which Java version I’m compiling at?

Easiest way is to go into “Project settings”, click on the “project” tab on the left (yes i do mean left this time :wink: ) and there it will state what its attempting to compile at. Typically its “default” which is whatever version your JDK is. However you can select 8 (sometime labelled 1.8)