ef4j

Simple and lightweight event framework

License

License

GroupId

GroupId

com.github.lero4ka16
ArtifactId

ArtifactId

ef4j
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

ef4j
Simple and lightweight event framework
Project URL

Project URL

https://github.com/lero4ka16/ef4j
Project Organization

Project Organization

com.github.lero4ka16
Source Code Management

Source Code Management

https://github.com/lero4ka16/ef4j

Download ef4j

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Ef4j

About the project

Ef4j (Event Framework For Java) - Simple and lightweight event framework

Benchmarks

TODO

Example

class MyListener { 
  @EventHandler
  public void listen(MyEvent event) {
    System.out.println(event.getMessage());
  }
}

class MyEvent extends Event {
  private final String message;
	
  public MyEvent(String message) {
    this.message = message;
  }
    
  public String getMessage() {
    return message;
  }
}

EventBus bus = new ConcurrentEventBus();

// register listener
bus.subscribe(new MyListener());

// send event to all listeners
bus.publish(new MyEvent("Hello world!"));

You can to specify the EventNamespace to EventBus#subscribe and then you will be able to remove all listeners by that EventNamespace using EventBus#unsubscribeAll(EventNamespace)

Also you can set EventHandler's priority, just use @EventHandler(EventPriority.<...>)

There are 6 types of priority:

  • LOWEST will be executed first
  • LOW will be executed after LOWEST
  • NORMAL will be executed after LOW (default)
  • HIGH will be executed after NORMAL
  • HIGHEST will be executed after HIGH
  • MONITOR will be executed last

Add as dependency

Maven

<dependencies>
    <dependency>
        <groupId>com.github.lero4ka16</groupId>
        <artifactId>ef4j</artifactId>
        <version>1.1.0</version>
    </dependency>
</dependencies>

Gradle

dependencies {
    implementation 'com.github.lero4ka16:ef4j:1.1.0'
}

Build the project

  1. Execute ./gradlew build
  2. Output file located at build/libs/ef4j.jar

Contact

Vkontakte, Telegram

Post Scriptum

I will be very glad if someone can help me with development.

Versions

Version
1.1.0
1.0.0