Skip to content

UnderVolt/VEventSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EventSystem

An event system for java

Why ?

Because i don't like at all the EventBus from Google

Example

Create an Event

import io.undervolt.api.event.VEvent;

public class TestEvent extends VEvent {

    private String message;

    public TestEvent(String message) {
        this.message = message;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}

Create a Listener

import io.undervolt.api.event.VHandler;
import io.undervolt.api.event.VListener;
import io.undervolt.api.event.VPriority;

public class TestEventListener implements VListener{
    
    //You can use LOW, NORMAL, HIGH, HIGHEST, MONITOR
    
    @VHandler(priority = VPriority.NORMAL)
    public void onText(TestEvent e){
        System.out.println("Event 1: "+e.getMessage());
    }
   
}

Call the event and register the listener

    public static void main(String[] args){
        VEManager.getInstance().linkListener(new TestEventListener());
        VEManager.getInstance().callVEvent(new TestEvent("Test Message"));
    }

That's it!

About

Java Event System coded with <3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages