I'm not entirely sure what you're looking for, but it might be this (polymorphic method):
Inside the event handler class have a method:
public void eventHandler(Event event){
event.handleEvent();
}
That way any class the has Event
as a parent can be sent as a parameter. And then in the Event
class make a method:
public void handleEvent(){
//Do something
}
Or you can override the above method to suit the needs of every specific class that extends from Event
(@override
).
Hope that's what you're looking for!
Edit
Or you may be looking for something like this:
public void eventHandler(DiceRollEvent event){
//Do something
}
public void eventHandler(SomeOtherEvent event){
//Do something
}