[OUTDATED] Coming from Bukkit? Here's Some Tips and Tricks to Get you Started

In normal forge you would need to register the class onto the EVENT_BUS. I don’t know what the plan is for sponge, but I would assume something similar.

One difference with bukkit though is that you don’t need to implement anything. You can just use any class you have and add a SubscribeEvent without needing to implement a special interface.

Now even Forge Modders could make plugins :smiley:

Great guide! I can’t wait for all of the great new things we will be able to do with Sponge.

Until a better build system is available drone.io looks rather nice :slight_smile:

1 Like

It looks like you will need to register the class. However it seems like you need to get the current game object, yet there is no way to get it except in an event. (I’m thinking events in the main class may be automatically registered?) Here’s what you seem to need to do right now: when the server is starting you grab that event, and then do this to register it:

event.getGame().getEventManager().register(listenerClass);

However, until there is more concrete evidence to support this theory I have chosen to leave it out of the opening post.

1 Like

Oh ok, I understand you now! We will be getting a wiki in place for all of these things and hopefully having far better documentation that past projects.

I do like drone.io.

Keep in mind the @Plugin … in front of a class can’t be changed at runtime. Its not like you can control them in your code (however just like Bukkit, you will most likely be able to change settings at runtime)

I was almost broken down to tears when I saw the mess happening at Bukkit, but coming here, I’m really excited.

How will we know when the first Sponge release is available? I wanna get started on a plugin! :smiley:

1 Like

Me too :stuck_out_tongue:

Will Sponge have an easy file creation/editing method? Or would we have to create our own methods to use files…?

It’s in discussion, but according to the talk, yes, it will have easy file creation/editing methods (at least for the config files). However we’ll just have to wait and see.

3 Likes

Can’t you just java to create a new file, and load that somehow avaiable for us to edit?

  File playerconfig = new File(emp.getDataFolder() + File.separator  + "userdata" 
                 + File.separator + playername + ".yml"); 
    if (!playerconfig.exists()) {
        playerconfig.createNewFile();
    config = YamlConfiguration.loadItSomeHow(playerconfig);

config.editWhatever

I think that’ll be a nice idea, using java as a means to create the file, anyway

So basically end up the same as the Bukkit configuration system?

Kind of, the only thing you have to change is how you load and edit it.

Seems like there is only an init event for the plugin when the server is started. Will there be an independent plugin enable event (as it was in bukkit)? I liked the ability in bukkit to load and unload plugins selectively using plugman although that didn’t work for all plugins. Thanks.

Edit: just saw Plugin reloading/enabling

THANK GOD, no more plugin.yml files.

The major problem there with the Bukkit configuration system was that at least 75% of the plugin developers did NOT understand the system.

2 Likes

All you’re really doing is getting and setting plugin paths and putting values in there, doesn’t seem to hard but…I guess you were a bukkit documenter correct? I’ll take your word for it…

That’s kind of sad :confused:
Especially when the documentation for configuration actually kicked ass. I think my only problem with the documentation was serializing objects, other than that it nailed it and made perfectly clear how to use it.