Skip to content

Commit 42ca56c

Browse files
authored
Add EventManager#registerListeners overload with lookup (#2441)
1 parent 0c5950c commit 42ca56c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/main/java/org/spongepowered/api/event/EventManager.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
import org.spongepowered.plugin.PluginContainer;
2828

29+
import java.lang.invoke.MethodHandles;
30+
2931
/**
3032
* Manages the registration of event listeners and the dispatching of events.
3133
*/
@@ -52,6 +54,22 @@ public interface EventManager {
5254
*/
5355
EventManager registerListeners(PluginContainer plugin, Object obj);
5456

57+
/**
58+
* Registers {@link Event} methods annotated with @{@link Listener} in the
59+
* specified object.
60+
*
61+
* <p>This will not include any methods declared in supertypes, but will
62+
* test for private and package-private listener methods.</p>
63+
*
64+
* <p>The provided lookup will be used for privileged access to the listener object.</p>
65+
*
66+
* @param plugin The plugin container
67+
* @param obj The object
68+
* @param lookup The lookup with which to access the listener object
69+
* @return This manager, for fluency
70+
*/
71+
EventManager registerListeners(PluginContainer plugin, Object obj, MethodHandles.Lookup lookup);
72+
5573
/**
5674
* Un-registers an object from receiving {@link Event}s.
5775
*

0 commit comments

Comments
 (0)