Commit f3061a36 authored by KingRainbow44's avatar KingRainbow44
Browse files

gave up, Pass class as argument to constructor

parent ae6a6abc
...@@ -3,17 +3,14 @@ package emu.grasscutter.server.event; ...@@ -3,17 +3,14 @@ package emu.grasscutter.server.event;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.utils.EventConsumer; import emu.grasscutter.utils.EventConsumer;
import java.lang.reflect.ParameterizedType;
public final class EventHandler<T extends Event> { public final class EventHandler<T extends Event> {
private final Class<T> eventClass; private final Class<T> eventClass;
private EventConsumer<T> listener; private EventConsumer<T> listener;
private HandlerPriority priority; private HandlerPriority priority;
private boolean handleCanceled; private boolean handleCanceled;
@SuppressWarnings("unchecked") public EventHandler(Class<T> eventClass) {
public EventHandler() { this.eventClass = eventClass;
this.eventClass = (Class<T>) ((ParameterizedType) (getClass().getGenericSuperclass())).getActualTypeArguments()[0];
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment