Hello,
I’m getting into Sponge and I want to have all my commands In separate classes, just to keep it clean and organized.
How do you do his? The docs are outdated and SpongeExample too. (I’m getting an error that says my game is not defined.
Hello,
I’m getting into Sponge and I want to have all my commands In separate classes, just to keep it clean and organized.
How do you do his? The docs are outdated and SpongeExample too. (I’m getting an error that says my game is not defined.
You have to inject game in your plugin class.
Just use
@Inject Game game;
Could you specify the pages that are outdated? The docs are currently struggling to follow up recent changes to the Sponge API and we’re eager to know which pages need to be updated faster.
You can either inject the game into your main class, or get it with the static method Sponge.getGame()
With the recent API changes towards the new beta i have been using
private static Game game = Sponge.getGame();
You don’t need both.
https://docs.spongepowered.org/en/plugin/commands/service.html
Thanks to all of you by the way! Solved the problem.
I failed to find any outdated information on that page. The code examples are in accordance with the API as well.