Package be.seeseemelk.mockbukkit.plugin
Class ListenerEntry
java.lang.Object
be.seeseemelk.mockbukkit.plugin.ListenerEntry
The
ListenerEntry
is a class that represents a single event handler
of a plugin.-
Constructor Summary
ConstructorDescriptionListenerEntry
(Plugin plugin, Listener listener, @NotNull Method method) Creates a new listener entry for a given method. -
Method Summary
Modifier and TypeMethodDescription@NotNull Method
void
Tries to invoke the method handler with a given event.void
invokeUnsafe
(Event event) Tries to invoke the method, but will cast any exceptions to RuntimeExceptions.boolean
isCompatibleFor
(Event event) Checks if this method is compatible for a given event type.
-
Constructor Details
-
ListenerEntry
Creates a new listener entry for a given method.- Parameters:
plugin
- The plugin that owns the listener.listener
- The listener object that contains the method.method
- The method to call on events.
-
-
Method Details
-
getPlugin
- Returns:
- The plugin that owns the listener.
-
getListener
- Returns:
- The listener.
-
getMethod
- Returns:
- The method this listener is attached to.
-
invoke
public void invoke(Event event) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException Tries to invoke the method handler with a given event.- Parameters:
event
- The event to pass on to the method.- Throws:
IllegalAccessException
- Can be thrown by the event handler.IllegalArgumentException
- Can be thrown by the event handler.InvocationTargetException
- Can be thrown by the event handler.
-
invokeUnsafe
Tries to invoke the method, but will cast any exceptions to RuntimeExceptions.- Parameters:
event
- The event to pass on to the method.
-
isCompatibleFor
Checks if this method is compatible for a given event type.- Parameters:
event
- The event type the handler should be able to handle.- Returns:
true
if the handler can handle that event,false
if it can't.
-