Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
f3061a36
Commit
f3061a36
authored
Apr 26, 2022
by
KingRainbow44
Browse files
gave up, Pass class as argument to constructor
parent
ae6a6abc
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/event/EventHandler.java
View file @
f3061a36
...
...
@@ -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
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment