mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 23:06:00 +00:00
gave up, Pass class as argument to constructor
This commit is contained in:
parent
ae6a6abcd1
commit
f3061a366e
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user