PSA: Major API breakages over the last month

We’re nearing the end of the alpha phase, and that means “get all API breaking necessary changes done”. Fortunately, the community has been helpful with not only notifying staff of bugs, but also willing to work with these plugin breaking changes and provide feedback. I know this hasn’t been done before, but I feel it necessary to not only notify plugin developers, but server owners that their plugins are more than likely not cease functioning after X changes.

To summarize the recent breaking changes:

All of these changes equate to the API being cleaner overall and we’re slowing down on the breakages pending the 3.0 release.

Note: As of current writing, SpongeForge build 930 is the first build with ALL of the above changes. Server owners and plugin developers should consider plugins having been developed for SpongeForge before build 930 no longer functioning and need updating.

7 Likes

Reflecting these changes in the SpongeDocs will take some time. This has been given a high priority, as outdated docs aren’t very helpful. Please bear with us as we attempt to straighten it all out.
Anyone willing to assist in this enterprise - identifying changes to be made and amending code examples accordingly - please chime in on the issue here.

2 Likes

Keep up the good work! I am very excited for the 3.0 release. :smile:

The first successful build for SpongeForge is build 930, available here

It would be nice to have Game.getServer() changed back to an Optional before beta; I’ve done some research that shows it will be required before 1.9, and doing it now will reduce the breakages both in beta and for the 1.9 update.

https://github.com/SpongePowered/SpongeAPI/issues/833

@JBYoshi

Optional can be unpopular and since Server will be used quite a lot…we’ll be keeping it as is.

To mitigate the possibility of null, this method will throw an un-checked exception as well as a hasServer will be added so you can check.

…ok i changed the .getgame().getScheduler to ((game)event)…getScheduler…that may have fixed that issue…however now my plugins which were registering just fine are no longer registering as ‘mods’ according to the server as of the newest updates…why? And how do i fix that?

More information would be helpful here. What version(s) of SpongeForge have this problem?
Is it your own plugins, or everything?

hahahaha yes going from 894 which they worked on and have had absolutely no issues to the newer 942 they won’t load into the server for some reason…this is my pride and joy and now for some reason these new updates are not allowing it to work…help would be much appreciated. I’m willing to learn but there’s not much on why they wont :slight_smile: thank you

I believe this issue has to deal with the @plugin portion of the coding above the main Class as that’s what use to tell Sponge it was a plugin…however now that’s not working…so how to i fix this?

No.

You are casting the event to Game which makes no sense whatsoever.

Try injecting Game into your main plugin instance. https://docs.spongepowered.org/en/plugin/injection.html?highlight=game

Or use the static sponge access methods. Sponge.getGame() SpongeAPI/src/main/java/org/spongepowered/api/Sponge.java at api-10 · SpongePowered/SpongeAPI · GitHub

2 Likes