Skip to content

Latest commit

 

History

History
22 lines (21 loc) · 863 Bytes

README.md

File metadata and controls

22 lines (21 loc) · 863 Bytes

eventsystem

Simple Java eventsystem.

Calling

  • Call your event where it needs to be invoked
    EventManager.getInstance().call(new MyEvent());
  • Another way if you need to access fields or methods in the event class
    MyEvent myEvent = new MyEvent();
    myEvent.doStuff();
    EventManager.getInstance().call(myEvent);
  • As well as
    new MyEvent().call();

Listening

  • Listen for events in the class
    EventManager.getInstance().register(this);
  • Stop listening
    EventManager.getInstance().unregister(this);
  • The listener will look for methods containing the Listener annotation
    @Listener
    public void onMyEvent(MyEvent event) {
    doStuff();
    }