mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2025-03-11 06:01:31 +01:00
Don't try to bake handlers when there are no more handlers. Remove them instead!
This commit is contained in:
parent
07e330b005
commit
d0e5ee4e09
@ -176,6 +176,8 @@ public class EventBus
|
|||||||
private void bakeHandlers(Class<?> eventClass)
|
private void bakeHandlers(Class<?> eventClass)
|
||||||
{
|
{
|
||||||
Map<EventPriority, Map<Object, Method[]>> handlersByPriority = byListenerAndPriority.get( eventClass );
|
Map<EventPriority, Map<Object, Method[]>> handlersByPriority = byListenerAndPriority.get( eventClass );
|
||||||
|
if ( handlersByPriority != null )
|
||||||
|
{
|
||||||
List<EventHandlerMethod> handlersList = new ArrayList<>( handlersByPriority.size() * 2 );
|
List<EventHandlerMethod> handlersList = new ArrayList<>( handlersByPriority.size() * 2 );
|
||||||
for ( EventPriority value : EventPriority.values() )
|
for ( EventPriority value : EventPriority.values() )
|
||||||
{
|
{
|
||||||
@ -193,5 +195,9 @@ public class EventBus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
byEventBaked.put( eventClass, handlersList.toArray( new EventHandlerMethod[ handlersList.size() ] ) );
|
byEventBaked.put( eventClass, handlersList.toArray( new EventHandlerMethod[ handlersList.size() ] ) );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
byEventBaked.put( eventClass, null );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user