JEvent is a lightweight Java library designed for dynamic event management. It allows developers to create, manage, and trigger events in their applications easily. By implementing the EventListener
interface, users can define custom behaviors that respond to various events.
- Register and manage multiple event listeners.
- Trigger events with a name and optional arguments.
- Handle exceptions thrown during event processing.
- Simple and intuitive API for quick integration.
EventManager manager = EventUtil.getSystemEventManager();
EventManager manager = new EventManager();
public class MyListener implements EventListener {
public void onEventTriggered(String eventName, String[] args) throws Throwable {
// Interpret event name and args and add your logic...
}
}
new EventListener() {
@Override
public void onEventTriggered(String eventName, String[] args) throws Throwable {
// Interpret event name and args and add your logic...
}
}
manager.registerListener(myEventListener);
manager.triggerEvent("myEventName", "arg1", "arg2", "..."); // Throws EventException if an error occurs triggering the event
For Maven:
<dependency>
<groupId>io.github.nozyx12</groupId>
<artifactId>jevent</artifactId>
<version>1.0</version> <!-- Update with the latest version -->
</dependency>
For Gradle (Groovy DSL):
implementation "io.github.nozyx12:jevent:1.0" // Update with the latest version
For Gradle (Kotlin DSL):
implementation("io.github.nozyx12:jevent:1.0") // Update with the latest version