Skip to content

A weird ass event system that doesn't use Reflection.

Notifications You must be signed in to change notification settings

EmotionalLove/Tinnitus

Repository files navigation

Example:

public class Main implements Listener {

    private EventManager manager = new EventManager();

    public void start() {
        manager.registerListener(this);
        TestEvent event = new TestEvent();
        manager.invokeEvent(event);
        PreExitTestEvent event1 = new PreExitTestEvent();
        manager.invokeEvent(event1);
        if (event1.isCancelled()) {
            manager.clear();
            start();
        }
        return;
    }

    private final Reactor<?> onTest = new Reactor<TestEvent>(e -> {
        System.out.println("Nice! " + e.getTimeReacted());
    }).register(this);

    private final Reactor<?> onExit = new Reactor<PreExitTestEvent>(e -> {
        Random random = new Random();
        e.setCancelled(random.nextBoolean());
    }).register(this);

    public static void main(String[] args) {
        new Main().start();

    }
}

About

A weird ass event system that doesn't use Reflection.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages