gave up, Pass class as argument to constructor

This commit is contained in:
KingRainbow44 2022-04-26 20:54:56 -04:00
parent ae6a6abcd1
commit f3061a366e

View File

@ -3,17 +3,14 @@ package emu.grasscutter.server.event;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.utils.EventConsumer;
import java.lang.reflect.ParameterizedType;
public final class EventHandler<T extends Event> {
private final Class<T> eventClass;
private EventConsumer<T> listener;
private HandlerPriority priority;
private boolean handleCanceled;
@SuppressWarnings("unchecked")
public EventHandler() {
this.eventClass = (Class<T>) ((ParameterizedType) (getClass().getGenericSuperclass())).getActualTypeArguments()[0];
public EventHandler(Class<T> eventClass) {
this.eventClass = eventClass;
}
/**