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
99325523
Commit
99325523
authored
Apr 26, 2022
by
KingRainbow44
Browse files
Fix handler invocation
parent
0e514b90
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/plugin/PluginManager.java
View file @
99325523
...
...
@@ -140,13 +140,19 @@ public final class PluginManager {
* @param event The event to invoke.
*/
public
void
invokeEvent
(
Event
event
)
{
Stream
<
EventHandler
>
handlers
=
this
.
listeners
.
stream
()
.
filter
(
handler
->
handler
.
handles
().
isInstance
(
event
));
handlers
.
filter
(
handler
->
handler
.
getPriority
()
==
HandlerPriority
.
HIGH
)
.
toList
().
forEach
(
handler
->
this
.
invokeHandler
(
event
,
handler
));
handlers
.
filter
(
handler
->
handler
.
getPriority
()
==
HandlerPriority
.
NORMAL
)
.
toList
().
forEach
(
handler
->
this
.
invokeHandler
(
event
,
handler
));
handlers
.
filter
(
handler
->
handler
.
getPriority
()
==
HandlerPriority
.
LOW
)
EnumSet
.
allOf
(
HandlerPriority
.
class
)
.
forEach
(
priority
->
this
.
checkAndFilter
(
event
,
priority
));
}
/**
* Check an event to handlers for the priority.
* @param event The event being called.
* @param priority The priority to call for.
*/
private
void
checkAndFilter
(
Event
event
,
HandlerPriority
priority
)
{
this
.
listeners
.
stream
()
.
filter
(
handler
->
handler
.
handles
().
isInstance
(
event
))
.
filter
(
handler
->
handler
.
getPriority
()
==
priority
)
.
toList
().
forEach
(
handler
->
this
.
invokeHandler
(
event
,
handler
));
}
...
...
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