Trying my first plugin failed - doesnt load

I tried to script my first “Hello World” plugin. The server seems to not load any plugin.

I found this tutorial here Sponge Coding For Dummies

Do i have to change the dependency version in pom.xml to 3.1.0-SNAPSHOT?

If yes, where can i find all the “commands” like onServerStart(GameStartedServerEvent event)? I ask becouse they doesnt seem to be the same like in 1.1-SNAPSHOT

Those “commands” are events. You can read more here:

Basically whenever the server does anything notable, it will send an Event to all plugins that have registered that they want to listen for it. This includes entities spawning, the server starting, chat being said, etc.

So when you add @Subscribe to a method, you’re telling Sponge that you want to listen to the Event mentioned in the first argument of the method. All plugin classes (those annotated with @Plugin) are automatically set up as listeners.

When possible, you should always be using the most recent version of SpongeAPI. Otherwise there could be changes which break plugins that you won’t be aware of, potentially preventing your plugin from working with the latest sponge versions.

All events for 3.1-SNAPSHOT
The @Subcribe is now @Listener.
Sponge for dummies seems to be outdated.

Ok, nice thank you guys! :slight_smile:

Do you got a tutorial thats up to date?


I tried it again, but my plugin still fails. This time i tried it without the tutorial, becouse its outdated.

package com.anomalyx.quests;

import org.slf4j.Logger;
import org.spongepowered.api.Game;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.plugin.Plugin;


@Plugin(id = “QuestPlugin”, name = “Quests”, version = “1.0.0”)
public class Quests {

Game game;
Logger logger;

public void onServerStarting (GameLoadCompleteEvent event) { ("Hello World");


Logger needs to be initialized.

Before calling, do something like this:

this.logger = LoggerFactory.getLogger("QuestPlugin");

Logger shouldn’t need initializing since it’s being injected on plugin construction.

1 Like

When posting that your plugin is failing, it would help if you posted the log from either running the plugin, or the compilation error you get when you attempt to compile your plugin, otherwise we essentially have to create a new project to test with, or just eyeball it on the forums and hope we get it right.

I have no error while compiling… and here the log!

[17:40:55] [Server console handler/ERROR]: Exception handling console input Das Handle ist ungültig
at Method) ~[?:1.8.0_74]
at Source) ~[?:1.8.0_74]
at Source) ~[?:1.8.0_74]
at Source) ~[?:1.8.0_74]
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source) ~[?:1.8.0_74]
at sun.nio.cs.StreamDecoder.implRead(Unknown Source) ~[?:1.8.0_74]
at Source) ~[?:1.8.0_74]
at Source) ~[?:1.8.0_74]
at Source) ~[?:1.8.0_74]
at Source) ~[?:1.8.0_74]
at Source) ~[?:1.8.0_74]
at ko$ [minecraft_server.1.8.9.jar:?]
[17:40:55] [Server thread/INFO]: Starting minecraft server version 1.8.9
[17:40:55] [Server thread/INFO]: Loading properties
[17:40:55] [Server thread/INFO]: Default game type: CREATIVE
[17:40:55] [Server thread/INFO]: Generating keypair
[17:40:55] [Server thread/INFO]: Starting Minecraft server on *:25565
[17:40:55] [Server thread/INFO]: Using default channel type
[17:40:56] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
[17:40:56] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[17:40:56] [Server thread/WARN]: To change this, set “online-mode” to “true” in the file.
[17:40:56] [Server thread/INFO]: Preparing level “world”
[17:40:56] [Server thread/INFO]: Preparing start region for level 0
[17:40:57] [Server thread/INFO]: Preparing spawn area: 60%
[17:40:58] [Server thread/INFO]: Done (2,005s)! For help, type “help” or “?”
[17:41:45] [Server thread/INFO]: Stopping server
[17:41:45] [Server thread/INFO]: Saving players
[17:41:45] [Server thread/INFO]: Saving worlds
[17:41:45] [Server thread/INFO]: Saving chunks for level ‘world’/Overworld

As far as I see the problem might be, that you cannot inject the game.
So I guess this tutorial is outdated (Many are tho).
And I also saw from the console output, that you are german and I am german too ^^
So if this does not work, you can add me on Skype if you want to: creepah__

I just read the code again and I might have found the problem. Definetly add me on skype

If the problem is fixed make sure you post back here in order to archive the solution for others.