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
ConstructorsConstructorDescriptionListenerEntry(Plugin plugin, Listener listener, @NotNull Method method) Creates a new listener entry for a given method. -
Method Summary
Modifier and TypeMethodDescription@NotNull MethodvoidTries to invoke the method handler with a given event.voidinvokeUnsafe(Event event) Tries to invoke the method, but will cast any exceptions to RuntimeExceptions.booleanisCompatibleFor(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
-
getListener
-
getMethod
-
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:
trueif the handler can handle that event,falseif it can't.
-