Dependency injection is great. Using it with Spigot is even better, right?
Guice is a pretty good framework to use it with, but it was pretty boilerplate-y to use it with Spigot . Not to mention the hassle of putting listeners and commands.
And that's where GuicyBukkit comes in!
Features
- Register listeners
- Register commands
- Remove your pesky static singletons
Documentation
Showcase
public class MyNicePluginModule extends PluginModule {
// We need a MyNicePlugin instance to create this module, and inject it.
public MyNicePluginModule ( MyNicePlugin plugin ) {
super ( plugin ) ;
}
@Override
protected void configureBindings ( ) {
bind ( SomeService. class ) . to ( SomeServiceImpl. class ) ;
}
@Override
protected void configureListeners ( Multibinder < Listener > binder ) {
binder. addBinding ( ) . to ( UsefulListener. class ) ;
}
@Override
protected void configureCommands ( Multibinder < CommandConfigurator > binder ) {
binder. addBinding ( ) . to ( HelloCommand. class ) ;
}
}
public class MyNicePlugin extends JavaPlugin {
@Override
public void onLoad ( ) {
Injector injector = Guice. createInjector ( new MyNicePluginModule ( this ) ) ;
PluginDependencies. fromInjector ( injector ) . registerAll ( this ) ;
}
}
You just need few lines of code to get Guice running with spigot. Neat.
Aditionnal resources
- MockBukkit is a pretty good library to mock a Bukkit server to test your plugin. In fact it's the only one I've found.
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta