PluginInitializerLib icon

PluginInitializerLib -----

A library that provides annotations to easily and quickly initialize your plugin



[​IMG]
PluginInitializerLib

A Spigot library that provides annotations to easily and quickly register events, commands and runnables to your Spigot Plugin

Report Bug · Request Feature . View on Spigot

About The Project
PluginInitializerLib is a Spigot library that helps you with the development of Spigot plugins. It is mainly used to speed up the process of registering events, commands and other tedious tasks.

This functionality is achieved with simply adding an annotation to the class to indicate which type of plugin class it is. The rest is all handled by the library. So to register a new event, you only have to add the @EventListener above the class.

Currently, this library is in active development to add new features to make the life of Spigot developers easier.

Get Started
To use this library you have two options:

Use Maven Dependency
If you have a Maven project, just add the dependency to your pom.xml

Code (Text):
<dependency>
   <groupId>io.github.lennertsoffers</groupId>
   <artifactId>PluginInitializerLib</artifactId>
   <version>1.0.0</version>
</dependency>
Download On Spigot
Download the library here and use it directly

Usage
Initialization
Initialize the plugin in the onEnable() method of your plugin

Code (Java):
@Override
public void onEnable ( ) {
   PluginInitializerLib. init ( this, "me.example" ) ;
}
Where this is your Plugin instance and "me.example" your groupId.
Now you can make use of the provided annotations

Registering Events
Each Listener class annotated with @EventListener will be automatically be registered, no matter in which folder you put it. (As long it is in your project of course)

Code (Java):
@ EventListener
public class ExampleListener implements Listener {
   @EventHandler
    public void onExample (ExampleEvent event ) { }
}

Registering Commands

The @NamedCommandExecutor annotation registers all commandExecutors to the server. The name the commandExecutor will be registered to is the name you provide as a parameter in the annotation.

Code (Java):
@NamedCommandExecutor (commandName = "example" )
public class ExampleCommand implements CommandExecutor {
   @Override
    public boolean onCommand (CommandSender sender, Command command, String label, String [ ] args ) { }
}
Auto Running BukkitRunnables

With the @ScheduledBukkitRunnable annotation, you can run BukkitRunnables in the initialisation step of your plugin. It provides the same functionalities as invoking this runnable directly, except there won't be such a mess of code in your plugin main class.

Code (Java):
@ScheduledBukkitRunnable (runMethod = RunMethod. RUN_TIMER, async = true, delay = 1, period = 40 )
public class ExampleRunnable extends BukkitRunnable {
   @Override
    public void run ( ) { }
}
Resource Information
Author:
----------
Total Downloads: 51
First Release: Jun 2, 2022
Last Update: Jun 2, 2022
Category: ---------------
All-Time Rating:
0 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings